7.13. CDD_I2C

More…

7.13.1. Types

Base type

Type Name

Brief

enum

Cdd_I2c_HwUnitStatusType

This is an enum containing the possible HW unit states states. The default HW unit state is CDD_I2C_HW_UNIT_FREE.

enum

Cdd_I2c_ComponentStatusType

This is an enum containing the possible driver states. The default driver state is CDD_I2C_UNINIT.

enum

Cdd_I2c_HandlingType

This is an enum containing the possible variants of arbitration loss timeout handling.

enum

Cdd_I2c_ChannelResultType

This is an enum containing all the possible channel results The default channel state is CDD_I2C_CH_RESULT_OK.

enum

Cdd_I2c_SequenceResultType

This type defines a range of specific sequences status for the I2C Driver.

enum

Cdd_I2c_RestartModeType

This is an enum containing the possible restart modes. The default mode is CDD_I2C_RESTART_MODE_NOSTOP.

typedef uint16

Cdd_I2c_AddressType

This type defines the addresss size.

typedef uint8

Cdd_I2c_DirectionType

This type defines the direction of operation - write or read.

typedef uint8

Cdd_I2c_DataType

This type defines the data to be transmitted using the CDD_I2C Driver.

typedef uint8 *

Cdd_I2c_DataPtrType

Definition for the pointer type for general buffer handling.

typedef const uint8 *

Cdd_I2c_DataConstPtrType

Definition for the pointer type for TX buffer handling.

typedef uint8

Cdd_I2c_HwUnitType

Specifies the identification (ID) for a CDD_I2C Hardware unit.

typedef uint8

Cdd_I2c_SequenceType

This is the type for a sequence identifier.

typedef uint8

Cdd_I2c_ChannelType

This is the type for a Ch identifier.

typedef uint16

Cdd_I2c_DataLengthType

Type to define the number of data elements to be sent and/or received during a transmission.

typedef void(*)(void)

Cdd_I2c_SequenceEndNotification

Callback routine provided by the user for each Sequence to notify the caller that a Sequence has been finished.

typedef void(*)(uint8 errorCode)

Cdd_I2c_SequenceErrorNotification

Callback routine provided by the user for each Sequence to notify the caller that a Sequence has been finished with an error.

typedef void(*)(Cdd_I2c_HwUnitType hwUnitId)

Cdd_I2c_TargetRxStartNotificationType

Target RX start notification callback - called on start condition.

typedef void(*)(Cdd_I2c_HwUnitType hwUnitId)

Cdd_I2c_TargetTxStartNotificationType

Target TX start notification callback - called on start condition.

typedef void(*)(Cdd_I2c_HwUnitType hwUnitId, Cdd_I2c_DataPtrType pRxBuffer, Cdd_I2c_DataLengthType rxCount, uint8 event)

Cdd_I2c_TargetRxCompleteNotificationType

Target RX complete notification callback - called on stop condition or the buffer is fully filled.

typedef void(*)(Cdd_I2c_HwUnitType hwUnitId, Cdd_I2c_DataConstPtrType pTxBuffer, Cdd_I2c_DataLengthType txCount, uint8 event)

Cdd_I2c_TargetTxCompleteNotificationType

Target TX complete notification callback - called on stop condition or the buffer is fully transferred.

typedef void(*)(Cdd_I2c_HwUnitType hwUnitId, uint8 errorEvent)

Cdd_I2c_TargetErrorNotificationType

Target error notification callback - called on bus error conditions.

7.13.1.1. enum Cdd_I2c_HwUnitStatusType

Enumerator

Value

Description

CDD_I2C_HW_UNIT_FREE

CDD_I2C Hardware unit not in use by a sequence.

CDD_I2C_HW_UNIT_BUSY

CDD_I2C Hardware unit in use by a sequence.

Brief: This is an enum containing the possible HW unit states states. The default HW unit state is CDD_I2C_HW_UNIT_FREE.

7.13.1.2. enum Cdd_I2c_ComponentStatusType

Enumerator

Value

Description

CDD_I2C_UNINIT

I2C driver is uninitialized.

CDD_I2C_IDLE

I2C driver is idle.

CDD_I2C_BUSY

I2C driver is busy.

Brief: This is an enum containing the possible driver states. The default driver state is CDD_I2C_UNINIT.

7.13.1.3. enum Cdd_I2c_HandlingType

Enumerator

Value

Description

CDD_I2C_BURST_MODE

In case bus is busy detach from I2C bus.

CDD_I2C_RECURRENT_MODE

In case bus is busy try to recover I2C bus.

Brief: This is an enum containing the possible variants of arbitration loss timeout handling.

7.13.1.4. enum Cdd_I2c_ChannelResultType

Enumerator

