7.17. CDD_UART

7.17.1. Types

Base type

Type Name

Brief

enum

Cdd_Uart_Instance

Uart Configuration Instance ID.

enum

Cdd_Uart_WordLength

UART Word Length.

enum

Cdd_Uart_StopBits

UART Stop Bits.

enum

Cdd_Uart_Mode

UART Mode.

enum

Cdd_Uart_FifoLevel

UART FIFO Level.

enum

Cdd_Uart_ParityType

UART Parity Type.

typedef void(*)(void)

Cdd_Uart_CallbackType

Cdd Uart Callback type.

typedef uint8

Cdd_Uart_DataBufferType

Typedef for the data buffer elements.

7.17.1.1. enum Cdd_Uart_Instance

Enumerator

Value

Description

CDD_UART_INSTANCE_UARTA

0U

UARTA Config Instance.

CDD_UART_INSTANCE_UARTB

1U

UARTB Config Instance.

CDD_UART_INSTANCE_UARTC

2U

UARTC Config Instance.

CDD_UART_INSTANCE_UARTD

3U

UARTD Config Instance.

CDD_UART_INSTANCE_UARTE

4U

UARTE Config Instance.

CDD_UART_INSTANCE_UARTF

5U

UARTF Config Instance.

Brief: Uart Configuration Instance ID.

7.17.1.2. enum Cdd_Uart_WordLength

Enumerator

Value

Description

CDD_UART_WORD_LENGTH_5

0U

UART Word Length 5 bits.

CDD_UART_WORD_LENGTH_6

1U

UART Word Length 6 bits.

CDD_UART_WORD_LENGTH_7

2U

UART Word Length 7 bits.

CDD_UART_WORD_LENGTH_8

3U

UART Word Length 8 bits.

Brief: UART Word Length.

7.17.1.3. enum Cdd_Uart_StopBits

Enumerator

Value

Description

CDD_UART_STOP_BITS_1

0U

UART Stop Bits 1 bit.

CDD_UART_STOP_BITS_2

1U

UART Stop Bits 2 bits.

Brief: UART Stop Bits.

7.17.1.4. enum Cdd_Uart_Mode

Enumerator

Value

Description

CDD_UART_MODE_POLLING

0U

UART Mode Polling.

CDD_UART_MODE_INTERRUPT

1U

UART Mode Interrupt.

Brief: UART Mode.

7.17.1.5. enum Cdd_Uart_FifoLevel

Enumerator

Value

Description

CDD_UART_FIFO_LEVEL_1_8

0U

UART FIFO Level 1/8.

CDD_UART_FIFO_LEVEL_1_4

1U

UART FIFO Level 1/4.

CDD_UART_FIFO_LEVEL_1_2

2U

UART FIFO Level 1/2.

CDD_UART_FIFO_LEVEL_3_4

3U

UART FIFO Level 3/4.

CDD_UART_FIFO_LEVEL_7_8

4U

UART FIFO Level 7/8.

Brief: UART FIFO Level.

7.17.1.6. enum Cdd_Uart_ParityType

Enumerator

Value

Description

CDD_UART_PARITY_ODD

0x00U

Odd parity (EPS=0, SPS=0)

CDD_UART_PARITY_EVEN

0x04U

Even parity (EPS=1, SPS=0)

CDD_UART_PARITY_STICK_ZERO

0x84U

Stick parity zero (EPS=1, SPS=1): parity bit always transmitted/checked as 0.

CDD_UART_PARITY_STICK_ONE

0x80U

Stick parity one (EPS=0, SPS=1): parity bit always transmitted/checked as 1.

Brief: UART Parity Type.

UART Parity Type

Each enum value encodes the EPS (bit 2) and SPS (bit 7) field values of the UARTLCRH register directly. This allows the parity configuration to be applied with a single masked write: LCRH = (LCRH & ~(SPS|EPS)) | UART_LCRH_PEN | (uint32)ParityType

