mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
complete enhancing osal with static memory
This commit is contained in:
parent
ea7efb0fd6
commit
3a64acaa28
@ -169,6 +169,8 @@ typedef struct ATTR_ALIGNED(4)
|
|||||||
|
|
||||||
VERIFY_STATIC(sizeof(usbd_task_event_t) <= 12, "size is not correct");
|
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 -------------*/
|
/*------------- event queue -------------*/
|
||||||
OSAL_QUEUE_DEF(_usbd_qdef, USBD_TASK_QUEUE_DEPTH, usbd_task_event_t);
|
OSAL_QUEUE_DEF(_usbd_qdef, USBD_TASK_QUEUE_DEPTH, usbd_task_event_t);
|
||||||
static osal_queue_t _usbd_q;
|
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);
|
_usbd_ctrl_sem = osal_semaphore_create(&_usbd_sem_def);
|
||||||
VERIFY(_usbd_q, TUSB_ERROR_OSAL_SEMAPHORE_FAILED);
|
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 -------------//
|
//------------- Core init -------------//
|
||||||
arrclr_( _usbd_descs );
|
arrclr_( _usbd_descs );
|
||||||
|
@ -65,13 +65,15 @@
|
|||||||
//
|
//
|
||||||
// NOTE: no switch statement is allowed in Task and subtask
|
// 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;
|
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;
|
(void) taskdef;
|
||||||
return (osal_task_t) 1;
|
return (osal_task_t) 1; // return non zero
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TASK_RESTART \
|
#define TASK_RESTART \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user