osal macro clean up

This commit is contained in:
hathach 2018-03-01 12:14:44 +07:00
parent 40935fc01c
commit 7add7337ba
15 changed files with 32 additions and 41 deletions

View File

@ -76,9 +76,9 @@ void led_blinking_task(void* param)
{
(void) param;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
led_blinking_subtask();
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
tusb_error_t led_blinking_subtask(void)

View File

@ -125,9 +125,9 @@ void cdcd_serial_app_task(void* param)
{
(void) param;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
cdcd_serial_subtask();
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
tusb_error_t cdcd_serial_subtask(void)

View File

@ -115,9 +115,9 @@ void keyboard_device_app_task(void* param)
{
(void) param;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
keyboard_device_subtask();
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
tusb_error_t keyboard_device_subtask(void)

View File

@ -103,9 +103,9 @@ void mouse_device_subtask(void);
void mouse_device_app_task(void * param)
{
(void) para;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
mouse_device_subtask();
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
void mouse_device_subtask(void)

View File

@ -160,9 +160,9 @@ void msc_device_app_task(void* param)
{ // no need to implement the task yet
(void) param;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
void msc_device_app_init (void)

View File

@ -123,7 +123,7 @@ void cdc_serial_host_app_task( void* param )
{
(void) param;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
//------------- send characters got from uart terminal to the first CDC device -------------//
for(uint8_t dev_addr=1; dev_addr <= TUSB_CFG_HOST_DEVICE_MAX; dev_addr++)
@ -163,7 +163,7 @@ void cdc_serial_host_app_task( void* param )
}
}
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
#endif

View File

@ -113,7 +113,7 @@ void keyboard_host_app_task(void* param)
{
(void) param;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
hid_keyboard_report_t kbd_report;
tusb_error_t error;
@ -123,7 +123,7 @@ void keyboard_host_app_task(void* param)
process_kbd_report(&kbd_report);
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
//--------------------------------------------------------------------+

View File

@ -114,7 +114,7 @@ void mouse_host_app_task(void* param)
{
(void) param;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
tusb_error_t error;
hid_mouse_report_t mouse_report;
@ -124,7 +124,7 @@ void mouse_host_app_task(void* param)
process_mouse_report(&mouse_report);
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
//--------------------------------------------------------------------+

View File

@ -150,7 +150,7 @@ void msc_host_app_task(void* param)
{
(void) param;;
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_BEGIN
bool is_any_disk_mounted;
@ -176,7 +176,7 @@ void msc_host_app_task(void* param)
}
}
OSAL_TASK_LOOP_END
OSAL_TASK_END
}
#endif

View File

@ -69,8 +69,8 @@ void rndis_host_app_init(void)
void rndis_host_app_task(void* param)
{
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_LOOP_END
OSAL_TASK_BEGIN
OSAL_TASK_END
}
#endif

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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;\