5.5. LIN

5.5.1. Types

Base type

Type Name

Brief

enum

Lin_InterruptLineNum

Enum of Lin Interrupt line number, 0 or 1.

enum

Lin_LoopbackModeType

Enum of Lin Loopbackmode, Internal/External/Disabled Type selection.

5.5.1.1. enum Lin_InterruptLineNum

Enumerator

Value

Description

LIN_INTERRUPT_LINE_NUM_0

0x0U

Use Interrupt Line 0.

LIN_INTERRUPT_LINE_NUM_1

0x1U

Use Interrupt Line 1.

Brief: Enum of Lin Interrupt line number, 0 or 1.

5.5.1.2. enum Lin_LoopbackModeType

Enumerator

Value

Description

LIN_LOOPBACK_DISABLED

Loopback disabled.

LIN_LOOPBACK_INTERNAL

Loopback internal.

LIN_LOOPBACK_EXTERNAL

Loopback external.

Brief: Enum of Lin Loopbackmode, Internal/External/Disabled Type selection.

5.5.2. Structures

Name

Brief

Lin_ChannelType

Lin Channel type structure.

Lin_ConfigType

LIN Channel Configuration structure.

Lin_ControllerType

Lin Controller Configuration structure.

Lin_BaudRateConfigType

Lin Controller BaudRate Configuration.

5.5.3. Defines

Name

Brief

LIN_SW_MAJOR_VERSION

Driver Implementation Major Version.

LIN_SW_MINOR_VERSION

Driver Implementation Minor Version.

LIN_SW_PATCH_VERSION

Driver Implementation Patch Version.

LIN_AR_RELEASE_MAJOR_VERSION

AUTOSAR Major version specification implemented by LIN Driver.

LIN_AR_RELEASE_MINOR_VERSION

AUTOSAR Minor version specification implemented by LIN Driver.

LIN_AR_RELEASE_REVISION_VERSION

AUTOSAR Patch version specification implemented by LIN Driver.

LIN_VENDOR_ID

Texas Instruments Vendor ID.

LIN_MODULE_ID

LIN Driver Module ID.

LIN_INSTANCE_ID

LIN Driver Instance ID.

LIN_E_UNINIT

API service used without module initialization.

LIN_E_INVALID_CHANNEL

API service used with an invalid or inactive channel parameter.

LIN_E_INVALID_POINTER

API service called with invalid configuration pointer.

LIN_E_STATE_TRANSITION

Invalid state transition for the current state.

LIN_E_PARAM_POINTER

API service called with a NULL pointer.

LIN_SID_INIT

Service ID - Lin_Init().

LIN_SID_GET_VERSION_INFO

Service ID - Lin_GetVersionInfo().

LIN_SID_SEND_FRAME

Service ID - Lin_SendFrame().

LIN_SID_GOTO_SLEEP

Service ID - Lin_GoToSleep().

LIN_SID_WAKEUP

Service ID - Lin_Wakeup().

LIN_SID_GET_STATUS

Service ID - Lin_GetStatus().

LIN_SID_GOTO_SLEEP_INTERNAL

Service ID - Lin_GoToSleepInternal().

LIN_SID_CHECK_WAKEUP

Service ID - Lin_CheckWakeup().

LIN_SID_WAKEUP_INTERNAL

Service ID - Lin_WakeupInternal().

LIN_ISR_CAT1_RTINT

Category 1 RT ISR type.

LIN_ISR_CAT1_INT

Category 1 ISR type.

LIN_ISR_CAT2

Category 2 ISR type.

5.5.4. Functions

Return type

Function Name

Brief

void

Lin_GetVersionInfo(Std_VersionInfoType * versioninfo)

Service to get the version information of the module.

void

Lin_Init(const Lin_ConfigType * Config)

Lin_Init - Initializes the LIN module.

Std_ReturnType

Lin_CheckWakeup(uint8 Channel)

Lin_CheckWakeup - This function checks if a wakeup has occurred on the addressed LIN channel.

Std_ReturnType

Lin_SendFrame(uint8 Channel, const Lin_PduType * PduInfoPtr)

Lin_SendFrame - Sends a LIN header and a LIN response, if necessary. The direction of the frame response (master response, slave response, slave-to-slave communication) is provided by the PduInfoPtr.

Std_ReturnType

Lin_GoToSleep(uint8 Channel)

Lin_GoToSleep - The service instructs the driver to transmit a go-to-sleep-command on the addressed LIN channel.

Std_ReturnType

Lin_GoToSleepInternal(uint8 Channel)

Lin_GoToSleepInternal - Sets the channel state to LIN_CH_SLEEP, enables the wake-up detection and optionally sets the LIN hardware unit to reduced power operation mode.

Std_ReturnType

Lin_Wakeup(uint8 Channel)

Lin_Wakeup - Generates a wake up pulse and sets the channel state to LIN_CH_OPERATIONAL.

Std_ReturnType

Lin_WakeupInternal(uint8 Channel)

Lin_WakeupInternal - Generates a wake up pulse and sets the channel state to LIN_CH_OPERATIONAL without generating a wake up pulse.

Lin_StatusType

Lin_GetStatus(uint8 Channel, uint8 ** Lin_SduPtr)

Lin_GetStatus - Gets the status of the LIN driver.

5.5.4.1. function Lin_GetVersionInfo

void Lin_GetVersionInfo(
    Std_VersionInfoType * versioninfo
)