Value

Description

CDD_I2C_CH_RESULT_OK

I2C channel transmission not in progress.

CDD_I2C_CH_RESULT_NOT_OK

I2C channel transmission is not OK.

CDD_I2C_CH_RESULT_PENDING

I2C channel transmission is in progress.

CDD_I2C_CH_RESULT_BUSFAIL

I2C channel transmission failed due to bus unavailability.

CDD_I2C_CH_RESULT_ARBFAIL

I2C channel transmission failed due to arbitration loss.

CDD_I2C_CH_RESULT_NACKFAIL

I2C channel transmission failed due to bus NACK.

CDD_I2C_CH_RESULT_HW_UNIT_RESET

I2C channel transmission failed due to HW unit reset.

Brief: This is an enum containing all the possible channel results The default channel state is CDD_I2C_CH_RESULT_OK.

7.13.1.5. enum Cdd_I2c_SequenceResultType

Enumerator

Value

Description

CDD_I2C_SEQ_OK

0x00U

The last transmission of the Sequence has been finished successfully.

CDD_I2C_SEQ_PENDING

0x01U

The I2C Driver is performing an I2C Sequence. The meaning of this status is equal to I2C_BUSY.

CDD_I2C_SEQ_QUEUED

0x02U

An I2C Sequence is queued and waiting to be transmitted.

CDD_I2C_SEQ_NACK

0x03U

An I2C Sequence encountered a NACK signal.

CDD_I2C_SEQ_FAILED

0x04U

The last transmission of the Sequence has failed.

CDD_I2C_SEQ_CANCELLED

0x05U

I2C sequence transmission cancelled from queue.

CDD_I2C_SEQ_NOT_OK

0x06U

I2C sequence transmission is not OK.

CDD_I2C_SEQ_ARB

0x07U

An I2C Sequence encountered a arbitration loss.

CDD_I2C_SEQ_HW_UNIT_RESET

0x08U

An I2C Sequence was terminated due to HW unit reset (bus-off recovery)

Brief: This type defines a range of specific sequences status for the I2C Driver.

7.13.1.6. enum Cdd_I2c_RestartModeType

Enumerator

Value

Description

CDD_I2C_RESTART_MODE_STOP

CDD_I2C restart mode with stop at end of each transaction/channel write/read.

CDD_I2C_RESTART_MODE_NOSTOP

CDD_I2C restart mode with no stop at end of each transaction/channel write/read, by default there is start at begining of each transaction.

Brief: This is an enum containing the possible restart modes. The default mode is CDD_I2C_RESTART_MODE_NOSTOP.

7.13.1.7. typedef Cdd_I2c_AddressType

typedef uint16 Cdd_I2c_AddressType;

Brief: This type defines the addresss size.

7.13.1.8. typedef Cdd_I2c_DirectionType

typedef uint8 Cdd_I2c_DirectionType;

Brief: This type defines the direction of operation - write or read.

7.13.1.9. typedef Cdd_I2c_DataType

typedef uint8 Cdd_I2c_DataType;

Brief: This type defines the data to be transmitted using the CDD_I2C Driver.

7.13.1.10. typedef Cdd_I2c_DataPtrType

typedef uint8* Cdd_I2c_DataPtrType;

Brief: Definition for the pointer type for general buffer handling.

7.13.1.11. typedef Cdd_I2c_DataConstPtrType

typedef const uint8* Cdd_I2c_DataConstPtrType;

Brief: Definition for the pointer type for TX buffer handling.

7.13.1.12. typedef Cdd_I2c_HwUnitType

typedef uint8 Cdd_I2c_HwUnitType;

Brief: Specifies the identification (ID) for a CDD_I2C Hardware unit.

7.13.1.13. typedef Cdd_I2c_SequenceType

typedef uint8 Cdd_I2c_SequenceType;

Brief: This is the type for a sequence identifier.

7.13.1.14. typedef Cdd_I2c_ChannelType

typedef uint8 Cdd_I2c_ChannelType;

Brief: This is the type for a Ch identifier.

7.13.1.15. typedef Cdd_I2c_DataLengthType

typedef uint16 Cdd_I2c_DataLengthType;

Brief: Type to define the number of data elements to be sent and/or received during a transmission.

7.13.1.16. typedef Cdd_I2c_SequenceEndNotification

typedef void(* Cdd_I2c_SequenceEndNotification) (void);

Brief: Callback routine provided by the user for each Sequence to notify the caller that a Sequence has been finished.

7.13.1.17. typedef Cdd_I2c_SequenceErrorNotification

typedef void(* Cdd_I2c_SequenceErrorNotification) (uint8 errorCode);

Brief: Callback routine provided by the user for each Sequence to notify the caller that a Sequence has been finished with an error.

