From 93f9395956a01a26632b1e7b19ce3c925544dca6 Mon Sep 17 00:00:00 2001 From: Nithyaa shri R B Date: Mon, 5 May 2025 11:44:11 +0530 Subject: [PATCH 1/4] am64/am24: uart: Code cleanup - Remove unused DMA related function pointers. Fixes: SITSW-7155 Signed-off-by: Nithyaa shri R B --- source/drivers/uart/v0/lld/dma/uart_dma.h | 78 ----------------------- 1 file changed, 78 deletions(-) diff --git a/source/drivers/uart/v0/lld/dma/uart_dma.h b/source/drivers/uart/v0/lld/dma/uart_dma.h index ca5f2b7ae49..2ef1bfc9165 100644 --- a/source/drivers/uart/v0/lld/dma/uart_dma.h +++ b/source/drivers/uart/v0/lld/dma/uart_dma.h @@ -48,89 +48,11 @@ extern "C" { #endif -/** - * \brief Driver implementation to open a specific DMA driver channel - UDMA, EDMA etc - * - * Typically this callback is hidden from the end application and is implemented - * when a new DMA driver needs to be supported. - * - * \param uartHandle [in] UART Handle - * \param uartDmaArgs [in] DMA specific arguments, obtained from the config - * - * \return SystemP_SUCCESS on success, else failure - */ -typedef int32_t (*UART_dmaOpenFxn)(UART_Handle uartHandle, void *uartDmaArgs); - -/** - * \brief Driver implementation to do a DMA read using a specific DMA driver - UDMA, EDMA etc - * - * Typically this callback is hidden from the end application and is implemented - * when a new DMA driver needs to be supported. - * - * \param obj [in] Pointer to UART object - * \param attrs [in] Pointer to UART attributes. - * \param transaction [in] Pointer to #UART_Transaction. This parameter can't be NULL - * - * \return SystemP_SUCCESS on success, else failure - */ -typedef int32_t (*UART_dmaTransferReadFxn)(UART_Object *obj, const UART_Attrs *attrs, - UART_Transaction *transaction); - -/** - * \brief Driver implementation to do a DMA write using a specific DMA driver - UDMA, EDMA etc - * - * Typically this callback is hidden from the end application and is implemented - * when a new DMA driver needs to be supported. - * - * \param obj [in] Pointer to UART object. - * \param attrs [in] Pointer to UART attributes. - * \param transaction [in] Pointer to #UART_Transaction. This parameter can't be NULL - * - * \return SystemP_SUCCESS on success, else failure - */ -typedef int32_t (*UART_dmaTransferWriteFxn)(UART_Object *obj, const UART_Attrs *attrs, - UART_Transaction *transaction); - -/** - * \brief Driver implementation to close a specific DMA driver channel - UDMA, EDMA etc - * - * Typically this callback is hidden from the end application and is implemented - * when a new DMA driver needs to be supported. - * - * \param handle [in] UART handle returned from \ref UART_open - * - * \return SystemP_SUCCESS on success, else failure - */ -typedef int32_t (*UART_dmaCloseFxn)(UART_Handle handle); - -/** - * \brief Driver implementation to diisable a specific DMA driver channel - UDMA, EDMA etc - * - * \param handle [in] UART handle returned from \ref UART_open - * \param isChannelTx [in] Variable to indicate if it is TX/RX Channel - * - * \return SystemP_SUCCESS on success, else failure - */ -typedef int32_t (*UART_dmaDisableChannelFxn)(UART_Handle handle, uint32_t isChannelTx); - -/** - * \brief Driver implementation callbacks - */ -typedef struct UART_DmaFxns_s -{ - UART_dmaOpenFxn dmaOpenFxn; - UART_dmaTransferWriteFxn dmaTransferWriteFxn; - UART_dmaTransferReadFxn dmaTransferReadFxn; - UART_dmaCloseFxn dmaCloseFxn; - UART_dmaDisableChannelFxn dmaDisableChannelFxn; -} UART_DmaFxns; - /** * \brief UART DMA Configuration, these are filled by SysCfg based on the DMA driver that is selected */ typedef struct UART_DmaConfig_s { - UART_DmaFxns *fxns; /** Registered callbacks for a particular DMA driver. This will be set by Sysconfig depending on the DMA driver selected */ void *uartDmaArgs; /** Arguments specific to a DMA driver. This will be typecasted to the specific DMA driver args struct From 525cd30b4c8ad6f48e1dc0f282355f57ea6d18ff Mon Sep 17 00:00:00 2001 From: Nithyaa shri R B Date: Mon, 2 Jun 2025 13:30:17 +0530 Subject: [PATCH 2/4] am64/am24: uart: Code cleanup - Remove void* pointers and use fixed type. Fixes: SITSW-7155 Signed-off-by: Nithyaa shri R B --- .../doxy_samples/drivers/Uart_sample.c | 2 +- .../uart_echo_callback/uart_echo_callback.c | 4 +- source/drivers/bootloader/bootloader_xmodem.c | 2 +- .../uart/v0/lld/dma/udma/uart_dma_udma.c | 4 +- source/drivers/uart/v0/lld/uart_lld.h | 22 +++--- source/drivers/uart/v0/lld/uart_v0_lld.c | 50 +++++++------- source/drivers/uart/v0/uart.h | 35 +++++----- source/drivers/uart/v0/uart_v0.c | 54 +++++++-------- source/drivers/uart/v1/uart_sci.c | 68 +++++++++---------- source/drivers/uart/v1/uart_sci.h | 35 +++++----- source/drivers/uart/v1/uart_sci_edma.c | 8 +-- source/drivers/uart/v1/uart_sci_edma.h | 2 +- .../nortos/dpl/common/DebugP_uartLogWriter.c | 4 +- .../nortos/dpl/common/DebugP_uartScanf.c | 2 +- test/drivers/uart/test_uart.c | 26 +++---- test/drivers/uart/test_uart_v1.c | 20 +++--- .../DebugP_uartScanf_test_pos.c | 9 ++- 17 files changed, 168 insertions(+), 179 deletions(-) diff --git a/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c b/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c index 715d98fcc88..4457882c496 100644 --- a/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c +++ b/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c @@ -7,7 +7,7 @@ #define CONFIG_UART0 (0U) #define APP_UART_MSGSIZE (8U) -UART_Handle gUartHandle; +UART_Config* gUartHandle; /* Semaphore to indicate Write/Read completion used in callback api's */ SemaphoreP_Object gUartWriteDoneSem; SemaphoreP_Object gUartReadDoneSem; diff --git a/examples/drivers/uart/uart_echo_callback/uart_echo_callback.c b/examples/drivers/uart/uart_echo_callback/uart_echo_callback.c index 66fef72fe60..8ffba2d0179 100644 --- a/examples/drivers/uart/uart_echo_callback/uart_echo_callback.c +++ b/examples/drivers/uart/uart_echo_callback/uart_echo_callback.c @@ -136,7 +136,7 @@ void uart_echo_callback(void *args) return; } -void uart_echo_write_callback(UART_Handle handle, UART_Transaction *trans) +void uart_echo_write_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesWritten = trans->count; @@ -145,7 +145,7 @@ void uart_echo_write_callback(UART_Handle handle, UART_Transaction *trans) return; } -void uart_echo_read_callback(UART_Handle handle, UART_Transaction *trans) +void uart_echo_read_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesRead = trans->count; diff --git a/source/drivers/bootloader/bootloader_xmodem.c b/source/drivers/bootloader/bootloader_xmodem.c index 70749bca145..b9a5ca3449e 100644 --- a/source/drivers/bootloader/bootloader_xmodem.c +++ b/source/drivers/bootloader/bootloader_xmodem.c @@ -37,7 +37,7 @@ int xmodemReceive(unsigned char *dest, int destsz); int xmodemTransmit(unsigned char *src, int srcsz); -static UART_Handle gUartHandle; +static UART_Config* gUartHandle; int32_t _inbyte(uint16_t timeout) { diff --git a/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c b/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c index 00b44adea1e..3479e76934a 100644 --- a/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c +++ b/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c @@ -241,7 +241,7 @@ static int32_t UART_udmaConfigPdmaTx(UARTLLD_Handle hUart, const UART_Transactio DebugP_assert(UDMA_SOK == retVal); /* Update host packet descriptor, length should be always in terms of total number of bytes */ - UART_udmaHpdInit(txChHandle, (uint8_t *) udmaChCfg->txHpdMem, hUart->writeBuf, transaction->count); + UART_udmaHpdInit(txChHandle, (uint8_t *) udmaChCfg->txHpdMem, ((const void*)hUart->writeBuf), transaction->count); retVal = Udma_ringQueueRaw( Udma_chGetFqRingHandle(txChHandle), @@ -276,7 +276,7 @@ static int32_t UART_udmaConfigPdmaRx(UARTLLD_Handle hUart, const UART_Transactio DebugP_assert(UDMA_SOK == retVal); /* Update host packet descriptor, length should be always in terms of total number of bytes */ - UART_udmaHpdInit(rxChHandle, (uint8_t *) udmaChCfg->rxHpdMem, hUart->readBuf, transaction->count); + UART_udmaHpdInit(rxChHandle, (uint8_t *) udmaChCfg->rxHpdMem, (void*) hUart->readBuf, transaction->count); /* Submit HPD to channel */ retVal = Udma_ringQueueRaw( diff --git a/source/drivers/uart/v0/lld/uart_lld.h b/source/drivers/uart/v0/lld/uart_lld.h index 7433ac4c1e3..e773a00d601 100644 --- a/source/drivers/uart/v0/lld/uart_lld.h +++ b/source/drivers/uart/v0/lld/uart_lld.h @@ -445,7 +445,7 @@ typedef void *UART_DmaChConfig; /* ========================================================================== */ typedef struct UART_ExtendedParams_s { - void *args; + uint32_t *args; /**< [IN] Argument to be passed to the callback function */ } UART_ExtendedParams; @@ -466,7 +466,7 @@ typedef struct /**< Timeout for this transaction in units of system ticks */ uint32_t status; /**< [OUT] \ref UART_TransferStatus code */ - void *args; + uint32_t *args; /**< [IN] Argument to be passed to the callback function */ } UART_Transaction; @@ -583,7 +583,7 @@ typedef struct /* * UART write variables */ - const void *writeBuf; + const uint8_t *writeBuf; /**< Buffer data pointer */ uint32_t writeCount; /**< Number of Chars sent */ @@ -593,7 +593,7 @@ typedef struct /* * UART receive variables */ - void *readBuf; + uint8_t *readBuf; /**< Buffer data pointer */ uint32_t readCount; /**< Number of Chars read */ @@ -735,7 +735,7 @@ int32_t UART_lld_deInitDma(UARTLLD_Handle hUart); * \return #SystemP_SUCCESS if successful; else error on failure * */ -int32_t UART_lld_write(UARTLLD_Handle hUart, void * txBuf, uint32_t size, uint32_t timeout, +int32_t UART_lld_write(UARTLLD_Handle hUart, uint8_t * txBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams); /** @@ -749,7 +749,7 @@ int32_t UART_lld_write(UARTLLD_Handle hUart, void * txBuf, uint32_t size, uint32 * \return #SystemP_SUCCESS if successful; else error on failure * */ -int32_t UART_lld_writeIntr(UARTLLD_Handle hUart, void * txBuf, uint32_t size, +int32_t UART_lld_writeIntr(UARTLLD_Handle hUart, uint8_t * txBuf, uint32_t size, const UART_ExtendedParams *extendedParams); /** @@ -763,7 +763,7 @@ int32_t UART_lld_writeIntr(UARTLLD_Handle hUart, void * txBuf, uint32_t size, * \return #SystemP_SUCCESS if successful; else error on failure * */ -int32_t UART_lld_writeDma(UARTLLD_Handle hUart, void * txBuf, uint32_t size, +int32_t UART_lld_writeDma(UARTLLD_Handle hUart, uint8_t * txBuf, uint32_t size, const UART_ExtendedParams *extendedParams); /** @@ -778,7 +778,7 @@ int32_t UART_lld_writeDma(UARTLLD_Handle hUart, void * txBuf, uint32_t size, * \return #SystemP_SUCCESS if successful; else error on failure * */ -int32_t UART_lld_read(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, uint32_t timeout, +int32_t UART_lld_read(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams); /** @@ -793,7 +793,7 @@ int32_t UART_lld_read(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, uint32_ * \return #SystemP_SUCCESS if successful; else error on failure * */ -int32_t UART_lld_readWithCounter(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, uint32_t timeout, +int32_t UART_lld_readWithCounter(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams); /** @@ -807,7 +807,7 @@ int32_t UART_lld_readWithCounter(UARTLLD_Handle hUart, void * rxBuf, uint32_t si * \return #SystemP_SUCCESS if successful; else error on failure * */ -int32_t UART_lld_readIntr(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, +int32_t UART_lld_readIntr(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, const UART_ExtendedParams *extendedParams); /** @@ -821,7 +821,7 @@ int32_t UART_lld_readIntr(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, * \return #SystemP_SUCCESS if successful; else error on failure * */ -int32_t UART_lld_readDma(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, +int32_t UART_lld_readDma(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, const UART_ExtendedParams *extendedParams); /** diff --git a/source/drivers/uart/v0/lld/uart_v0_lld.c b/source/drivers/uart/v0/lld/uart_v0_lld.c index 236e32a7504..7a64d1b5274 100644 --- a/source/drivers/uart/v0/lld/uart_v0_lld.c +++ b/source/drivers/uart/v0/lld/uart_v0_lld.c @@ -1217,11 +1217,11 @@ static void UART_writeDataPolling(UARTLLD_Handle hUart) uint32_t numBytesWritten = 0U; numBytesWritten = UART_fifoWrite(hUart, - (const uint8_t *) hUart->writeBuf, + hUart->writeBuf, hUart->writeSizeRemaining); hUart->writeSizeRemaining -= numBytesWritten; - hUart->writeBuf = (const void *)((uint8_t *)hUart->writeBuf + numBytesWritten); + hUart->writeBuf = (hUart->writeBuf + numBytesWritten); hUart->writeCount += numBytesWritten; return; @@ -1533,7 +1533,7 @@ int32_t UART_writeCancelNoCB(UARTLLD_Handle hUart) else { /* Reset the write buffer so we can pass it back */ - hUart->writeBuf = (const uint8_t *)hUart->writeBuf - hUart->writeCount; + hUart->writeBuf = hUart->writeBuf - hUart->writeCount; if (hUart->writeTrans.buf != NULL) { hUart->writeTrans.count = (uint32_t)(hUart->writeCount); @@ -1583,7 +1583,7 @@ int32_t UART_readCancelNoCB(UARTLLD_Handle hUart) else { /* Reset the read buffer so we can pass it back */ - hUart->readBuf = (uint8_t *)hUart->readBuf - hUart->readCount; + hUart->readBuf = hUart->readBuf - hUart->readCount; if (hUart->readTrans.buf != NULL) { hUart->readTrans.count = hUart->readCount; @@ -1599,7 +1599,7 @@ int32_t UART_readCancelNoCB(UARTLLD_Handle hUart) return (status); } -int32_t UART_lld_write(UARTLLD_Handle hUart, void * txBuf, uint32_t size, uint32_t timeout, +int32_t UART_lld_write(UARTLLD_Handle hUart, uint8_t * txBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; @@ -1627,7 +1627,7 @@ int32_t UART_lld_write(UARTLLD_Handle hUart, void * txBuf, uint32_t size, uint32 { trans->args = NULL; } - trans->buf = (void *) txBuf; + trans->buf = txBuf; trans->count = size; trans->timeout = timeout; @@ -1666,7 +1666,7 @@ int32_t UART_lld_write(UARTLLD_Handle hUart, void * txBuf, uint32_t size, uint32 return status; } -int32_t UART_lld_writeIntr(UARTLLD_Handle hUart, void * txBuf, uint32_t size, +int32_t UART_lld_writeIntr(UARTLLD_Handle hUart, uint8_t * txBuf, uint32_t size, const UART_ExtendedParams *extendedParams) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; @@ -1694,7 +1694,7 @@ int32_t UART_lld_writeIntr(UARTLLD_Handle hUart, void * txBuf, uint32_t size, trans->args = NULL; } - trans->buf = (void *) txBuf; + trans->buf = txBuf; trans->count = size; /* Check parameters */ @@ -1731,7 +1731,7 @@ int32_t UART_lld_writeIntr(UARTLLD_Handle hUart, void * txBuf, uint32_t size, return status; } -int32_t UART_lld_writeDma(UARTLLD_Handle hUart, void * txBuf, uint32_t size, +int32_t UART_lld_writeDma(UARTLLD_Handle hUart, uint8_t * txBuf, uint32_t size, const UART_ExtendedParams *extendedParams) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; @@ -1760,7 +1760,7 @@ int32_t UART_lld_writeDma(UARTLLD_Handle hUart, void * txBuf, uint32_t size, trans->args = NULL; } - trans->buf = (void *) txBuf; + trans->buf = txBuf; trans->count = size; if(hUart->state == UART_STATE_READY) @@ -1801,7 +1801,7 @@ int32_t UART_lld_writeDma(UARTLLD_Handle hUart, void * txBuf, uint32_t size, return status; } -int32_t UART_lld_read(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, uint32_t timeout, +int32_t UART_lld_read(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; @@ -1829,7 +1829,7 @@ int32_t UART_lld_read(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, uint32_ trans->args = NULL; } - trans->buf = (void *) rxBuf; + trans->buf = rxBuf; trans->count = size; trans->timeout = timeout; @@ -1867,7 +1867,7 @@ int32_t UART_lld_read(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, uint32_ return status; } -int32_t UART_lld_readWithCounter(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, uint32_t timeout, +int32_t UART_lld_readWithCounter(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; @@ -1895,7 +1895,7 @@ int32_t UART_lld_readWithCounter(UARTLLD_Handle hUart, void * rxBuf, uint32_t si trans->args = NULL; } - trans->buf = (void *) rxBuf; + trans->buf = rxBuf; trans->count = size; trans->timeout = timeout; @@ -1933,7 +1933,7 @@ int32_t UART_lld_readWithCounter(UARTLLD_Handle hUart, void * rxBuf, uint32_t si return status; } -int32_t UART_lld_readIntr(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, +int32_t UART_lld_readIntr(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, const UART_ExtendedParams *extendedParams) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; @@ -1961,7 +1961,7 @@ int32_t UART_lld_readIntr(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, trans->args = NULL; } - trans->buf = (void *) rxBuf; + trans->buf = rxBuf; trans->count = size; if(hUart->state == UART_STATE_READY) @@ -1997,7 +1997,7 @@ int32_t UART_lld_readIntr(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, return status; } -int32_t UART_lld_readDma(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, +int32_t UART_lld_readDma(UARTLLD_Handle hUart, uint8_t * rxBuf, uint32_t size, const UART_ExtendedParams *extendedParams) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; @@ -2025,7 +2025,7 @@ int32_t UART_lld_readDma(UARTLLD_Handle hUart, void * rxBuf, uint32_t size, trans->args = NULL; } - trans->buf = (void *) rxBuf; + trans->buf = rxBuf; trans->count = size; if(hUart->state == UART_STATE_READY) @@ -2389,7 +2389,7 @@ void UART_lld_controllerIsr(void* args) /* Update the driver internal status. */ /* Reset the read buffer so we can pass it back */ - hUart->readBuf = (uint8_t *)hUart->readBuf - hUart->readCount; + hUart->readBuf = hUart->readBuf - hUart->readCount; if (hUart->readTrans.buf != NULL) { hUart->readTrans.count = (uint32_t)(hUart->readCount); @@ -2427,7 +2427,7 @@ void UART_lld_controllerIsr(void* args) UART_intrDisable(hUart->baseAddr, UART_INTR_THR); /* Reset the write buffer so we can pass it back */ - hUart->writeBuf = (const void *)((uint8_t *)hUart->writeBuf - hUart->writeCount); + hUart->writeBuf = (hUart->writeBuf - hUart->writeCount); if (hUart->writeTrans.buf != NULL) { hUart->writeTrans.count = (uint32_t)(hUart->writeCount); @@ -2578,11 +2578,11 @@ static void UART_readDataPolling(UARTLLD_Handle hUart) { uint32_t numBytesRead = 0U; - numBytesRead = UART_fifoRead(hUart, (uint8_t *) hUart->readBuf, + numBytesRead = UART_fifoRead(hUart, hUart->readBuf, hUart->readSizeRemaining); hUart->readSizeRemaining -= numBytesRead; - hUart->readBuf = (void *)((uint8_t *)hUart->readBuf + numBytesRead); + hUart->readBuf = hUart->readBuf + numBytesRead; hUart->readCount += numBytesRead; return; @@ -2658,7 +2658,7 @@ int32_t UART_procLineStatusErr(UARTLLD_Handle hUart) UART_intrDisable(hUart->baseAddr, UART_INTR_RHR_CTI | UART_INTR_LINE_STAT); /* Reset the read buffer and read count so we can pass it back */ - hUart->readBuf = (void *)((uint8_t *)hUart->readBuf - hUart->readCount); + hUart->readBuf = hUart->readBuf - hUart->readCount; if (hUart->readTrans.buf != NULL) { @@ -2802,8 +2802,8 @@ static inline uint32_t UART_readData(UARTLLD_Handle hUart, uint32_t size) /* Receive chars until empty or done. */ while ((rdSize != 0U) && (readSuccess != 0U)) { - *(uint8_t *)hUart->readBuf = readIn; - hUart->readBuf = (uint8_t *)hUart->readBuf + 1U; + *(hUart->readBuf) = readIn; + hUart->readBuf = hUart->readBuf + 1U; hUart->readCount++; rdSize--; diff --git a/source/drivers/uart/v0/uart.h b/source/drivers/uart/v0/uart.h index 5a16bf09900..c973a328fad 100644 --- a/source/drivers/uart/v0/uart.h +++ b/source/drivers/uart/v0/uart.h @@ -106,8 +106,7 @@ typedef void *UART_Handle; * \param handle UART_Handle * \param transaction* Pointer to a #UART_Transaction */ -typedef void (*UART_CallbackFxn) (UART_Handle handle, - UART_Transaction *transaction); +typedef void (*UART_CallbackFxn) (UART_Transaction *transaction); /** * \brief UART Parameters @@ -201,14 +200,12 @@ typedef struct /* * User parameters */ - UART_Handle handle; - /**< Instance handle to which this object belongs */ UART_Params prms; /**< Open parameter as provided by user */ /* * UART write variables */ - const void *writeBuf; + const uint8_t *writeBuf; /**< Buffer data pointer */ uint32_t writeCount; /**< Number of Chars sent */ @@ -217,7 +214,7 @@ typedef struct /* * UART receive variables */ - void *readBuf; + uint8_t *readBuf; /**< Buffer data pointer */ uint32_t readCount; /**< Number of Chars read */ @@ -239,21 +236,21 @@ typedef struct */ uint32_t isOpen; /**< Flag to indicate whether the instance is opened already */ - void *lock; + SemaphoreP_Object *lock; /**< Instance lock - to protect across transfers */ SemaphoreP_Object lockObj; /**< Driver lock object */ - void *readTransferSem; + SemaphoreP_Object *readTransferSem; /**< Read Transfer Sync Sempahore - to sync between transfer completion ISR * and task */ SemaphoreP_Object readTransferSemObj; /**< Read Transfer Sync Sempahore object */ - void *writeTransferSem; + SemaphoreP_Object *writeTransferSem; /**< Write Transfer Sync Sempahore - to sync between transfer completion ISR * and task */ SemaphoreP_Object writeTransferSemObj; /**< Write Transfer Sync Sempahore object */ - void *hwiHandle; + HwiP_Object *hwiHandle; /**< Interrupt handle for controller ISR */ HwiP_Object hwiObj; /**< Interrupt object */ @@ -321,7 +318,7 @@ void UART_deinit(void); * \sa #UART_close() * \sa #UART_Params_init */ -UART_Handle UART_open(uint32_t index, const UART_Params *prms); +UART_Config* UART_open(uint32_t index, const UART_Params *prms); /** * \brief Function to close a UART peripheral specified by the UART handle @@ -332,7 +329,7 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms); * * \sa #UART_open() */ -void UART_close(UART_Handle handle); +void UART_close(UART_Config *handle); /** * \brief Function to perform UART write operation @@ -372,7 +369,7 @@ void UART_close(UART_Handle handle); * * \sa #UART_open */ -int32_t UART_write(UART_Handle handle, UART_Transaction *trans); +int32_t UART_write(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to perform UART read operation @@ -408,7 +405,7 @@ int32_t UART_write(UART_Handle handle, UART_Transaction *trans); * * \sa #UART_open */ -int32_t UART_read(UART_Handle handle, UART_Transaction *trans); +int32_t UART_read(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to perform UART canceling of current write transaction. @@ -441,7 +438,7 @@ int32_t UART_read(UART_Handle handle, UART_Transaction *trans); * * \sa #UART_open */ -int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans); +int32_t UART_writeCancel(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to perform UART canceling of current read transaction @@ -474,7 +471,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans); * * \sa #UART_open */ -int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans); +int32_t UART_readCancel(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to return a open'ed UART handle given a UART instance index @@ -484,7 +481,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans); * \return A #UART_Handle on success or a NULL on an error or if the instance * index has NOT been opened yet */ -UART_Handle UART_getHandle(uint32_t index); +UART_Config* UART_getHandle(uint32_t index); /** * \brief Function to flush a TX FIFO of peripheral specified by the UART handle @@ -495,7 +492,7 @@ UART_Handle UART_getHandle(uint32_t index); * * \sa #UART_open() */ -void UART_flushTxFifo(UART_Handle handle); +void UART_flushTxFifo(UART_Config *handle); /* ========================================================================== */ /* Advanced Function Declarations */ @@ -508,7 +505,7 @@ void UART_flushTxFifo(UART_Handle handle); * * \sa #UART_open */ -uint32_t UART_getBaseAddr(UART_Handle handle); +uint32_t UART_getBaseAddr(UART_Config *handle); /** * \brief Function to initialize the #UART_Transaction struct to its defaults diff --git a/source/drivers/uart/v0/uart_v0.c b/source/drivers/uart/v0/uart_v0.c index 949a3bdc911..7834fe53b22 100644 --- a/source/drivers/uart/v0/uart_v0.c +++ b/source/drivers/uart/v0/uart_v0.c @@ -233,10 +233,10 @@ static int32_t UART_checkOpenParams(const UART_Params *prms) return (status); } -UART_Handle UART_open(uint32_t index, const UART_Params *prms) +UART_Config* UART_open(uint32_t index, const UART_Params *prms) { int32_t status = SystemP_SUCCESS; - UART_Handle handle = NULL; + UART_Config *handle = NULL; UART_Config *config = NULL; UART_Object *object = NULL; const UART_Attrs *attrs; @@ -271,8 +271,6 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) if(SystemP_SUCCESS == status) { - /* Init state */ - object->handle = (UART_Handle) config; if(NULL != prms) { ( void )memcpy(&object->prms, prms, sizeof(UART_Params)); @@ -293,7 +291,7 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) uartLld_handle->hUartInit = uartLldInit_handle; uartLld_handle->baseAddr = attrs->baseAddr; - uartLld_handle->args = (void *)object->handle; + uartLld_handle->args = (void *) config; uartLld_handle->writeBuf = object->writeBuf; uartLld_handle->writeCount = object->writeCount; uartLld_handle->writeSizeRemaining = object->writeSizeRemaining; @@ -397,7 +395,7 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) if(SystemP_SUCCESS == status) { object->isOpen = TRUE; - handle = (UART_Handle) config; + handle = config; } SemaphoreP_post(&gUartDrvObj.lockObj); @@ -407,16 +405,16 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) { if(NULL != config) { - UART_close((UART_Handle) config); + UART_close(config); } } return (handle); } -UART_Handle UART_getHandle(uint32_t index) +UART_Config* UART_getHandle(uint32_t index) { - UART_Handle handle = NULL; + UART_Config* handle = NULL; /* Check index */ if(index < gUartConfigNum) @@ -428,20 +426,20 @@ UART_Handle UART_getHandle(uint32_t index) if(object && (TRUE == object->isOpen)) { /* valid handle */ - handle = object->handle; + handle = &gUartConfig[index]; } } return handle; } -void UART_close(UART_Handle handle) +void UART_close(UART_Config *handle) { UART_Config *config; UART_Object *object; const UART_Attrs *attrs; - config = (UART_Config *) handle; + config = handle; UARTLLD_Handle uartLld_handle; if ((NULL != config) && (config->object != NULL) && (config->object->isOpen != FALSE)) @@ -503,7 +501,7 @@ void UART_close(UART_Handle handle) return; } -int32_t UART_write(UART_Handle handle, UART_Transaction *trans) +int32_t UART_write(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS, semStatus = SystemP_SUCCESS; UART_Config *config; @@ -522,7 +520,7 @@ int32_t UART_write(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; attrs = config->attrs; prms = &config->object->prms; @@ -614,7 +612,7 @@ int32_t UART_write(UART_Handle handle, UART_Transaction *trans) return (status); } -int32_t UART_read(UART_Handle handle, UART_Transaction *trans) +int32_t UART_read(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS, semStatus = SystemP_SUCCESS; UART_Config *config; @@ -633,7 +631,7 @@ int32_t UART_read(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; attrs = config->attrs; prms = &config->object->prms; @@ -725,7 +723,7 @@ int32_t UART_read(UART_Handle handle, UART_Transaction *trans) return (status); } -int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) +int32_t UART_writeCancel(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS; UART_Config *config; @@ -741,7 +739,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; prms = &config->object->prms; DebugP_assert(NULL != object); @@ -766,7 +764,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) */ if (object->prms.writeMode == UART_TRANSFER_MODE_CALLBACK) { - object->prms.writeCallbackFxn((UART_Handle) config, object->writeTrans); + object->prms.writeCallbackFxn(object->writeTrans); } else { @@ -784,7 +782,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) return (status); } -int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) +int32_t UART_readCancel(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS; UART_Config *config; @@ -800,7 +798,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; prms = &config->object->prms; uartLld_handle = object->uartLld_handle; @@ -821,7 +819,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) object->readTrans->status = UART_TRANSFER_STATUS_CANCELLED; if (object->prms.readMode == UART_TRANSFER_MODE_CALLBACK) { - object->prms.readCallbackFxn((UART_Handle) config, object->readTrans); + object->prms.readCallbackFxn(object->readTrans); } else { @@ -839,7 +837,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) return (status); } -void UART_flushTxFifo(UART_Handle handle) +void UART_flushTxFifo(UART_Config *handle) { UART_Config *config; const UART_Attrs *attrs; @@ -847,7 +845,7 @@ void UART_flushTxFifo(UART_Handle handle) uint32_t timeout = UART_TRANSMITEMPTY_TRIALCOUNT; uint32_t timeoutElapsed = FALSE; - config = (UART_Config *) handle; + config = handle; if (NULL != config) { @@ -901,7 +899,7 @@ static void UART_lld_writeCompleteCallback(void *args) obj->writeTrans->count = hUart->writeTrans.count; if (obj->prms.writeMode == UART_TRANSFER_MODE_CALLBACK) { - obj->prms.writeCallbackFxn(hUart, &hUart->writeTrans); + obj->prms.writeCallbackFxn(&hUart->writeTrans); } else { @@ -929,7 +927,7 @@ static void UART_lld_readCompleteCallback(void *args) obj->readTrans->count = hUart->readTrans.count; if (obj->prms.readMode == UART_TRANSFER_MODE_CALLBACK) { - obj->prms.readCallbackFxn(hUart, &hUart->readTrans); + obj->prms.readCallbackFxn(&hUart->readTrans); } else { @@ -998,7 +996,7 @@ void UART_Transaction_init(UART_Transaction *trans) /* Advanced Function Definitions */ /* ========================================================================== */ -uint32_t UART_getBaseAddr(UART_Handle handle) +uint32_t UART_getBaseAddr(UART_Config *handle) { UART_Config *config; UART_Attrs *attrs; @@ -1011,7 +1009,7 @@ uint32_t UART_getBaseAddr(UART_Handle handle) } else { - config = (UART_Config *) handle; + config = handle; attrs = config->attrs; baseAddr = attrs->baseAddr; } diff --git a/source/drivers/uart/v1/uart_sci.c b/source/drivers/uart/v1/uart_sci.c index 7b9ac432dde..4a85d1bf9b1 100644 --- a/source/drivers/uart/v1/uart_sci.c +++ b/source/drivers/uart/v1/uart_sci.c @@ -77,7 +77,7 @@ typedef struct { - void *lock; + SemaphoreP_Object *lock; /**< Driver lock - to protect across open/close */ SemaphoreP_Object lockObj; /**< Driver lock object */ @@ -178,10 +178,10 @@ void UART_deinit(void) return; } -UART_Handle UART_open(uint32_t index, const UART_Params *prms) +UART_Config* UART_open(uint32_t index, const UART_Params *prms) { int32_t status = SystemP_SUCCESS; - UART_Handle handle = NULL; + UART_Config *handle = NULL; UART_Config *config = NULL; UART_Object *object = NULL; HwiP_Params hwiPrms; @@ -213,8 +213,6 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) if(SystemP_SUCCESS == status) { - /* Init state */ - object->handle = (UART_Handle) config; if(NULL != prms) { memcpy(&object->prms, prms, sizeof(UART_Params)); @@ -270,7 +268,7 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) /* Initialize the DMA configuration */ if(UART_CONFIG_MODE_DMA == object->prms.transferMode) { - UART_edmaChannelConfig((UART_Handle) config, object->prms.edmaInst); + UART_edmaChannelConfig(config, object->prms.edmaInst); } /* Start the SCI */ @@ -281,7 +279,7 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) if(SystemP_SUCCESS == status) { object->isOpen = TRUE; - handle = (UART_Handle) config; + handle = config; } SemaphoreP_post(&gUartDrvObj.lockObj); @@ -291,16 +289,16 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms) { if(NULL != config) { - UART_close((UART_Handle) config); + UART_close(config); } } return (handle); } -UART_Handle UART_getHandle(uint32_t index) +UART_Config* UART_getHandle(uint32_t index) { - UART_Handle handle = NULL; + UART_Config* handle = NULL; /* Check index */ if(index < gUartConfigNum) @@ -312,20 +310,20 @@ UART_Handle UART_getHandle(uint32_t index) if(object && (TRUE == object->isOpen)) { /* valid handle */ - handle = object->handle; + handle = &gUartConfig[index]; } } return handle; } -void UART_close(UART_Handle handle) +void UART_close(UART_Config *handle) { UART_Config *config; UART_Object *object; const UART_Attrs *attrs; - config = (UART_Config *) handle; + config = handle; if((NULL != config) && (config->object != NULL) && @@ -378,7 +376,7 @@ void UART_close(UART_Handle handle) return; } -int32_t UART_write(UART_Handle handle, UART_Transaction *trans) +int32_t UART_write(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS; UART_Config *config; @@ -394,7 +392,7 @@ int32_t UART_write(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; attrs = config->attrs; @@ -466,7 +464,7 @@ int32_t UART_write(UART_Handle handle, UART_Transaction *trans) return (status); } -int32_t UART_read(UART_Handle handle, UART_Transaction *trans) +int32_t UART_read(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS; UART_Config *config; @@ -482,7 +480,7 @@ int32_t UART_read(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; attrs = config->attrs; DebugP_assert(NULL != object); @@ -554,7 +552,7 @@ int32_t UART_read(UART_Handle handle, UART_Transaction *trans) return (status); } -int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) +int32_t UART_writeCancel(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS; UART_Config *config; @@ -569,7 +567,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; attrs = config->attrs; DebugP_assert(NULL != object); @@ -600,7 +598,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) */ if(object->prms.writeMode == UART_TRANSFER_MODE_CALLBACK) { - object->prms.writeCallbackFxn((UART_Handle) config, object->writeTrans); + object->prms.writeCallbackFxn(object->writeTrans); } else { @@ -618,7 +616,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans) return (status); } -int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) +int32_t UART_readCancel(UART_Config *handle, UART_Transaction *trans) { int32_t status = SystemP_SUCCESS; UART_Config *config; @@ -633,7 +631,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) if(SystemP_SUCCESS == status) { - config = (UART_Config *) handle; + config = handle; object = config->object; attrs = config->attrs; DebugP_assert(NULL != object); @@ -660,7 +658,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) object->readTrans->status = UART_TRANSFER_STATUS_CANCELLED; if(object->prms.readMode == UART_TRANSFER_MODE_CALLBACK) { - object->prms.readCallbackFxn((UART_Handle) config, object->readTrans); + object->prms.readCallbackFxn(object->readTrans); } else { @@ -678,7 +676,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans) return (status); } -void UART_flushTxFifo(UART_Handle handle) +void UART_flushTxFifo(UART_Config *handle) { UART_Config *config; UART_Object *object; @@ -686,7 +684,7 @@ void UART_flushTxFifo(UART_Handle handle) uint32_t timeout = UART_TRANSMITEMPTY_TRIALCOUNT; uint32_t timeoutElapsed = FALSE; - config = (UART_Config *) handle; + config = handle; if ((NULL != config) && (config->object != NULL) && @@ -759,7 +757,7 @@ static void UART_controllerIsr(void *arg) /* Update the driver internal status */ /* Reset the read buffer so we can pass it back */ object->readBuf = - (uint8_t *)object->readBuf - object->readCount; + object->readBuf - object->readCount; if(object->readTrans != NULL) { object->readTrans->count = (uint32_t)(object->readCount); @@ -772,7 +770,7 @@ static void UART_controllerIsr(void *arg) */ if(object->prms.readMode == UART_TRANSFER_MODE_CALLBACK) { - object->prms.readCallbackFxn((UART_Handle) config, object->readTrans); + object->prms.readCallbackFxn(object->readTrans); } else { @@ -807,7 +805,7 @@ static void UART_controllerIsr(void *arg) UART_txIntrDisable(object->pSCIRegs); /* Reset the write buffer so we can pass it back */ - object->writeBuf = (const uint8_t *)object->writeBuf - object->writeCount; + object->writeBuf = object->writeBuf - object->writeCount; if(object->writeTrans != NULL) { object->writeTrans->count = (uint32_t)(object->writeCount); @@ -820,7 +818,7 @@ static void UART_controllerIsr(void *arg) */ if(object->prms.writeMode == UART_TRANSFER_MODE_CALLBACK) { - object->prms.writeCallbackFxn((UART_Handle) config, object->writeTrans); + object->prms.writeCallbackFxn(object->writeTrans); } else { @@ -888,7 +886,7 @@ static Bool UART_writeCancelNoCB(UART_Object *object, UART_Attrs const *attrs) else { /* Reset the write buffer so we can pass it back */ - object->writeBuf = (const uint8_t *)object->writeBuf - object->writeCount; + object->writeBuf = object->writeBuf - object->writeCount; if(object->writeTrans != NULL) { object->writeTrans->count = (uint32_t)(object->writeCount); @@ -922,7 +920,7 @@ static Bool UART_readCancelNoCB(UART_Object *object, UART_Attrs const *attrs) else { /* Reset the read buffer so we can pass it back */ - object->readBuf = (uint8_t *)object->readBuf - object->readCount; + object->readBuf = object->readBuf - object->readCount; if(object->readTrans != NULL) { object->readTrans->count = object->readCount; @@ -1309,10 +1307,10 @@ static inline void UART_txChar(UART_Object *object) { uint8_t txCh; - txCh = *((uint8_t *) object->writeBuf); + txCh = *(object->writeBuf); CSL_FINS(object->pSCIRegs->SCITD, SCI_SCITD_TD, txCh); object->writeSizeRemaining--; - object->writeBuf = (uint8_t *) object->writeBuf + 1; + object->writeBuf = object->writeBuf + 1; object->writeCount++; return; @@ -1324,9 +1322,9 @@ static inline void UART_rxChar(UART_Object *object) rxCh = (uint8_t) CSL_FEXT(object->pSCIRegs->SCIRD, SCI_SCIRD_RD); rxCh >>= object->shiftJustification; - *((uint8_t *) object->readBuf) = rxCh; + *(object->readBuf) = rxCh; object->readSizeRemaining--; - object->readBuf = (uint8_t *) object->readBuf + 1; + object->readBuf = object->readBuf + 1; object->readCount++; return; diff --git a/source/drivers/uart/v1/uart_sci.h b/source/drivers/uart/v1/uart_sci.h index 14b1cf86f82..b043c9c0eee 100644 --- a/source/drivers/uart/v1/uart_sci.h +++ b/source/drivers/uart/v1/uart_sci.h @@ -210,7 +210,7 @@ typedef struct /**< Timeout for this transaction in units of system ticks */ uint32_t status; /**< [OUT] \ref UART_TransferStatus code */ - void *args; + uint32_t *args; /**< [IN] Argument to be passed to the callback function */ } UART_Transaction; @@ -221,8 +221,7 @@ typedef struct * \param handle UART_Handle * \param transaction* Pointer to a #UART_Transaction */ -typedef void (*UART_CallbackFxn) (UART_Handle handle, - UART_Transaction *transaction); +typedef void (*UART_CallbackFxn) (UART_Transaction *transaction); /** * \brief UART Parameters @@ -318,14 +317,12 @@ typedef struct /* * User parameters */ - UART_Handle handle; - /**< Instance handle to which this object belongs */ UART_Params prms; /**< Open parameter as provided by user */ /* * UART write variables */ - const void *writeBuf; + const uint8_t *writeBuf; /**< Buffer data pointer */ uint32_t writeCount; /**< Number of Chars sent */ @@ -334,7 +331,7 @@ typedef struct /* * UART receive variables */ - void *readBuf; + uint8_t *readBuf; /**< Buffer data pointer */ uint32_t readCount; /**< Number of Chars read */ @@ -356,21 +353,21 @@ typedef struct */ uint32_t isOpen; /**< Flag to indicate whether the instance is opened already */ - void *lock; + SemaphoreP_Object *lock; /**< Instance lock - to protect across transfers */ SemaphoreP_Object lockObj; /**< Driver lock object */ - void *readTransferSem; + SemaphoreP_Object *readTransferSem; /**< Read Transfer Sync Sempahore - to sync between transfer completion ISR * and task */ SemaphoreP_Object readTransferSemObj; /**< Read Transfer Sync Sempahore object */ - void *writeTransferSem; + SemaphoreP_Object *writeTransferSem; /**< Write Transfer Sync Sempahore - to sync between transfer completion ISR * and task */ SemaphoreP_Object writeTransferSemObj; /**< Write Transfer Sync Sempahore object */ - void *hwiHandle; + HwiP_Object *hwiHandle; /**< Interrupt handle for controller ISR */ HwiP_Object hwiObj; /**< Interrupt object */ @@ -448,7 +445,7 @@ void UART_deinit(void); * \sa #UART_close() * \sa #UART_Params_init */ -UART_Handle UART_open(uint32_t index, const UART_Params *prms); +UART_Config* UART_open(uint32_t index, const UART_Params *prms); /** * \brief Function to close a UART peripheral specified by the UART handle @@ -459,7 +456,7 @@ UART_Handle UART_open(uint32_t index, const UART_Params *prms); * * \sa #UART_open() */ -void UART_close(UART_Handle handle); +void UART_close(UART_Config *handle); /** * \brief Function to perform UART write operation @@ -499,7 +496,7 @@ void UART_close(UART_Handle handle); * * \sa #UART_open */ -int32_t UART_write(UART_Handle handle, UART_Transaction *trans); +int32_t UART_write(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to perform UART read operation @@ -535,7 +532,7 @@ int32_t UART_write(UART_Handle handle, UART_Transaction *trans); * * \sa #UART_open */ -int32_t UART_read(UART_Handle handle, UART_Transaction *trans); +int32_t UART_read(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to perform UART canceling of current write transaction. @@ -568,7 +565,7 @@ int32_t UART_read(UART_Handle handle, UART_Transaction *trans); * * \sa #UART_open */ -int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans); +int32_t UART_writeCancel(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to perform UART canceling of current read transaction @@ -601,7 +598,7 @@ int32_t UART_writeCancel(UART_Handle handle, UART_Transaction *trans); * * \sa #UART_open */ -int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans); +int32_t UART_readCancel(UART_Config *handle, UART_Transaction *trans); /** * \brief Function to return a open'ed UART handle given a UART instance index @@ -611,7 +608,7 @@ int32_t UART_readCancel(UART_Handle handle, UART_Transaction *trans); * \return A #UART_Handle on success or a NULL on an error or if the instance * index has NOT been opened yet */ -UART_Handle UART_getHandle(uint32_t index); +UART_Config* UART_getHandle(uint32_t index); /** * \brief Function to flush a TX FIFO of peripheral specified by the UART handle @@ -622,7 +619,7 @@ UART_Handle UART_getHandle(uint32_t index); * * \sa #UART_open() */ -void UART_flushTxFifo(UART_Handle handle); +void UART_flushTxFifo(UART_Config *handle); /** * \brief Function to initialize the #UART_Params struct to its defaults diff --git a/source/drivers/uart/v1/uart_sci_edma.c b/source/drivers/uart/v1/uart_sci_edma.c index cdac6428134..140a5e5cb87 100644 --- a/source/drivers/uart/v1/uart_sci_edma.c +++ b/source/drivers/uart/v1/uart_sci_edma.c @@ -78,11 +78,11 @@ static void UART_txEdmaIsrFxn(Edma_IntrHandle intrHandle, void *args); /* ========================================================================== */ -int32_t UART_edmaChannelConfig(UART_Handle uartHandle, uint32_t edmaInst) +int32_t UART_edmaChannelConfig(UART_Config *uartHandle, uint32_t edmaInst) { uint32_t baseAddr, regionId, dmaCh, tcc, param; int32_t status = SystemP_SUCCESS; - UART_Object *object = ((UART_Config *)uartHandle)->object; + UART_Object *object = uartHandle->object; UART_EdmaParams *edmaParams; EDMA_Handle uartEdmaHandle = EDMA_getHandle(edmaInst); @@ -241,7 +241,7 @@ static void UART_rxEdmaIsrFxn(Edma_IntrHandle intrHandle, void *args) if(object->prms.readMode == UART_TRANSFER_MODE_CALLBACK) { object->readTrans->status = UART_TRANSFER_STATUS_SUCCESS; - object->prms.readCallbackFxn((UART_Handle) config, object->readTrans); + object->prms.readCallbackFxn(object->readTrans); } else { @@ -355,7 +355,7 @@ static void UART_txEdmaIsrFxn(Edma_IntrHandle intrHandle, void *args) if(object->prms.writeMode == UART_TRANSFER_MODE_CALLBACK) { object->writeTrans->status = UART_TRANSFER_STATUS_SUCCESS; - object->prms.writeCallbackFxn((UART_Handle) config, object->writeTrans); + object->prms.writeCallbackFxn(object->writeTrans); } else { diff --git a/source/drivers/uart/v1/uart_sci_edma.h b/source/drivers/uart/v1/uart_sci_edma.h index 5f308f420a4..9dfc2f30bae 100644 --- a/source/drivers/uart/v1/uart_sci_edma.h +++ b/source/drivers/uart/v1/uart_sci_edma.h @@ -54,7 +54,7 @@ extern "C" { * * \return #SystemP_SUCCESS if edma configuration is successfully; else error on failure */ -int32_t UART_edmaChannelConfig(UART_Handle uartHandle, uint32_t edmaInst); +int32_t UART_edmaChannelConfig(UART_Config *uartHandle, uint32_t edmaInst); /** * \brief This function called by UART_read in DMA mode diff --git a/source/kernel/nortos/dpl/common/DebugP_uartLogWriter.c b/source/kernel/nortos/dpl/common/DebugP_uartLogWriter.c index 2b051e6b120..728c2dff084 100755 --- a/source/kernel/nortos/dpl/common/DebugP_uartLogWriter.c +++ b/source/kernel/nortos/dpl/common/DebugP_uartLogWriter.c @@ -47,7 +47,7 @@ void DebugP_uartSetDrvIndex(uint32_t uartDrvIndex) void DebugP_uartLogWriterPutLine(uint8_t *buf, uint16_t num_bytes) { - UART_Handle uartHandle = UART_getHandle(gDebugP_uartDrvIndex); + UART_Config* uartHandle = UART_getHandle(gDebugP_uartDrvIndex); if(uartHandle!=NULL) { UART_Transaction trans; @@ -61,7 +61,7 @@ void DebugP_uartLogWriterPutLine(uint8_t *buf, uint16_t num_bytes) void DebugP_uartLogWriterPutChar(char character) { char value = character; - UART_Handle uartHandle = UART_getHandle(gDebugP_uartDrvIndex); + UART_Config* uartHandle = UART_getHandle(gDebugP_uartDrvIndex); if(uartHandle!=NULL) { UART_Transaction trans; diff --git a/source/kernel/nortos/dpl/common/DebugP_uartScanf.c b/source/kernel/nortos/dpl/common/DebugP_uartScanf.c index afdb2250f83..2bf39b6fadf 100644 --- a/source/kernel/nortos/dpl/common/DebugP_uartScanf.c +++ b/source/kernel/nortos/dpl/common/DebugP_uartScanf.c @@ -40,7 +40,7 @@ extern uint32_t gDebugP_uartDrvIndex; int32_t DebugP_readLine(char *lineBuf, uint32_t bufSize) { int32_t status = SystemP_FAILURE; - UART_Handle uartHandle; + UART_Config* uartHandle; uartHandle = UART_getHandle(gDebugP_uartDrvIndex); if(uartHandle!=NULL) diff --git a/test/drivers/uart/test_uart.c b/test/drivers/uart/test_uart.c index 68e894dc680..e4544a9eabe 100644 --- a/test/drivers/uart/test_uart.c +++ b/test/drivers/uart/test_uart.c @@ -214,7 +214,7 @@ static void uart_echo_read_full_test(void *args) { int32_t transferOK, status; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config* uartHandle; UART_TestParams *testParams = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); uint32_t baseAddr; @@ -364,7 +364,7 @@ static void uart_echo_read_partial_test(void *args) { int32_t transferOK; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config* uartHandle; UART_TestParams *testParams = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); uint32_t baseAddr, strLen, tmpVar; @@ -414,7 +414,7 @@ static void uart_external_loopback_full_test(void *args) { int32_t transferOK, status; UART_Transaction trans; - UART_Handle uartHandle, uartHandle1; + UART_Config* uartHandle, uartHandle1; UART_TestParams *testParams = (UART_TestParams*)args; UART_TestParams *testParams1 = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); @@ -498,7 +498,7 @@ static void uart_six_bit_char_length_external_loopback_full_test(void *args) { int32_t transferOK, status; UART_Transaction trans; - UART_Handle uartHandle, uartHandle1; + UART_Config* uartHandle, uartHandle1; UART_TestParams *testParams = (UART_TestParams*)args; UART_TestParams *testParams1 = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); @@ -582,7 +582,7 @@ static void uart_echo_read_partial_external_loopback_full_test(void *args) { int32_t transferOK, status; UART_Transaction trans; - UART_Handle uartHandle, uartHandle1; + UART_Config* uartHandle, uartHandle1; UART_TestParams *testParams = (UART_TestParams*)args; UART_TestParams *testParams1 = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); @@ -660,7 +660,7 @@ static void uart_autobaud_external_loopback_full_test(void *args) { int32_t transferOK, status; UART_Transaction trans; - UART_Handle uartHandle, uartHandle1; + UART_Config* uartHandle, uartHandle1; UART_TestParams *testParams = (UART_TestParams*)args; UART_TestParams *testParams1 = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); @@ -748,7 +748,7 @@ static void uart_write_cancel_external_loopback_full_test(void *args) { int32_t transferOK, status; UART_Transaction trans; - UART_Handle uartHandle, uartHandle1; + UART_Config* uartHandle, uartHandle1; UART_TestParams *testParams = (UART_TestParams*)args; UART_TestParams *testParams1 = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); @@ -834,7 +834,7 @@ static void uart_read_cancel_external_loopback_full_test(void *args) { int32_t transferOK, status; UART_Transaction trans; - UART_Handle uartHandle, uartHandle1; + UART_Config* uartHandle, uartHandle1; UART_TestParams *testParams = (UART_TestParams*)args; UART_TestParams *testParams1 = (UART_TestParams*)args; UART_Params *uartParams = &(testParams->uartParams); @@ -934,7 +934,7 @@ static void test_printExitString(void *args) int32_t transferOK; UART_Transaction trans; #if !defined(SOC_AM65X) - UART_Handle uartHandle; + UART_Config* uartHandle; UART_TestParams *testParams = (UART_TestParams*)args; UART_Params *uartParams; @@ -962,7 +962,7 @@ static void test_printExitString(void *args) return; } -void uart_echo_write_callback(UART_Handle handle, UART_Transaction *trans) +void uart_echo_write_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesWritten = trans->count; @@ -971,7 +971,7 @@ void uart_echo_write_callback(UART_Handle handle, UART_Transaction *trans) return; } -void uart_echo_read_callback(UART_Handle handle, UART_Transaction *trans) +void uart_echo_read_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesRead = trans->count; @@ -980,7 +980,7 @@ void uart_echo_read_callback(UART_Handle handle, UART_Transaction *trans) return; } -void uart_echo_writeCancel_callback(UART_Handle handle, UART_Transaction *trans) +void uart_echo_writeCancel_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_CANCELLED == trans->status); gNumBytesWritten = trans->count; @@ -989,7 +989,7 @@ void uart_echo_writeCancel_callback(UART_Handle handle, UART_Transaction *trans) return; } -void uart_echo_readCancel_callback(UART_Handle handle, UART_Transaction *trans) +void uart_echo_readCancel_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_CANCELLED == trans->status); gNumBytesRead = trans->count; diff --git a/test/drivers/uart/test_uart_v1.c b/test/drivers/uart/test_uart_v1.c index e30a784e9b8..4fae808f1ff 100644 --- a/test/drivers/uart/test_uart_v1.c +++ b/test/drivers/uart/test_uart_v1.c @@ -84,8 +84,8 @@ static void uart_echo_callback_test(void *args); static void uart_read_write_cancel_test(void *args); static void uart_int_disable_read_write_test(void *args); static void uart_timeout_test(void *args); -static void uart_echo_write_callback(UART_Handle handle, UART_Transaction *trans); -static void uart_echo_read_callback(UART_Handle handle, UART_Transaction *trans); +static void uart_echo_write_callback(UART_Transaction *trans); +static void uart_echo_read_callback(UART_Transaction *trans); static void test_printExitString(void *args); void test_main(void *args) @@ -121,7 +121,7 @@ static void block_mode_read_write_test(void *args) { int32_t transferOK; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config* uartHandle; UART_Params * uartParams = (UART_Params*)args; UART_close(gUartHandle[CONFIG_UART_CONSOLE]); @@ -163,7 +163,7 @@ static void uartB_write_test(void *args) { int32_t transferOK; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config* uartHandle; UART_Params * uartParams = (UART_Params*)args; UART_close(gUartHandle[CONFIG_UARTB_CONSOLE]); @@ -198,7 +198,7 @@ static void uart_echo_callback_test(void *args) { int32_t transferOK,status; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config* uartHandle; UART_Params * uartParams = (UART_Params*)args; UART_close(gUartHandle[CONFIG_UART_CONSOLE]); @@ -257,7 +257,7 @@ static void uart_read_write_cancel_test(void *args) { int32_t transferOK,status; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config * uartHandle; UART_Params * uartParams = (UART_Params*)args; UART_close(gUartHandle[CONFIG_UART_CONSOLE]); @@ -393,7 +393,7 @@ static void uart_timeout_test(void *args) { int32_t transferOK; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config* uartHandle; UART_Params * uartParams = (UART_Params*)args; UART_close(gUartHandle[CONFIG_UART_CONSOLE]); @@ -424,7 +424,7 @@ static void uart_timeout_test(void *args) return; } -static void uart_echo_write_callback(UART_Handle handle, UART_Transaction *trans) +static void uart_echo_write_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesWritten = trans->count; @@ -433,7 +433,7 @@ static void uart_echo_write_callback(UART_Handle handle, UART_Transaction *trans return; } -static void uart_echo_read_callback(UART_Handle handle, UART_Transaction *trans) +static void uart_echo_read_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesRead = trans->count; @@ -457,7 +457,7 @@ static void test_printExitString(void *args) { int32_t transferOK; UART_Transaction trans; - UART_Handle uartHandle; + UART_Config* uartHandle; UART_Params * uartParams = (UART_Params*)args; uartHandle = UART_open(CONFIG_UART_CONSOLE, uartParams); diff --git a/test/kernel/dpl/dpl_ut/nortos/common/DebugP_uartScanf/DebugP_uartScanf_test_pos.c b/test/kernel/dpl/dpl_ut/nortos/common/DebugP_uartScanf/DebugP_uartScanf_test_pos.c index f2ea515c261..eb561bd3333 100644 --- a/test/kernel/dpl/dpl_ut/nortos/common/DebugP_uartScanf/DebugP_uartScanf_test_pos.c +++ b/test/kernel/dpl/dpl_ut/nortos/common/DebugP_uartScanf/DebugP_uartScanf_test_pos.c @@ -66,7 +66,6 @@ /* ========================================================================== */ extern uint32_t gDebugP_uartDrvIndex; - UART_Handle uartHandle; int32_t testStatus=SystemP_SUCCESS; char lineBuf; uint32_t bufSize = 0xFFFFF; @@ -82,7 +81,7 @@ */ void posTest_DebugP_readLine(void * args) { - UART_Handle handle = NULL; + UART_Config* handle = NULL; UART_close(handle); if(testStatus==SystemP_SUCCESS) { @@ -106,7 +105,7 @@ void posTest_DebugP_readLine(void * args) */ void posTest_DebugP_scanf(void * args) { - UART_Handle handle = NULL; + UART_Config* handle = NULL; if(testStatus==SystemP_SUCCESS) { value32 = 0; @@ -129,7 +128,7 @@ void posTest_DebugP_scanf(void * args) */ void posTest_DebugP_scanfOne(void * args) { - UART_Handle handle = NULL; + UART_Config* handle = NULL; UART_close(handle); if(testStatus==SystemP_SUCCESS) @@ -199,7 +198,7 @@ void posTest_DebugP_scanfTwo(void * args) { extern uint32_t gDebugP_uartDrvIndex; gDebugP_uartDrvIndex = 3U; - UART_Handle handle = NULL; + UART_Config* handle = NULL; if(testStatus==SystemP_SUCCESS) { value32 = 0; From fa0906f96a79acd13263931df100619343cc0f29 Mon Sep 17 00:00:00 2001 From: Nithyaa shri R B Date: Mon, 12 May 2025 11:01:22 +0530 Subject: [PATCH 3/4] am64/am24: uart: Remove unused callback function - Remove errorcalback function since there is no proper use of the function. Fixes: SITSW-7155 Signed-off-by: Nithyaa shri R B --- source/drivers/uart/v0/lld/uart_lld.h | 9 --------- source/drivers/uart/v0/lld/uart_v0_lld.c | 2 -- source/drivers/uart/v0/uart.h | 8 ++++---- source/drivers/uart/v0/uart_v0.c | 16 ---------------- 4 files changed, 4 insertions(+), 31 deletions(-) diff --git a/source/drivers/uart/v0/lld/uart_lld.h b/source/drivers/uart/v0/lld/uart_lld.h index e773a00d601..e30b2c37d1e 100644 --- a/source/drivers/uart/v0/lld/uart_lld.h +++ b/source/drivers/uart/v0/lld/uart_lld.h @@ -489,13 +489,6 @@ typedef void (*UART_readCompCallbackFxn) (void *hUart); */ typedef void (*UART_writeCompCallbackFxn) (void *hUart); -/** - * \brief The definition of a error callback function used by the UART driver - * when used in #UART_TRANSFER_MODE_CALLBACK - * - * \param hUart Handle to the UART instance used - */ -typedef void (*UART_errorCallbackFxn) (void *hUart); /* ========================================================================== */ /* Internal/Private Structure Declarations */ @@ -566,8 +559,6 @@ typedef struct /**< Read Callback function pointer */ UART_writeCompCallbackFxn writeCompleteCallbackFxn; /**< Write Callback function pointer */ - UART_errorCallbackFxn errorCallbackFxn; - /**< Error callback function */ } UARTLLD_InitObject, *UARTLLD_InitHandle; /** diff --git a/source/drivers/uart/v0/lld/uart_v0_lld.c b/source/drivers/uart/v0/lld/uart_v0_lld.c index 7a64d1b5274..372926b930c 100644 --- a/source/drivers/uart/v0/lld/uart_v0_lld.c +++ b/source/drivers/uart/v0/lld/uart_v0_lld.c @@ -2683,8 +2683,6 @@ int32_t UART_procLineStatusErr(UARTLLD_Handle hUart) hUart->readErrorCnt++; } } - - hUart->hUartInit->errorCallbackFxn(hUart); UART_lld_Transaction_deInit(&hUart->readTrans); } } diff --git a/source/drivers/uart/v0/uart.h b/source/drivers/uart/v0/uart.h index c973a328fad..c76f4fd0ee8 100644 --- a/source/drivers/uart/v0/uart.h +++ b/source/drivers/uart/v0/uart.h @@ -236,21 +236,21 @@ typedef struct */ uint32_t isOpen; /**< Flag to indicate whether the instance is opened already */ - SemaphoreP_Object *lock; + SemaphoreP_Object *lock; /**< Instance lock - to protect across transfers */ SemaphoreP_Object lockObj; /**< Driver lock object */ - SemaphoreP_Object *readTransferSem; + SemaphoreP_Object *readTransferSem; /**< Read Transfer Sync Sempahore - to sync between transfer completion ISR * and task */ SemaphoreP_Object readTransferSemObj; /**< Read Transfer Sync Sempahore object */ - SemaphoreP_Object *writeTransferSem; + SemaphoreP_Object *writeTransferSem; /**< Write Transfer Sync Sempahore - to sync between transfer completion ISR * and task */ SemaphoreP_Object writeTransferSemObj; /**< Write Transfer Sync Sempahore object */ - HwiP_Object *hwiHandle; + HwiP_Object *hwiHandle; /**< Interrupt handle for controller ISR */ HwiP_Object hwiObj; /**< Interrupt object */ diff --git a/source/drivers/uart/v0/uart_v0.c b/source/drivers/uart/v0/uart_v0.c index 7834fe53b22..f66574739d3 100644 --- a/source/drivers/uart/v0/uart_v0.c +++ b/source/drivers/uart/v0/uart_v0.c @@ -74,16 +74,6 @@ static void UART_lld_writeCompleteCallback(void *args); static void UART_lld_readCompleteCallback(void *args); -/** - * \brief This API is the callback that gets called when a UART error occurs. - * - * \param hUart Handle to the UART instance used - * \param transaction Structure pointing to the current transaction. The transaction - * status holds the error flag. - * - */ -static void UART_lld_errorCallback(void *args); - /** * \brief This function checks the openParameters for UART * @@ -329,7 +319,6 @@ UART_Config* UART_open(uint32_t index, const UART_Params *prms) /* Read, Write & Error callback Functions */ uartLldInit_handle->readCompleteCallbackFxn = UART_lld_readCompleteCallback; uartLldInit_handle->writeCompleteCallbackFxn = UART_lld_writeCompleteCallback; - uartLldInit_handle->errorCallbackFxn = UART_lld_errorCallback; /* Check open parameters */ status = UART_checkOpenParams(&object->prms); @@ -937,11 +926,6 @@ static void UART_lld_readCompleteCallback(void *args) } } -static void UART_lld_errorCallback(void *args) -{ - UART_NOT_IN_USE(args); -} - /** * \brief Function to initialize the #UART_Params struct to its defaults * From 5dfeb148d0f30aa8d1477950dffa69c380d97ae3 Mon Sep 17 00:00:00 2001 From: Nithyaa shri R B Date: Tue, 27 May 2025 16:16:36 +0530 Subject: [PATCH 4/4] am64/am24: uart: Udma/Edma changes - Common void* used for UDMA and EDMA channel configuration is removed. - This pointer is redefined based on the DMA used by the soc based on the DMA macro and respective headers are included. Fixes: SITSW-7155 Signed-off-by: Nithyaa shri R B --- .../doxy_samples/drivers/Uart_sample.c | 4 +- .../uart/v0/lld/dma/dummy/uart_dma_dummy.c | 10 ++- .../uart/v0/lld/dma/edma/uart_dma_edma.c | 10 +-- .../uart/v0/lld/dma/edma/uart_dma_edma.h | 16 ++++ source/drivers/uart/v0/lld/dma/uart_dma.h | 82 ++---------------- .../uart/v0/lld/dma/udma/uart_dma_udma.c | 14 ++-- .../uart/v0/lld/dma/udma/uart_dma_udma.h | 16 ++++ source/drivers/uart/v0/lld/uart_lld.h | 84 ++++++++++++++++--- source/drivers/uart/v0/lld/uart_v0_lld.c | 1 + source/drivers/uart/v0/uart.h | 25 +++--- source/drivers/uart/v0/uart_v0.c | 21 +++-- source/drivers/uart/v1/uart_sci.h | 20 ++--- source/drivers/uart/v1/uart_sci_edma.h | 2 +- 13 files changed, 162 insertions(+), 143 deletions(-) diff --git a/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c b/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c index 4457882c496..72933a17d40 100644 --- a/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c +++ b/docs_src/docs/api_guide/doxy_samples/drivers/Uart_sample.c @@ -80,7 +80,7 @@ void read_transfer_blocking(void) } //! [write_transfer_nonblocking] -void write_callback(UART_Handle handle, UART_Transaction *trans) +void write_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesWritten = trans->count; @@ -118,7 +118,7 @@ void write_transfer_nonblocking(void) //! [write_transfer_nonblocking] //! [read_transfer_nonblocking] -void read_callback(UART_Handle handle, UART_Transaction *trans) +void read_callback(UART_Transaction *trans) { DebugP_assertNoLog(UART_TRANSFER_STATUS_SUCCESS == trans->status); gNumBytesRead = trans->count; diff --git a/source/drivers/uart/v0/lld/dma/dummy/uart_dma_dummy.c b/source/drivers/uart/v0/lld/dma/dummy/uart_dma_dummy.c index d80e09477f0..82e94baed4b 100644 --- a/source/drivers/uart/v0/lld/dma/dummy/uart_dma_dummy.c +++ b/source/drivers/uart/v0/lld/dma/dummy/uart_dma_dummy.c @@ -41,14 +41,18 @@ #define UART_DMA_H_ #include -#include -#include - +//#include #ifdef __cplusplus extern "C" { #endif +typedef void* UART_DmaChConfig; +typedef void* UARTLLD_Handle; +typedef void* UART_Transaction; +/** \brief Transaction success */ +#define UART_STATUS_SUCCESS ((int32_t)0) + int32_t UART_lld_dmaInit(UARTLLD_Handle hUart, UART_DmaChConfig dmaChCfg) { return UART_STATUS_SUCCESS; diff --git a/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.c b/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.c index ffe57f96e80..74609128fd3 100644 --- a/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.c +++ b/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.c @@ -70,7 +70,7 @@ static void UART_edmaDoNothing(Edma_IntrHandle intrHandle, void *args); int32_t UART_lld_dmaInit(UARTLLD_Handle hUart, UART_DmaChConfig dmaChCfg) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; - UART_EdmaChConfig *edmaChCfg = (UART_EdmaChConfig *)dmaChCfg; + UART_EdmaChConfig *edmaChCfg = dmaChCfg; status = UART_edmaChInit(hUart, edmaChCfg); @@ -237,7 +237,7 @@ int32_t UART_lld_dmaWrite(UARTLLD_Handle hUart, const UART_Transaction *transact isTxFifoEmpty = FALSE; isEdmaEventPending = FALSE; - edmaChCfg = (UART_EdmaChConfig *)hUart->hUartInit->dmaChCfg; + edmaChCfg = hUart->hUartInit->dmaChCfg; /* Fetch the EDMA paramters for UART transfer */ baseAddr = edmaChCfg->edmaBaseAddr; @@ -336,7 +336,7 @@ int32_t UART_lld_dmaRead(UARTLLD_Handle hUart, const UART_Transaction *transacti EDMACCPaRAMEntry edmaRxParam; UART_EdmaChConfig *edmaChCfg; - edmaChCfg = (UART_EdmaChConfig *)hUart->hUartInit->dmaChCfg; + edmaChCfg = hUart->hUartInit->dmaChCfg; /* Fetch the EDMA paramters for UART transfer */ baseAddr = edmaChCfg->edmaBaseAddr; @@ -415,7 +415,7 @@ int32_t UART_lld_dmaDeInit(UARTLLD_Handle hUart) if(UART_TRANSFER_STATUS_SUCCESS == status) { hUartInit = hUart->hUartInit; - edmaChCfg = (UART_EdmaChConfig *)hUartInit->dmaChCfg; + edmaChCfg = hUartInit->dmaChCfg; uartEdmaHandle = (EDMA_Handle)hUartInit->uartDmaHandle; /* Fetch the EDMA paramters */ @@ -516,7 +516,7 @@ int32_t UART_lld_dmaDisableChannel(UARTLLD_Handle hUart, if(NULL_PTR != hUart) { - edmaChCfg = (UART_EdmaChConfig *)hUart->hUartInit->dmaChCfg; + edmaChCfg = hUart->hUartInit->dmaChCfg; baseAddr = edmaChCfg->edmaBaseAddr; regionId = edmaChCfg->edmaRegionId; diff --git a/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.h b/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.h index b539383cec2..a06f7a571c9 100644 --- a/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.h +++ b/source/drivers/uart/v0/lld/dma/edma/uart_dma_edma.h @@ -74,6 +74,22 @@ typedef struct UART_EdmaChConfig_s /**< Flag to indicate whether the DMA instance is opened already */ }UART_EdmaChConfig; +/** + * \brief UART DMA Configuration, these are filled by SysCfg based on the DMA driver that is selected + */ +typedef struct UART_DmaConfig_s +{ + /** Registered callbacks for a particular DMA driver. This will be set by Sysconfig depending on the DMA driver selected */ + UART_EdmaChConfig *uartDmaArgs; + /** Arguments specific to a DMA driver. This will be typecasted to the specific DMA driver args struct + * when used by the appropriate callback. This struct will be defined in the specific DMA driver header file. + * Allocation of this struct will be done statically using Sysconfig code generation in the example code + */ +} UART_DmaConfig; + +typedef struct UART_EdmaChConfig_s *UART_DmaChConfig; +typedef EDMA_Config *UART_DmaHandle; + #ifdef __cplusplus } #endif diff --git a/source/drivers/uart/v0/lld/dma/uart_dma.h b/source/drivers/uart/v0/lld/dma/uart_dma.h index 2ef1bfc9165..904e514f7d4 100644 --- a/source/drivers/uart/v0/lld/dma/uart_dma.h +++ b/source/drivers/uart/v0/lld/dma/uart_dma.h @@ -40,88 +40,18 @@ #define UART_DMA_H_ #include -#include -#include + +#if defined(DMA_VERSION_UART_EDMA) +#include +#else +#include +#endif #ifdef __cplusplus extern "C" { #endif -/** - * \brief UART DMA Configuration, these are filled by SysCfg based on the DMA driver that is selected - */ -typedef struct UART_DmaConfig_s -{ - /** Registered callbacks for a particular DMA driver. This will be set by Sysconfig depending on the DMA driver selected */ - void *uartDmaArgs; - /** Arguments specific to a DMA driver. This will be typecasted to the specific DMA driver args struct - * when used by the appropriate callback. This struct will be defined in the specific DMA driver header file. - * Allocation of this struct will be done statically using Sysconfig code generation in the example code - */ -} UART_DmaConfig; - -/** - * \defgroup UART_DMA_LLD APIs for UART DMA mode - * \ingroup DRV_UART_LLD_MODULE - * - * This module contains APIs to program and use DMA drivers available in the SoC with UART. - * - * @{ - */ - -/** - * \brief API to open an UART DMA channel - * - * This API will open a DMA Channel using the appropriate DMA driver callbacks and the registered via Sysconfig - * - * \param hUart [in] UART Handle - * \param dmaChCfg [in] UART DMA Handle - * - * \return SystemP_SUCCESS on success, else failure - */ -int32_t UART_lld_dmaInit(UARTLLD_Handle hUart, UART_DmaChConfig dmaChCfg); -/** - * \brief API to close an UART DMA channel - * - * \param hUart [in] UART handle returned from \ref UART_open - * - * \return SystemP_SUCCESS on success, else failure - */ -int32_t UART_lld_dmaDeInit(UARTLLD_Handle hUart); - -/** - * \brief API to write data using an UART DMA channel - * - * \param hUart [in] Pointer to UART object - * \param transaction [in] Pointer to #UART_Transaction. This parameter can't be NULL - * - * \return SystemP_SUCCESS on success, else failure - */ -int32_t UART_lld_dmaWrite(UARTLLD_Handle hUart, const UART_Transaction *transaction); - -/** - * \brief API to read data using an UART DMA channel - * - * \param hUart [in] Pointer to UART object - * \param transaction [in] Pointer to #UART_Transaction. This parameter can't be NULL - * - * \return SystemP_SUCCESS on success, else failure - */ -int32_t UART_lld_dmaRead(UARTLLD_Handle hUart, const UART_Transaction *transaction); - -/** - * \brief API to disable DMA channel - * - * \param hUart [in] UART Handle - * \param isChannelTx [in] Variable to hold the Tx channel - * - * \return SystemP_SUCCESS on success, else failure - */ -int32_t UART_lld_dmaDisableChannel(UARTLLD_Handle hUart, - uint32_t isChannelTx); -/** @} */ - #ifdef __cplusplus } #endif diff --git a/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c b/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c index 3479e76934a..ba7feca47e1 100644 --- a/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c +++ b/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.c @@ -53,7 +53,7 @@ static void UART_udmaIsrTx(Udma_EventHandle eventHandle, uint32_t eventType, voi int32_t UART_lld_dmaInit(UARTLLD_Handle hUart, UART_DmaChConfig dmaChCfg) { int32_t status = UART_TRANSFER_STATUS_SUCCESS; - UART_UdmaChConfig *udmaChCfg = (UART_UdmaChConfig *)dmaChCfg; + UART_UdmaChConfig *udmaChCfg = dmaChCfg; status = UART_udmaInitRxCh(hUart, udmaChCfg); status += UART_udmaInitTxCh(hUart, udmaChCfg); @@ -202,7 +202,7 @@ int32_t UART_lld_dmaDeInit(UARTLLD_Handle hUart) int32_t status = UART_TRANSFER_STATUS_SUCCESS; UART_UdmaChConfig *udmaChCfg; - udmaChCfg = (UART_UdmaChConfig *)hUart->hUartInit->dmaChCfg; + udmaChCfg = hUart->hUartInit->dmaChCfg; if (udmaChCfg->isOpen != FALSE) { @@ -223,7 +223,7 @@ static int32_t UART_udmaConfigPdmaTx(UARTLLD_Handle hUart, const UART_Transactio Udma_ChHandle txChHandle; UART_UdmaChConfig *udmaChCfg; - udmaChCfg = (UART_UdmaChConfig *)hUart->hUartInit->dmaChCfg; + udmaChCfg = hUart->hUartInit->dmaChCfg; txChHandle = udmaChCfg->txChHandle; /* Config PDMA channel */ @@ -258,7 +258,7 @@ static int32_t UART_udmaConfigPdmaRx(UARTLLD_Handle hUart, const UART_Transactio Udma_ChHandle rxChHandle; UART_UdmaChConfig *udmaChCfg; - udmaChCfg = (UART_UdmaChConfig *)hUart->hUartInit->dmaChCfg; + udmaChCfg = hUart->hUartInit->dmaChCfg; rxChHandle = udmaChCfg->rxChHandle; /* Config PDMA channel */ @@ -363,7 +363,7 @@ int32_t UART_lld_dmaDisableChannel(UARTLLD_Handle hUart, UART_UdmaChConfig *udmaChCfg; Udma_ChHandle chHandle; - udmaChCfg = (UART_UdmaChConfig *)hUart->hUartInit->dmaChCfg; + udmaChCfg = hUart->hUartInit->dmaChCfg; /* Disable Channel */ if (isChannelTx == TRUE) @@ -409,7 +409,7 @@ static void UART_udmaIsrTx(Udma_EventHandle eventHandle, if(NULL != args) { hUart = (UARTLLD_Handle)args; - udmaChCfg = (UART_UdmaChConfig *)hUart->hUartInit->dmaChCfg; + udmaChCfg = hUart->hUartInit->dmaChCfg; txChHandle = udmaChCfg->txChHandle; if (eventType == UDMA_EVENT_TYPE_DMA_COMPLETION) @@ -455,7 +455,7 @@ static void UART_udmaIsrRx(Udma_EventHandle eventHandle, if(NULL != args) { hUart = (UARTLLD_Handle)args; - udmaChCfg = (UART_UdmaChConfig *)hUart->hUartInit->dmaChCfg; + udmaChCfg = hUart->hUartInit->dmaChCfg; rxChHandle = udmaChCfg->rxChHandle; if (eventType == UDMA_EVENT_TYPE_DMA_COMPLETION) diff --git a/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.h b/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.h index eb29cef331c..8272ac85f5b 100644 --- a/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.h +++ b/source/drivers/uart/v0/lld/dma/udma/uart_dma_udma.h @@ -77,6 +77,22 @@ typedef struct UART_UdmaChConfig_s /**< This is only used for AM65x */ }UART_UdmaChConfig; +/** + * \brief UART DMA Configuration, these are filled by SysCfg based on the DMA driver that is selected + */ +typedef struct UART_DmaConfig_s +{ + /** Registered callbacks for a particular DMA driver. This will be set by Sysconfig depending on the DMA driver selected */ + UART_UdmaChConfig *uartDmaArgs; + /** Arguments specific to a DMA driver. This will be typecasted to the specific DMA driver args struct + * when used by the appropriate callback. This struct will be defined in the specific DMA driver header file. + * Allocation of this struct will be done statically using Sysconfig code generation in the example code + */ +} UART_DmaConfig; + +typedef struct UART_UdmaChConfig_s *UART_DmaChConfig; +typedef struct Udma_DrvObjectInt_t *UART_DmaHandle; + #ifdef __cplusplus } #endif diff --git a/source/drivers/uart/v0/lld/uart_lld.h b/source/drivers/uart/v0/lld/uart_lld.h index e30b2c37d1e..8ee10d9d0f3 100644 --- a/source/drivers/uart/v0/lld/uart_lld.h +++ b/source/drivers/uart/v0/lld/uart_lld.h @@ -56,6 +56,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -65,11 +66,6 @@ extern "C" { /* Macros & Typedefs */ /* ========================================================================== */ -/** \brief A handle that is returned from a #UART_open() call */ -typedef void *UART_DmaHandle; - -typedef void *UART_DmaChConfig; - /** \brief Uart FIFO Size */ #define UART_FIFO_SIZE (64U) @@ -443,6 +439,10 @@ typedef void *UART_DmaChConfig; /* ========================================================================== */ /* Structures and Enums */ /* ========================================================================== */ + +struct UARTLLD_Object_s; +struct UART_Config_s; + typedef struct UART_ExtendedParams_s { uint32_t *args; @@ -479,7 +479,7 @@ typedef uint32_t (*UART_clockUsecToTick) (uint64_t usecs); * * \param hUart Handle to the UART instance used */ -typedef void (*UART_readCompCallbackFxn) (void *hUart); +typedef void (*UART_readCompCallbackFxn) (struct UARTLLD_Object_s *args); /** * \brief The definition of a write complete callback function used by @@ -487,7 +487,7 @@ typedef void (*UART_readCompCallbackFxn) (void *hUart); * * \param hUart Handle to the UART instance used */ -typedef void (*UART_writeCompCallbackFxn) (void *hUart); +typedef void (*UART_writeCompCallbackFxn) (struct UARTLLD_Object_s *args); /* ========================================================================== */ @@ -564,7 +564,7 @@ typedef struct /** * \brief UART driver object */ -typedef struct +typedef struct UARTLLD_Object_s { uint32_t baseAddr; /**< Peripheral base address */ @@ -609,12 +609,12 @@ typedef struct */ uint32_t state; /**< Flag to indicate whether the instance is opened already */ - void *readTransferMutex; + void *readTransferMutex; /**< Read Transfer Sync Sempahore - to signal transfer completion */ - void *writeTransferMutex; + void *writeTransferMutex; /**< Write Transfer Sync Sempahore - to signal transfer completion */ - void* args; + struct UART_Config_s *args; /**< Pointer to be used by application to store miscellaneous data.*/ uint64_t lineStatusTimeout; /**< Variable to hold the line status timeout in ticks */ @@ -1103,6 +1103,68 @@ void UART_lld_Transaction_init(UART_Transaction *trans); */ void UART_lld_Transaction_deInit(UART_Transaction *trans); +/** + * \defgroup UART_DMA_LLD APIs for UART DMA mode + * \ingroup DRV_UART_LLD_MODULE + * + * This module contains APIs to program and use DMA drivers available in the SoC with UART. + * + * @{ + */ + +/** + * \brief API to open an UART DMA channel + * + * This API will open a DMA Channel using the appropriate DMA driver callbacks and the registered via Sysconfig + * + * \param hUart [in] UART Handle + * \param dmaChCfg [in] UART DMA Handle + * + * \return SystemP_SUCCESS on success, else failure + */ +int32_t UART_lld_dmaInit(UARTLLD_Handle hUart, UART_DmaChConfig dmaChCfg); + +/** + * \brief API to close an UART DMA channel + * + * \param hUart [in] UART handle returned from \ref UART_open + * + * \return SystemP_SUCCESS on success, else failure + */ +int32_t UART_lld_dmaDeInit(UARTLLD_Handle hUart); + +/** + * \brief API to write data using an UART DMA channel + * + * \param hUart [in] Pointer to UART object + * \param transaction [in] Pointer to #UART_Transaction. This parameter can't be NULL + * + * \return SystemP_SUCCESS on success, else failure + */ +int32_t UART_lld_dmaWrite(UARTLLD_Handle hUart, const UART_Transaction *transaction); + +/** + * \brief API to read data using an UART DMA channel + * + * \param hUart [in] Pointer to UART object + * \param transaction [in] Pointer to #UART_Transaction. This parameter can't be NULL + * + * \return SystemP_SUCCESS on success, else failure + */ +int32_t UART_lld_dmaRead(UARTLLD_Handle hUart, const UART_Transaction *transaction); + +/** + * \brief API to disable DMA channel + * + * \param hUart [in] UART Handle + * \param isChannelTx [in] Variable to hold the Tx channel + * + * \return SystemP_SUCCESS on success, else failure + */ +int32_t UART_lld_dmaDisableChannel(UARTLLD_Handle hUart, + uint32_t isChannelTx); +/** @} */ + #ifdef __cplusplus } #endif diff --git a/source/drivers/uart/v0/lld/uart_v0_lld.c b/source/drivers/uart/v0/lld/uart_v0_lld.c index 372926b930c..b2fe5962834 100644 --- a/source/drivers/uart/v0/lld/uart_v0_lld.c +++ b/source/drivers/uart/v0/lld/uart_v0_lld.c @@ -49,6 +49,7 @@ #include #include #include +#include /* ========================================================================== */ /* Macros & Typedefs */ diff --git a/source/drivers/uart/v0/uart.h b/source/drivers/uart/v0/uart.h index c76f4fd0ee8..96c20d56b82 100644 --- a/source/drivers/uart/v0/uart.h +++ b/source/drivers/uart/v0/uart.h @@ -68,10 +68,6 @@ extern "C" { /* Macros & Typedefs */ /* ========================================================================== */ - -/** \brief A handle that is returned from a #UART_open() call */ -typedef void *UART_Handle; - /** * \anchor UART_TransferMode * \name Transfer Mode @@ -103,7 +99,6 @@ typedef void *UART_Handle; * \brief The definition of a callback function used by the UART driver * when used in #UART_TRANSFER_MODE_CALLBACK * - * \param handle UART_Handle * \param transaction* Pointer to a #UART_Transaction */ typedef void (*UART_CallbackFxn) (UART_Transaction *transaction); @@ -269,7 +264,7 @@ typedef struct * This structure needs to be defined before calling #UART_init() and it must * not be changed by user thereafter. */ -typedef struct +typedef struct UART_Config_s { UART_Attrs *attrs; /**< Pointer to driver specific attributes */ @@ -311,7 +306,7 @@ void UART_deinit(void); * \param prms Pointer to open parameters. If NULL is passed, then * default values will be used * - * \return A #UART_Handle on success or a NULL on an error or if it has been + * \return A #UART_Config on success or a NULL on an error or if it has been * opened already * * \sa #UART_init() @@ -325,7 +320,7 @@ UART_Config* UART_open(uint32_t index, const UART_Params *prms); * * \pre #UART_open() has to be called first * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * * \sa #UART_open() */ @@ -353,7 +348,7 @@ void UART_close(UART_Config *handle); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -389,7 +384,7 @@ int32_t UART_write(UART_Config *handle, UART_Transaction *trans); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -422,7 +417,7 @@ int32_t UART_read(UART_Config *handle, UART_Transaction *trans); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -455,7 +450,7 @@ int32_t UART_writeCancel(UART_Config *handle, UART_Transaction *trans); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -478,7 +473,7 @@ int32_t UART_readCancel(UART_Config *handle, UART_Transaction *trans); * * \param index Index of config to use in the *UART_Config* array * - * \return A #UART_Handle on success or a NULL on an error or if the instance + * \return A #UART_Config on success or a NULL on an error or if the instance * index has NOT been opened yet */ UART_Config* UART_getHandle(uint32_t index); @@ -488,7 +483,7 @@ UART_Config* UART_getHandle(uint32_t index); * * \pre #UART_open() has to be called first * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * * \sa #UART_open() */ @@ -501,7 +496,7 @@ void UART_flushTxFifo(UART_Config *handle); * \brief Function to get base address of UART instance of a particular * handle. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * * \sa #UART_open */ diff --git a/source/drivers/uart/v0/uart_v0.c b/source/drivers/uart/v0/uart_v0.c index f66574739d3..9a9e7cd1596 100644 --- a/source/drivers/uart/v0/uart_v0.c +++ b/source/drivers/uart/v0/uart_v0.c @@ -50,6 +50,7 @@ #include #include #include +#include /* UART Config,DMA structure handles */ extern UART_DmaHandle gUartDmaHandle[]; @@ -62,7 +63,7 @@ extern UART_DmaChConfig gUartDmaChConfig[]; * \param transaction Structure pointing to the current transaction * */ -static void UART_lld_writeCompleteCallback(void *args); +static void UART_lld_writeCompleteCallback(struct UARTLLD_Object_s *args); /** * \brief This API is the callback that gets after UART read completion. @@ -71,7 +72,7 @@ static void UART_lld_writeCompleteCallback(void *args); * \param transaction Structure pointing to the current transaction * */ -static void UART_lld_readCompleteCallback(void *args); +static void UART_lld_readCompleteCallback(struct UARTLLD_Object_s *args); /** @@ -147,7 +148,7 @@ static int32_t UART_checkOpenParams(const UART_Params *prms); typedef struct { - void *lock; + SemaphoreP_Object *lock; /**< Driver lock - to protect across open/close */ SemaphoreP_Object lockObj; /**< Driver lock object */ @@ -871,7 +872,7 @@ void UART_flushTxFifo(UART_Config *handle) return; } -static void UART_lld_writeCompleteCallback(void *args) +static void UART_lld_writeCompleteCallback(struct UARTLLD_Object_s *args) { UART_Config *config; UART_Object *obj; @@ -880,10 +881,9 @@ static void UART_lld_writeCompleteCallback(void *args) if(NULL_PTR != hUart) { - UART_Handle handle = (UART_Handle)hUart->args; - if(NULL_PTR != handle) + config = hUart->args; + if(NULL_PTR != config) { - config = (UART_Config *) handle; obj = config->object; obj->writeTrans->count = hUart->writeTrans.count; if (obj->prms.writeMode == UART_TRANSFER_MODE_CALLBACK) @@ -899,7 +899,7 @@ static void UART_lld_writeCompleteCallback(void *args) } -static void UART_lld_readCompleteCallback(void *args) +static void UART_lld_readCompleteCallback(struct UARTLLD_Object_s *args) { UART_Config *config; UART_Object *obj; @@ -908,10 +908,9 @@ static void UART_lld_readCompleteCallback(void *args) if(NULL_PTR != hUart) { - UART_Handle handle = (UART_Handle)hUart->args; - if(NULL_PTR != handle) + config = hUart->args; + if(NULL_PTR != config) { - config = (UART_Config *) handle; obj = config->object; obj->readTrans->count = hUart->readTrans.count; if (obj->prms.readMode == UART_TRANSFER_MODE_CALLBACK) diff --git a/source/drivers/uart/v1/uart_sci.h b/source/drivers/uart/v1/uart_sci.h index b043c9c0eee..ca615fb65e2 100644 --- a/source/drivers/uart/v1/uart_sci.h +++ b/source/drivers/uart/v1/uart_sci.h @@ -69,9 +69,6 @@ extern "C" { /* Macros & Typedefs */ /* ========================================================================== */ -/** \brief A handle that is returned from a #UART_open() call */ -typedef void *UART_Handle; - /** * \anchor UART_TransferStatus * \name Transfer Status Code @@ -218,7 +215,6 @@ typedef struct * \brief The definition of a callback function used by the UART driver * when used in #UART_TRANSFER_MODE_CALLBACK * - * \param handle UART_Handle * \param transaction* Pointer to a #UART_Transaction */ typedef void (*UART_CallbackFxn) (UART_Transaction *transaction); @@ -438,7 +434,7 @@ void UART_deinit(void); * \param prms Pointer to open parameters. If NULL is passed, then * default values will be used * - * \return A #UART_Handle on success or a NULL on an error or if it has been + * \return A #UART_Config on success or a NULL on an error or if it has been * opened already * * \sa #UART_init() @@ -452,7 +448,7 @@ UART_Config* UART_open(uint32_t index, const UART_Params *prms); * * \pre #UART_open() has to be called first * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * * \sa #UART_open() */ @@ -480,7 +476,7 @@ void UART_close(UART_Config *handle); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -516,7 +512,7 @@ int32_t UART_write(UART_Config *handle, UART_Transaction *trans); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -549,7 +545,7 @@ int32_t UART_read(UART_Config *handle, UART_Transaction *trans); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -582,7 +578,7 @@ int32_t UART_writeCancel(UART_Config *handle, UART_Transaction *trans); * during a transaction, even though the physical transfer might not have * started yet. Doing this can result in data corruption. * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * \param trans Pointer to a #UART_Transaction. All of the fields * within transaction except #UART_Transaction.count and * #UART_Transaction.status are WO (write-only) unless @@ -605,7 +601,7 @@ int32_t UART_readCancel(UART_Config *handle, UART_Transaction *trans); * * \param index Index of config to use in the *UART_Config* array * - * \return A #UART_Handle on success or a NULL on an error or if the instance + * \return A #UART_Config on success or a NULL on an error or if the instance * index has NOT been opened yet */ UART_Config* UART_getHandle(uint32_t index); @@ -615,7 +611,7 @@ UART_Config* UART_getHandle(uint32_t index); * * \pre #UART_open() has to be called first * - * \param handle #UART_Handle returned from #UART_open() + * \param handle #UART_Config returned from #UART_open() * * \sa #UART_open() */ diff --git a/source/drivers/uart/v1/uart_sci_edma.h b/source/drivers/uart/v1/uart_sci_edma.h index 9dfc2f30bae..3dbb12a41f5 100644 --- a/source/drivers/uart/v1/uart_sci_edma.h +++ b/source/drivers/uart/v1/uart_sci_edma.h @@ -49,7 +49,7 @@ extern "C" { * \brief Function to configure the edma channels for UART DMA mode * Called from the #UART_open() * - * \param uartHandle #UART_Handle returned assigned in #UART_open() + * \param uartHandle #UART_UART_ConfigHandle returned assigned in #UART_open() * \param edmaInst edma instance to be used * * \return #SystemP_SUCCESS if edma configuration is successfully; else error on failure