ソースを参照

Add experimental interface

main
PaulStoffregen 4年前
コミット
7a458043ea
3個のファイルの変更76行の追加4行の削除
  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 ファイルの表示

@@ -55,6 +55,10 @@ struct endpoint_struct {
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)));

transfer_t endpoint0_transfer_data __attribute__ ((used, aligned(32)));
@@ -455,6 +459,9 @@ static void endpoint0_setup(uint64_t setupdata)
#if defined(AUDIO_INTERFACE)
usb_audio_configure();
#endif
#if defined(EXPERIMENTAL_INTERFACE)
endpoint_queue_head[2].unused1 = (uint32_t)experimental_buffer;
#endif
endpoint0_receive(NULL, 0, 0);
return;
case 0x0880: // GET_CONFIGURATION

+ 67
- 3
teensy4/usb_desc.c ファイルの表示

@@ -620,7 +620,15 @@ static uint8_t flightsim_report_desc[] = {
#define MULTITOUCH_INTERFACE_DESC_SIZE 0
#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



@@ -1613,7 +1621,35 @@ PROGMEM const uint8_t usb_config_descriptor_480[CONFIG_DESC_SIZE] = {
0x03, // bmAttributes (0x03=intr)
MULTITOUCH_SIZE, 0, // wMaxPacketSize
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
};


@@ -2599,7 +2635,35 @@ PROGMEM const uint8_t usb_config_descriptor_12[CONFIG_DESC_SIZE] = {
0x03, // bmAttributes (0x03=intr)
MULTITOUCH_SIZE, 0, // wMaxPacketSize
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 ファイルの表示

@@ -122,7 +122,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
#define EP0_SIZE 64
#define NUM_ENDPOINTS 4
#define NUM_USB_BUFFERS 12
#define NUM_INTERFACE 2
#define NUM_INTERFACE 3
#define CDC_STATUS_INTERFACE 0
#define CDC_DATA_INTERFACE 1
#define CDC_ACM_ENDPOINT 2
@@ -133,6 +133,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
#define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64
#define CDC_TX_SIZE_12 64
#define EXPERIMENTAL_INTERFACE 2
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK

読み込み中…
キャンセル
保存