Parameters:

  • errorCode Sequence error code

7.13.1.18. typedef Cdd_I2c_TargetRxStartNotificationType

typedef void(* Cdd_I2c_TargetRxStartNotificationType) (Cdd_I2c_HwUnitType hwUnitId);

Brief: Target RX start notification callback - called on start condition.

Parameters:

  • hwUnitId I2C instance

7.13.1.19. typedef Cdd_I2c_TargetTxStartNotificationType

typedef void(* Cdd_I2c_TargetTxStartNotificationType) (Cdd_I2c_HwUnitType hwUnitId);

Brief: Target TX start notification callback - called on start condition.

Parameters:

  • hwUnitId I2C instance

7.13.1.20. typedef Cdd_I2c_TargetRxCompleteNotificationType

typedef void(* Cdd_I2c_TargetRxCompleteNotificationType) (Cdd_I2c_HwUnitType hwUnitId, Cdd_I2c_DataPtrType pRxBuffer, Cdd_I2c_DataLengthType rxCount, uint8 event);

Brief: Target RX complete notification callback - called on stop condition or the buffer is fully filled.

Parameters:

  • hwUnitId I2C instance

  • pRxBuffer Pointer to RX data buffer given at time of submit

  • rxCount Number of bytes actually received

  • event CDD_I2C_TARGET_EVENT_TRANSFER_COMPLETE or CDD_I2C_TARGET_EVENT_STOP

7.13.1.21. typedef Cdd_I2c_TargetTxCompleteNotificationType

typedef void(* Cdd_I2c_TargetTxCompleteNotificationType) (Cdd_I2c_HwUnitType hwUnitId, Cdd_I2c_DataConstPtrType pTxBuffer, Cdd_I2c_DataLengthType txCount, uint8 event);

Brief: Target TX complete notification callback - called on stop condition or the buffer is fully transferred.

Parameters:

  • hwUnitId I2C instance

  • pTxBuffer Pointer to TX data buffer

  • txCount Number of bytes actually transmitted

  • event CDD_I2C_TARGET_EVENT_TRANSFER_COMPLETE or CDD_I2C_TARGET_EVENT_STOP

7.13.1.22. typedef Cdd_I2c_TargetErrorNotificationType

typedef void(* Cdd_I2c_TargetErrorNotificationType) (Cdd_I2c_HwUnitType hwUnitId, uint8 errorEvent);

Brief: Target error notification callback - called on bus error conditions.

Parameters:

  • hwUnitId I2C instance

  • errorEvent Error Events: CDD_I2C_TARGET_EVENT_NO_BUFFER, CDD_I2C_TARGET_EVENT_TX_UNDERFLOW, CDD_I2C_TARGET_EVENT_RX_OVERFLOW, CDD_I2C_TARGET_EVENT_NACK

7.13.2. Structures

Name

Brief

Cdd_I2c_HwUnitConfigType

CDD_I2C Hardware unit configuration structure.

Cdd_I2c_ChConfigType

CDD_I2C Channel configuration structure.

Cdd_I2c_SequenceConfigType

CDD_I2C Sequence configuration structure.

Cdd_I2c_ConfigType

CDD_I2C config structure.

7.13.3. Defines

Name

Brief

CDD_I2C_CFG_MAJOR_VERSION

I2C configuration Major Version.

CDD_I2C_CFG_MINOR_VERSION

I2C configuration Minor Version.

CDD_I2C_CFG_PATCH_VERSION

I2C configuration Patch Version.

CDD_I2C_HW_UNIT_I2CA

HW unit 0.

CDD_I2C_HW_UNIT_I2CB

HW unit 1.

CDD_I2C_SW_MAJOR_VERSION

Driver Implementation Major Version.

CDD_I2C_SW_MINOR_VERSION

Driver Implementation Minor Version.

CDD_I2C_SW_PATCH_VERSION

Driver Implementation Patch Version.

CDD_I2C_AR_RELEASE_MAJOR_VERSION

AUTOSAR Major version specification implemented by CDD_I2C Driver.

CDD_I2C_AR_RELEASE_MINOR_VERSION

AUTOSAR Minor version specification implemented by CDD_I2C Driver.

CDD_I2C_AR_RELEASE_REVISION_VERSION

AUTOSAR Patch version specification implemented by CDD_I2C Driver.

CDD_I2C_VENDOR_ID

Texas Instruments Vendor ID.

CDD_I2C_MODULE_ID

CDD_I2C Driver Module ID.

CDD_I2C_INSTANCE_ID

CDD_I2C Instance ID.

CDD_I2C_SID_INIT

Service ID Cdd_I2c_Init()

CDD_I2C_SID_DEINIT

