From 44b36d74f2c75b4aae061d95e5468c367a8ed1a3 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 17 Apr 2014 18:02:51 +0700 Subject: [PATCH] clean up STATIC_VAR --- .../device_cmsis_rtx/device_cmsis_rtx.uvopt | 14 +++--- .../device_freertos/device_freertos.uvopt | 14 +++--- demos/device/device_os_none/.cproject | 46 +++++++++++-------- .../device_os_none/device_os_none.uvopt | 14 +++--- .../host/host_cmsis_rtx/host_cmsis_rtx.uvopt | 18 ++++---- demos/host/host_freertos/host_freertos.uvopt | 6 +-- demos/host/host_os_none/host_os_none.uvopt | 12 ++--- tinyusb/class/cdc_device.c | 5 +- tinyusb/class/cdc_host.c | 2 +- tinyusb/class/hid_device.c | 2 +- tinyusb/class/msc_host.c | 1 - tinyusb/device/dcd_lpc175x_6x.c | 2 +- tinyusb/device/dcd_lpc43xx.c | 4 +- tinyusb/device/dcd_lpc_11uxx_13uxx.c | 2 +- tinyusb/host/ehci/ehci.c | 2 +- tinyusb/host/hub.c | 2 +- tinyusb/host/usbh.c | 2 +- 17 files changed, 77 insertions(+), 71 deletions(-) diff --git a/demos/device/device_cmsis_rtx/device_cmsis_rtx.uvopt b/demos/device/device_cmsis_rtx/device_cmsis_rtx.uvopt index d0c05790..fc0d0fa7 100644 --- a/demos/device/device_cmsis_rtx/device_cmsis_rtx.uvopt +++ b/demos/device/device_cmsis_rtx/device_cmsis_rtx.uvopt @@ -73,7 +73,7 @@ 0 0 - 1 + 0 8 @@ -791,9 +791,9 @@ 0 - 0 + 1 0 - 0 + 1 8 @@ -893,10 +893,10 @@ 1 0 0 - 25 + 0 0 - 86 - 97 + 88 + 93 0 ..\src\main.c main.c @@ -1951,7 +1951,7 @@ 0 0 0 - 145 + 147 151 0 ..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s diff --git a/demos/device/device_freertos/device_freertos.uvopt b/demos/device/device_freertos/device_freertos.uvopt index 27a373fd..9b9e341b 100644 --- a/demos/device/device_freertos/device_freertos.uvopt +++ b/demos/device/device_freertos/device_freertos.uvopt @@ -212,7 +212,7 @@ 0 - 0 + 1 0 0 @@ -494,7 +494,7 @@ 0 - 0 + 1 0 0 @@ -637,7 +637,7 @@ 1 0 - 1 + 0 8 @@ -793,7 +793,7 @@ 1 0 - 0 + 1 8 @@ -895,7 +895,7 @@ 0 24 0 - 84 + 86 94 0 ..\src\main.c @@ -1951,7 +1951,7 @@ 0 0 0 - 144 + 146 151 0 ..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s @@ -2103,7 +2103,7 @@ 0 1 0 - 79 + 81 83 0 ..\..\..\vendor\freertos\freertoslpc\FreeRTOSCommonHooks.c diff --git a/demos/device/device_os_none/.cproject b/demos/device/device_os_none/.cproject index d6ae23fc..6ffd2758 100644 --- a/demos/device/device_os_none/.cproject +++ b/demos/device/device_os_none/.cproject @@ -1,23 +1,25 @@ - + + + - + + + - - @@ -90,24 +92,25 @@ + - + + + - - @@ -181,24 +184,25 @@ + - + + + - - @@ -277,24 +281,25 @@ + - + + + - - @@ -367,24 +372,25 @@ + - + + + - - @@ -461,24 +467,25 @@ + - + + + - - @@ -551,6 +558,7 @@ + diff --git a/demos/device/device_os_none/device_os_none.uvopt b/demos/device/device_os_none/device_os_none.uvopt index 1a62f4c7..c86d08cf 100644 --- a/demos/device/device_os_none/device_os_none.uvopt +++ b/demos/device/device_os_none/device_os_none.uvopt @@ -671,7 +671,7 @@ 1 0 - 1 + 0 8 @@ -854,7 +854,7 @@ 1 0 - 0 + 1 8 @@ -956,7 +956,7 @@ 0 3 0 - 71 + 72 76 0 ..\src\main.c @@ -1004,7 +1004,7 @@ 0 1 0 - 107 + 108 112 0 ..\src\keyboard_device_app.c @@ -1092,7 +1092,7 @@ 0 6 0 - 57 + 58 61 0 ..\..\..\tinyusb\tusb.c @@ -1396,7 +1396,7 @@ 0 47 0 - 418 + 422 427 0 ..\..\..\tinyusb\device\usbd.c @@ -2012,7 +2012,7 @@ 0 54 0 - 152 + 155 160 0 ..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s diff --git a/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt b/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt index 0ce431bd..3625cf85 100644 --- a/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt +++ b/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt @@ -71,9 +71,9 @@ 0 - 0 + 1 0 - 0 + 1 8 @@ -212,7 +212,7 @@ 0 - 0 + 1 0 0 @@ -496,7 +496,7 @@ 1 0 - 1 + 0 8 @@ -638,10 +638,10 @@ 1 0 0 - 22 + 29 0 95 - 96 + 101 0 ..\src\main.c main.c @@ -900,7 +900,7 @@ tinyusb - 0 + 1 0 0 0 @@ -1116,7 +1116,7 @@ 3 30 1 - 0 + 1 0 0 0 @@ -1528,7 +1528,7 @@ 0 0 0 - 144 + 145 151 0 ..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s diff --git a/demos/host/host_freertos/host_freertos.uvopt b/demos/host/host_freertos/host_freertos.uvopt index 07beecf2..4779f0ce 100644 --- a/demos/host/host_freertos/host_freertos.uvopt +++ b/demos/host/host_freertos/host_freertos.uvopt @@ -73,7 +73,7 @@ 0 0 - 1 + 0 8 @@ -506,7 +506,7 @@ 0 0 - 0 + 1 8 @@ -1416,7 +1416,7 @@ 0 0 0 - 149 + 151 154 0 ..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt index 9258661d..a4c967ae 100644 --- a/demos/host/host_os_none/host_os_none.uvopt +++ b/demos/host/host_os_none/host_os_none.uvopt @@ -613,7 +613,7 @@ 0 9 0 - 86 + 87 90 0 ..\src\main.c @@ -645,7 +645,7 @@ 0 0 0 - 114 + 115 117 0 ..\src\keyboard_host_app.c @@ -661,7 +661,7 @@ 0 9 0 - 120 + 125 135 0 ..\src\mouse_host_app.c @@ -677,7 +677,7 @@ 0 0 0 - 142 + 149 159 0 ..\src\msc_host_app.c @@ -781,7 +781,7 @@ 0 0 0 - 351 + 352 354 0 ..\..\..\tinyusb\host\usbh.c @@ -1349,7 +1349,7 @@ 0 0 0 - 145 + 146 151 0 ..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s diff --git a/tinyusb/class/cdc_device.c b/tinyusb/class/cdc_device.c index 0d312006..2c90bfc4 100644 --- a/tinyusb/class/cdc_device.c +++ b/tinyusb/class/cdc_device.c @@ -50,8 +50,7 @@ //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF //--------------------------------------------------------------------+ -TUSB_CFG_ATTR_USBRAM -static cdc_line_coding_t cdcd_line_coding[CONTROLLER_DEVICE_NUMBER]; +TUSB_CFG_ATTR_USBRAM STATIC_VAR cdc_line_coding_t cdcd_line_coding[CONTROLLER_DEVICE_NUMBER]; typedef struct { uint8_t interface_number; @@ -63,7 +62,7 @@ typedef struct { //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -cdcd_data_t cdcd_data[CONTROLLER_DEVICE_NUMBER]; +STATIC_VAR cdcd_data_t cdcd_data[CONTROLLER_DEVICE_NUMBER]; static tusb_error_t cdcd_xfer(uint8_t coreid, cdc_pipeid_t pipeid, void * p_buffer, uint32_t length, bool is_notify) { diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c index 679b3752..0227e5e9 100644 --- a/tinyusb/class/cdc_host.c +++ b/tinyusb/class/cdc_host.c @@ -55,7 +55,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -/*STATIC_*/ cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO to be static +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) diff --git a/tinyusb/class/hid_device.c b/tinyusb/class/hid_device.c index 7e2454d3..540e01db 100644 --- a/tinyusb/class/hid_device.c +++ b/tinyusb/class/hid_device.c @@ -105,7 +105,7 @@ static hidd_class_driver_t const hidd_class_driver[HIDD_NUMBER_OF_SUBCLASS] = }; // internal buffer for transferring data -TUSB_CFG_ATTR_USBRAM static uint8_t m_hid_buffer[ HIDD_BUFFER_SIZE ]; +TUSB_CFG_ATTR_USBRAM STATIC_VAR uint8_t m_hid_buffer[ HIDD_BUFFER_SIZE ]; //--------------------------------------------------------------------+ // KEYBOARD APPLICATION API diff --git a/tinyusb/class/msc_host.c b/tinyusb/class/msc_host.c index 4983a95f..e3eaf799 100644 --- a/tinyusb/class/msc_host.c +++ b/tinyusb/class/msc_host.c @@ -53,7 +53,6 @@ //--------------------------------------------------------------------+ TUSB_CFG_ATTR_USBRAM STATIC_VAR msch_interface_t msch_data[TUSB_CFG_HOST_DEVICE_MAX]; - //------------- Initalization Data -------------// OSAL_SEM_DEF(msch_semaphore); static osal_semaphore_handle_t msch_sem_hdl; diff --git a/tinyusb/device/dcd_lpc175x_6x.c b/tinyusb/device/dcd_lpc175x_6x.c index e5bc4f74..0644f92a 100644 --- a/tinyusb/device/dcd_lpc175x_6x.c +++ b/tinyusb/device/dcd_lpc175x_6x.c @@ -68,7 +68,7 @@ typedef struct { }dcd_data_t; -TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(128) STATIC_ dcd_data_t dcd_data; +TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(128) STATIC_VAR dcd_data_t dcd_data; //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c index 3aa4a437..f2c8519e 100644 --- a/tinyusb/device/dcd_lpc43xx.c +++ b/tinyusb/device/dcd_lpc43xx.c @@ -168,11 +168,11 @@ typedef struct { }dcd_data_t; #if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE) -TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) dcd_data_t dcd_data0; +TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data0; #endif #if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE) -TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) dcd_data_t dcd_data1; +TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data1; #endif static LPC_USB0_Type * const LPC_USB[2] = { LPC_USB0, ((LPC_USB0_Type*) LPC_USB1_BASE) }; diff --git a/tinyusb/device/dcd_lpc_11uxx_13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c index 4692779d..b50041f0 100644 --- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c +++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c @@ -147,7 +147,7 @@ ATTR_ALIGNED(256) TUSB_CFG_ATTR_USBRAM // for IAR the first ATTR_ALIGNED takes e #else TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(256) // GCC & Keil the last ATTR_ALIGNED takes effect #endif -static dcd_11u_13u_data_t dcd_data; +STATIC_VAR dcd_11u_13u_data_t dcd_data; static inline uint16_t addr_offset(void const * p_buffer) ATTR_CONST ATTR_ALWAYS_INLINE; static inline uint16_t addr_offset(void const * p_buffer) diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index 62915b6b..cd50c64f 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -70,7 +70,7 @@ TUSB_CFG_ATTR_USBRAM STATIC_VAR ehci_data_t ehci_data; #endif #if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST) - TUSB_CFG_ATTR_USBRAM STATIC_VAR ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE] ATTR_ALIGNED(4096); + TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4096) STATIC_VAR ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE]; #ifndef __ICCARM__ // IAR cannot able to determine the alignment with datalignment pragma STATIC_ASSERT( ALIGN_OF(period_frame_list1) == 4096, "Period Framelist must be 4k alginment"); // validation diff --git a/tinyusb/host/hub.c b/tinyusb/host/hub.c index 2a9764bd..3259732e 100644 --- a/tinyusb/host/hub.c +++ b/tinyusb/host/hub.c @@ -58,7 +58,7 @@ typedef struct { uint8_t status_change; // data from status change interrupt endpoint }usbh_hub_t; -TUSB_CFG_ATTR_USBRAM usbh_hub_t hub_data[TUSB_CFG_HOST_DEVICE_MAX]; +TUSB_CFG_ATTR_USBRAM STATIC_VAR usbh_hub_t hub_data[TUSB_CFG_HOST_DEVICE_MAX]; ATTR_ALIGNED(4) TUSB_CFG_ATTR_USBRAM STATIC_VAR uint8_t hub_enum_buffer[sizeof(descriptor_hub_desc_t)]; //OSAL_SEM_DEF(hub_enum_semaphore); diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index 13f08719..1e61cbf1 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -108,7 +108,7 @@ enum { USBH_CLASS_DRIVER_COUNT = sizeof(usbh_class_drivers) / sizeof(host_class_ TUSB_CFG_ATTR_USBRAM usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; // including zero-address //------------- Enumeration Task Data -------------/ -enum { ENUM_QUEUE_DEPTH = 5 }; +enum { ENUM_QUEUE_DEPTH = 8 }; OSAL_TASK_DEF(usbh_enumeration_task, 200, TUSB_CFG_OS_TASK_PRIO); OSAL_QUEUE_DEF(enum_queue_def, ENUM_QUEUE_DEPTH, uint32_t);