StatusType isr_PostQueueMail(OS_EventID id,void* pmail) { if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */ { /* Insert the request into service request queue */ if(InsertInSRQ(QUEUE_REQ,id,pmail) == FALSE) { return E_SEV_REQ_FULL; /* If service request queue is full */ } else /* If the request have been inserted into service request queue */ { return E_OK; } } else /* The scheduler is unlocked */ { return(CoPostQueueMail(id,pmail)); /* Send the message to the queue*/ } }
StatusType isr_PostSem(OS_EventID id) { if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */ { /* Initiate a post service handling request */ if(InsertInSRQ(SEM_REQ,id,Co_NULL) == Co_FALSE) { return E_SEV_REQ_FULL; /* If service request queue is full */ } else /* Operate successfully */ { return E_OK; } } else { return(CoPostSem(id)); /* Post semaphore */ } }
StatusType isr_SetFlag(OS_FlagID id) { if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */ { /* Insert the request into service request queue */ if(InsertInSRQ(FLAG_REQ,id,Co_NULL) == Co_FALSE) { return E_SEV_REQ_FULL; /* The service requst queue is full */ } else { return E_OK; } } else { return(CoSetFlag(id)); /* The caller is not ISR, set the flag*/ } }
StatusType isr_PostMail(OS_EventID id,void* pmail) { if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */ { /* Insert the request into service request queue */ if(InsertInSRQ(MBOX_REQ,id,pmail) == FALSE) { return E_SEV_REQ_FULL; /* If service request queue is full */ } else /* Operate successfully */ { return E_OK; } } else { return(CoPostMail(id,pmail)); /* Sends the message to the mailbox */ } }