|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
-
-
- #ifndef _usb_desc_h_
- #define _usb_desc_h_
-
-
-
-
-
-
- #include <stdint.h>
- #include <stddef.h>
-
- #define ENDPOINT_UNUSED 0x00
- #define ENDPOINT_TRANSIMIT_ONLY 0x15
- #define ENDPOINT_RECEIVE_ONLY 0x19
- #define ENDPOINT_TRANSMIT_AND_RECEIVE 0x1D
-
-
-
-
-
- #if defined(USB_SERIAL)
- #define VENDOR_ID 0x16C0
- #define PRODUCT_ID 0x0483
- #define DEVICE_CLASS 2
- #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
- #define MANUFACTURER_NAME_LEN 11
- #define PRODUCT_NAME {'U','S','B',' ','S','e','r','i','a','l'}
- #define PRODUCT_NAME_LEN 10
- #define EP0_SIZE 64
- #define NUM_ENDPOINTS 4
- #define NUM_USB_BUFFERS 12
- #define NUM_INTERFACE 2
- #define CDC_STATUS_INTERFACE 0
- #define CDC_DATA_INTERFACE 1
- #define CDC_ACM_ENDPOINT 2
- #define CDC_RX_ENDPOINT 3
- #define CDC_TX_ENDPOINT 4
- #define CDC_ACM_SIZE 16
- #define CDC_RX_SIZE 64
- #define CDC_TX_SIZE 64
- #define CONFIG_DESC_SIZE (9+9+5+5+4+5+7+9+7+7)
- #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
- #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
-
- #elif defined(USB_HID)
- #define VENDOR_ID 0x16C0
- #define PRODUCT_ID 0x0482
- #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
- #define MANUFACTURER_NAME_LEN 11
- #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
- #define PRODUCT_NAME_LEN 23
- #define EP0_SIZE 64
- #define NUM_ENDPOINTS 5
- #define NUM_USB_BUFFERS 24
- #define NUM_INTERFACE 4
- #define SEREMU_INTERFACE 2
- #define SEREMU_TX_ENDPOINT 1
- #define SEREMU_TX_SIZE 64
- #define SEREMU_TX_INTERVAL 1
- #define SEREMU_RX_ENDPOINT 2
- #define SEREMU_RX_SIZE 32
- #define SEREMU_RX_INTERVAL 2
- #define KEYBOARD_INTERFACE 0
- #define KEYBOARD_ENDPOINT 3
- #define KEYBOARD_SIZE 8
- #define KEYBOARD_INTERVAL 1
- #define MOUSE_INTERFACE 1
- #define MOUSE_ENDPOINT 5
- #define MOUSE_SIZE 8
- #define MOUSE_INTERVAL 1
- #define JOYSTICK_INTERFACE 3
- #define JOYSTICK_ENDPOINT 4
- #define JOYSTICK_SIZE 16
- #define JOYSTICK_INTERVAL 2
- #define KEYBOARD_DESC_OFFSET (9 + 9)
- #define MOUSE_DESC_OFFSET (9 + 9+9+7 + 9)
- #define SEREMU_DESC_OFFSET (9 + 9+9+7 + 9+9+7 + 9)
- #define JOYSTICK_DESC_OFFSET (9 + 9+9+7 + 9+9+7 + 9+9+7+7 + 9)
- #define CONFIG_DESC_SIZE (9 + 9+9+7 + 9+9+7 + 9+9+7+7 + 9+9+7)
- #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
- #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
-
- #elif defined(USB_SERIAL_HID)
- #define VENDOR_ID 0x16C0
- #define PRODUCT_ID 0x0487
- #define DEVICE_CLASS 0xEF
- #define DEVICE_SUBCLASS 0x02
- #define DEVICE_PROTOCOL 0x01
- #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
- #define MANUFACTURER_NAME_LEN 11
- #define PRODUCT_NAME {'S','e','r','i','a','l','/','K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
- #define PRODUCT_NAME_LEN 30
- #define EP0_SIZE 64
- #define NUM_ENDPOINTS 6
- #define NUM_USB_BUFFERS 30
- #define NUM_INTERFACE 5
- #define CDC_IAD_DESCRIPTOR 1
- #define CDC_STATUS_INTERFACE 0
- #define CDC_DATA_INTERFACE 1
- #define CDC_ACM_ENDPOINT 2
- #define CDC_RX_ENDPOINT 3
- #define CDC_TX_ENDPOINT 4
- #define CDC_ACM_SIZE 16
- #define CDC_RX_SIZE 64
- #define CDC_TX_SIZE 64
- #define KEYBOARD_INTERFACE 2
- #define KEYBOARD_ENDPOINT 1
- #define KEYBOARD_SIZE 8
- #define KEYBOARD_INTERVAL 1
- #define MOUSE_INTERFACE 3
- #define MOUSE_ENDPOINT 5
- #define MOUSE_SIZE 8
- #define MOUSE_INTERVAL 2
- #define JOYSTICK_INTERFACE 4
- #define JOYSTICK_ENDPOINT 6
- #define JOYSTICK_SIZE 16
- #define JOYSTICK_INTERVAL 1
- #define KEYBOARD_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9)
- #define MOUSE_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
- #define JOYSTICK_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9)
- #define CONFIG_DESC_SIZE (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9+9+7)
- #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
- #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY
-
- #elif defined(USB_MIDI)
- #define VENDOR_ID 0x16C0
- #define PRODUCT_ID 0x0485
- #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
- #define MANUFACTURER_NAME_LEN 11
- #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
- #define PRODUCT_NAME_LEN 11
- #define EP0_SIZE 64
- #define NUM_ENDPOINTS 4
- #define NUM_USB_BUFFERS 16
- #define NUM_INTERFACE 2
- #define SEREMU_INTERFACE 1
- #define SEREMU_TX_ENDPOINT 1
- #define SEREMU_TX_SIZE 64
- #define SEREMU_TX_INTERVAL 1
- #define SEREMU_RX_ENDPOINT 2
- #define SEREMU_RX_SIZE 32
- #define SEREMU_RX_INTERVAL 2
- #define MIDI_INTERFACE 0
- #define MIDI_TX_ENDPOINT 3
- #define MIDI_TX_SIZE 64
- #define MIDI_RX_ENDPOINT 4
- #define MIDI_RX_SIZE 64
- #define SEREMU_DESC_OFFSET (9 + 9+7+6+6+9+9+9+5+9+5 + 9)
- #define CONFIG_DESC_SIZE (9 + 9+7+6+6+9+9+9+5+9+5 + 9+9+7+7)
- #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
- #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
-
- #elif defined(USB_RAWHID)
- #define VENDOR_ID 0x16C0
- #define PRODUCT_ID 0x0486
- #define RAWHID_USAGE_PAGE 0xFFAB
- #define RAWHID_USAGE 0x0200
- #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
- #define MANUFACTURER_NAME_LEN 11
- #define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D'}
- #define PRODUCT_NAME_LEN 18
- #define EP0_SIZE 64
- #define NUM_ENDPOINTS 6
- #define NUM_USB_BUFFERS 12
- #define NUM_INTERFACE 2
- #define RAWHID_INTERFACE 0
- #define RAWHID_TX_ENDPOINT 3
- #define RAWHID_TX_SIZE 64
- #define RAWHID_TX_INTERVAL 1
- #define RAWHID_RX_ENDPOINT 4
- #define RAWHID_RX_SIZE 64
- #define RAWHID_RX_INTERVAL 1
- #define SEREMU_INTERFACE 1
- #define SEREMU_TX_ENDPOINT 1
- #define SEREMU_TX_SIZE 64
- #define SEREMU_TX_INTERVAL 1
- #define SEREMU_RX_ENDPOINT 2
- #define SEREMU_RX_SIZE 32
- #define SEREMU_RX_INTERVAL 2
- #define RAWHID_DESC_OFFSET (9 + 9)
- #define SEREMU_DESC_OFFSET (9 + 9+9+7+7 + 9)
- #define CONFIG_DESC_SIZE (9 + 9+9+7+7 + 9+9+7+7)
- #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
- #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
-
- #elif defined(USB_FLIGHTSIM)
- #define VENDOR_ID 0x16C0
- #define PRODUCT_ID 0x0488
- #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
- #define MANUFACTURER_NAME_LEN 11
- #define PRODUCT_NAME {'T','e','e','n','s','y',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
- #define PRODUCT_NAME_LEN 26
- #define EP0_SIZE 64
- #define NUM_ENDPOINTS 4
- #define NUM_USB_BUFFERS 20
- #define NUM_INTERFACE 2
- #define FLIGHTSIM_INTERFACE 0
- #define FLIGHTSIM_TX_ENDPOINT 3
- #define FLIGHTSIM_TX_SIZE 64
- #define FLIGHTSIM_TX_INTERVAL 1
- #define FLIGHTSIM_RX_ENDPOINT 4
- #define FLIGHTSIM_RX_SIZE 64
- #define FLIGHTSIM_RX_INTERVAL 1
- #define SEREMU_INTERFACE 1
- #define SEREMU_TX_ENDPOINT 1
- #define SEREMU_TX_SIZE 64
- #define SEREMU_TX_INTERVAL 1
- #define SEREMU_RX_ENDPOINT 2
- #define SEREMU_RX_SIZE 32
- #define SEREMU_RX_INTERVAL 2
- #define FLIGHTSIM_DESC_OFFSET (9 + 9)
- #define SEREMU_DESC_OFFSET (9 + 9+9+7+7 + 9)
- #define CONFIG_DESC_SIZE (9 + 9+9+7+7 + 9+9+7+7)
- #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
- #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
- #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
-
- #endif
-
-
- extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
-
- typedef struct {
- uint16_t wValue;
- uint16_t wIndex;
- const uint8_t *addr;
- uint16_t length;
- } usb_descriptor_list_t;
-
- extern const usb_descriptor_list_t usb_descriptor_list[];
-
-
- #endif
|