complete enhancing osal with static memory

This commit is contained in:
hathach 2018-05-17 20:04:52 +07:00
parent ea7efb0fd6
commit 3a64acaa28
2 changed files with 9 additions and 5 deletions

View File

@ -169,6 +169,8 @@ typedef struct ATTR_ALIGNED(4)
VERIFY_STATIC(sizeof(usbd_task_event_t) <= 12, "size is not correct");
OSAL_TASK_DEF(_usbd_task_def, "usbd", usbd_task, CFG_TUD_TASK_PRIO, CFG_TUD_TASK_STACKSIZE);
/*------------- event queue -------------*/
OSAL_QUEUE_DEF(_usbd_qdef, USBD_TASK_QUEUE_DEPTH, usbd_task_event_t);
static osal_queue_t _usbd_q;
@ -220,7 +222,7 @@ tusb_error_t usbd_init (void)
_usbd_ctrl_sem = osal_semaphore_create(&_usbd_sem_def);
VERIFY(_usbd_q, TUSB_ERROR_OSAL_SEMAPHORE_FAILED);
osal_task_create(usbd_task, "usbd", CFG_TUD_TASK_STACKSIZE, NULL, CFG_TUD_TASK_PRIO);
osal_task_create(&_usbd_task_def);
//------------- Core init -------------//
arrclr_( _usbd_descs );

View File

@ -65,13 +65,15 @@
//
// NOTE: no switch statement is allowed in Task and subtask
//--------------------------------------------------------------------+
typedef void (*osal_func_t)(void *param);
#define OSAL_TASK_DEF(_name, _str, _func, _prio, _stack_sz) osal_task_def_t _name;
typedef uint8_t osal_task_def_t;
typedef void* osal_task_t;
static inline osal_task_t osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio)
static inline osal_task_t osal_task_create(osal_task_def_t* taskdef)
{
(void) code; (void) name; (void) stack_size; (void) param; (void) prio;
return (osal_task_t) 1;
(void) taskdef;
return (osal_task_t) 1; // return non zero
}
#define TASK_RESTART \