Brief: Service to get the version information of the module.

This service writes the version information of this module into the data structure referenced by the parameter. If this parameter references NULL_PTR, a development error is reported to Det. This service is only available if the pre-compile configuration parameter LIN_GET_VERSION_INFO_API is enabled.

Parameters:

  • versioninfo structure that contains the version information parameters.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.5.4.2. function Lin_Init

void Lin_Init(
    const Lin_ConfigType * Config
)

Brief: Lin_Init - Initializes the LIN module.

Parameters:

  • Config Pointer to LIN driver configuration set.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.5.4.3. function Lin_CheckWakeup

Std_ReturnType Lin_CheckWakeup(
    uint8 Channel
)

Brief: Lin_CheckWakeup - This function checks if a wakeup has occurred on the addressed LIN channel.

Parameters:

  • Channel LIN channel to be addressed.

Returns:

  • E_OK No error has occurred during execution of the API

  • E_NOT_OK An error has occurred during execution of the API

Return: return_value

Precondition: None

Postcondition: None

5.5.4.4. function Lin_SendFrame

Std_ReturnType Lin_SendFrame(
    uint8 Channel,
    const Lin_PduType * PduInfoPtr
)

Brief: Lin_SendFrame - Sends a LIN header and a LIN response, if necessary. The direction of the frame response (master response, slave response, slave-to-slave communication) is provided by the PduInfoPtr.

Parameters:

  • Channel LIN channel to be addressed.

  • PduInfoPtr Pointer to PDU containing the PID, checksum model, response type, Dl and SDU data pointer

Returns:

  • E_OK Send command has been accepted.

  • E_NOT_OK Send command has not been accepted, development or production error occurred.

Return: return_value

Precondition: None

Postcondition: None

5.5.4.5. function Lin_GoToSleep

Std_ReturnType Lin_GoToSleep(
    uint8 Channel
)

Brief: Lin_GoToSleep - The service instructs the driver to transmit a go-to-sleep-command on the addressed LIN channel.

Parameters:

  • Channel LIN channel to be addressed.

Returns:

  • E_OK Sleep command has been accepted.

  • E_NOT_OK Sleep command has not been accepted, development or production error occurred.

Return: return_value

Precondition: None

Postcondition: None

5.5.4.6. function Lin_GoToSleepInternal

Std_ReturnType Lin_GoToSleepInternal(
    uint8 Channel
)

Brief: Lin_GoToSleepInternal - Sets the channel state to LIN_CH_SLEEP, enables the wake-up detection and optionally sets the LIN hardware unit to reduced power operation mode.

Parameters:

  • Channel LIN channel to be addressed.

Returns:

  • E_OK Command has been accepted.

  • E_NOT_OK Command has not been accepted, development or production error occurred.

Return: return_value

Precondition: None

Postcondition: None

5.5.4.7. function Lin_Wakeup

Std_ReturnType Lin_Wakeup(
    uint8 Channel
)

Brief: Lin_Wakeup - Generates a wake up pulse and sets the channel state to LIN_CH_OPERATIONAL.

Parameters:

  • Channel LIN channel to be addressed.

Returns:

  • E_OK Wake-up request has been accepted

  • E_NOT_OK Wake-up request has not been accepted, development or production error occurred.

Return: return_value

Precondition: None

Postcondition: None

5.5.4.8. function Lin_WakeupInternal

Std_ReturnType Lin_WakeupInternal(
    uint8 Channel
)

Brief: Lin_WakeupInternal - Generates a wake up pulse and sets the channel state to LIN_CH_OPERATIONAL without generating a wake up pulse.

Parameters:

  • Channel LIN channel to be addressed.

Returns:

  • E_OK Wake-up request has been accepted

  • E_NOT_OK Wake-up request has not been accepted, development or production error occurred.

Return: return_value

Precondition: None

Postcondition: None

5.5.4.9. function Lin_GetStatus

Lin_StatusType Lin_GetStatus(
    uint8 Channel,
    uint8 ** Lin_SduPtr
)

Brief: Lin_GetStatus - Gets the status of the LIN driver.

Parameters:

  • Channel LIN channel to be addressed.

  • Lin_SduPtr Pointer to pointer to a shadow buffer or memory mapped LIN Hardware receive buffer where the current SDU is stored.

Returns:

  • LIN_NOT_OK Development or production error occurred

  • LIN_TX_OK Successful transmission

  • LIN_TX_BUSY Ongoing transmission (Header or Response)

  • LIN_TX_HEADER_ERROR Erroneous header transmission such as:

  • Mismatch between sent and read back data

  • Identifier parity error or Physical bus error

  • LIN_TX_ERROR Erroneous response transmission such as:

  • Mismatch between sent and read back data

  • Physical bus error

  • LIN_RX_OK Reception of correct response

  • LIN_RX_BUSY Ongoing reception: at least one response byte has been received, but the checksum byte has not been received

  • LIN_RX_ERROR Erroneous response reception such as:

  • Framing error

  • Overrun error

  • Checksum error or Short response

  • LIN_RX_NO_RESPONSE No response byte has been received so far

  • LIN_OPERATIONAL Normal operation; the related LIN channel is woken up from the LIN_CH_SLEEP and no data has been sent.

  • LIN_CH_SLEEP Sleep state operation; in this state wake-up detection from slave nodes is enabled.

Return: return_value

Precondition: None

Postcondition: None