From 61657f6751ce96dd2b0c260729061ac0eb2adab4 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 19 Mar 2014 16:50:49 +0700 Subject: [PATCH] change OSAL_TASK_FUNCTION to adapt with cmsis rtx --- demos/device/device_os_none/.cproject | 46 ++++++-------- .../device_os_none/device_os_none.uvopt | 40 ++++++------ demos/device/src/cdcd_app.c | 2 +- demos/device/src/cdcd_app.h | 2 +- demos/device/src/keyboardd_app.c | 2 +- demos/device/src/keyboardd_app.h | 2 +- demos/device/src/main.c | 4 +- demos/device/src/moused_app.c | 2 +- demos/device/src/moused_app.h | 2 +- demos/device/src/mscd_app.h | 2 +- demos/host/host_cmsis_rtx/host_cmsis_rtx.ewp | 63 +++++++++++-------- .../host/host_cmsis_rtx/host_cmsis_rtx.uvopt | 22 +++---- demos/host/host_freertos/host_freertos.uvopt | 40 ++++++------ demos/host/host_os_none/.cproject | 60 ++++++++---------- demos/host/host_os_none/host_os_none.uvopt | 20 +++--- demos/host/src/cdc_serial_app.c | 2 +- demos/host/src/cdc_serial_app.h | 2 +- demos/host/src/keyboard_app.c | 2 +- demos/host/src/keyboard_app.h | 2 +- demos/host/src/main.c | 4 +- demos/host/src/mouse_app.c | 2 +- demos/host/src/mouse_app.h | 2 +- demos/host/src/msc_app.c | 2 +- demos/host/src/msc_app.h | 2 +- tinyusb/device/usbd.c | 2 +- tinyusb/device/usbd.h | 2 +- tinyusb/host/usbh.c | 2 +- tinyusb/host/usbh.h | 2 +- tinyusb/osal/osal.h | 17 +++-- tinyusb/osal/osal_cmsis_rtx.h | 2 + tinyusb/osal/osal_common.h | 8 +++ tinyusb/osal/osal_freeRTOS.h | 2 + tinyusb/osal/osal_none.h | 3 +- vendor/cmsis_rtos_rtx/INC/cmsis_os.h | 4 +- vendor/cmsis_rtos_rtx/RTX_Conf_CM.c | 22 +++---- 35 files changed, 200 insertions(+), 195 deletions(-) diff --git a/demos/device/device_os_none/.cproject b/demos/device/device_os_none/.cproject index de9cc4c19..8f871ad42 100644 --- a/demos/device/device_os_none/.cproject +++ b/demos/device/device_os_none/.cproject @@ -1,25 +1,23 @@ - - - + - + - - + + @@ -92,25 +90,24 @@ - - + - - + + @@ -183,25 +180,24 @@ - - + - - + + @@ -278,25 +274,24 @@ - - + - - + + @@ -369,25 +364,24 @@ - - + - - + + @@ -464,25 +458,24 @@ - - + - - + + @@ -559,7 +552,6 @@ - diff --git a/demos/device/device_os_none/device_os_none.uvopt b/demos/device/device_os_none/device_os_none.uvopt index e51ad3d78..1ebafbacd 100644 --- a/demos/device/device_os_none/device_os_none.uvopt +++ b/demos/device/device_os_none/device_os_none.uvopt @@ -932,8 +932,8 @@ 0 0 0 - 1 - 1 + 99 + 123 0 ..\src\main.c main.c @@ -946,10 +946,10 @@ 1 0 0 - 0 + 3 0 - 0 - 0 + 95 + 116 0 ..\src\cdcd_app.c cdcd_app.c @@ -962,10 +962,10 @@ 1 0 0 - 23 + 0 0 - 119 - 128 + 100 + 123 0 ..\src\keyboardd_app.c keyboardd_app.c @@ -978,10 +978,10 @@ 1 0 0 - 0 + 1 0 - 0 - 0 + 77 + 97 0 ..\src\moused_app.c moused_app.c @@ -1386,10 +1386,10 @@ 1 0 0 - 0 + 1 0 - 1 - 1 + 204 + 223 0 ..\..\..\tinyusb\device\usbd.c usbd.c @@ -1615,7 +1615,7 @@ - bsp lpc11uxx + lpc11uxx 0 0 0 @@ -1687,8 +1687,8 @@ - bsp lpc13uxx - 1 + lpc13uxx + 0 0 0 0 @@ -1759,7 +1759,7 @@ - bsp lpc175x_6x + lpc175x_6x 0 0 0 @@ -1863,8 +1863,8 @@ - bsp lpc43xx - 1 + lpc43xx + 0 0 0 0 diff --git a/demos/device/src/cdcd_app.c b/demos/device/src/cdcd_app.c index e4c004952..b35883da1 100644 --- a/demos/device/src/cdcd_app.c +++ b/demos/device/src/cdcd_app.c @@ -116,7 +116,7 @@ void tusbd_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, } } -OSAL_TASK_FUNCTION( cdcd_serial_app_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( cdcd_serial_app_task , p_task_para) { OSAL_TASK_LOOP_BEGIN diff --git a/demos/device/src/cdcd_app.h b/demos/device/src/cdcd_app.h index 6f5df7b9d..c11019bd7 100644 --- a/demos/device/src/cdcd_app.h +++ b/demos/device/src/cdcd_app.h @@ -56,7 +56,7 @@ #if TUSB_CFG_DEVICE_CDC void cdcd_serial_app_init(void); -OSAL_TASK_FUNCTION( cdcd_serial_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( cdcd_serial_app_task , p_task_para); #else diff --git a/demos/device/src/keyboardd_app.c b/demos/device/src/keyboardd_app.c index 9c0212435..3b1819da7 100644 --- a/demos/device/src/keyboardd_app.c +++ b/demos/device/src/keyboardd_app.c @@ -121,7 +121,7 @@ void keyboardd_app_init(void) ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(keyboardd_app_task) ), VOID_RETURN); } -OSAL_TASK_FUNCTION( keyboardd_app_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( keyboardd_app_task , p_task_para) { OSAL_TASK_LOOP_BEGIN diff --git a/demos/device/src/keyboardd_app.h b/demos/device/src/keyboardd_app.h index a6af1220b..0e7ae4360 100644 --- a/demos/device/src/keyboardd_app.h +++ b/demos/device/src/keyboardd_app.h @@ -56,7 +56,7 @@ #if TUSB_CFG_DEVICE_HID_KEYBOARD void keyboardd_app_init(void); -OSAL_TASK_FUNCTION( keyboardd_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( keyboardd_app_task , p_task_para); #else diff --git a/demos/device/src/main.c b/demos/device/src/main.c index f5c05bece..dc80ed5ec 100644 --- a/demos/device/src/main.c +++ b/demos/device/src/main.c @@ -58,7 +58,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( led_blinking_task , p_task_para); OSAL_TASK_DEF(led_blinking_task, 128, LED_BLINKING_APP_TASK_PRIO); void print_greeting(void); @@ -120,7 +120,7 @@ void led_blinking_set_interval(uint32_t ms) led_blink_interval_ms = ms; } -OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( led_blinking_task , p_task_para) { OSAL_TASK_LOOP_BEGIN diff --git a/demos/device/src/moused_app.c b/demos/device/src/moused_app.c index 2c19376bb..6aed296c2 100644 --- a/demos/device/src/moused_app.c +++ b/demos/device/src/moused_app.c @@ -98,7 +98,7 @@ void moused_app_init(void) ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(moused_app_task) ), VOID_RETURN); } -OSAL_TASK_FUNCTION( moused_app_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( moused_app_task , p_task_para) { OSAL_TASK_LOOP_BEGIN diff --git a/demos/device/src/moused_app.h b/demos/device/src/moused_app.h index 9561680fe..39c33da0d 100644 --- a/demos/device/src/moused_app.h +++ b/demos/device/src/moused_app.h @@ -56,7 +56,7 @@ #if TUSB_CFG_DEVICE_HID_MOUSE void moused_app_init(void); -OSAL_TASK_FUNCTION( moused_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( moused_app_task , p_task_para); #else diff --git a/demos/device/src/mscd_app.h b/demos/device/src/mscd_app.h index 203e05d2d..7fabf697b 100644 --- a/demos/device/src/mscd_app.h +++ b/demos/device/src/mscd_app.h @@ -73,7 +73,7 @@ issue at github.com/hathach/tinyusb" #endif void msc_dev_app_init(void); -OSAL_TASK_FUNCTION( msc_dev_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( msc_dev_app_task , p_task_para); extern scsi_sense_fixed_data_t mscd_sense_data; diff --git a/demos/host/host_cmsis_rtx/host_cmsis_rtx.ewp b/demos/host/host_cmsis_rtx/host_cmsis_rtx.ewp index 945d6f91a..5211b06c3 100644 --- a/demos/host/host_cmsis_rtx/host_cmsis_rtx.ewp +++ b/demos/host/host_cmsis_rtx/host_cmsis_rtx.ewp @@ -167,7 +167,8 @@ CORE_M4 TUSB_CFG_MCU=MCU_LPC43XX BOARD=BOARD_EA4357 - TUSB_CFG_OS=TUSB_OS_NONE + TUSB_CFG_OS=TUSB_OS_CMSIS_RTX + TUSB_CFG_OS_TASK_PRIO=osPriorityRealtime - bsp - - boards - - $PROJ_DIR$\..\..\..\boards\board.c - - - $PROJ_DIR$\..\..\..\boards\embedded_artists\ea4357\board_ea4357.c - - - $PROJ_DIR$\..\..\..\boards\microbuilder\board_lpc4357usb.c - - - $PROJ_DIR$\..\..\..\boards\lpcxpresso\board_lpcxpresso1769.c - - - $PROJ_DIR$\..\..\..\boards\ngx\board_ngx4330.c - - - $PROJ_DIR$\..\..\..\boards\embedded_artists\oem_base_board\pca9532.c - - - $PROJ_DIR$\..\..\..\boards\printf_retarget.c - - + boards + + $PROJ_DIR$\..\..\..\boards\board.c + + + $PROJ_DIR$\..\..\..\boards\embedded_artists\ea4357\board_ea4357.c + + + $PROJ_DIR$\..\..\..\boards\microbuilder\board_lpc4357usb.c + + + $PROJ_DIR$\..\..\..\boards\lpcxpresso\board_lpcxpresso1769.c + + + $PROJ_DIR$\..\..\..\boards\ngx\board_ngx4330.c + + + $PROJ_DIR$\..\..\..\boards\embedded_artists\oem_base_board\pca9532.c + + + $PROJ_DIR$\..\..\..\boards\printf_retarget.c + + + + mcu lpc175x_6x @@ -2871,6 +2873,15 @@ + + cmsis-rtx + + $PROJ_DIR$\..\..\..\vendor\cmsis_rtos_rtx\LIB\IAR\RTX_CM4.a + + + $PROJ_DIR$\..\..\..\vendor\cmsis_rtos_rtx\RTX_Conf_CM.c + + fatfs diff --git a/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt b/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt index 78a9652d4..ec755f332 100644 --- a/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt +++ b/demos/host/host_cmsis_rtx/host_cmsis_rtx.uvopt @@ -499,7 +499,7 @@ 0 0 0 - 138 + 139 145 0 ..\src\msc_app.c @@ -527,7 +527,7 @@ boards - 0 + 1 0 0 0 @@ -771,7 +771,7 @@ 0 17 0 - 356 + 366 373 0 ..\..\..\tinyusb\host\usbh.c @@ -967,12 +967,12 @@ 4 34 1 - 1 + 0 0 - 0 + 52 0 - 1 - 1 + 3 + 9 0 ..\..\..\vendor\cmsis_rtos_rtx\RTX_Conf_CM.c RTX_Conf_CM.c @@ -1075,7 +1075,7 @@ 0 68 0 - 105 + 113 120 0 ..\..\..\mcu\lpc43xx\CMSIS_LPC43xx_DriverLib\src\system_LPC43xx.c @@ -1105,10 +1105,10 @@ 2 0 0 - 0 + 25 0 - 139 - 151 + 159 + 166 0 ..\..\..\mcu\lpc43xx\keil\startup_LPC43xx.s startup_LPC43xx.s diff --git a/demos/host/host_freertos/host_freertos.uvopt b/demos/host/host_freertos/host_freertos.uvopt index 7f187062f..7b6ec2797 100644 --- a/demos/host/host_freertos/host_freertos.uvopt +++ b/demos/host/host_freertos/host_freertos.uvopt @@ -706,8 +706,8 @@ 0 0 0 - 1 - 1 + 109 + 129 0 ..\src\main.c main.c @@ -720,10 +720,10 @@ 1 0 0 - 0 + 21 0 - 0 - 0 + 116 + 124 0 ..\src\cdc_serial_app.c cdc_serial_app.c @@ -738,8 +738,8 @@ 0 0 0 - 0 - 0 + 95 + 113 0 ..\src\keyboard_app.c keyboard_app.c @@ -752,10 +752,10 @@ 1 0 0 - 0 + 1 0 - 1 - 1 + 96 + 117 0 ..\src\mouse_app.c mouse_app.c @@ -786,8 +786,8 @@ 0 0 0 - 0 - 0 + 133 + 150 0 ..\src\msc_app.c msc_app.c @@ -888,10 +888,10 @@ 1 0 0 - 0 + 33 0 - 0 - 0 + 325 + 333 0 ..\..\..\tinyusb\host\usbh.c usbh.c @@ -1050,7 +1050,7 @@ 0 31 0 - 224 + 225 229 0 ..\..\..\tinyusb\class\hid_host.c @@ -1158,7 +1158,7 @@ freertos - 0 + 1 0 0 0 @@ -1170,7 +1170,7 @@ 0 5 0 - 48 + 49 54 0 ..\..\..\vendor\freertos\freertoslpc\FreeRTOSCommonHooks.c @@ -1278,7 +1278,7 @@ 3 36 1 - 0 + 1 0 1 0 @@ -1626,7 +1626,7 @@ 0 0 0 - 14 + 15 34 0 ..\..\..\mcu\lpc43xx\CMSIS_LPC43xx_DriverLib\src\system_LPC43xx.c diff --git a/demos/host/host_os_none/.cproject b/demos/host/host_os_none/.cproject index 427e9e34a..973d8f762 100644 --- a/demos/host/host_os_none/.cproject +++ b/demos/host/host_os_none/.cproject @@ -1,25 +1,23 @@ - - - + - + - - + + @@ -75,7 +73,7 @@ - + - - + + @@ -167,10 +164,10 @@ - + - - + + @@ -261,7 +257,7 @@ - + - - + + @@ -353,7 +348,7 @@ - + - - + + @@ -443,7 +437,7 @@ - + - - + + @@ -534,7 +527,7 @@ diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt index 9a7585cd2..d67fa8cb7 100644 --- a/demos/host/host_os_none/host_os_none.uvopt +++ b/demos/host/host_os_none/host_os_none.uvopt @@ -838,7 +838,7 @@ app - 1 + 0 0 0 0 @@ -958,7 +958,7 @@ tinyusb - 1 + 0 0 0 0 @@ -1114,7 +1114,7 @@ 0 0 0 - 34 + 35 38 0 ..\..\..\tinyusb\hal\hal_lpc175x_6x.c @@ -1162,7 +1162,7 @@ 0 0 0 - 17 + 18 34 0 ..\..\..\tinyusb\class\cdc_host.c @@ -1306,7 +1306,7 @@ 0 15 0 - 5 + 6 10 0 ..\..\..\tinyusb\host\ohci\ohci.c @@ -1382,7 +1382,7 @@ fatfs - 1 + 0 0 0 0 @@ -1438,7 +1438,7 @@ boards - 1 + 0 0 0 0 @@ -1605,7 +1605,7 @@ - bsp lpc43xx + lpc43xx 0 0 0 @@ -1725,7 +1725,7 @@ - bsp lpc175x_6x + lpc175x_6x 0 0 0 @@ -1754,7 +1754,7 @@ 0 35 0 - 76 + 77 86 0 ..\..\..\mcu\lpc175x_6x\LPC17xx_DriverLib\source\lpc17xx_clkpwr.c diff --git a/demos/host/src/cdc_serial_app.c b/demos/host/src/cdc_serial_app.c index 6226d44b9..cffc5b401 100644 --- a/demos/host/src/cdc_serial_app.c +++ b/demos/host/src/cdc_serial_app.c @@ -119,7 +119,7 @@ void cdc_serial_app_init(void) } //------------- main task -------------// -OSAL_TASK_FUNCTION( cdc_serial_app_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( cdc_serial_app_task, p_task_para) { (void) p_task_para; diff --git a/demos/host/src/cdc_serial_app.h b/demos/host/src/cdc_serial_app.h index e5d366299..9cf9a1595 100644 --- a/demos/host/src/cdc_serial_app.h +++ b/demos/host/src/cdc_serial_app.h @@ -56,7 +56,7 @@ #if TUSB_CFG_HOST_CDC void cdc_serial_app_init(void); -OSAL_TASK_FUNCTION( cdc_serial_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( cdc_serial_app_task, p_task_para); #else diff --git a/demos/host/src/keyboard_app.c b/demos/host/src/keyboard_app.c index 6a770a06d..07505ae5f 100644 --- a/demos/host/src/keyboard_app.c +++ b/demos/host/src/keyboard_app.c @@ -112,7 +112,7 @@ void keyboard_app_init(void) } //------------- main task -------------// -OSAL_TASK_FUNCTION( keyboard_app_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( keyboard_app_task, p_task_para) { (void) p_task_para; diff --git a/demos/host/src/keyboard_app.h b/demos/host/src/keyboard_app.h index 2e29b7070..ae43fe0c2 100644 --- a/demos/host/src/keyboard_app.h +++ b/demos/host/src/keyboard_app.h @@ -62,7 +62,7 @@ #if TUSB_CFG_HOST_HID_KEYBOARD void keyboard_app_init(void); -OSAL_TASK_FUNCTION( keyboard_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( keyboard_app_task, p_task_para); #else diff --git a/demos/host/src/main.c b/demos/host/src/main.c index d3bf1032e..32804010c 100644 --- a/demos/host/src/main.c +++ b/demos/host/src/main.c @@ -60,7 +60,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( led_blinking_task, p_task_para); OSAL_TASK_DEF(led_blinking_task, 128, LED_BLINKING_APP_TASK_PRIO); void print_greeting(void); @@ -124,7 +124,7 @@ int main(void) //--------------------------------------------------------------------+ // BLINKING TASK //--------------------------------------------------------------------+ -OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( led_blinking_task, p_task_para) { (void) p_task_para; // suppress compiler warnings diff --git a/demos/host/src/mouse_app.c b/demos/host/src/mouse_app.c index 0f1323a2e..cff84bbba 100644 --- a/demos/host/src/mouse_app.c +++ b/demos/host/src/mouse_app.c @@ -113,7 +113,7 @@ void mouse_app_init(void) } //------------- main task -------------// -OSAL_TASK_FUNCTION( mouse_app_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( mouse_app_task, p_task_para) { (void) p_task_para; diff --git a/demos/host/src/mouse_app.h b/demos/host/src/mouse_app.h index 3fd1c0c7a..d8f63d0e5 100644 --- a/demos/host/src/mouse_app.h +++ b/demos/host/src/mouse_app.h @@ -65,7 +65,7 @@ #if TUSB_CFG_HOST_HID_MOUSE void mouse_app_init(void); -OSAL_TASK_FUNCTION( mouse_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( mouse_app_task, p_task_para); #else diff --git a/demos/host/src/msc_app.c b/demos/host/src/msc_app.c index fa1f0696d..e6df5d6be 100644 --- a/demos/host/src/msc_app.c +++ b/demos/host/src/msc_app.c @@ -147,7 +147,7 @@ void msc_app_init(void) } //------------- main task -------------// -OSAL_TASK_FUNCTION( msc_app_task ) (void* p_task_para) +OSAL_TASK_FUNCTION( msc_app_task, p_task_para) { (void) p_task_para; diff --git a/demos/host/src/msc_app.h b/demos/host/src/msc_app.h index 7bb52819c..0b34510e3 100644 --- a/demos/host/src/msc_app.h +++ b/demos/host/src/msc_app.h @@ -57,7 +57,7 @@ #if TUSB_CFG_HOST_MSC void msc_app_init(void); -OSAL_TASK_FUNCTION( msc_app_task ) (void* p_task_para); +OSAL_TASK_FUNCTION( msc_app_task, p_task_para); #else diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index a9ed82e2d..b64b25f4a 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -225,7 +225,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t // To enable the TASK_ASSERT style (quick return on false condition) in a real RTOS, a task must act as a wrapper // and is used mainly to call subtasks. Within a subtask return statement can be called freely, the task with // forever loop cannot have any return at all. -OSAL_TASK_FUNCTION(usbd_task) (void* p_task_para) +OSAL_TASK_FUNCTION(usbd_task, p_task_para) { OSAL_TASK_LOOP_BEGIN diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h index 684d2fbed..48574fddc 100644 --- a/tinyusb/device/usbd.h +++ b/tinyusb/device/usbd.h @@ -101,7 +101,7 @@ bool tusbd_is_configured(uint8_t coreid) ATTR_WARN_UNUSED_RESULT; extern osal_semaphore_handle_t usbd_control_xfer_sem_hdl; tusb_error_t usbd_init(void); -OSAL_TASK_FUNCTION (usbd_task) (void* p_task_para); +OSAL_TASK_FUNCTION (usbd_task, p_task_para); #endif diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index 7653affba..1ff9d365e 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -342,7 +342,7 @@ static tusb_error_t enumeration_body_subtask(void); // To enable the TASK_ASSERT style (quick return on false condition) in a real RTOS, a task must act as a wrapper // and is used mainly to call subtasks. Within a subtask return statement can be called freely, the task with // forever loop cannot have any return at all. -OSAL_TASK_FUNCTION(usbh_enumeration_task) (void* p_task_para) +OSAL_TASK_FUNCTION(usbh_enumeration_task, p_task_para) { (void) p_task_para; // suppress compiler warnings diff --git a/tinyusb/host/usbh.h b/tinyusb/host/usbh.h index 467ab6e95..efddfbeb9 100644 --- a/tinyusb/host/usbh.h +++ b/tinyusb/host/usbh.h @@ -99,7 +99,7 @@ ATTR_WEAK void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_descript #ifdef _TINY_USB_SOURCE_FILE_ -OSAL_TASK_FUNCTION (usbh_enumeration_task) (void* p_task_para); +OSAL_TASK_FUNCTION (usbh_enumeration_task, p_task_para); tusb_error_t usbh_init(void); tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest, diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 4bb28c1fb..d5faba68e 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -66,8 +66,15 @@ #include "osal_none.h" #else + #if TUSB_CFG_OS == TUSB_OS_FREERTOS + #include "osal_freeRTOS.h" + #elif TUSB_CFG_OS == TUSB_OS_CMSIS_RTX + #include "osal_cmsis_rtx.h" + #else + #error TUSB_CFG_OS is not defined or OS is not supported yet + #endif + #define OSAL_VAR - #define OSAL_TASK_FUNCTION(task_func) void task_func #define OSAL_TASK_LOOP_BEGIN \ while(1) { @@ -98,14 +105,6 @@ #define SUBTASK_ASSERT_WITH_HANDLER(condition, func_call) \ ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, func_call, ,\ condition, TUSB_ERROR_OSAL_TASK_FAILED, "%s", "evaluated to false") - - #if TUSB_CFG_OS == TUSB_OS_FREERTOS - #include "osal_freeRTOS.h" - #elif TUSB_CFG_OS == TUSB_OS_CMSIS_RTX - #include "osal_cmsis_rtx.h" - #else - #error TUSB_CFG_OS is not defined or OS is not supported yet - #endif #endif //------------- OSAL API for cmock -------------// diff --git a/tinyusb/osal/osal_cmsis_rtx.h b/tinyusb/osal/osal_cmsis_rtx.h index c65dc911c..3e6297eeb 100644 --- a/tinyusb/osal/osal_cmsis_rtx.h +++ b/tinyusb/osal/osal_cmsis_rtx.h @@ -59,6 +59,8 @@ //--------------------------------------------------------------------+ // TASK API //--------------------------------------------------------------------+ +#define OSAL_TASK_FUNCTION(task_func, p_para) void task_func(void const * p_para) + typedef osThreadDef_t osal_task_t; #define OSAL_TASK_DEF(task_code, task_stack_depth, task_prio) \ diff --git a/tinyusb/osal/osal_common.h b/tinyusb/osal/osal_common.h index 3f1bfe08e..4c551126c 100644 --- a/tinyusb/osal/osal_common.h +++ b/tinyusb/osal/osal_common.h @@ -52,6 +52,10 @@ #include "common/common.h" +#ifdef __CC_ARM +#pragma diag_suppress 66 // Suppress Keil warnings #66-D: enumeration value is out of "int" range +#endif + enum { OSAL_TIMEOUT_NOTIMEOUT = 0, // for use within ISR, return immediately @@ -59,6 +63,10 @@ enum OSAL_TIMEOUT_WAIT_FOREVER = 0xFFFFFFFF }; +#ifdef __CC_ARM +#pragma diag_default 66 // return Keil 66 to normal severity +#endif + static inline uint32_t osal_tick_from_msec(uint32_t msec) ATTR_CONST ATTR_ALWAYS_INLINE; static inline uint32_t osal_tick_from_msec(uint32_t msec) { diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h index 5a904736f..3a99589d0 100644 --- a/tinyusb/osal/osal_freeRTOS.h +++ b/tinyusb/osal/osal_freeRTOS.h @@ -64,6 +64,8 @@ extern "C" { //--------------------------------------------------------------------+ // TASK API //--------------------------------------------------------------------+ +#define OSAL_TASK_FUNCTION portTASK_FUNCTION + typedef struct { char const * name; pdTASK_CODE code; diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index 0d4bee1b1..435493586 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -77,8 +77,7 @@ uint32_t tusb_tick_get(void); #define OSAL_TASK_REF #define osal_task_create(x) TUSB_ERROR_NONE -#define OSAL_TASK_FUNCTION(task_func) \ - tusb_error_t task_func +#define OSAL_TASK_FUNCTION(task_func, p_para) tusb_error_t task_func(void * p_para) #define TASK_RESTART \ state = 0 diff --git a/vendor/cmsis_rtos_rtx/INC/cmsis_os.h b/vendor/cmsis_rtos_rtx/INC/cmsis_os.h index 17cc71778..76283968c 100644 --- a/vendor/cmsis_rtos_rtx/INC/cmsis_os.h +++ b/vendor/cmsis_rtos_rtx/INC/cmsis_os.h @@ -21,7 +21,7 @@ * Version 1.02 * Control functions for short timeouts in microsecond resolution: * Added: osKernelSysTick, osKernelSysTickFrequency, osKernelSysTickMicroSec - * Removed: osSignalGet + * Removed: osSignalGet *---------------------------------------------------------------------------- * * Copyright (c) 2013 ARM LIMITED @@ -344,7 +344,7 @@ extern uint16_t const os_tickus_f; /// Get the RTOS kernel system timer counter. /// \note MUST REMAIN UNCHANGED: \b osKernelSysTick shall be consistent in every CMSIS-RTOS. -/// \return RTOS kernel system timer as 32-bit value +/// \return RTOS kernel system timer as 32-bit value uint32_t osKernelSysTick (void); /// The RTOS kernel system timer frequency in Hz. diff --git a/vendor/cmsis_rtos_rtx/RTX_Conf_CM.c b/vendor/cmsis_rtos_rtx/RTX_Conf_CM.c index 7577414d4..6d74b6ddc 100644 --- a/vendor/cmsis_rtos_rtx/RTX_Conf_CM.c +++ b/vendor/cmsis_rtos_rtx/RTX_Conf_CM.c @@ -15,19 +15,19 @@ * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * - Neither the name of ARM nor the names of its contributors may be used - * to endorse or promote products derived from this software without + * - Neither the name of ARM nor the names of its contributors may be used + * to endorse or promote products derived from this software without * specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *---------------------------------------------------------------------------*/ @@ -86,8 +86,8 @@ #define OS_STKCHECK 1 #endif -// Processor mode for thread execution -// <0=> Unprivileged mode +// Processor mode for thread execution +// <0=> Unprivileged mode // <1=> Privileged mode // Default: Privileged mode #ifndef OS_RUNPRIV @@ -192,7 +192,7 @@ // Standard library system mutexes // =============================== -// Define max. number system mutexes that are used to protect +// Define max. number system mutexes that are used to protect // the arm standard runtime library. For microlib they are not used. #ifndef OS_MUTEXCNT #define OS_MUTEXCNT 8