From 7add7337babf0af8f4f2bbd1127e57dc0d580c1d Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 1 Mar 2018 12:14:44 +0700 Subject: osal macro clean up --- tinyusb/class/cdc_rndis_host.c | 6 ++---- tinyusb/device/usbd.c | 4 ++-- tinyusb/host/usbh.c | 6 ++---- tinyusb/osal/osal.h | 9 ++------- tinyusb/osal/osal_none.h | 8 ++++---- 5 files changed, 12 insertions(+), 21 deletions(-) (limited to 'tinyusb') diff --git a/tinyusb/class/cdc_rndis_host.c b/tinyusb/class/cdc_rndis_host.c index 7f164fb48..75184b39d 100644 --- a/tinyusb/class/cdc_rndis_host.c +++ b/tinyusb/class/cdc_rndis_host.c @@ -91,11 +91,9 @@ tusb_error_t tusbh_cdc_rndis_get_mac_addr(uint8_t dev_addr, uint8_t mac_address[ // forever loop cannot have any return at all. OSAL_TASK_FUNCTION(cdch_rndis_task) (void* param;) { - OSAL_TASK_LOOP_BEGIN - + OSAL_TASK_BEGIN rndis_body_subtask(); - - OSAL_TASK_LOOP_END + OSAL_TASK_END } static tusb_error_t rndis_body_subtask(void) diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index bbe8290e1..0bc15221f 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -193,9 +193,9 @@ void usbd_task( void* param) { (void) param; - OSAL_TASK_LOOP_BEGIN + OSAL_TASK_BEGIN usbd_body_subtask(); - OSAL_TASK_LOOP_END + OSAL_TASK_END } static tusb_error_t usbd_body_subtask(void) diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index e1fb320bd..e9750f1fa 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -351,11 +351,9 @@ void usbh_enumeration_task(void* param) { (void) param; - OSAL_TASK_LOOP_BEGIN - + OSAL_TASK_BEGIN enumeration_body_subtask(); - - OSAL_TASK_LOOP_END + OSAL_TASK_END } tusb_error_t enumeration_body_subtask(void) diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 95e36f7b4..4dbeabc11 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -56,11 +56,6 @@ #include "tusb_option.h" #include "common/common.h" -/*------------- Task -------------*/ - -/*------------- Queue -------------*/ - - #if TUSB_CFG_OS == TUSB_OS_NONE #include "osal_none.h" @@ -72,8 +67,8 @@ #error TUSB_CFG_OS is not defined or OS is not supported yet #endif - #define OSAL_TASK_LOOP_BEGIN while(1) { - #define OSAL_TASK_LOOP_END } + #define OSAL_TASK_BEGIN while(1) { + #define OSAL_TASK_END } //------------- Sub Task -------------// #define OSAL_SUBTASK_BEGIN diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index 469722ec7..378a3a6f6 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -63,7 +63,7 @@ uint32_t tusb_tick_get(void); // retain value before/after such services needed to declare as static // OSAL_TASK_LOOP // { -// OSAL_TASK_LOOP_BEGIN +// OSAL_TASK_BEGIN // // task body statements // @@ -82,14 +82,14 @@ static inline osal_task_t osal_task_create(osal_func_t code, const char* name, u #define TASK_RESTART \ state = 0 -#define OSAL_TASK_LOOP_BEGIN \ +#define OSAL_TASK_BEGIN \ ATTR_UNUSED static uint32_t timeout = 0;\ static uint16_t state = 0;\ (void) timeout; /* timemout can possible unsued */ \ switch(state) { \ case 0: { \ -#define OSAL_TASK_LOOP_END \ +#define OSAL_TASK_END \ default:\ TASK_RESTART;\ }}\ @@ -117,7 +117,7 @@ static inline osal_task_t osal_task_create(osal_func_t code, const char* name, u }\ }while(0) -#define OSAL_SUBTASK_BEGIN OSAL_TASK_LOOP_BEGIN +#define OSAL_SUBTASK_BEGIN OSAL_TASK_BEGIN #define OSAL_SUBTASK_END \ default:\ TASK_RESTART;\ -- cgit v1.3.1