summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-04-10 19:44:08 +0700
committerhathach <[email protected]>2018-04-10 19:49:00 +0700
commit7faceeb02d7d2ff7bd79f1039e7900bbdbda9b11 (patch)
tree03a3f57490ff405529e70c844d41f6f32bc5fd50 /tinyusb
parentfecef9ca427a928d9e21c468b5072cf604e0e109 (diff)
rename ATTR_USB_MIN_ALIGNMENT to CFG_TUSB_MEM_ALIGN
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/class/cdc/cdc_device.c12
-rw-r--r--tinyusb/class/cdc/cdc_device.h6
-rw-r--r--tinyusb/class/msc/msc_device.c6
-rw-r--r--tinyusb/device/usbd.c2
4 files changed, 15 insertions, 11 deletions
diff --git a/tinyusb/class/cdc/cdc_device.c b/tinyusb/class/cdc/cdc_device.c
index 5ca4c7d31..681e50f84 100644
--- a/tinyusb/class/cdc/cdc_device.c
+++ b/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
diff --git a/tinyusb/class/cdc/cdc_device.h b/tinyusb/class/cdc/cdc_device.h
index 9d91ae4f5..59ea13d23 100644
--- a/tinyusb/class/cdc/cdc_device.h
+++ b/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
diff --git a/tinyusb/class/msc/msc_device.c b/tinyusb/class/msc/msc_device.c
index 0d7fa4f71..6117d1770 100644
--- a/tinyusb/class/msc/msc_device.c
+++ b/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
//--------------------------------------------------------------------+
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index 23bf971d3..a1886b9b4 100644
--- a/tinyusb/device/usbd.c
+++ b/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[] =
{