Service ID Cdd_I2c_DeInit()

CDD_I2C_SID_GET_VERSION_INFO

Service ID Cdd_I2c_GetVersionInfo()

CDD_I2C_SID_SETUP_EB

Service ID Cdd_I2c_SetupEB()

CDD_I2C_SID_SETUP_EB_DYNAMIC

Service ID Cdd_I2c_SetupDynamicEB()

CDD_I2C_SID_ASYNC_TRANSMIT

Service ID Cdd_I2c_AsyncTransmit()

CDD_I2C_SID_CANCEL

Service ID Cdd_I2c_Cancel()

CDD_I2C_SID_GET_RESULT

Service ID Cdd_I2c_GetResult()

CDD_I2C_SID_GET_SEQUENCE_RESULT

Service ID Cdd_I2c_GetSequenceResult()

CDD_I2C_SID_MAIN_FUNCTION

Service ID Cdd_I2c_MainFunction()

CDD_I2C_SID_GET_STATUS

Service ID Cdd_I2c_GetStatus()

CDD_I2C_SID_RESET_HW_UNIT

Service ID Cdd_I2c_ResetHwUnit()

CDD_I2C_SID_TARGET_START

Service ID Cdd_I2c_TargetStart()

CDD_I2C_SID_TARGET_STOP

Service ID Cdd_I2c_TargetStop()

CDD_I2C_SID_TARGET_SUBMIT_TX_BUF

Service ID Cdd_I2c_TargetSubmitTxBuffer()

CDD_I2C_SID_TARGET_SUBMIT_RX_BUF

Service ID Cdd_I2c_TargetSubmitRxBuffer()

CDD_I2C_E_NO_ERROR

No errors.

CDD_I2C_E_UNINIT

Error code for not initialized module.

CDD_I2C_E_ALREADY_INITIALIZED

Init service called twice without deinit.

CDD_I2C_E_PARAM_CHANNEL

Channel out of bounds, exceeds the maximum number of configured channels.

CDD_I2C_E_PARAM_SEQUENCE

Sequence out of bounds, exceeds the maximum number of configured sequences.

CDD_I2C_E_PARAM_LENGTH

Length out of bounds – a zero length is not accepted.

CDD_I2C_E_PARAM_VINFO_PTR

An invalid version info pointer has been passed (a NULL_PTR)

CDD_I2C_E_PARAM_CONFIG

An invalid configuration has been passed (a non NULL_PTR)

CDD_I2C_E_PARAM_TRANS_BUFFER

Two in-valid transmission buffers have been passed (no NULL_PTR/ or both NULL_PTR)

CDD_I2C_E_PARAM_ADDRESS

Address out of bounds, exceeds the limit of the configured address range.

CDD_I2C_E_PARAM_DIRECTION

Buffer direction conflicts with channel direction set via EB.

CDD_I2C_E_PARAM_HWUNIT

API service called with invalid HW unit ID.

CDD_I2C_E_SEQ_BUSY

API service called with sequence is busy.

CDD_I2C_E_PARAM_MODE

API service called with invalid mode - controller or target.

CDD_I2C_E_NACK_RECEIVED

Error is reported if NACK was received.

CDD_I2C_E_ARBITRATION_FAILURE

Error is reported if the master loses arbitration. This usually happens if the SDA is stuck low or another master has won the arbitration procedure.

CDD_I2C_E_BUS_FAILURE

Error is reported if the SCL line is stuck low.

CDD_I2C_E_CANCELLED

Sequence cancelled.

CDD_I2C_E_RX_OVERFLOW

RX buffer overflow - applicable only in target mode.

CDD_I2C_E_TX_UNDERFLOW

TX buffer underflow - applicable only in target mode.

CDD_I2C_E_NO_BUFFER

No buffer submitted - applicable only in target mode.

CDD_I2C_E_HW_UNIT_RESET

HW unit reset error.

CDD_I2C_WRITE

CDD_I2C direction - write.

CDD_I2C_READ

CDD_I2C direction - read.

CDD_I2C_ADDRESS_7_BIT

7 bit address

CDD_I2C_ADDRESS_10_BIT

10 bit address

CDD_I2C_MODE_CONTROLLER

HW unit operates as I2C controller (master)

CDD_I2C_MODE_TARGET

HW unit operates as I2C target (slave)

CDD_I2C_TARGET_EVENT_TRANSFER_COMPLETE

CDD_I2C_TARGET_EVENT_STOP

CDD_I2C_TARGET_EVENT_NO_BUFFER

CDD_I2C_TARGET_EVENT_TX_UNDERFLOW

CDD_I2C_TARGET_EVENT_RX_OVERFLOW

CDD_I2C_TARGET_EVENT_NACK

