【更新】ipc init/create增加 flag 判断

This commit is contained in:
wangqinglin 2021-10-19 00:35:38 +08:00
parent abf8812802
commit 4c4f107436
1 changed files with 10 additions and 2 deletions

View File

@ -287,6 +287,7 @@ rt_err_t rt_sem_init(rt_sem_t sem,
{
RT_ASSERT(sem != RT_NULL);
RT_ASSERT(value < 0x10000U);
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* initialize object */
rt_object_init(&(sem->parent.parent), RT_Object_Class_Semaphore, name);
@ -379,6 +380,7 @@ rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag)
RT_DEBUG_NOT_IN_INTERRUPT;
RT_ASSERT(value < 0x10000U);
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* allocate object */
sem = (rt_sem_t)rt_object_allocate(RT_Object_Class_Semaphore, name);
@ -1257,6 +1259,7 @@ rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag)
{
/* parameter check */
RT_ASSERT(event != RT_NULL);
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* initialize object */
rt_object_init(&(event->parent.parent), RT_Object_Class_Event, name);
@ -1344,6 +1347,7 @@ rt_event_t rt_event_create(const char *name, rt_uint8_t flag)
rt_event_t event;
RT_DEBUG_NOT_IN_INTERRUPT;
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* allocate object */
event = (rt_event_t)rt_object_allocate(RT_Object_Class_Event, name);
@ -1766,6 +1770,7 @@ rt_err_t rt_mb_init(rt_mailbox_t mb,
rt_uint8_t flag)
{
RT_ASSERT(mb != RT_NULL);
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* initialize object */
rt_object_init(&(mb->parent.parent), RT_Object_Class_MailBox, name);
@ -1865,6 +1870,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
rt_mailbox_t mb;
RT_DEBUG_NOT_IN_INTERRUPT;
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* allocate object */
mb = (rt_mailbox_t)rt_object_allocate(RT_Object_Class_MailBox, name);
@ -2463,6 +2469,7 @@ rt_err_t rt_mq_init(rt_mq_t mq,
/* parameter check */
RT_ASSERT(mq != RT_NULL);
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* initialize object */
rt_object_init(&(mq->parent.parent), RT_Object_Class_MessageQueue, name);
@ -2585,6 +2592,7 @@ rt_mq_t rt_mq_create(const char *name,
register rt_base_t temp;
RT_DEBUG_NOT_IN_INTERRUPT;
RT_ASSERT((flag == RT_IPC_FLAG_FIFO) || (flag == RT_IPC_FLAG_PRIO));
/* allocate object */
mq = (rt_mq_t)rt_object_allocate(RT_Object_Class_MessageQueue, name);