void isr_sem_send (OS_ID semaphore) { /* Same function as "os_sem"send", but to be called by ISRs */ P_SCB p_SCB = semaphore; rt_psq_enq (p_SCB, 0); rt_psh_req (); }
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; rt_psq_enq (p_MCB, (U32)p_msg); rt_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; } rt_psq_enq (p_tcb, event_flags); rt_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->state == 2) { /* A task is locked waiting to send message */ rt_psq_enq (p_MCB, 0); rt_psh_req (); } rt_dec (&p_MCB->count); if (++p_MCB->last == p_MCB->size) { p_MCB->last = 0; } return (OS_R_MBX); } return (OS_R_OK); }
/** * Same function as "os_mbx_send", but to be called by ISRs. * * @param mailbox Mailbox to use * @param p_msg Message to send */ void isr_mbx_send (OS_ID mailbox, void *p_msg) { P_MCB p_MCB = mailbox; rt_psq_enq (p_MCB, (U32)p_msg); rt_psh_req (); }