/* the UART send thread is only put to rest when the send buffer has been emptied */ void send_next_uart() { if(replyBuffer.size) embsys_uart_send(dequeue(&replyBuffer)); else tx_event_flags_set(&gUartSendEventFlags, 0, TX_AND); }
wiced_result_t wiced_rtos_set_event_flags( wiced_event_flags_t* event_flags, uint32_t flags_to_set ) { if ( tx_event_flags_set( event_flags, flags_to_set, TX_OR ) != WICED_SUCCESS ) { return WICED_ERROR; } return WICED_SUCCESS; }
/* when a period comes, the request is processed here */ void handleRequest() { char firstChar = dequeue(&requestBuffer), secondChar = dequeue(&requestBuffer); if(firstChar == 'M' && secondChar == 'C') handleMessageCount(); else if(firstChar == 'R' && secondChar == 'M') handleReadMessage(); else if(firstChar == 'D' && secondChar == 'E') handleDeleteMessage(); else if(firstChar == 'S' && secondChar == 'M') handleSendMessage(); else if(firstChar == 'U' && secondChar == 'M') handleUpdateMessage(); else sendInvalidRequestReply(); /* then enqueue a period, flush the remainder of the request, and notify the send uart thread */ enqueue(&replyBuffer, '.'); while(dequeue(&requestBuffer) != '.'); tx_event_flags_set(&gUartSendEventFlags,1,TX_OR); }
void thread_0_entry(ULONG thread_input) { UINT status; /* This thread simply sits in while-forever-sleep loop. */ while(1) { /* Increment the thread counter. */ thread_0_counter++; /* Sleep for 10 ticks. */ tx_thread_sleep(10); /* Set event flag 0 to wakeup thread 5. */ status = tx_event_flags_set(&event_flags_0, 0x1, TX_OR); /* Check status. */ if (status != TX_SUCCESS) break; } }
static void flash_request_done_cb(void) { tx_event_flags_set(&gFsGlobalEventFlags,1,TX_OR); }