Просмотр исходного кода

rename ATTR_USB_MIN_ALIGNMENT to CFG_TUSB_MEM_ALIGN

hathach 8 лет назад
Родитель
Сommit
7faceeb02d

+ 1 - 1
examples/device/nrf52840/src/msc_device_ramdisk.c

@@ -47,7 +47,7 @@
 //--------------------------------------------------------------------+
 // INTERNAL OBJECT & FUNCTION DECLARATION
 //--------------------------------------------------------------------+
-CFG_TUSB_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT
+CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN
 uint8_t msc_device_ramdisk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
 {
   //------------- Boot Sector -------------//

+ 3 - 3
examples/device/nrf52840/src/tusb_config.h

@@ -77,11 +77,11 @@
 
 // LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
 #if CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX
- #define ATTR_USB_MIN_ALIGNMENT   ATTR_ALIGNED(64)
+ #define CFG_TUSB_MEM_ALIGN   ATTR_ALIGNED(64)
 #elif defined NRF52840_XXAA
- #define ATTR_USB_MIN_ALIGNMENT   ATTR_ALIGNED(4)
+ #define CFG_TUSB_MEM_ALIGN   ATTR_ALIGNED(4)
 #else
- #define ATTR_USB_MIN_ALIGNMENT
+ #define CFG_TUSB_MEM_ALIGN
 #endif
 
 #ifdef __cplusplus

+ 3 - 3
examples/obsolete/device/src/tusb_config.h

@@ -112,11 +112,11 @@
 
 // LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
 #if CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX
- #define ATTR_USB_MIN_ALIGNMENT   ATTR_ALIGNED(64)
+ #define CFG_TUSB_MEM_ALIGN   ATTR_ALIGNED(64)
 #elif defined NRF52840_XXAA
- #define ATTR_USB_MIN_ALIGNMENT   ATTR_ALIGNED(4)
+ #define CFG_TUSB_MEM_ALIGN   ATTR_ALIGNED(4)
 #else
- #define ATTR_USB_MIN_ALIGNMENT
+ #define CFG_TUSB_MEM_ALIGN
 #endif
 
 

+ 8 - 4
tinyusb/class/cdc/cdc_device.c

@@ -69,8 +69,6 @@ typedef struct {
 CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4) uint8_t _tmp_rx_buf[64];
 CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4) uint8_t _tmp_tx_buf[64];
 
-#define CFG_TUD_CDC_BUFSIZE   128
-
 FIFO_DEF(_rx_ff, CFG_TUD_CDC_BUFSIZE, uint8_t, true);
 FIFO_DEF(_tx_ff, CFG_TUD_CDC_BUFSIZE, uint8_t, true);
 
@@ -163,8 +161,9 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface
   //------------- Communication Interface -------------//
   (*p_length) = sizeof(tusb_desc_interface_t);
 
+  // Communication Functional Descriptors
   while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
-  { // Communication Functional Descriptors
+  {
     if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) )
     { // save ACM bmCapabilities
       p_cdc->acm_capability = ((cdc_desc_func_acm_t const *) p_desc)->bmCapabilities;
@@ -244,7 +243,10 @@ tusb_error_t cdcd_control_request_st(uint8_t rhport, tusb_control_request_t cons
     usbd_control_xfer_st(rhport, p_request->bmRequestType_bit.direction, (uint8_t*) &cdcd_line_coding[rhport], len);
 
     // Invoke callback
-    if ( tud_cdc_line_coding_cb ) tud_cdc_line_coding_cb(rhport, &cdcd_line_coding[rhport]);
+    if (CDC_REQUEST_SET_LINE_CODING == p_request->bRequest)
+    {
+      if ( tud_cdc_line_coding_cb ) tud_cdc_line_coding_cb(rhport, &cdcd_line_coding[rhport]);
+    }
   }
   else if (CDC_REQUEST_SET_CONTROL_LINE_STATE == p_request->bRequest )
   {
@@ -290,7 +292,9 @@ tusb_error_t cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
 
 void cdcd_sof(uint8_t rhport)
 {
+#if CFG_TUD_CDC_FLUSH_ON_SOF
   tud_n_cdc_flush(rhport);
+#endif
 }
 
 #endif

+ 3 - 3
tinyusb/class/cdc/cdc_device.h

@@ -83,9 +83,9 @@ static inline bool     tud_cdc_flush      (void)
 //--------------------------------------------------------------------+
 // APPLICATION CALLBACK API (WEAK is optional)
 //--------------------------------------------------------------------+
-void tud_cdc_rx_cb(uint8_t rhport) ATTR_WEAK;
-void tud_cdc_line_state_cb(uint8_t rhport, bool dtr, bool rts) ATTR_WEAK;
-void tud_cdc_line_coding_cb(uint8_t rhport, cdc_line_coding_t const* p_line_coding) ATTR_WEAK;
+ATTR_WEAK void tud_cdc_rx_cb(uint8_t rhport);
+ATTR_WEAK void tud_cdc_line_state_cb(uint8_t rhport, bool dtr, bool rts);
+ATTR_WEAK void tud_cdc_line_coding_cb(uint8_t rhport, cdc_line_coding_t const* p_line_coding);
 
 //--------------------------------------------------------------------+
 // USBD-CLASS DRIVER API

+ 3 - 3
tinyusb/class/msc/msc_device.c

@@ -62,13 +62,13 @@ typedef struct {
   // buffer for scsi's response other than read10 & write10.
   // NOTE should be multiple of 64 to be compatible with lpc11/13u
   uint8_t scsi_data[64];
-  ATTR_USB_MIN_ALIGNMENT msc_cbw_t  cbw;
+  CFG_TUSB_MEM_ALIGN msc_cbw_t  cbw;
 
 #if defined (__ICCARM__) && (CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX)
   uint8_t padding1[64-sizeof(msc_cbw_t)]; // IAR cannot align struct's member
 #endif
 
-  ATTR_USB_MIN_ALIGNMENT msc_csw_t csw;
+  CFG_TUSB_MEM_ALIGN msc_csw_t csw;
 
   uint8_t max_lun;
   uint8_t interface_num;
@@ -79,7 +79,7 @@ typedef struct {
   uint16_t xferred_len; // numbered of bytes transferred so far in the Data Stage
 }mscd_interface_t;
 
-CFG_TUSB_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT STATIC_VAR mscd_interface_t mscd_data;
+CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN STATIC_VAR mscd_interface_t mscd_data;
 //--------------------------------------------------------------------+
 // INTERNAL OBJECT & FUNCTION DECLARATION
 //--------------------------------------------------------------------+

+ 1 - 1
tinyusb/device/usbd.c

@@ -76,7 +76,7 @@ typedef struct {
 // MACRO CONSTANT TYPEDEF
 //--------------------------------------------------------------------+
 usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
-CFG_TUSB_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT uint8_t usbd_enum_buffer[CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE];
+CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t usbd_enum_buffer[CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE];
 
 static usbd_class_driver_t const usbd_class_drivers[] =
 {