123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730 |
- #include "fsl_flexio_uart.h"
- #ifndef FSL_COMPONENT_ID
- #define FSL_COMPONENT_ID "platform.drivers.flexio_uart"
- #endif
- enum _flexio_uart_transfer_states
- {
- kFLEXIO_UART_TxIdle,
- kFLEXIO_UART_TxBusy,
- kFLEXIO_UART_RxIdle,
- kFLEXIO_UART_RxBusy
- };
- static size_t FLEXIO_UART_TransferGetRxRingBufferLength(flexio_uart_handle_t *handle);
- static bool FLEXIO_UART_TransferIsRxRingBufferFull(flexio_uart_handle_t *handle);
- static uint32_t FLEXIO_UART_GetInstance(FLEXIO_UART_Type *base)
- {
- return FLEXIO_GetInstance(base->flexioBase);
- }
- static size_t FLEXIO_UART_TransferGetRxRingBufferLength(flexio_uart_handle_t *handle)
- {
- size_t size;
- if (handle->rxRingBufferTail > handle->rxRingBufferHead)
- {
- size = (size_t)(handle->rxRingBufferHead + handle->rxRingBufferSize - handle->rxRingBufferTail);
- }
- else
- {
- size = (size_t)(handle->rxRingBufferHead - handle->rxRingBufferTail);
- }
- return size;
- }
- static bool FLEXIO_UART_TransferIsRxRingBufferFull(flexio_uart_handle_t *handle)
- {
- bool full;
- if (FLEXIO_UART_TransferGetRxRingBufferLength(handle) == (handle->rxRingBufferSize - 1U))
- {
- full = true;
- }
- else
- {
- full = false;
- }
- return full;
- }
- status_t FLEXIO_UART_Init(FLEXIO_UART_Type *base, const flexio_uart_config_t *userConfig, uint32_t srcClock_Hz)
- {
- assert(base && userConfig);
- flexio_shifter_config_t shifterConfig;
- flexio_timer_config_t timerConfig;
- uint32_t ctrlReg = 0;
- uint16_t timerDiv = 0;
- uint16_t timerCmp = 0;
- status_t result = kStatus_Success;
-
- memset(&shifterConfig, 0, sizeof(shifterConfig));
- memset(&timerConfig, 0, sizeof(timerConfig));
- #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
-
- CLOCK_EnableClock(s_flexioClocks[FLEXIO_UART_GetInstance(base)]);
- #endif
-
- ctrlReg = base->flexioBase->CTRL;
- ctrlReg &= ~(FLEXIO_CTRL_DOZEN_MASK | FLEXIO_CTRL_DBGE_MASK | FLEXIO_CTRL_FASTACC_MASK | FLEXIO_CTRL_FLEXEN_MASK);
- ctrlReg |= (FLEXIO_CTRL_DBGE(userConfig->enableInDebug) | FLEXIO_CTRL_FASTACC(userConfig->enableFastAccess) |
- FLEXIO_CTRL_FLEXEN(userConfig->enableUart));
- if (!userConfig->enableInDoze)
- {
- ctrlReg |= FLEXIO_CTRL_DOZEN_MASK;
- }
- base->flexioBase->CTRL = ctrlReg;
-
-
- shifterConfig.timerSelect = base->timerIndex[0];
- shifterConfig.timerPolarity = kFLEXIO_ShifterTimerPolarityOnPositive;
- shifterConfig.pinConfig = kFLEXIO_PinConfigOutput;
- shifterConfig.pinSelect = base->TxPinIndex;
- shifterConfig.pinPolarity = kFLEXIO_PinActiveHigh;
- shifterConfig.shifterMode = kFLEXIO_ShifterModeTransmit;
- shifterConfig.inputSource = kFLEXIO_ShifterInputFromPin;
- shifterConfig.shifterStop = kFLEXIO_ShifterStopBitHigh;
- shifterConfig.shifterStart = kFLEXIO_ShifterStartBitLow;
- FLEXIO_SetShifterConfig(base->flexioBase, base->shifterIndex[0], &shifterConfig);
-
- timerConfig.triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_SHIFTnSTAT(base->shifterIndex[0]);
- timerConfig.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow;
- timerConfig.triggerSource = kFLEXIO_TimerTriggerSourceInternal;
- timerConfig.pinConfig = kFLEXIO_PinConfigOutputDisabled;
- timerConfig.pinSelect = base->TxPinIndex;
- timerConfig.pinPolarity = kFLEXIO_PinActiveHigh;
- timerConfig.timerMode = kFLEXIO_TimerModeDual8BitBaudBit;
- timerConfig.timerOutput = kFLEXIO_TimerOutputOneNotAffectedByReset;
- timerConfig.timerDecrement = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput;
- timerConfig.timerReset = kFLEXIO_TimerResetNever;
- timerConfig.timerDisable = kFLEXIO_TimerDisableOnTimerCompare;
- timerConfig.timerEnable = kFLEXIO_TimerEnableOnTriggerHigh;
- timerConfig.timerStop = kFLEXIO_TimerStopBitEnableOnTimerDisable;
- timerConfig.timerStart = kFLEXIO_TimerStartBitEnabled;
- timerDiv = srcClock_Hz / userConfig->baudRate_Bps;
- timerDiv = timerDiv / 2 - 1;
- if (timerDiv > 0xFFU)
- {
- result = kStatus_InvalidArgument;
- }
- timerCmp = ((uint32_t)(userConfig->bitCountPerChar * 2 - 1)) << 8U;
- timerCmp |= timerDiv;
- timerConfig.timerCompare = timerCmp;
- FLEXIO_SetTimerConfig(base->flexioBase, base->timerIndex[0], &timerConfig);
-
- shifterConfig.timerSelect = base->timerIndex[1];
- shifterConfig.timerPolarity = kFLEXIO_ShifterTimerPolarityOnNegitive;
- shifterConfig.pinConfig = kFLEXIO_PinConfigOutputDisabled;
- shifterConfig.pinSelect = base->RxPinIndex;
- shifterConfig.pinPolarity = kFLEXIO_PinActiveHigh;
- shifterConfig.shifterMode = kFLEXIO_ShifterModeReceive;
- shifterConfig.inputSource = kFLEXIO_ShifterInputFromPin;
- shifterConfig.shifterStop = kFLEXIO_ShifterStopBitHigh;
- shifterConfig.shifterStart = kFLEXIO_ShifterStartBitLow;
- FLEXIO_SetShifterConfig(base->flexioBase, base->shifterIndex[1], &shifterConfig);
-
- timerConfig.triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_PININPUT(base->RxPinIndex);
- timerConfig.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveHigh;
- timerConfig.triggerSource = kFLEXIO_TimerTriggerSourceExternal;
- timerConfig.pinConfig = kFLEXIO_PinConfigOutputDisabled;
- timerConfig.pinSelect = base->RxPinIndex;
- timerConfig.pinPolarity = kFLEXIO_PinActiveLow;
- timerConfig.timerMode = kFLEXIO_TimerModeDual8BitBaudBit;
- timerConfig.timerOutput = kFLEXIO_TimerOutputOneAffectedByReset;
- timerConfig.timerDecrement = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput;
- timerConfig.timerReset = kFLEXIO_TimerResetOnTimerPinRisingEdge;
- timerConfig.timerDisable = kFLEXIO_TimerDisableOnTimerCompare;
- timerConfig.timerEnable = kFLEXIO_TimerEnableOnPinRisingEdge;
- timerConfig.timerStop = kFLEXIO_TimerStopBitEnableOnTimerDisable;
- timerConfig.timerStart = kFLEXIO_TimerStartBitEnabled;
- timerConfig.timerCompare = timerCmp;
- FLEXIO_SetTimerConfig(base->flexioBase, base->timerIndex[1], &timerConfig);
- return result;
- }
- void FLEXIO_UART_Deinit(FLEXIO_UART_Type *base)
- {
- base->flexioBase->SHIFTCFG[base->shifterIndex[0]] = 0;
- base->flexioBase->SHIFTCTL[base->shifterIndex[0]] = 0;
- base->flexioBase->SHIFTCFG[base->shifterIndex[1]] = 0;
- base->flexioBase->SHIFTCTL[base->shifterIndex[1]] = 0;
- base->flexioBase->TIMCFG[base->timerIndex[0]] = 0;
- base->flexioBase->TIMCMP[base->timerIndex[0]] = 0;
- base->flexioBase->TIMCTL[base->timerIndex[0]] = 0;
- base->flexioBase->TIMCFG[base->timerIndex[1]] = 0;
- base->flexioBase->TIMCMP[base->timerIndex[1]] = 0;
- base->flexioBase->TIMCTL[base->timerIndex[1]] = 0;
-
- base->flexioBase->SHIFTSTAT = (1U << base->shifterIndex[0]);
- base->flexioBase->SHIFTSTAT = (1U << base->shifterIndex[1]);
-
- base->flexioBase->TIMSTAT = (1U << base->timerIndex[0]);
- base->flexioBase->TIMSTAT = (1U << base->timerIndex[1]);
- }
- void FLEXIO_UART_GetDefaultConfig(flexio_uart_config_t *userConfig)
- {
- assert(userConfig);
- userConfig->enableUart = true;
- userConfig->enableInDoze = false;
- userConfig->enableInDebug = true;
- userConfig->enableFastAccess = false;
-
- userConfig->baudRate_Bps = 115200U;
-
- userConfig->bitCountPerChar = kFLEXIO_UART_8BitsPerChar;
- }
- void FLEXIO_UART_EnableInterrupts(FLEXIO_UART_Type *base, uint32_t mask)
- {
- if (mask & kFLEXIO_UART_TxDataRegEmptyInterruptEnable)
- {
- FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[0]);
- }
- if (mask & kFLEXIO_UART_RxDataRegFullInterruptEnable)
- {
- FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[1]);
- }
- }
- void FLEXIO_UART_DisableInterrupts(FLEXIO_UART_Type *base, uint32_t mask)
- {
- if (mask & kFLEXIO_UART_TxDataRegEmptyInterruptEnable)
- {
- FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[0]);
- }
- if (mask & kFLEXIO_UART_RxDataRegFullInterruptEnable)
- {
- FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[1]);
- }
- }
- uint32_t FLEXIO_UART_GetStatusFlags(FLEXIO_UART_Type *base)
- {
- uint32_t status = 0;
- status =
- ((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->shifterIndex[0])) >> base->shifterIndex[0]);
- status |=
- (((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->shifterIndex[1])) >> (base->shifterIndex[1]))
- << 1U);
- status |=
- (((FLEXIO_GetShifterErrorFlags(base->flexioBase) & (1U << base->shifterIndex[1])) >> (base->shifterIndex[1]))
- << 2U);
- return status;
- }
- void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask)
- {
- if (mask & kFLEXIO_UART_TxDataRegEmptyFlag)
- {
- FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1U << base->shifterIndex[0]);
- }
- if (mask & kFLEXIO_UART_RxDataRegFullFlag)
- {
- FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1U << base->shifterIndex[1]);
- }
- if (mask & kFLEXIO_UART_RxOverRunFlag)
- {
- FLEXIO_ClearShifterErrorFlags(base->flexioBase, 1U << base->shifterIndex[1]);
- }
- }
- void FLEXIO_UART_WriteBlocking(FLEXIO_UART_Type *base, const uint8_t *txData, size_t txSize)
- {
- assert(txData);
- assert(txSize);
- while (txSize--)
- {
-
- while (!(FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->shifterIndex[0])))
- {
- }
- base->flexioBase->SHIFTBUF[base->shifterIndex[0]] = *txData++;
- }
- }
- void FLEXIO_UART_ReadBlocking(FLEXIO_UART_Type *base, uint8_t *rxData, size_t rxSize)
- {
- assert(rxData);
- assert(rxSize);
- while (rxSize--)
- {
-
- while (!(FLEXIO_UART_GetStatusFlags(base) & kFLEXIO_UART_RxDataRegFullFlag))
- {
- }
- *rxData++ = base->flexioBase->SHIFTBUFBYS[base->shifterIndex[1]];
- }
- }
- status_t FLEXIO_UART_TransferCreateHandle(FLEXIO_UART_Type *base,
- flexio_uart_handle_t *handle,
- flexio_uart_transfer_callback_t callback,
- void *userData)
- {
- assert(handle);
- IRQn_Type flexio_irqs[] = FLEXIO_IRQS;
-
- memset(handle, 0, sizeof(*handle));
-
- handle->rxState = kFLEXIO_UART_RxIdle;
- handle->txState = kFLEXIO_UART_TxIdle;
-
- handle->callback = callback;
- handle->userData = userData;
-
- EnableIRQ(flexio_irqs[FLEXIO_UART_GetInstance(base)]);
-
- return FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_UART_TransferHandleIRQ);
- }
- void FLEXIO_UART_TransferStartRingBuffer(FLEXIO_UART_Type *base,
- flexio_uart_handle_t *handle,
- uint8_t *ringBuffer,
- size_t ringBufferSize)
- {
- assert(handle);
-
- if (ringBuffer)
- {
- handle->rxRingBuffer = ringBuffer;
- handle->rxRingBufferSize = ringBufferSize;
- handle->rxRingBufferHead = 0U;
- handle->rxRingBufferTail = 0U;
-
- FLEXIO_UART_EnableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
- }
- }
- void FLEXIO_UART_TransferStopRingBuffer(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
- {
- assert(handle);
- if (handle->rxState == kFLEXIO_UART_RxIdle)
- {
- FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
- }
- handle->rxRingBuffer = NULL;
- handle->rxRingBufferSize = 0U;
- handle->rxRingBufferHead = 0U;
- handle->rxRingBufferTail = 0U;
- }
- status_t FLEXIO_UART_TransferSendNonBlocking(FLEXIO_UART_Type *base,
- flexio_uart_handle_t *handle,
- flexio_uart_transfer_t *xfer)
- {
- status_t status;
-
- if ((0U == xfer->dataSize) || (NULL == xfer->data))
- {
- return kStatus_InvalidArgument;
- }
-
- if (kFLEXIO_UART_TxBusy == handle->txState)
- {
- status = kStatus_FLEXIO_UART_TxBusy;
- }
- else
- {
- handle->txData = xfer->data;
- handle->txDataSize = xfer->dataSize;
- handle->txDataSizeAll = xfer->dataSize;
- handle->txState = kFLEXIO_UART_TxBusy;
-
- FLEXIO_UART_EnableInterrupts(base, kFLEXIO_UART_TxDataRegEmptyInterruptEnable);
- status = kStatus_Success;
- }
- return status;
- }
- void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
- {
-
- FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_TxDataRegEmptyInterruptEnable);
- handle->txDataSize = 0;
- handle->txState = kFLEXIO_UART_TxIdle;
- }
- status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
- {
- assert(handle);
- assert(count);
- if (kFLEXIO_UART_TxIdle == handle->txState)
- {
- return kStatus_NoTransferInProgress;
- }
- *count = handle->txDataSizeAll - handle->txDataSize;
- return kStatus_Success;
- }
- status_t FLEXIO_UART_TransferReceiveNonBlocking(FLEXIO_UART_Type *base,
- flexio_uart_handle_t *handle,
- flexio_uart_transfer_t *xfer,
- size_t *receivedBytes)
- {
- uint32_t i;
- status_t status;
-
- size_t bytesToCopy = 0U;
-
- size_t bytesToReceive;
-
- size_t bytesCurrentReceived;
-
- if ((0U == xfer->dataSize) || (NULL == xfer->data))
- {
- return kStatus_InvalidArgument;
- }
-
- if (kFLEXIO_UART_RxBusy == handle->rxState)
- {
- status = kStatus_FLEXIO_UART_RxBusy;
- }
- else
- {
- bytesToReceive = xfer->dataSize;
- bytesCurrentReceived = 0U;
-
- if (handle->rxRingBuffer)
- {
-
- FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
-
- bytesToCopy = FLEXIO_UART_TransferGetRxRingBufferLength(handle);
- if (bytesToCopy)
- {
- bytesToCopy = MIN(bytesToReceive, bytesToCopy);
- bytesToReceive -= bytesToCopy;
-
- for (i = 0U; i < bytesToCopy; i++)
- {
- xfer->data[bytesCurrentReceived++] = handle->rxRingBuffer[handle->rxRingBufferTail];
-
- if (handle->rxRingBufferTail + 1U == handle->rxRingBufferSize)
- {
- handle->rxRingBufferTail = 0U;
- }
- else
- {
- handle->rxRingBufferTail++;
- }
- }
- }
-
- if (bytesToReceive)
- {
-
- handle->rxData = xfer->data + bytesCurrentReceived;
- handle->rxDataSize = bytesToReceive;
- handle->rxDataSizeAll = bytesToReceive;
- handle->rxState = kFLEXIO_UART_RxBusy;
- }
-
- FLEXIO_UART_EnableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
- }
-
- else
- {
- handle->rxData = xfer->data + bytesCurrentReceived;
- handle->rxDataSize = bytesToReceive;
- handle->rxDataSizeAll = bytesToReceive;
- handle->rxState = kFLEXIO_UART_RxBusy;
-
- FLEXIO_UART_EnableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
- }
-
- if (receivedBytes)
- {
- *receivedBytes = bytesCurrentReceived;
- }
- status = kStatus_Success;
- }
- return status;
- }
- void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
- {
-
- if (!handle->rxRingBuffer)
- {
-
- FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
- }
- handle->rxDataSize = 0U;
- handle->rxState = kFLEXIO_UART_RxIdle;
- }
- status_t FLEXIO_UART_TransferGetReceiveCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
- {
- assert(handle);
- assert(count);
- if (kFLEXIO_UART_RxIdle == handle->rxState)
- {
- return kStatus_NoTransferInProgress;
- }
- *count = handle->rxDataSizeAll - handle->rxDataSize;
- return kStatus_Success;
- }
- void FLEXIO_UART_TransferHandleIRQ(void *uartType, void *uartHandle)
- {
- uint8_t count = 1;
- FLEXIO_UART_Type *base = (FLEXIO_UART_Type *)uartType;
- flexio_uart_handle_t *handle = (flexio_uart_handle_t *)uartHandle;
-
- uint8_t status = FLEXIO_UART_GetStatusFlags(base);
-
- if (kFLEXIO_UART_RxOverRunFlag & status)
- {
-
- FLEXIO_UART_ClearStatusFlags(base, kFLEXIO_UART_RxOverRunFlag);
-
- if (handle->callback)
- {
- handle->callback(base, handle, kStatus_FLEXIO_UART_RxHardwareOverrun, handle->userData);
- }
- }
-
- if ((kFLEXIO_UART_RxDataRegFullFlag & status) && (base->flexioBase->SHIFTSIEN & (1U << base->shifterIndex[1])))
- {
-
- if (handle->rxDataSize)
- {
-
- FLEXIO_UART_ReadByte(base, handle->rxData);
- handle->rxDataSize--;
- handle->rxData++;
- count--;
-
- if (!handle->rxDataSize)
- {
- handle->rxState = kFLEXIO_UART_RxIdle;
- if (handle->callback)
- {
- handle->callback(base, handle, kStatus_FLEXIO_UART_RxIdle, handle->userData);
- }
- }
- }
- if (handle->rxRingBuffer)
- {
- if (count)
- {
-
- if (FLEXIO_UART_TransferIsRxRingBufferFull(handle))
- {
- if (handle->callback)
- {
- handle->callback(base, handle, kStatus_FLEXIO_UART_RxRingBufferOverrun, handle->userData);
- }
- }
-
- if (FLEXIO_UART_TransferIsRxRingBufferFull(handle))
- {
-
- if (handle->rxRingBufferTail + 1U == handle->rxRingBufferSize)
- {
- handle->rxRingBufferTail = 0U;
- }
- else
- {
- handle->rxRingBufferTail++;
- }
- }
-
- handle->rxRingBuffer[handle->rxRingBufferHead] = base->flexioBase->SHIFTBUFBYS[base->shifterIndex[1]];
-
- if (handle->rxRingBufferHead + 1U == handle->rxRingBufferSize)
- {
- handle->rxRingBufferHead = 0U;
- }
- else
- {
- handle->rxRingBufferHead++;
- }
- }
- }
-
- else if (!handle->rxDataSize)
- {
- FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
- }
- else
- {
- }
- }
-
- if ((kFLEXIO_UART_TxDataRegEmptyFlag & status) && (base->flexioBase->SHIFTSIEN & (1U << base->shifterIndex[0])))
- {
- if (handle->txDataSize)
- {
-
- FLEXIO_UART_WriteByte(base, handle->txData);
- handle->txData++;
- handle->txDataSize--;
- count--;
-
- if (!handle->txDataSize)
- {
- handle->txState = kFLEXIO_UART_TxIdle;
-
- FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_TxDataRegEmptyInterruptEnable);
-
- if (handle->callback)
- {
- handle->callback(base, handle, kStatus_FLEXIO_UART_TxIdle, handle->userData);
- }
- }
- }
- }
- }
|