diff options
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/class/cdc.h | 1 | ||||
| -rw-r--r-- | tinyusb/class/cdc_host.c | 4 | ||||
| -rw-r--r-- | tinyusb/class/custom_class.h | 2 | ||||
| -rw-r--r-- | tinyusb/class/hid_host.c | 3 | ||||
| -rw-r--r-- | tinyusb/class/msc_host.c | 1 | ||||
| -rw-r--r-- | tinyusb/common/common.h | 2 | ||||
| -rw-r--r-- | tinyusb/common/compiler/compiler.h | 32 | ||||
| -rw-r--r-- | tinyusb/common/std_request.h | 1 | ||||
| -rw-r--r-- | tinyusb/common/tusb_types.h | 1 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc43xx.c | 6 | ||||
| -rw-r--r-- | tinyusb/host/ehci/ehci.c | 36 |
11 files changed, 27 insertions, 62 deletions
diff --git a/tinyusb/class/cdc.h b/tinyusb/class/cdc.h index 5cabf1ec4..2bc6448c3 100644 --- a/tinyusb/class/cdc.h +++ b/tinyusb/class/cdc.h @@ -374,7 +374,6 @@ typedef struct ATTR_PACKED } bmCapabilities;
}cdc_desc_func_telephone_call_state_reporting_capabilities_t;
-static inline uint8_t cdc_functional_desc_typeof(uint8_t const * p_desc) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline uint8_t cdc_functional_desc_typeof(uint8_t const * p_desc)
{
return p_desc[2];
diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c index 04ca46f00..ddacdb1f3 100644 --- a/tinyusb/class/cdc_host.c +++ b/tinyusb/class/cdc_host.c @@ -57,7 +57,6 @@ //--------------------------------------------------------------------+
STATIC_VAR cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO to be static
-static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl)
{
cdch_data_t const * p_cdc = &cdch_data[pipe_hdl.dev_addr-1];
@@ -68,8 +67,7 @@ static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl) }
-STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
-STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr)
+static inline bool tusbh_cdc_is_mounted(uint8_t dev_addr)
{
// FIXME cannot use mounted class flag as at the point _open_sublass is called, the flag is not set yet
#ifdef _TEST_
diff --git a/tinyusb/class/custom_class.h b/tinyusb/class/custom_class.h index 850f12a39..787c59abd 100644 --- a/tinyusb/class/custom_class.h +++ b/tinyusb/class/custom_class.h @@ -58,7 +58,7 @@ typedef struct { //--------------------------------------------------------------------+ // USBH-CLASS DRIVER API //--------------------------------------------------------------------+ -STATIC_ INLINE_ bool tusbh_custom_is_mounted(uint8_t dev_addr, uint16_t vendor_id, uint16_t product_id) +static inline bool tusbh_custom_is_mounted(uint8_t dev_addr, uint16_t vendor_id, uint16_t product_id) { (void) vendor_id; // TODO check this later (void) product_id; diff --git a/tinyusb/class/hid_host.c b/tinyusb/class/hid_host.c index 1263d4cf1..0f39a0487 100644 --- a/tinyusb/class/hid_host.c +++ b/tinyusb/class/hid_host.c @@ -54,7 +54,6 @@ //--------------------------------------------------------------------+
// HID Interface common functions
//--------------------------------------------------------------------+
-static inline tusb_error_t hidh_interface_open(uint8_t dev_addr, uint8_t interface_number, tusb_descriptor_endpoint_t const *p_endpoint_desc, hidh_interface_info_t *p_hid) ATTR_ALWAYS_INLINE;
static inline tusb_error_t hidh_interface_open(uint8_t dev_addr, uint8_t interface_number, tusb_descriptor_endpoint_t const *p_endpoint_desc, hidh_interface_info_t *p_hid)
{
p_hid->pipe_hdl = hcd_pipe_open(dev_addr, p_endpoint_desc, TUSB_CLASS_HID);
@@ -66,7 +65,6 @@ static inline tusb_error_t hidh_interface_open(uint8_t dev_addr, uint8_t interfa return TUSB_ERROR_NONE;
}
-static inline void hidh_interface_close(hidh_interface_info_t *p_hid) ATTR_ALWAYS_INLINE;
static inline void hidh_interface_close(hidh_interface_info_t *p_hid)
{
(void) hcd_pipe_close(p_hid->pipe_hdl);
@@ -74,7 +72,6 @@ static inline void hidh_interface_close(hidh_interface_info_t *p_hid) }
// called from public API need to validate parameters
-tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_interface_info_t *p_hid) ATTR_ALWAYS_INLINE;
tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_interface_info_t *p_hid)
{
//------------- parameters validation -------------//
diff --git a/tinyusb/class/msc_host.c b/tinyusb/class/msc_host.c index 00186ddd9..cff0bf472 100644 --- a/tinyusb/class/msc_host.c +++ b/tinyusb/class/msc_host.c @@ -102,7 +102,6 @@ tusb_error_t tuh_msc_get_capacity(uint8_t dev_addr, uint32_t* p_last_lba, uint32 //--------------------------------------------------------------------+
// PUBLIC API: SCSI COMMAND
//--------------------------------------------------------------------+
-static inline void msc_cbw_add_signature(msc_cmd_block_wrapper_t *p_cbw, uint8_t lun) ATTR_ALWAYS_INLINE;
static inline void msc_cbw_add_signature(msc_cmd_block_wrapper_t *p_cbw, uint8_t lun)
{
p_cbw->signature = MSC_CBW_SIGNATURE;
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h index a624b941f..9a37c6c97 100644 --- a/tinyusb/common/common.h +++ b/tinyusb/common/common.h @@ -115,13 +115,11 @@ #define arrcount(_arr) ( sizeof(_arr) / sizeof(_arr[0]) )
-static inline uint8_t const * descriptor_next(uint8_t const p_desc[]) ATTR_ALWAYS_INLINE ATTR_PURE;
static inline uint8_t const * descriptor_next(uint8_t const p_desc[])
{
return p_desc + p_desc[DESCRIPTOR_OFFSET_LENGTH];
}
-static inline uint8_t descriptor_typeof(uint8_t const p_desc[]) ATTR_ALWAYS_INLINE ATTR_PURE;
static inline uint8_t descriptor_typeof(uint8_t const p_desc[])
{
return p_desc[DESCRIPTOR_OFFSET_TYPE];
diff --git a/tinyusb/common/compiler/compiler.h b/tinyusb/common/compiler/compiler.h index 0103bc945..bbdd6e50e 100644 --- a/tinyusb/common/compiler/compiler.h +++ b/tinyusb/common/compiler/compiler.h @@ -53,7 +53,7 @@ // Compile-time Assert
//--------------------------------------------------------------------+
#ifdef __ICCARM__
- #define STATIC_ASSERT static_assert
+ #define STATIC_ASSERT static_assert
#else
#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
#define _ASSERT_COUNTER __COUNTER__
@@ -64,32 +64,14 @@ #define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
#endif
-#ifndef _TEST_
- // TODO move some to tusb_option.h
- #define STATIC_ static
- #define INLINE_ inline
- #define ATTR_TEST_WEAK
-
- // allow debugger to watch any module-wide variables anywhere
- #if TUSB_CFG_DEBUG
- #define STATIC_VAR
- #else
- #define STATIC_VAR static
- #endif
-
- // function will not be inline for easy step by step debugging
- #if TUSB_CFG_DEBUG >= 2
- #define ATTR_ALWAYS_INLINE
- #endif
-
-#else // TODO remove this, try to pass using compiler command option
- #define ATTR_ALWAYS_INLINE
- #define STATIC_
- #define STATIC_VAR
- #define INLINE_
-
+// allow debugger to watch any module-wide variables anywhere
+#if TUSB_CFG_DEBUG
+#define STATIC_VAR
+#else
+#define STATIC_VAR static
#endif
+
#if defined(__GNUC__)
#include "compiler_gcc.h"
#elif defined __ICCARM__ // IAR compiler
diff --git a/tinyusb/common/std_request.h b/tinyusb/common/std_request.h index fc37a9c28..87d6e5d0f 100644 --- a/tinyusb/common/std_request.h +++ b/tinyusb/common/std_request.h @@ -70,7 +70,6 @@ typedef struct ATTR_PACKED{ STATIC_ASSERT( sizeof(tusb_control_request_t) == 8, "mostly compiler option issue");
// TODO move to somewhere suitable
-static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient)
{
return ((uint8_t) (direction << 7)) | ((uint8_t) (type << 5)) | (recipient);
diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h index 7f774e13d..d156d5e02 100644 --- a/tinyusb/common/tusb_types.h +++ b/tinyusb/common/tusb_types.h @@ -203,7 +203,6 @@ enum { INTERFACE_INVALID_NUMBER = 0xff
};
-static inline uint8_t std_class_code_to_index(uint8_t std_class_code) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t std_class_code_to_index(uint8_t std_class_code)
{
return (std_class_code <= TUSB_CLASS_AUDIO_VIDEO ) ? std_class_code :
diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c index 3b69b4821..f72949868 100644 --- a/tinyusb/device/dcd_lpc43xx.c +++ b/tinyusb/device/dcd_lpc43xx.c @@ -277,26 +277,22 @@ tusb_error_t dcd_init(void) // PIPE HELPER
//--------------------------------------------------------------------+
#if 0
-static inline uint8_t edpt_pos2phy(uint8_t pos) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t edpt_pos2phy(uint8_t pos)
{ // 0-5 --> OUT, 16-21 IN
return (pos < DCD_QHD_MAX/2) ? (2*pos) : (2*(pos-16)+1);
}
#endif
-static inline uint8_t edpt_phy2pos(uint8_t physical_endpoint) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t edpt_phy2pos(uint8_t physical_endpoint)
{
return physical_endpoint/2 + ( (physical_endpoint%2) ? 16 : 0);
}
-static inline uint8_t edpt_addr2phy(uint8_t endpoint_addr) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t edpt_addr2phy(uint8_t endpoint_addr)
{
return 2*(endpoint_addr & 0x0F) + ((endpoint_addr & TUSB_DIR_DEV_TO_HOST_MASK) ? 1 : 0);
}
-static inline uint8_t edpt_phy2log(uint8_t physical_endpoint) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t edpt_phy2log(uint8_t physical_endpoint)
{
return physical_endpoint/2;
@@ -323,7 +319,6 @@ static void qtd_init(dcd_qtd_t* p_qtd, void * data_ptr, uint16_t total_bytes) }
// retval 0: invalid
-static inline uint8_t qtd_find_free(uint8_t coreid) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline uint8_t qtd_find_free(uint8_t coreid)
{
for(uint8_t i=2; i<DCD_QTD_MAX; i++)
@@ -383,7 +378,6 @@ tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t //--------------------------------------------------------------------+
// BULK/INTERRUPT/ISOCHRONOUS PIPE API
//--------------------------------------------------------------------+
-static inline volatile uint32_t * get_reg_control_addr(uint8_t coreid, uint8_t physical_endpoint) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline volatile uint32_t * get_reg_control_addr(uint8_t coreid, uint8_t physical_endpoint)
{
return &(LPC_USB[coreid]->ENDPTCTRL0) + edpt_phy2log(physical_endpoint);
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index b3069388a..167b8f2bf 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -84,21 +84,21 @@ TUSB_CFG_ATTR_USBRAM STATIC_VAR ehci_data_t ehci_data; //--------------------------------------------------------------------+
// PROTOTYPE
//--------------------------------------------------------------------+
-STATIC_ INLINE_ ehci_registers_t* get_operational_register(uint8_t hostid) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
-STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t hostid) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
-STATIC_ INLINE_ uint8_t hostid_to_data_idx(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_CONST ATTR_WARN_UNUSED_RESULT;
+static inline ehci_registers_t* get_operational_register(uint8_t hostid) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
+static inline ehci_link_t* get_period_frame_list(uint8_t hostid) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
+static inline uint8_t hostid_to_data_idx(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_CONST ATTR_WARN_UNUSED_RESULT;
-STATIC_ INLINE_ ehci_qhd_t* get_async_head(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
-STATIC_ INLINE_ ehci_link_t* get_period_head(uint8_t hostid, uint8_t interval_ms) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+static inline ehci_qhd_t* get_async_head(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+static inline ehci_link_t* get_period_head(uint8_t hostid, uint8_t interval_ms) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
-STATIC_ INLINE_ ehci_qhd_t* get_control_qhd(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
-STATIC_ INLINE_ ehci_qtd_t* get_control_qtds(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+static inline ehci_qhd_t* get_control_qhd(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
+static inline ehci_qtd_t* get_control_qtds(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t qhd_get_index(ehci_qhd_t const * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
static inline ehci_qhd_t* qhd_next(ehci_qhd_t const * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
static inline ehci_qhd_t* qhd_find_free (uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline tusb_xfer_type_t qhd_get_xfer_type(ehci_qhd_t const * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
-STATIC_ INLINE_ ehci_qhd_t* qhd_get_from_pipe_handle(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE;
+static inline ehci_qhd_t* qhd_get_from_pipe_handle(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline pipe_handle_t qhd_create_pipe_handle(ehci_qhd_t const * p_qhd, tusb_xfer_type_t xfer_type) ATTR_PURE ATTR_ALWAYS_INLINE;
// determine if a queue head has bus-related error
static inline bool qhd_has_xact_error(ehci_qhd_t * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
@@ -111,7 +111,7 @@ static inline bool qhd_has_xact_error(ehci_qhd_t * p_qhd) static void qhd_init(ehci_qhd_t *p_qhd, uint8_t dev_addr, uint16_t max_packet_size, uint8_t endpoint_addr, uint8_t xfer_type, uint8_t interval);
-STATIC_ INLINE_ ehci_qtd_t* qtd_find_free(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE;
+static inline ehci_qtd_t* qtd_find_free(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline ehci_qtd_t* qtd_next(ehci_qtd_t const * p_qtd ) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline void qtd_insert_to_qhd(ehci_qhd_t *p_qhd, ehci_qtd_t *p_qtd_new) ATTR_ALWAYS_INLINE;
static inline void qtd_remove_1st_from_qhd(ehci_qhd_t *p_qhd) ATTR_ALWAYS_INLINE;
@@ -784,13 +784,13 @@ void hcd_isr(uint8_t hostid) //--------------------------------------------------------------------+
// HELPER
//--------------------------------------------------------------------+
-STATIC_ INLINE_ ehci_registers_t* get_operational_register(uint8_t hostid)
+static inline ehci_registers_t* get_operational_register(uint8_t hostid)
{
return (ehci_registers_t*) (hostid ? (&LPC_USB1->USBCMD_H) : (&LPC_USB0->USBCMD_H) );
}
#if EHCI_PERIODIC_LIST // TODO refractor/group this together
-STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t hostid)
+static inline ehci_link_t* get_period_frame_list(uint8_t hostid)
{
switch(hostid)
{
@@ -809,7 +809,7 @@ STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t hostid) }
#endif
-STATIC_ INLINE_ uint8_t hostid_to_data_idx(uint8_t hostid)
+static inline uint8_t hostid_to_data_idx(uint8_t hostid)
{
#if (CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
(void) hostid;
@@ -820,26 +820,26 @@ STATIC_ INLINE_ uint8_t hostid_to_data_idx(uint8_t hostid) }
//------------- queue head helper -------------//
-STATIC_ INLINE_ ehci_qhd_t* get_async_head(uint8_t hostid)
+static inline ehci_qhd_t* get_async_head(uint8_t hostid)
{
return &ehci_data.async_head[ hostid_to_data_idx(hostid) ];
}
#if EHCI_PERIODIC_LIST // TODO refractor/group this together
-STATIC_ INLINE_ ehci_link_t* get_period_head(uint8_t hostid, uint8_t interval_ms)
+static inline ehci_link_t* get_period_head(uint8_t hostid, uint8_t interval_ms)
{
return (ehci_link_t*) (&ehci_data.period_head_arr[ hostid_to_data_idx(hostid) ]
[ log2_of( min8_of(EHCI_FRAMELIST_SIZE, interval_ms) ) ] );
}
#endif
-STATIC_ INLINE_ ehci_qhd_t* get_control_qhd(uint8_t dev_addr)
+static inline ehci_qhd_t* get_control_qhd(uint8_t dev_addr)
{
return (dev_addr == 0) ?
get_async_head( usbh_devices[dev_addr].core_id ) :
&ehci_data.device[dev_addr-1].control.qhd;
}
-STATIC_ INLINE_ ehci_qtd_t* get_control_qtds(uint8_t dev_addr)
+static inline ehci_qtd_t* get_control_qtds(uint8_t dev_addr)
{
return (dev_addr == 0) ?
ehci_data.addr0_qtd :
@@ -873,7 +873,7 @@ static inline ehci_qhd_t* qhd_next(ehci_qhd_t const * p_qhd) return (ehci_qhd_t*) align32(p_qhd->next.address);
}
-STATIC_ INLINE_ ehci_qhd_t* qhd_get_from_pipe_handle(pipe_handle_t pipe_hdl)
+static inline ehci_qhd_t* qhd_get_from_pipe_handle(pipe_handle_t pipe_hdl)
{
return &ehci_data.device[ pipe_hdl.dev_addr-1 ].qhd[ pipe_hdl.index ];
}
@@ -895,7 +895,7 @@ static inline pipe_handle_t qhd_create_pipe_handle(ehci_qhd_t const * p_qhd, tus }
//------------- TD helper -------------//
-STATIC_ INLINE_ ehci_qtd_t* qtd_find_free(uint8_t dev_addr)
+static inline ehci_qtd_t* qtd_find_free(uint8_t dev_addr)
{
uint8_t index=0;
while( index<HCD_MAX_XFER && ehci_data.device[dev_addr-1].qtd[index].used )
|
