Browse Source

Add experimental interface

main
PaulStoffregen 4 years ago
parent
commit
7a458043ea
3 changed files with 76 additions and 4 deletions
  1. +7
    -0
      teensy4/usb.c
  2. +67
    -3
      teensy4/usb_desc.c
  3. +2
    -1
      teensy4/usb_desc.h

+ 7
- 0
teensy4/usb.c View File

uint32_t callback_param; uint32_t callback_param;
};*/ };*/


#ifdef EXPERIMENTAL_INTERFACE
uint8_t experimental_buffer[1152] __attribute__ ((section(".dmabuffers"), aligned(64)));
#endif

endpoint_t endpoint_queue_head[(NUM_ENDPOINTS+1)*2] __attribute__ ((used, aligned(4096))); endpoint_t endpoint_queue_head[(NUM_ENDPOINTS+1)*2] __attribute__ ((used, aligned(4096)));


transfer_t endpoint0_transfer_data __attribute__ ((used, aligned(32))); transfer_t endpoint0_transfer_data __attribute__ ((used, aligned(32)));
#if defined(AUDIO_INTERFACE) #if defined(AUDIO_INTERFACE)
usb_audio_configure(); usb_audio_configure();
#endif #endif
#if defined(EXPERIMENTAL_INTERFACE)
endpoint_queue_head[2].unused1 = (uint32_t)experimental_buffer;
#endif
endpoint0_receive(NULL, 0, 0); endpoint0_receive(NULL, 0, 0);
return; return;
case 0x0880: // GET_CONFIGURATION case 0x0880: // GET_CONFIGURATION

+ 67
- 3
teensy4/usb_desc.c View File

#define MULTITOUCH_INTERFACE_DESC_SIZE 0 #define MULTITOUCH_INTERFACE_DESC_SIZE 0
#endif #endif


#define CONFIG_DESC_SIZE MULTITOUCH_INTERFACE_DESC_POS+MULTITOUCH_INTERFACE_DESC_SIZE
#define EXPERIMENTAL_INTERFACE_DESC_POS MULTITOUCH_INTERFACE_DESC_POS+MULTITOUCH_INTERFACE_DESC_SIZE
#ifdef EXPERIMENTAL_INTERFACE
#define EXPERIMENTAL_INTERFACE_DESC_SIZE 9+7+7
#define EXPERIMENTAL_HID_DESC_OFFSET MULTITOUCH_INTERFACE_DESC_POS+9
#else
#define EXPERIMENTAL_INTERFACE_DESC_SIZE 0
#endif

#define CONFIG_DESC_SIZE EXPERIMENTAL_INTERFACE_DESC_POS+EXPERIMENTAL_INTERFACE_DESC_SIZE






0x03, // bmAttributes (0x03=intr) 0x03, // bmAttributes (0x03=intr)
MULTITOUCH_SIZE, 0, // wMaxPacketSize MULTITOUCH_SIZE, 0, // wMaxPacketSize
4, // bInterval, 4 = 1ms 4, // bInterval, 4 = 1ms
#endif // KEYMEDIA_INTERFACE
#endif // MULTITOUCH_INTERFACE

#ifdef EXPERIMENTAL_INTERFACE
// configuration for 480 Mbit/sec speed
// interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
9, // bLength
4, // bDescriptorType
EXPERIMENTAL_INTERFACE, // bInterfaceNumber
0, // bAlternateSetting
1, // bNumEndpoints
0xFF, // bInterfaceClass (0xFF = Vendor)
0x6A, // bInterfaceSubClass
0xFF, // bInterfaceProtocol
0, // iInterface
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
7, // bLength
5, // bDescriptorType
1 | 0x80, // bEndpointAddress
0x02, // bmAttributes (0x02=bulk)
LSB(512), MSB(512), // wMaxPacketSize
1, // bInterval
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
7, // bLength
5, // bDescriptorType
1, // bEndpointAddress
0x02, // bmAttributes (0x02=bulk)
LSB(512), MSB(512), // wMaxPacketSize
1, // bInterval
#endif // EXPERIMENTAL_INTERFACE
}; };




0x03, // bmAttributes (0x03=intr) 0x03, // bmAttributes (0x03=intr)
MULTITOUCH_SIZE, 0, // wMaxPacketSize MULTITOUCH_SIZE, 0, // wMaxPacketSize
1, // bInterval 1, // bInterval
#endif // KEYMEDIA_INTERFACE
#endif // MULTITOUCH_INTERFACE

#ifdef EXPERIMENTAL_INTERFACE
// configuration for 12 Mbit/sec speed
// interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
9, // bLength
4, // bDescriptorType
EXPERIMENTAL_INTERFACE, // bInterfaceNumber
0, // bAlternateSetting
1, // bNumEndpoints
0xFF, // bInterfaceClass (0xFF = Vendor)
0x6A, // bInterfaceSubClass
0xFF, // bInterfaceProtocol
0, // iInterface
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
7, // bLength
5, // bDescriptorType
1 | 0x80, // bEndpointAddress
0x02, // bmAttributes (0x02=bulk)
LSB(64), MSB(64), // wMaxPacketSize
1, // bInterval
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
7, // bLength
5, // bDescriptorType
1, // bEndpointAddress
0x02, // bmAttributes (0x02=bulk)
LSB(64), MSB(64), // wMaxPacketSize
1, // bInterval
#endif // EXPERIMENTAL_INTERFACE
}; };





+ 2
- 1
teensy4/usb_desc.h View File

#define EP0_SIZE 64 #define EP0_SIZE 64
#define NUM_ENDPOINTS 4 #define NUM_ENDPOINTS 4
#define NUM_USB_BUFFERS 12 #define NUM_USB_BUFFERS 12
#define NUM_INTERFACE 2
#define NUM_INTERFACE 3
#define CDC_STATUS_INTERFACE 0 #define CDC_STATUS_INTERFACE 0
#define CDC_DATA_INTERFACE 1 #define CDC_DATA_INTERFACE 1
#define CDC_ACM_ENDPOINT 2 #define CDC_ACM_ENDPOINT 2
#define CDC_TX_SIZE_480 512 #define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64 #define CDC_RX_SIZE_12 64
#define CDC_TX_SIZE_12 64 #define CDC_TX_SIZE_12 64
#define EXPERIMENTAL_INTERFACE 2
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK

Loading…
Cancel
Save