Bit layout (UARTLCRH): bit 7 = SPS (Stick Parity Select) bit 2 = EPS (Even Parity Select) bit 1 = PEN (Parity Enable) — always set when parity is enabled, not encoded here

7.17.1.7. typedef Cdd_Uart_CallbackType

typedef void(* Cdd_Uart_CallbackType) (void);

Brief: Cdd Uart Callback type.

7.17.1.8. typedef Cdd_Uart_DataBufferType

typedef uint8 Cdd_Uart_DataBufferType;

Brief: Typedef for the data buffer elements.

7.17.2. Structures

Name

Brief

Cdd_Uart_CfgType

UART configuration data structure for a channel.

Cdd_Uart_ConfigType

UART configuration structure for all channels in use.

Cdd_Uart_WriteStatusType

Typedef for the Write Status.

Cdd_Uart_ReadStatusType

Typedef for the Read Status.

7.17.3. Defines

Name

Brief

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_UART Driver.

CDD_UART_AR_RELEASE_MINOR_VERSION

AUTOSAR Minor version specification implemented by CDD_UART Driver.

CDD_UART_AR_RELEASE_REVISION_VERSION

AUTOSAR Patch version specification implemented by CDD_UART Driver.

CDD_UART_VENDOR_ID

Texas Instruments Vendor ID.

CDD_UART_MODULE_ID

CDD UART Driver Module ID.

CDD_UART_INSTANCE_ID

CDD UART Instance ID.

CDD_UART_E_UNINIT

API service used without module initialization.

CDD_UART_E_ALREADY_INITIALIZED

API Cdd_Uart_Init service called while the UART driver has already been initialized.

CDD_UART_E_PARAM_VALUE

API service called with invalid parameter value.

CDD_UART_E_PARAM_POINTER

API service called with invalid data buffer pointer.

CDD_UART_E_PARAM_HWINDEX

API service called with invalid hardware index.

CDD_UART_E_BUSY

CDD_UART_NO_ERROR

CDD_UART_SID_GET_VERSION_INFO

Cdd_Uart_GetVersionInfo API Service ID.

CDD_UART_SID_INIT

Cdd_Uart_Init() API Service ID.

CDD_UART_SID_DEINIT

Cdd_Uart_DeInit() API Service ID.

CDD_UART_SID_WRITE

Cdd_Uart_Write() API Service ID.

CDD_UART_SID_READ

Cdd_Uart_Read() API Service ID.

CDD_UART_SID_CANCEL_WRITE

Cdd_Uart_CancelWrite() API Service ID.

CDD_UART_SID_CANCEL_READ

Cdd_Uart_CancelRead() API Service ID.

CDD_UART_SID_GET_WRITE_STATUS

Cdd_Uart_GetWriteStatus() API Service ID.

CDD_UART_SID_GET_READ_STATUS

Cdd_Uart_GetReadStatus() API Service ID.

CDD_UART_SID_MAIN_FUN_WRITE

Cdd_Uart_MainFunction_Write() API Service ID.

CDD_UART_SID_POLL_READ

Cdd_Uart_Poll_Read() API Service ID.

CDD_UART_SID_ERROR_STATUS

Cdd_Uart_GetErrorStatus() API Service ID.

CDD_UART_SID_FLUSH_READ_BUFFER

Cdd_Uart_FlushReadFIFO() API Service ID.

7.17.4. Functions

Return type

Function Name

Brief

void

Cdd_Uart_GetVersionInfo(Std_VersionInfoType * VersionInfoPtr)

Service to provide the version information of Cdd Uart module.

void

Cdd_Uart_Init(const Cdd_Uart_ConfigType * ConfigPtr)

Cdd_Uart_Init : Initializes the CDD_UART module.

void

Cdd_Uart_Deinit(void )

Cdd_Uart_Deinit : De-initializes the CDD_UART module.

Std_ReturnType

Cdd_Uart_Write(uint8 HwUnitId, const Cdd_Uart_DataBufferType * SrcBufferPtr, uint32 Count)

