summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorNathan Conrad <[email protected]>2019-09-19 19:51:37 -0400
committerNathan Conrad <[email protected]>2019-09-19 19:51:37 -0400
commit7e0490bbf32ed4a25e1917a1e5856338b9dc9346 (patch)
tree0ccf988776e31d0ffb28be6cacfbf715221990db /src/class
parent346443118fa9f22611ca1382ff999e43b6a40b43 (diff)
Move descriptors to usbd.h
Diffstat (limited to 'src/class')
-rw-r--r--src/class/usbtmc/usbtmc_device.c5
-rw-r--r--src/class/usbtmc/usbtmc_device.h30
2 files changed, 3 insertions, 32 deletions
diff --git a/src/class/usbtmc/usbtmc_device.c b/src/class/usbtmc/usbtmc_device.c
index db00b841f..f62bcd2b7 100644
--- a/src/class/usbtmc/usbtmc_device.c
+++ b/src/class/usbtmc/usbtmc_device.c
@@ -251,9 +251,9 @@ bool usbtmcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16
usbtmcd_reset(rhport);
// Perhaps there are other application specific class drivers, so don't assert here.
- if( itf_desc->bInterfaceClass != USBTMC_APP_CLASS)
+ if( itf_desc->bInterfaceClass != TUD_USBTMC_APP_CLASS)
return false;
- if( itf_desc->bInterfaceSubClass != USBTMC_APP_SUBCLASS)
+ if( itf_desc->bInterfaceSubClass != TUD_USBTMC_APP_SUBCLASS)
return false;
// Only 2 or 3 endpoints are allowed for USBTMC.
@@ -272,6 +272,7 @@ bool usbtmcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16
tusb_desc_endpoint_t const *ep_desc = (tusb_desc_endpoint_t const *)p_desc;
switch(ep_desc->bmAttributes.xfer) {
case TUSB_XFER_BULK:
+ TU_ASSERT(ep_desc->wMaxPacketSize.size == USBTMCD_MAX_PACKET_SIZE);
if (tu_edpt_dir(ep_desc->bEndpointAddress) == TUSB_DIR_IN)
{
usbtmc_state.ep_bulk_in = ep_desc->bEndpointAddress;
diff --git a/src/class/usbtmc/usbtmc_device.h b/src/class/usbtmc/usbtmc_device.h
index 4c991d5ff..1e28563dd 100644
--- a/src/class/usbtmc/usbtmc_device.h
+++ b/src/class/usbtmc/usbtmc_device.h
@@ -107,35 +107,5 @@ void usbtmcd_init(void);
* USBTMC Descriptor Templates
*************************************************************/
-#define USBTMC_APP_CLASS TUSB_CLASS_APPLICATION_SPECIFIC
-#define USBTMC_APP_SUBCLASS 0x03u
-
-#define USBTMC_PROTOCOL_STD 0x00u
-#define USBTMC_PROTOCOL_USB488 0x01u
-
-// Interface number, number of endpoints, EP string index, USB_TMC_PROTOCOL*, bulk-out endpoint ID,
-// bulk-in endpoint ID
-#define USBTMC_IF_DESCRIPTOR(_itfnum, _bNumEndpoints, _stridx, _itfProtocol) \
-/* Interface */ \
- 0x09, TUSB_DESC_INTERFACE, _itfnum, 0x00, _bNumEndpoints, USBTMC_APP_CLASS, USBTMC_APP_SUBCLASS, _itfProtocol, _stridx
-
-#define USBTMC_IF_DESCRIPTOR_LEN 9u
-
-// bulk-out Size must be a multiple of 4 bytes
-#define USBTMC_BULK_DESCRIPTORS(_epout, _epin) \
-/* Endpoint Out */ \
-7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(USBTMCD_MAX_PACKET_SIZE), 0u, \
-/* Endpoint In */ \
-7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(USBTMCD_MAX_PACKET_SIZE), 0u
-
-#define USBTMC_BULK_DESCRIPTORS_LEN (7u+7u)
-
-/* optional interrupt endpoint */ \
-// _int_pollingInterval : for LS/FS, expressed in frames (1ms each). 16 may be a good number?
-#define USBTMC_INT_DESCRIPTOR(_ep_interrupt, _ep_interrupt_size, _int_pollingInterval ) \
-7, TUSB_DESC_ENDPOINT, _ep_interrupt, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_interrupt_size), 0x16
-
-#define USBTMC_INT_DESCRIPTOR_LEN (7u)
-
#endif /* CLASS_USBTMC_USBTMC_DEVICE_H_ */