From 7092db264f9284c23d777562947111369baf7f68 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 7 Mar 2018 15:30:32 +0700 Subject: [PATCH] update --- .../device_virtual_com/src/cdc_device_app.c | 34 +-- .../device_virtual_com/src/tusb_descriptors.c | 225 +----------------- .../device_virtual_com/src/tusb_descriptors.h | 91 +------ .../obsolete/device/device_freertos/.cproject | 43 +++- .../obsolete/device/device_freertos/.project | 33 +-- examples/obsolete/device/src/cdc_device_app.c | 7 + hw/bsp/board.c | 2 + tinyusb/class/cdc/cdc_device.c | 17 +- tinyusb/class/cdc/cdc_device.h | 2 + tinyusb/common/verify.h | 4 +- tinyusb/device/usbd.c | 6 +- tinyusb/tusb_option.h | 2 +- vendor/freertos/FreeRTOSConfig.h | 1 - 13 files changed, 79 insertions(+), 388 deletions(-) diff --git a/examples/device/device_virtual_com/src/cdc_device_app.c b/examples/device/device_virtual_com/src/cdc_device_app.c index cbc4f4ffe..2a10d2ca6 100644 --- a/examples/device/device_virtual_com/src/cdc_device_app.c +++ b/examples/device/device_virtual_com/src/cdc_device_app.c @@ -76,36 +76,10 @@ void cdc_serial_app_umount(uint8_t coreid) } -void tud_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes) +void tud_cdc_rx_cb(uint8_t coreid, uint32_t xferred_bytes) { - switch ( pipe_id ) - { - case CDC_PIPE_DATA_OUT: - switch(event) - { - case TUSB_EVENT_XFER_COMPLETE: - for(uint8_t i=0; i 4) - #error These MCUs do not have enough number of endpoints for the current configuration -#endif +#define INTERFACE_NO_CDC 0 +#define TOTAL_INTEFACES 2 //--------------------------------------------------------------------+ // Endpoints Address & Max Packet Size @@ -75,57 +65,13 @@ #define EDPT_IN(x) (0x80 | (x)) #define EDPT_OUT(x) (x) -#if TUSB_CFG_MCU == MCU_LPC175X_6X // MCUs's endpoint number has a fixed type +#define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (1) +#define CDC_EDPT_NOTIFICATION_PACKETSIZE 64 - //------------- CDC -------------// - #define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (1) - #define CDC_EDPT_NOTIFICATION_PACKETSIZE 64 +#define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(2) +#define CDC_EDPT_DATA_IN_ADDR EDPT_IN (2) +#define CDC_EDPT_DATA_PACKETSIZE 64 - #define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(2) - #define CDC_EDPT_DATA_IN_ADDR EDPT_IN (2) - #define CDC_EDPT_DATA_PACKETSIZE 64 - - //------------- HID Keyboard -------------// - #define HID_KEYBOARD_EDPT_ADDR EDPT_IN (4) - #define HID_KEYBOARD_EDPT_PACKETSIZE 8 - - //------------- HID Mouse -------------// - #define HID_MOUSE_EDPT_ADDR EDPT_IN (7) - #define HID_MOUSE_EDPT_PACKETSIZE 8 - - //------------- HID Generic -------------// - - //------------- Mass Storage -------------// - #define MSC_EDPT_OUT_ADDR EDPT_OUT(5) - #define MSC_EDPT_IN_ADDR EDPT_IN (5) - -#else - - //------------- CDC -------------// - #define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (INTERFACE_NO_CDC+1) - #define CDC_EDPT_NOTIFICATION_PACKETSIZE 64 - - #define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(INTERFACE_NO_CDC+2) - #define CDC_EDPT_DATA_IN_ADDR EDPT_IN (INTERFACE_NO_CDC+2) - #define CDC_EDPT_DATA_PACKETSIZE 64 - - //------------- HID Keyboard -------------// - #define HID_KEYBOARD_EDPT_ADDR EDPT_IN (INTERFACE_NO_HID_KEYBOARD+1) - #define HID_KEYBOARD_EDPT_PACKETSIZE 8 - - //------------- HID Mouse -------------// - #define HID_MOUSE_EDPT_ADDR EDPT_IN (INTERFACE_NO_HID_MOUSE+1) - #define HID_MOUSE_EDPT_PACKETSIZE 8 - - //------------- HID Generic -------------// - - //------------- Mass Storage -------------// - #define MSC_EDPT_OUT_ADDR EDPT_OUT(INTERFACE_NO_MSC+1) - #define MSC_EDPT_IN_ADDR EDPT_IN (INTERFACE_NO_MSC+1) - -#endif - -#define MSC_EDPT_PACKETSIZE (TUSB_CFG_MCU == MCU_LPC43XX ? 512 : 64) //--------------------------------------------------------------------+ // CONFIGURATION DESCRIPTOR @@ -135,7 +81,6 @@ typedef struct ATTR_PACKED tusb_descriptor_configuration_t configuration; //------------- CDC -------------// -#if TUSB_CFG_DEVICE_CDC tusb_descriptor_interface_association_t cdc_iad; //CDC Control Interface @@ -150,28 +95,6 @@ typedef struct ATTR_PACKED tusb_descriptor_interface_t cdc_data_interface; tusb_descriptor_endpoint_t cdc_endpoint_out; tusb_descriptor_endpoint_t cdc_endpoint_in; -#endif - - //------------- HID Keyboard -------------// -#if TUSB_CFG_DEVICE_HID_KEYBOARD - tusb_descriptor_interface_t keyboard_interface; - tusb_hid_descriptor_hid_t keyboard_hid; - tusb_descriptor_endpoint_t keyboard_endpoint; -#endif - -//------------- HID Mouse -------------// -#if TUSB_CFG_DEVICE_HID_MOUSE - tusb_descriptor_interface_t mouse_interface; - tusb_hid_descriptor_hid_t mouse_hid; - tusb_descriptor_endpoint_t mouse_endpoint; -#endif - -//------------- Mass Storage -------------// -#if TUSB_CFG_DEVICE_MSC - tusb_descriptor_interface_t msc_interface; - tusb_descriptor_endpoint_t msc_endpoint_in; - tusb_descriptor_endpoint_t msc_endpoint_out; -#endif } app_descriptor_configuration_t; diff --git a/examples/obsolete/device/device_freertos/.cproject b/examples/obsolete/device/device_freertos/.cproject index 1fd91ce3d..2183c323a 100644 --- a/examples/obsolete/device/device_freertos/.cproject +++ b/examples/obsolete/device/device_freertos/.cproject @@ -89,7 +89,7 @@ - + @@ -186,7 +186,7 @@ - + @@ -237,13 +237,15 @@