Service to transmit data.

Std_ReturnType

Cdd_Uart_Read(uint8 HwUnitId, Cdd_Uart_DataBufferType * DestBufferPtr, uint32 Count)

Service to reception of data.

Std_ReturnType

Cdd_Uart_CancelWrite(uint8 HwUnitId)

Service to cancel the ongoing transmission.

Std_ReturnType

Cdd_Uart_CancelRead(uint8 HwUnitId)

Service to cancel the ongoing transmission.

Std_ReturnType

Cdd_Uart_GetWriteStatus(uint8 HwUnitId, Cdd_Uart_WriteStatusType * WriteStatus)

Service to get the status of the ongoing transmission.

Std_ReturnType

Cdd_Uart_GetReadStatus(uint8 HwUnitId, Cdd_Uart_ReadStatusType * ReadStatus)

Service to get the status of the ongoing transmission.

void

Cdd_Uart_MainFunction_Write(void )

Service to auto perform the polling of configured UART Write channel.

void

Cdd_Uart_Poll_Read(void )

Service to perform the polling of confgured UART Read channel by user.

Std_ReturnType

Cdd_Uart_GetErrorStatus(uint8 HwUnitId, uint8 * ErrorStatus)

Service to get the status of the Uart error. User can use this service in the Error callback implementation to fetch the exact Uart Error.

void

Cdd_Uart_FlushReadFIFO(uint8 HwUnitId)

Service to flush the read buffer. User can use this service to flush the readbuffer incase of any unread data after any Uart Error.

7.17.4.1. function Cdd_Uart_GetVersionInfo

void Cdd_Uart_GetVersionInfo(
    Std_VersionInfoType * VersionInfoPtr
)

Brief: Service to provide the version information of Cdd Uart module.

Parameters:

  • VersionInfoPtr is the pointer to CDD UART driver version information

Returns:

  • None

Return: None

Precondition: This API is available only if CDD_UART_GET_VERSION_INFO_API is STD_ON

Postcondition: None

7.17.4.2. function Cdd_Uart_Init

void Cdd_Uart_Init(
    const Cdd_Uart_ConfigType * ConfigPtr
)

Brief: Cdd_Uart_Init : Initializes the CDD_UART module.

This service initialize the CDD_UART driver

Parameters:

  • ConfigPtr Pointer to CDD_UART driver configuration set

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

7.17.4.3. function Cdd_Uart_Deinit

void Cdd_Uart_Deinit(
    void 
)

Brief: Cdd_Uart_Deinit : De-initializes the CDD_UART module.

This service deinitialize the CDD_UART driver

Returns:

  • None

Return: None

Precondition: Cdd_Uart_Init should be called first, before calling this service.

Postcondition: None

7.17.4.4. function Cdd_Uart_Write

Std_ReturnType Cdd_Uart_Write(
    uint8 HwUnitId,
    const Cdd_Uart_DataBufferType * SrcBufferPtr,
    uint32 Count
)

Brief: Service to transmit data.

Parameters:

  • HwUnitId number to be used for writing data

  • SrcBufferPtr - Pointer to source data buffer

  • Count - number of data elements to be transmitted from SrcBufferPtr

Returns:

  • E_OK Write request has been accepted.

  • E_NOT_OK Write request has not been accepted.

Return: Cdd_Uart_Write request is accepted or not

Precondition: None

Postcondition: None

7.17.4.5. function Cdd_Uart_Read

Std_ReturnType Cdd_Uart_Read(
    uint8 HwUnitId,
    Cdd_Uart_DataBufferType * DestBufferPtr,
    uint32 Count
)

Brief: Service to reception of data.

Parameters:

  • HwUnitId number to be used for writing data

  • DestBufferPtr - Pointer to dest data buffer

  • Count - number of data elements to be read into DestBufferPtr

Returns:

  • E_OK Read request has been accepted.

  • E_NOT_OK Read request has not been accepted.