CDD_I2C_PRE_COMPILE_VARIANT

I2C Build Variant. Build variants.(i.e Pre Compile and Post Build)

CDD_I2C_CONFIG_PC

Precompile variant macro.

CDD_I2C_POLLING_MODE

STD_ON if any HW unit uses polling.

CDD_I2C_INTERRUPT_MODE

STD_ON if any HW unit uses interrupts.

CDD_I2C_CONTROLLER_ACTIVE

STD_ON if any HW unit is in controller mode.

CDD_I2C_TARGET_ACTIVE

STD_ON if any HW unit is in target mode.

CDD_I2C_DEV_ERROR_DETECT

Enable/Disable I2C dev detect error.

CDD_I2C_VERSION_INFO_API

Version info API macro.

CDD_I2C_CANCEL_API

Check to enable cancel API.

CDD_I2C_GET_STATUS_API

Check to enable get driver status API.

CDD_I2C_HW_UNIT_MAX

Maximum supported HW units for the SOC.

CDD_I2C_MAX_CH_PER_SEQ

Maximum channels allowed per sequence.

CDD_I2C_MAX_CH

Maximum channels across all sequence/hwunit.

CDD_I2C_MAX_SEQ

Maximum sequence across all hwunit.

CDD_I2C_MAX_HW_UNIT

Maximum HW unit.

CDD_I2C_HW_UNIT_I2CA_ACTIVE

CDD_I2C_HW_UNIT_I2CB_ACTIVE

CDD_I2C_HW_UNIT_I2CA_CONTROLLER_INT_MODE

CDD_I2C_HW_UNIT_I2CA_ISR_CAT2_INT

CDD_I2C_HW_UNIT_I2CB_CONTROLLER_INT_MODE

CDD_I2C_HW_UNIT_I2CB_ISR_CAT2_INT

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_0

Symbolic Name for I2c Sequence 0.

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_1

Symbolic Name for I2c Sequence 1.

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_2

Symbolic Name for I2c Sequence 2.

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_3

Symbolic Name for I2c Sequence 3.

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_4

Symbolic Name for I2c Sequence 4.

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_5

Symbolic Name for I2c Sequence 5.

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_6

Symbolic Name for I2c Sequence 6.

CddI2cConf_CddI2cSeqConfig_CddI2cSeqConfig_7

Symbolic Name for I2c Sequence 7.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_0

Symbolic Name for I2c Channel 0.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_1

Symbolic Name for I2c Channel 1.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_2

Symbolic Name for I2c Channel 2.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_3

Symbolic Name for I2c Channel 3.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_4

Symbolic Name for I2c Channel 4.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_5

Symbolic Name for I2c Channel 5.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_6

Symbolic Name for I2c Channel 6.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_7

Symbolic Name for I2c Channel 7.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_8

Symbolic Name for I2c Channel 8.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_9

Symbolic Name for I2c Channel 9.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_10

Symbolic Name for I2c Channel 10.

CddI2cConf_CddI2cChConfig_CddI2cChConfig_11

Symbolic Name for I2c Channel 11.

7.13.4. Functions

Return type

Function Name

Brief

void

Cdd_I2c_Init(const Cdd_I2c_ConfigType * configPtr)

Service for CDD_I2C initialization.

Std_ReturnType

Cdd_I2c_DeInit(void )

Service for CDD_I2C driver de-initialization.

void

Cdd_I2c_GetVersionInfo(Std_VersionInfoType * versionInfo)

Service that returns the version information of the module.

Std_ReturnType

Cdd_I2c_SetupEB(Cdd_I2c_ChannelType chId, Cdd_I2c_DataConstPtrType txDataBufferPtr, Cdd_I2c_DataPtrType rxDataBufferPtr, Cdd_I2c_DataLengthType length)

Service to setup the buffers and the length of data for the Ch specified.

Std_ReturnType

Cdd_I2c_SetupEBDynamic(Cdd_I2c_ChannelType chId, Cdd_I2c_AddressType deviceAddress, Cdd_I2c_DataConstPtrType txDataBufferPtr, Cdd_I2c_DataPtrType rxDataBufferPtr, Cdd_I2c_DataLengthType length)

Service to setup the buffers and the length of data for the Ch specified.

Std_ReturnType

Cdd_I2c_AsyncTransmit(Cdd_I2c_SequenceType sequenceId)

The service conducts an asynchronous data transmission according to the parameters provided to the Cdd_I2c_SetupEB() service. The callback Cdd_I2c_SequenceErrorNotification() is called, when the asynchronous operation has finished.

Std_ReturnType

Cdd_I2c_Cancel(Cdd_I2c_SequenceType sequenceId)

Cancel a transmission.

void

Cdd_I2c_MainFunction(void )

