bool COM_InternalTxIsIdle(COM_Port_t port) { // UART if ( (port == COM_USART0) || (port == COM_USART1) || (port == COM_USART2) ) { return (USART_StatusGet(comhandle[port]->uarthandle->initData.port) & _USART_STATUS_TXIDLE_MASK) ? true : false; } return false; }
static int uart_gecko_poll_in(struct device *dev, unsigned char *c) { const struct uart_gecko_config *config = dev->config->config_info; u32_t flags = USART_StatusGet(config->base); if (flags & USART_STATUS_RXDATAV) { *c = USART_Rx(config->base); return 0; } return -1; }
Ecode_t COM_WaitSend(COM_Port_t port) { if (checkValidPort(port)==false) { return EMBER_ERR_FATAL; } if (port == COM_VCP) { while (comhandle[port]->txQueue->used>0); } if ( (port==COM_USART0) || (port==COM_USART1) || (port==COM_USART2) ) { while ( (comhandle[port]->txQueue->used > 0) || (UARTDRV_GetTransmitDepth(comhandle[port]->uarthandle) > 0) || !( (USART_StatusGet(comhandle[port]->uarthandle->initData.port) & _USART_STATUS_TXC_MASK) #ifdef _USART_STATUS_TXIDLE_MASK && (USART_StatusGet(comhandle[port]->uarthandle->initData.port) & _USART_STATUS_TXIDLE_MASK) #endif ) ); } return EMBER_SUCCESS; }