Return: Cdd_Uart_Read request is accepted or not

Precondition: None

Postcondition: None

7.17.4.6. function Cdd_Uart_CancelWrite

Std_ReturnType Cdd_Uart_CancelWrite(
    uint8 HwUnitId
)

Brief: Service to cancel the ongoing transmission.

Parameters:

  • HwUnitId number to be used for cancellation of Write

Returns:

  • E_OK CancelWrite request has been accepted.

  • E_NOT_OK CancelWrite request has not been accepted.

Return: Cdd_Uart_CancelWrite request is accepted or not

Precondition: None

Postcondition: None

7.17.4.7. function Cdd_Uart_CancelRead

Std_ReturnType Cdd_Uart_CancelRead(
    uint8 HwUnitId
)

Brief: Service to cancel the ongoing transmission.

Parameters:

  • HwUnitId number to be used for cancellation of Write

Returns:

  • E_OK CancelRead request has been accepted.

  • E_NOT_OK CancelRead request has not been accepted.

Return: Cdd_Uart_CancelRead request is accepted or not

Precondition: None

Postcondition: None

7.17.4.8. function Cdd_Uart_GetWriteStatus

Std_ReturnType Cdd_Uart_GetWriteStatus(
    uint8 HwUnitId,
    Cdd_Uart_WriteStatusType * WriteStatus
)

Brief: Service to get the status of the ongoing transmission.

Parameters:

  • HwUnitId hw id to be used for status of Write

  • WriteStatus pointer to Cdd_Uart_WriteStatusType

Returns:

  • E_OK GetWriteStatus request has been accepted.

  • E_NOT_OK GetWriteStatus request has not been accepted.

Return: Cdd_Uart_GetWriteStatus request is accepted or not

Precondition: None

Postcondition: None

7.17.4.9. function Cdd_Uart_GetReadStatus

Std_ReturnType Cdd_Uart_GetReadStatus(
    uint8 HwUnitId,
    Cdd_Uart_ReadStatusType * ReadStatus
)

Brief: Service to get the status of the ongoing transmission.

Parameters:

  • HwUnitId hw id to be used for status of Read

  • ReadStatus pointer to Cdd_Uart_ReadStatusType

Returns:

  • E_OK GetReadStatus request has been accepted.

  • E_NOT_OK GetReadStatus request has not been accepted.

Return: Cdd_Uart_GetReadStatus request is accepted or not

Precondition: None

Postcondition: None

7.17.4.10. function Cdd_Uart_MainFunction_Write

void Cdd_Uart_MainFunction_Write(
    void 
)

Brief: Service to auto perform the polling of configured UART Write channel.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

7.17.4.11. function Cdd_Uart_Poll_Read

void Cdd_Uart_Poll_Read(
    void 
)

Brief: Service to perform the polling of confgured UART Read channel by user.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

7.17.4.12. function Cdd_Uart_GetErrorStatus

Std_ReturnType Cdd_Uart_GetErrorStatus(
    uint8 HwUnitId,
    uint8 * ErrorStatus
)

Brief: Service to get the status of the Uart error. User can use this service in the Error callback implementation to fetch the exact Uart Error.

Parameters:

  • HwUnitId hw id to be used for status of Error

  • ErrorStatus pointer to Cdd_Uart_Error type

Returns:

  • E_OK Error status request has been accepted

  • E_NOT_OK Error status request has not been accepted

Return: Uart error : PE,OE,BE,FE

Precondition: None

Postcondition: None

7.17.4.13. function Cdd_Uart_FlushReadFIFO

void Cdd_Uart_FlushReadFIFO(
    uint8 HwUnitId
)

Brief: Service to flush the read buffer. User can use this service to flush the readbuffer incase of any unread data after any Uart Error.

Parameters:

  • HwUnitId hw id to be used to flush the read buffer

Returns:

  • None

Return: None

Precondition: None

Postcondition: None