Makes a target channel available for processing requests (addressing). When called, the target channel becomes available for starting incoming or outgoing transfers.

Cdd_I2c_SequenceResultType

Cdd_I2c_GetSequenceResult(Cdd_I2c_SequenceType sequenceId)

This service returns the current status of the given SequenceId.

Cdd_I2c_ChannelResultType

Cdd_I2c_GetResult(Cdd_I2c_ChannelType chId)

This service returns the current status of the given channel.

Std_ReturnType

Cdd_I2c_ResetHwUnit(Cdd_I2c_HwUnitType hwUnitId)

Service to reset and recover a single I2C HW unit from a bus-off condition.

Cdd_I2c_ComponentStatusType

Cdd_I2c_GetStatus(void )

This service returns the module’s status.

Std_ReturnType

Cdd_I2c_TargetStart(Cdd_I2c_HwUnitType hwUnitId)

This service starts the target-mode for the provided HW unit ID This enables interrupts and targets will start responding to I2C events after this.

Std_ReturnType

Cdd_I2c_TargetStop(Cdd_I2c_HwUnitType hwUnitId)

This service stops the target-mode for the provided HW unit ID. This disables interrupts and targets will not respond to I2C events after this.

Std_ReturnType

Cdd_I2c_TargetSubmitTxBuffer(Cdd_I2c_HwUnitType hwUnitId, Cdd_I2c_DataConstPtrType pTxBuffer, Cdd_I2c_DataLengthType txBufferSize)

Submit TX buffer - call before Start or in TX Notification callback to provide a new buffer to work with.

Std_ReturnType

Cdd_I2c_TargetSubmitRxBuffer(Cdd_I2c_HwUnitType hwUnitId, Cdd_I2c_DataPtrType pRxBuffer, Cdd_I2c_DataLengthType rxBufferSize)

Submit RX buffer - call before Start or in RX Notification callback to provide a new buffer to work with.

void

I2c_appSeqComplete(void )

void

I2c_appSeqFail(uint8 errorCode)

7.13.4.1. function Cdd_I2c_Init

void Cdd_I2c_Init(
    const Cdd_I2c_ConfigType * configPtr
)

Brief: Service for CDD_I2C initialization.

Initialize the CDD_I2C hardware for each Cdd_I2cChannel using the Cdd_I2cHwUnitBaseAddress and configure the Cdd_I2cBaudRate accordingly.

Note: This API is applicable for both controller and target mode.

Service ID[hex] - CDD_I2C_SID_INIT Sync/Async - Synchronous Reentrancy - Non Reentrant

Parameters:

  • configPtr Pointer to CDD_I2C Driver configuration set

Return: None

Precondition: Preconditions - Driver not already initialized

Postcondition: Postconditions - Driver in initialized state

7.13.4.2. function Cdd_I2c_DeInit

Std_ReturnType Cdd_I2c_DeInit(
    void 
)

Brief: Service for CDD_I2C driver de-initialization.

CDD_I2C_DeInit de-initializes the CDD_I2C peripheral(s) into a Power On Reset state.

Note: This API is applicable for both controller and target mode.

Service ID[hex] - CDD_I2C_SID_DEINIT Sync/Async - Synchronous Reentrancy - Non Reentrant

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected

Return: Std_ReturnType

Precondition: None

Postcondition: None

7.13.4.3. function Cdd_I2c_GetVersionInfo

void Cdd_I2c_GetVersionInfo(
    Std_VersionInfoType * versionInfo
)

Brief: Service that returns the version information of the module.

Note: This API is applicable for both controller and target mode.

Service ID[hex] - CDD_I2C_SID_GET_VERSION_INFO Sync/Async - Synchronous Reentrancy - Reentrant

Parameters:

  • versionInfo Pointer to where to store the version information of this module

Return: None

Precondition: This API is available only if CDD_I2C_VERSION_INFO_API is STD_ON

Postcondition: None

7.13.4.4. function Cdd_I2c_SetupEB

Std_ReturnType Cdd_I2c_SetupEB(
    Cdd_I2c_ChannelType chId,
    Cdd_I2c_DataConstPtrType txDataBufferPtr,
    Cdd_I2c_DataPtrType rxDataBufferPtr,
    Cdd_I2c_DataLengthType length
)

Brief: Service to setup the buffers and the length of data for the Ch specified.

Note: This API is applicable only for controller mode.

Service ID[hex] - CDD_I2C_SID_SETUP_EB Sync/Async - Synchronous Reentrancy - Non Reentrant

Parameters:

  • chId Channel to be used in the transmission

  • txDataBufferPtr Pointer to the TX transmission data location

  • rxDataBufferPtr Pointer to the RX transmission data location

  • length Length (number of data elements) of the data to be transmitted from TxDataBufferPtr and/or received from RxDataBufferPtr.

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected

