void isr_mbx_send (OS_ID mailbox, void *p_msg) { /* Same function as "os_mbx_send", but to be called by ISRs. */ P_MCB p_MCB = mailbox; os_psq_enq (p_MCB, (U32)p_msg); os_psh_req (); }
void isr_evt_set (U16 event_flags, OS_TID task_id) { /* Same function as "os_evt_set", but to be called by ISRs. */ P_TCB p_tcb = os_active_TCB[task_id-1]; if (p_tcb == NULL) { return; } os_psq_enq (p_tcb, event_flags); os_psh_req (); }
OS_RESULT isr_mbx_receive (OS_ID mailbox, void **message) { /* Receive a message in the interrupt function. The interrupt function */ /* should not wait for a message since this would block the rtx os. */ P_MCB p_MCB = mailbox; if (p_MCB->count) { /* A message is available in the fifo buffer. */ *message = p_MCB->msg[p_MCB->last]; if (p_MCB->isr_st == 1) { /* A task is locked waiting to send message */ p_MCB->isr_st = 2; os_psq_enq (p_MCB, 0); os_psh_req (); } p_MCB->count--; if (++p_MCB->last == p_MCB->size) { p_MCB->last = 0; } return (OS_R_MBX); } return (OS_R_OK); }