/* Indicates this is a blocking transaction. */ uartState->isTxBlocking = true; /* Reset signal before transfer */ //这里会尝试获取txcomplete信号量, (void)OSIF_SemaWait(&(uartState->txComplete), 0);
/* Start the transmission process using DMA */ //真正发送数据的入口API retVal = LINFlexD_UART_DRV_StartSendUsingDma(instance, txBuff, txSize);
if (retVal == STATUS_SUCCESS) { //等待信号量 /* Wait until to transmit is complete. */ retVal = OSIF_SemaWait(&uartState->txComplete, timeout);
/* Finish the transmission if timeout expired */ if (retVal == STATUS_TIMEOUT) { uartState->isTxBlocking = false; uartState->transmitStatus = STATUS_TIMEOUT;
typedefenum { UART_EVENT_RX_FULL = 0x00U, /*!< Rx buffer is full */ UART_EVENT_TX_EMPTY = 0x01U, /*!< Tx buffer is empty */ UART_EVENT_END_TRANSFER = 0x02U, /*!< The current transfer is ending */ UART_EVENT_ERROR = 0x03U, /*!< An error occured during transfer */ UART_EVENT_TIMEOUT = 0x04U, /*!< Uart TimeOut */