Return: Std_ReturnType

Precondition: None

Postcondition: None

7.13.4.5. function Cdd_I2c_SetupEBDynamic

Std_ReturnType Cdd_I2c_SetupEBDynamic(
    Cdd_I2c_ChannelType chId,
    Cdd_I2c_AddressType deviceAddress,
    Cdd_I2c_DataConstPtrType txDataBufferPtr,
    Cdd_I2c_DataPtrType rxDataBufferPtr,
    Cdd_I2c_DataLengthType length
)

Brief: Service to setup the buffers and the length of data for the Ch specified.

Note: This API is applicable only for controller mode.

Service ID[hex] - CDD_I2C_SID_SETUP_EB_DYNAMIC Sync/Async - Synchronous Reentrancy - Non Reentrant

Parameters:

  • chId Channel to be used in the transmission

  • deviceAddress Any other value then zero will override the statically configured device address.

  • txDataBufferPtr Pointer to the TX transmission data location

  • rxDataBufferPtr Pointer to the RX transmission data location

  • length Length (number of data elements) of the data to be transmitted from TxDataBufferPtr and/or received from RxDataBufferPtr.

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected

Return: Std_ReturnType

Precondition: None

Postcondition: None

7.13.4.6. function Cdd_I2c_AsyncTransmit

Std_ReturnType Cdd_I2c_AsyncTransmit(
    Cdd_I2c_SequenceType sequenceId
)

Brief: The service conducts an asynchronous data transmission according to the parameters provided to the Cdd_I2c_SetupEB() service. The callback Cdd_I2c_SequenceErrorNotification() is called, when the asynchronous operation has finished.

Note: This API is applicable only for controller mode.

Service ID[hex] - CDD_I2C_SID_ASYNC_TRANSMIT Sync/Async - Synchronous Reentrancy - Non Reentrant

Parameters:

  • sequenceId Sequence used for data exchange

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected

Return: Std_ReturnType

Precondition: None

Postcondition: None

7.13.4.7. function Cdd_I2c_Cancel

Std_ReturnType Cdd_I2c_Cancel(
    Cdd_I2c_SequenceType sequenceId
)

Brief: Cancel a transmission.

A request that is already in transmission progress, is cancelled by finishing the current sequence. This is done to achieve a stable state with no undefined data. A queued transmission request is cancelled at once.

Note: This API is applicable only for controller mode.

Service ID[hex] - CDD_I2C_SID_CANCEL Sync/Async - Synchronous Reentrancy - Non Reentrant

Parameters:

  • sequenceId Sequence to cancel

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected

Return: Std_ReturnType

Precondition: None

Postcondition: None

7.13.4.8. function Cdd_I2c_MainFunction

void Cdd_I2c_MainFunction(
    void 
)

Brief: Makes a target channel available for processing requests (addressing). When called, the target channel becomes available for starting incoming or outgoing transfers.

Note: This API is applicable only for controller mode.

Service ID[hex] - CDD_I2C_SID_MAIN_FUNCTION Sync/Async - Asynchronous Reentrancy - Reentrant

Return: None

Precondition: None

Postcondition: None

7.13.4.9. function Cdd_I2c_GetSequenceResult

Cdd_I2c_SequenceResultType Cdd_I2c_GetSequenceResult(
    Cdd_I2c_SequenceType sequenceId
)

Brief: This service returns the current status of the given SequenceId.

Note: This API is applicable only for controller mode.

Service ID[hex] - CDD_I2C_SID_GET_SEQUENCE_RESULT Sync/Async - Synchronous Reentrancy - Reentrant

Parameters:

  • sequenceId Sequence to query

Return: CDD_I2C_SequenceResultType - Return the current status

Precondition: None

Postcondition: None

7.13.4.10. function Cdd_I2c_GetResult

Cdd_I2c_ChannelResultType Cdd_I2c_GetResult(
    Cdd_I2c_ChannelType chId
)

Brief: This service returns the current status of the given channel.

Note: This API is applicable only for controller mode.

Service ID[hex] - CDD_I2C_SID_GET_RESULT Sync/Async - Synchronous Reentrancy - Reentrant

Parameters:

  • chId Channel to query

Return: Cdd_I2c_ChannelResultType - Return the current status

Precondition: None

Postcondition: None

7.13.4.11. function Cdd_I2c_ResetHwUnit

Std_ReturnType Cdd_I2c_ResetHwUnit(
    Cdd_I2c_HwUnitType hwUnitId
)

Brief: Service to reset and recover a single I2C HW unit from a bus-off condition.

