????д????????????????
???????????? ???????[ 2013/8/15 12:21:07 ] ????????
??????????????????????????????????????????????У?
???????????????????С?“???????”????????????????б????????????????????й???????????????????м?????????????м???????е???????????·????????????????????????????????????????????л????????????????????????
??????????????????????????????
/*???????????????????????*/
uint8 MsgQueueFlag[MAX_QUEUE_NUMBER];
/*???????????????*/
OS_Q MsgQueue[MAX_QUEUE_NUMBER];
/*
* ???????????
*/
OS_Q* OSQCreate()
{
OS_CPU_SR cpu_sr = 0;
uint32 index;
OS_ENTER_CRITICAL();
for(index=0;index<MAX_QUEUE_NUMBER;index++)
{
/*?????????δ?????*/
if (MsgQueueFlag[index]==0)
{
MsgQueueFlag[index]=1;
/*???????β?????*/
MsgQueue[index].front=NULL;
MsgQueue[index].rear=NULL;
OS_EXIT_CRITICAL();
return &(MsgQueue[index]);
}
}
OS_EXIT_CRITICAL();
return (OS_Q*)NULL;
}
/*
*??????????
*/
int8 OSQDelate(OS_Q* q)
{
OS_CPU_SR cpu_sr = 0;
OS_ENTER_CRITICAL();
/*???????????*/
if (q == NULL)
{
OS_EXIT_CRITICAL();
return OS_Err;
}
/*??????????*/
if ((( q-MsgQueue ) < 0)||(( q-MsgQueue ) > (MAX_QUEUE_NUMBER-1)))
{
OS_EXIT_CRITICAL();
return OS_Err;
}
/*?????λ??0*/
MsgQueueFlag[q-MsgQueue] = (uint8)0;
OS_EXIT_CRITICAL();
return OS_OK;
}
/*
*??????????
*?ú??????????ж??????
*/
int8 OSQPost(OS_Q* q??OS_MSG msg)
{
OS_CPU_SR cpu_sr = 0;
OS_ENTER_CRITICAL();
if (q == NULL)
{
OS_EXIT_CRITICAL();
return OS_Err;
}
if ((( q-MsgQueue ) < 0)||(( q-MsgQueue ) > (MAX_QUEUE_NUMBER-1)))
{
OS_EXIT_CRITICAL();
return OS_Err;
}
if((q->rear+1)%MAX_MSG_NUMBER==q->front)
{
OS_EXIT_CRITICAL();
return OS_Err;
}
else
{
q->msgQueue[q->rear]=msg;
q->rear=(q->rear+1)%MAX_MSG_NUMBER;
OS_EXIT_CRITICAL();
return OS_OK;
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11