5.20. UART
5.20.1. Types
Base type |
Type Name |
Brief |
---|---|---|
enum |
This type defines a range of specific status for UART Complex Driver. |
|
typedef uint8 |
Typedef for the data buffer elements. |
|
typedef uint8_least |
Type for defining the direction of data transfer, i.e., sending or receiving. |
5.20.1.1. enum Cdd_Uart_StatusType
Enumerator |
Value |
Description |
---|---|---|
CDD_UART_UNINIT |
0U |
The UART Complex Driver is not initialized or not usable. |
CDD_UART_INIT |
1U |
The UART Complex Driver is not currently transferring. |
CDD_UART_BUSY |
2U |
The UART Complex Driver is performing a read/write operation. |
Brief: This type defines a range of specific status for UART Complex Driver.
5.20.1.2. typedef CddUartDataBufferType
typedef uint8 CddUartDataBufferType;
Brief: Typedef for the data buffer elements.
5.20.1.3. typedef CddUartDataDirectionType
typedef uint8_least CddUartDataDirectionType;
Brief: Type for defining the direction of data transfer, i.e., sending or receiving.
5.20.2. Structures
Name |
Brief |
---|---|
UART notification callbacks structure. |
|
UART configuration type data structure for a channel. |
|
UART configuration type structure for all channels in use. |
5.20.3. Defines
Name |
Brief |
---|---|
CDD_UART_MODULE_ID |
CDD Module ID. |
CDD_UART_VENDOR_ID |
Texas Instruments Vendor ID. |
CDD_UART_INSTANCE_ID |
Texas Instruments Vendor ID. |
CDD_UART_SW_MAJOR_VERSION |
Driver Implementation Major Version. |
CDD_UART_SW_MINOR_VERSION |
Driver Implementation Minor Version. |
CDD_UART_SW_PATCH_VERSION |
Driver Implementation patch Version. |
CDD_UART_AR_RELEASE_MAJOR_VERSION |
AUTOSAR Major version specification implemented by CDD Driver. |
CDD_UART_AR_RELEASE_MINOR_VERSION |
AUTOSAR Minor version specification implemented by CDD Driver. |
CDD_UART_AR_RELEASE_REVISION_VERSION |
AUTOSAR Patch version specification implemented by CDD Driver. |
CDD_UART_INIT_SERVICE_ID |
API Service ID for initialization. |
CDD_UART_GETVERSIONINFO_SERVICE_ID |
API Service ID for get version info. |
CDD_UART_REGISTERREADBACK_SERVICE_ID |
API Service ID for Register Readback service ID. |
CDD_UART_READDATA_SERVICE_ID |
API Service ID for read API. |
CDD_UART_WRITEDATA_SERVICE_ID |
API Service ID for write API. |
CDD_UART_ERROR_SERVICE_ID |
API Service ID for error API. |
CDD_UART_CANCEL_SERVICE_ID |
API Service ID for cancel API. |
CDD_UART_GETREMAININGWORDS_SERVICE_ID |
API Service ID for get remaining words API. |
CDD_UART_READNOTIF_SERVICE_ID |
API Service ID for read notification handler. |
CDD_UART_WRITENOTIF_SERVICE_ID |
API Service ID for write notification handler. |
CDD_UART_ERRORNOTIF_SERVICE_ID |
API Service ID for error notification handler. |
CDD_UART_DEINIT_SERVICE_ID |
API Service ID for deinitialization. |
CDD_UART_INTERNAL_ISR_ID |
API Service ID for ISR. |
CDD_UART_E_UNINIT |
Error code indicating the UART is uninitialized. |
CDD_UART_E_INVALID_EVENT |
Error code indicating an invalid event. |
CDD_UART_E_READ_LOCKED |
Error code indicating UART reading mode ongoing. |
CDD_UART_E_WRITE_LOCKED |
Error code indicating UART writing mode ongoing. |
CDD_UART_E_PARAM_POINTER |
Error code indicating invalid parameter pointer. |
CDD_UART_E_ALREADY_INITIALIZED |
Error code indicating UART is already initialized. |
CDD_UART_E_PARAM_VALUE |
Error code indicating Service called with wrong param. |
CDD_UART_E_PARAM_LENGTH |
Error code indicating Service called with invalid length. |
CDD_UART_E_INVALID_CHANNEL |
Error code indicating invalid UART channel. |
CDD_UART_E_INVALID_CONFIG |
Error code indicating invalid UART configuration. |
UART_TX_FIFO_NOT_FULL |
|
UART_TX_FIFO_FULL |
|
UART_INTID_MODEM_STAT |
Values pertaining to status of UART Interrupt sources. |
UART_INTID_TX_THRES_REACH |
Values pertaining to status of UART Interrupt sources. |
UART_INTID_RX_THRES_REACH |
Values pertaining to status of UART Interrupt sources. |
UART_INTID_RX_LINE_STAT_ERROR |
Values pertaining to status of UART Interrupt sources. |
UART_INTID_CHAR_TIMEOUT |
Values pertaining to status of UART Interrupt sources. |
UART_INTID_XOFF_SPEC_CHAR_DETECT |
Values pertaining to status of UART Interrupt sources. |
UART_INTID_MODEM_SIG_STATE_CHANGE |
Values pertaining to status of UART Interrupt sources. |
UART_INTR_PENDING |
Values indicating the UART Interrupt pending status. |
UART_NO_INTR_PENDING |
Values indicating the UART Interrupt pending status. |
UART_INTR_CTS |
Values for enabling/disabling the interrupts of UART. |
UART_INTR_RTS |
Values for enabling/disabling the interrupts of UART. |
UART_INTR_XOFF |
Values for enabling/disabling the interrupts of UART. |
UART_INTR_SLEEPMODE |
Values for enabling/disabling the interrupts of UART. |
UART_INTR_MODEM_STAT |
Values for enabling/disabling the interrupts of UART. |
UART_INTR_LINE_STAT |
Values for enabling/disabling the interrupts of UART. |
UART_INTR_THR |
Values for enabling/disabling the interrupts of UART. |
UART_INTR_RHR_CTI |
Values for enabling/disabling the interrupts of UART. |
UART_INTR2_RX_EMPTY |
Values for enabling/disabling the interrupts of UART. |
UART_INTR2_TX_EMPTY |
Values for enabling/disabling the interrupts of UART. |
UART_FIFO_PE_FE_BI_DETECTED |
Values pertaining to UART Line Status information. |
UART_BREAK_DETECTED_ERROR |
Values pertaining to UART Line Status information. |
UART_FRAMING_ERROR |
Values pertaining to UART Line Status information. |
UART_PARITY_ERROR |
Values pertaining to UART Line Status information. |
UART_OVERRUN_ERROR |
Values pertaining to UART Line Status information. |
MCAL_STATE_RESET |
MCAL state reset. |
MCAL_STATE_READY |
MCAL state ready. |
MCAL_STATE_BUSY |
MCAL state busy. |
MCAL_STATE_ERROR |
MCAL state error. |
UART_FIFO_SIZE |
Uart FIFO Size. |
UART_TRANSMITEMPTY_TRIALCOUNT |
Timeout in ms used for TX FIFO empty at the time of delete. Three seconds is more than sufficient to transfer 64 bytes (FIFO size) at the lowest baud rate of 2400. |
UART_STATE_RX_DISABLED |
|
UART_STATE_RX_ENABLED |
|
IS_DATA_LENGTH_VALID (dataLength) |
Macro to check if the Data length is valid. |
IS_STOP_BITS_VALID (stopBits) |
Macro to check if the Number of stop bits is valid. |
IS_PARITY_TYPE_VALID (parityType) |
Macro to check if the Parity type is valid. |
IS_OPER_MODE_VALID (operMode) |
Macro to check if the Operation mode is valid. |
IS_RXTRIG_LVL_VALID (rxTrigLvl) |
Macro to check if the RX Trigger level is valid. |
IS_TXTRIG_LVL_VALID (txTrigLvl) |
Macro to check if the TX Trigger level is valid. |
5.20.4. Functions
Return type |
Function Name |
Brief |
---|---|---|
void |
Cdd_Uart_GetVersionInfo(Std_VersionInfoType * VersionInfoPtr) |
Service for getting CDD UART version. |
Std_ReturnType |
Cdd_Uart_RegisterReadback(uint8 ChannelID, CddUart_RegisterReadbackType * RegisterSetPtr) |
Service for reading HW IP registers of a CDD UART instance. Service for reading data or status from the HW registers of a CDD UART instance. |
void |
Cdd_Uart_Init(const Cdd_Uart_CfgType * ConfigurationPtr) |
Service for CDD UART Initialization. |
void |
Cdd_Uart_DeInit(void ) |
Service for deinitializing CDD UART Service for deinitializing the CDD UART and change driver state to uninitialized. |
Std_ReturnType |
Cdd_Uart_Write(uint8 ChannelID, CddUartDataBufferType * SrcBufferPtr, uint32 Count, uint32 Timeout) |
Service to transmit message using UART. Service to write message using the UART instance. |
Std_ReturnType |
Cdd_Uart_Read(uint8 ChannelID, CddUartDataBufferType * DestBufferPtr, uint32 Count, uint32 Timeout) |
Service to read message or command from the UART. |
boolean |
Cdd_Uart_Cancel(uint8 ChannelID, CddUartDataDirectionType TransferType) |
Service to cancel an ongoing transaction with UART. |
uint32 |
Cdd_Uart_GetRemainingWords(uint8 ChannelID, CddUartDataDirectionType TransferType) |
Service to get remaining words to be transmitted from the UART for any ongoing transaction. |
sint32 |
Uart_Cdd_init(CddUart_Handle hUart) |
This API Initializes the UART instance. |
sint32 |
Uart_Cdd_deInit(CddUart_Handle hUart) |
This API De-Initializes the UART instance. |
sint32 |
Uart_Cdd_writeEx(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API writes data to the UART instance in Polling mode with exteded parameters. |
sint32 |
Uart_Cdd_writeIntrEx(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API writes data to the UART instance in Interrupt mode with exteded parameters. |
sint32 |
Uart_Cdd_writeDmaEx(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API writes data to the UART instance in DMA mode with exteded parameters. |
sint32 |
Uart_Cdd_readEx(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API reads data to the UART instance in Polling mode with exteded parameters. |
sint32 |
Uart_Cdd_readIntrEx(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API reads data to the UART instance in Interrupt mode with exteded parameters. |
sint32 |
Uart_Cdd_readDmaEx(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API reads data to the UART instance in DMA mode with exteded parameters. |
sint32 |
Uart_Cdd_writeCancel(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API cancels current UART Write. |
sint32 |
Uart_Cdd_writeCancelDma(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API cancels current UART Write in DMA mode. |
sint32 |
Uart_Cdd_readCancel(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API cancels current UART Read. |
sint32 |
Uart_Cdd_readCancelDma(CddUart_Handle hUart, CddUart_Transaction * trans) |
This API cancels current UART Read in DMA mode. |
5.20.4.1. function Cdd_Uart_GetVersionInfo
void Cdd_Uart_GetVersionInfo(
Std_VersionInfoType * VersionInfoPtr
)
Brief: Service for getting CDD UART version.
None
Service ID[hex] : 0x02
Sync/Async : Synchronous
Reentrancy : Reentrant
Parameters:
VersionInfoPtr - Pointer to Std_VersionInfoType structure
Returns:
None
Return: None
5.20.4.2. function Cdd_Uart_RegisterReadback
Std_ReturnType Cdd_Uart_RegisterReadback(
uint8 ChannelID,
CddUart_RegisterReadbackType * RegisterSetPtr
)
Brief: Service for reading HW IP registers of a CDD UART instance. Service for reading data or status from the HW registers of a CDD UART instance.
Service ID[hex] : 0x08
Sync/Async : Synchronous
Reentrancy : Reentrant
Parameters:
ChannelID - Channel ID
RegisterSetPtr - Pointer to CddUart_RegisterReadbackType structure with useful registers for UART IP
Returns:
E_OK Register read back has been done successfully
E_NOT_OK Register read back failed
Return: Std_ReturnType
5.20.4.3. function Cdd_Uart_Init
void Cdd_Uart_Init(
const Cdd_Uart_CfgType * ConfigurationPtr
)
Brief: Service for CDD UART Initialization.
Service ID[hex] : 0x01
Sync/Async : Synchronous
Reentrancy : Non-Reentrant
Parameters:
ConfigurationPtr - Constant Pointer to Cdd_Uart_CfgType containing configurations for all channels
Returns:
None
Return: None
5.20.4.4. function Cdd_Uart_DeInit
void Cdd_Uart_DeInit(
void
)
Brief: Service for deinitializing CDD UART Service for deinitializing the CDD UART and change driver state to uninitialized.
Service ID[hex] : 0x03
Sync/Async : Synchronous
Reentrancy : Non-Reentrant
Parameters:
None
Returns:
None
Return: None
5.20.4.5. function Cdd_Uart_Write
Std_ReturnType Cdd_Uart_Write(
uint8 ChannelID,
CddUartDataBufferType * SrcBufferPtr,
uint32 Count,
uint32 Timeout
)
Brief: Service to transmit message using UART. Service to write message using the UART instance.
Service ID[hex] : 0x04
Sync/Async : Synchronous
Reentrancy : Reentrant
Parameters:
ChannelID - Channel number to be used for writing data
SrcBufferPtr - Pointer to source data buffer
Count - Length (number of data elements) of the data to be transmitted from SrcBufferPtr to remote endpoint
Timeout - maximum duration of transmission for blocking mode.
Returns:
E_OK If successful. E_NOT_OK: If the write failed.
Return: Std_ReturnType
5.20.4.6. function Cdd_Uart_Read
Std_ReturnType Cdd_Uart_Read(
uint8 ChannelID,
CddUartDataBufferType * DestBufferPtr,
uint32 Count,
uint32 Timeout
)
Brief: Service to read message or command from the UART.
Service ID[hex] : 0x05
Sync/Async : Synchronous
Reentrancy : Reentrant
Parameters:
ChannelID - Channel number to be used for reading data
DestBufferPtr - Pointer to destination data buffer from which the data is read.
Count - Length (number of data elements) of the data to be received from DestBufferPtr.
Timeout - maximum duration of transmission for blocking mode.
Returns:
E_OK If data has been read E_NOT_OK: If the read returned an error.
Return: Std_ReturnType
5.20.4.7. function Cdd_Uart_Cancel
boolean Cdd_Uart_Cancel(
uint8 ChannelID,
CddUartDataDirectionType TransferType
)
Brief: Service to cancel an ongoing transaction with UART.
Service ID[hex] : 0x06
Sync/Async : Synchronous
Reentrancy : Reentrant
Parameters:
ChannelID - Channel number
TransferType - Read or Write
Returns:
Cancellation status (true for success, else false).
Return: boolean
5.20.4.8. function Cdd_Uart_GetRemainingWords
uint32 Cdd_Uart_GetRemainingWords(
uint8 ChannelID,
CddUartDataDirectionType TransferType
)
Brief: Service to get remaining words to be transmitted from the UART for any ongoing transaction.
Service ID[hex] : 0x07
Sync/Async : Synchronous
Reentrancy : Reentrant
Parameters:
ChannelID - Channel number with ongoing write transaction
TransferType - Read or Write
Returns:
Size of the data left to be transmitted
Return: uint32
5.20.4.9. function Uart_Cdd_init
sint32 Uart_Cdd_init(
CddUart_Handle hUart
)
Brief: This API Initializes the UART instance.
Parameters:
hUart - Handle to the UART instance used
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.10. function Uart_Cdd_deInit
sint32 Uart_Cdd_deInit(
CddUart_Handle hUart
)
Brief: This API De-Initializes the UART instance.
Parameters:
hUart - Handle to the UART instance used
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.11. function Uart_Cdd_writeEx
sint32 Uart_Cdd_writeEx(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API writes data to the UART instance in Polling mode with exteded parameters.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.12. function Uart_Cdd_writeIntrEx
sint32 Uart_Cdd_writeIntrEx(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API writes data to the UART instance in Interrupt mode with exteded parameters.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.13. function Uart_Cdd_writeDmaEx
sint32 Uart_Cdd_writeDmaEx(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API writes data to the UART instance in DMA mode with exteded parameters.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.14. function Uart_Cdd_readEx
sint32 Uart_Cdd_readEx(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API reads data to the UART instance in Polling mode with exteded parameters.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.15. function Uart_Cdd_readIntrEx
sint32 Uart_Cdd_readIntrEx(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API reads data to the UART instance in Interrupt mode with exteded parameters.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.16. function Uart_Cdd_readDmaEx
sint32 Uart_Cdd_readDmaEx(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API reads data to the UART instance in DMA mode with exteded parameters.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.17. function Uart_Cdd_writeCancel
sint32 Uart_Cdd_writeCancel(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API cancels current UART Write.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.18. function Uart_Cdd_writeCancelDma
sint32 Uart_Cdd_writeCancelDma(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API cancels current UART Write in DMA mode.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.19. function Uart_Cdd_readCancel
sint32 Uart_Cdd_readCancel(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API cancels current UART Read.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32
5.20.4.20. function Uart_Cdd_readCancelDma
sint32 Uart_Cdd_readCancelDma(
CddUart_Handle hUart,
CddUart_Transaction * trans
)
Brief: This API cancels current UART Read in DMA mode.
Parameters:
hUart - Handle to the UART instance used
trans - Pointer to the transaction structure
Returns:
MCAL_SystemP_SUCCESS if successful else error on failure
Return: sint32