This API performs a hard reset of the specified I2C hardware unit without attempting a STOP condition on the bus. Use this when the bus is stuck (e.g. SCL held low by a faulty target) and Cdd_I2c_Cancel cannot complete because the state machine is unable to progress.

The reset performs the following:

  • Disables all interrupts on the HW unit

  • Marks the currently active channel (if any) with CDD_I2C_CH_RESULT_BUSFAIL

  • Drains all queued channels on this HW unit and marks them with CDD_I2C_CH_RESULT_BUSFAIL. All channels on this HW unit are affected, including channels belonging to different sequences queued on the same HW unit.

  • For each affected sequence whose pending channel count reaches zero, the sequence result is set to CDD_I2C_SEQ_HW_UNIT_RESET and the sequence error notification callback (errorNotify) is invoked with CDD_I2C_E_BUS_FAILURE if configured.

  • Re-initializes the HW unit registers (baud rate, address, mode)

  • Sets the HW unit status to free for new transfers

Service ID[hex] - CDD_I2C_SID_RESET_HW_UNIT Sync/Async - Synchronous Reentrancy - Non Reentrant

Parameters:

  • hwUnitId I2C HW unit ID to reset

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected (invalid params or driver not init)

Return: Std_ReturnType

Precondition: Driver must be initialized

Postcondition: HW unit is reset and ready for new transfers

7.13.4.12. function Cdd_I2c_GetStatus

Cdd_I2c_ComponentStatusType Cdd_I2c_GetStatus(
    void 
)

Brief: This service returns the module’s status.

Service ID[hex] - CDD_I2C_SID_GET_STATUS Sync/Async - Synchronous Reentrancy - Reentrant

Return: Cdd_I2c_ComponentStatusType - Return the current status

Precondition: None

Postcondition: None

7.13.4.13. function Cdd_I2c_TargetStart

Std_ReturnType Cdd_I2c_TargetStart(
    Cdd_I2c_HwUnitType hwUnitId
)

Brief: This service starts the target-mode for the provided HW unit ID This enables interrupts and targets will start responding to I2C events after this.

Note: This API is applicable only for target mode.

Service ID[hex] - CDD_I2C_SID_TARGET_START Sync/Async - Synchronous Reentrancy - Reentrant

Parameters:

  • hwUnitId I2C HW unit ID

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected

Return: Std_ReturnType

Precondition: None

Postcondition: None

7.13.4.14. function Cdd_I2c_TargetStop

Std_ReturnType Cdd_I2c_TargetStop(
    Cdd_I2c_HwUnitType hwUnitId
)

Brief: This service stops the target-mode for the provided HW unit ID. This disables interrupts and targets will not respond to I2C events after this.

Note: This API is applicable only for target mode.

Service ID[hex] - CDD_I2C_SID_TARGET_STOP Sync/Async - Synchronous Reentrancy - Reentrant

Parameters:

  • hwUnitId I2C HW unit ID

Returns:

  • E_OK Success

  • E_NOT_OK Request rejected

Return: Std_ReturnType

Precondition: None

Postcondition: None

7.13.4.15. function Cdd_I2c_TargetSubmitTxBuffer

Std_ReturnType Cdd_I2c_TargetSubmitTxBuffer(
    Cdd_I2c_HwUnitType hwUnitId,
    Cdd_I2c_DataConstPtrType pTxBuffer,
    Cdd_I2c_DataLengthType txBufferSize
)

Brief: Submit TX buffer - call before Start or in TX Notification callback to provide a new buffer to work with.

Parameters:

  • hwUnitId I2C HW unit ID

  • pTxBuffer Pointer to TX data buffer

  • txBufferSize Size of TX data buffer in bytes

Return: E_OK on success, E_NOT_OK on failure

Precondition: None

Postcondition: None

7.13.4.16. function Cdd_I2c_TargetSubmitRxBuffer

Std_ReturnType Cdd_I2c_TargetSubmitRxBuffer(
    Cdd_I2c_HwUnitType hwUnitId,
    Cdd_I2c_DataPtrType pRxBuffer,
    Cdd_I2c_DataLengthType rxBufferSize
)

Brief: Submit RX buffer - call before Start or in RX Notification callback to provide a new buffer to work with.

Parameters:

  • hwUnitId I2C HW unit ID

  • pRxBuffer Pointer to RX data buffer

  • rxBufferSize Size of RX data buffer in bytes

Return: E_OK on success, E_NOT_OK on failure

Precondition: None

Postcondition: None

7.13.4.17. function I2c_appSeqComplete

void I2c_appSeqComplete(
    void 
)

7.13.4.18. function I2c_appSeqFail

void I2c_appSeqFail(
    uint8 errorCode
)

7.13.5. Detailed Description

This files defines I2C configuration structures