/* send a message to a specific queue from an isr * routing requires 25 us * putting a message into a queue (in interrupt context) requires 28 us * this requires 1/2 the time of using route */ void SendMessageToQueueFromIsr(unsigned char Qindex, tMessage* pMsg) { signed portBASE_TYPE HigherPriorityTaskWoken; if ( Qindex == FREE_QINDEX ) { SendToFreeQueueIsr(pMsg); } else if ( errQUEUE_FULL == xQueueSendFromISR(QueueHandles[Qindex], pMsg, &HigherPriorityTaskWoken)) { PrintQueueNameIsFull(Qindex); SendToFreeQueueIsr(pMsg); } #if 0 /* This is not used * * we don't want to task switch when in sleep mode * The ISR will exit sleep mode and then the RTOS will run * */ if ( HigherPriorityTaskWoken == pdTRUE ) { portYIELD(); } #endif }
static void SendMessageToQueueFromIsr(unsigned char Qindex, tHostMsg** ppMsg) { if ( xQueueSendFromISR(QueueHandles[Qindex], ppMsg, 0) == errQUEUE_FULL ) { PrintQueueNameIsFull(Qindex); SendToFreeQueueIsr(ppMsg); } }
/* this was kept for reference */ static void SendMessageToQueueWait(unsigned char Qindex, tMessage* pMsg) { /* wait */ if ( xQueueSend(QueueHandles[Qindex], pMsg, portMAX_DELAY) == errQUEUE_FULL ) { PrintQueueNameIsFull(Qindex); SendToFreeQueue(pMsg); } }
static void SendMessageToQueue(unsigned char Qindex, tHostMsg** ppMsg) { /* if the queue is full, don't wait */ if ( xQueueSend(QueueHandles[Qindex], ppMsg, 0) == errQUEUE_FULL ) { PrintQueueNameIsFull(Qindex); SendToFreeQueue(ppMsg); } }
/* if the queue is full, don't wait */ static void SendMsgToQ(unsigned char Qindex, tMessage* pMsg) { if ( Qindex == FREE_QINDEX ) { SendToFreeQueue(pMsg); } else if (errQUEUE_FULL == xQueueSend(QueueHandles[Qindex], pMsg, DONT_WAIT)) { PrintQueueNameIsFull(Qindex); SendToFreeQueue(pMsg); } }