/*
*****************************************************
*
* Modify area end
*
*****************************************************
*/ #if OS_ARG_CHK_EN > 0 if(pevent ==(OS_EVENT *)0){/* Validate 'pevent' */ return(OS_ERR_PEVENT_NULL); } if(msg ==(void*)0){/* Make sure we are not posting a NULL pointer */ return(OS_ERR_POST_NULL_PTR); } if(pevent->OSEventType != OS_EVENT_TYPE_Q){/* Validate event block type */ return(OS_ERR_EVENT_TYPE); } #endif
OS_ENTER_CRITICAL(); if(pevent->OSEventGrp != 0x00){/* See if any task pending on queue */
OS_EventTaskRdy(pevent, msg, OS_STAT_Q);/* Ready highest priority task waiting on event */
OS_EXIT_CRITICAL();
OS_Sched();/* Find highest priority task ready to run */ return(OS_NO_ERR); }
pq =(OS_Q *)pevent->OSEventPtr;/* Point to queue control block */ if(pq->OSQEntries >= pq->OSQSize){/* Make sure queue is not full */ /*
*****************************************************
*
* Modify area below
*if full time delay 500 ticks //notice the os_EXIT_CRITICAL Wheather to modify
*****************************************************
*/
OS_EXIT_CRITICAL();//author
OSTimeDly(2);//modify 1
OS_ENTER_CRITICAL();//add modify 3
if(pq->OSQEntries >= pq->OSQSize)//modify 2 back after 200 ticks
{//modify 3
return(OS_Q_FULL);//author return 进入满
}//modify4
OS_EXIT_CRITICAL();//add modify 4
} *pq->OSQIn++= msg;/* Insert message into queue */
pq->OSQEntries++;/* Update the nbr of entries in the queue */ if(pq->OSQIn == pq->OSQEnd){/* Wrap IN ptr if we are at end of queue */
pq->OSQIn = pq->OSQStart; }
OS_EXIT_CRITICAL(); return(OS_NO_ERR); } */
pq->OSQIn = pq->OSQStart; }
OS_EXIT_CRITICAL(); return(OS_NO_ERR); }