5.15. LIN
5.15.1. Types
Base type |
Type Name |
Brief |
---|---|---|
enum |
Interrupt Line number. |
|
enum |
Loopback mode type. |
5.15.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: Interrupt Line number.
5.15.1.2. enum Lin_LoopbackModeType
Enumerator |
Value |
Description |
---|---|---|
LIN_LOOPBACK_DISABLED |
Loopback disabled. |
|
LIN_LOOPBACK_INTERNAL |
Loopback Internal. |
|
LIN_LOOPBACK_EXTERNAL |
Loopback External. |
Brief: Loopback mode type.
5.15.2. Structures
Name |
Brief |
---|---|
Structure defining the channel type |
|
Structure defining the config type |
|
Lin Controller Configuration definition. |
|
Lin Controller BaudRate Configuration. |
|
LIN register readback structure. |
5.15.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 Instance ID. |
LIN_SID_INIT |
Lin_Init() |
LIN_SID_GET_VERSION_INFO |
Lin_GetVersionInfo() |
LIN_SID_SEND_FRAME |
Lin_SendFrame() |
LIN_SID_GOTO_SLEEP |
Lin_GoToSleep() |
LIN_SID_WAKEUP |
Lin_Wakeup() |
LIN_SID_GET_STATUS |
Lin_GetStatus() |
LIN_SID_GOTO_SLEEP_INTERNAL |
Lin_GoToSleepInternal() |
LIN_SID_CHECK_WAKEUP |
Lin_CheckWakeup() |
LIN_SID_WAKEUP_INTERNAL |
Lin_WakeupInternal() |
LIN_SID_REGISTER_READBACK |
Lin_RegisterReadback() |
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_ISR_VOID |
void ISR type |
LIN_ISR_CAT1 |
Category 1 ISR type. |
LIN_ISR_CAT2 |
Category 2 ISR type. |
5.15.4. Functions
Return type |
Function Name |
Brief |
---|---|---|
void |
Lin_GetVersionInfo(Std_VersionInfoType * versioninfo) |
This function returns the version information of this module. |
void |
Lin_Init(const Lin_ConfigType * Config) |
This function initializes the LIN module. |
Std_ReturnType |
Lin_CheckWakeup(uint8 Channel) |
This function checks if a wakeup has occurred on the addressed LIN channel. |
Std_ReturnType |
Lin_SendFrame(uint8 Channel, const Lin_PduType * PduInfoPtr) |
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) |
The service instructs the driver to transmit a go-to-sleep-command on the addressed LIN channel. |
Std_ReturnType |
Lin_GoToSleepInternal(uint8 Channel) |
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) |
Generates a wake up pulse and sets the channel state to LIN_CH_OPERATIONAL. |
Std_ReturnType |
Lin_WakeupInternal(uint8 Channel) |
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) |
Gets the status of the LIN driver. |
Std_ReturnType |
Lin_RegisterReadback(uint8 Channel, Lin_RegisterReadbackType * RegRbPtr) |
This function reads the important registers of the hardware unit and returns the value in the structure. This API is used to check the status of critical registers which do not change during program execution. |
5.15.4.1. function Lin_GetVersionInfo
void Lin_GetVersionInfo(
Std_VersionInfoType * versioninfo
)
Brief: This function returns the version information of this module.
Service ID[hex] : 0x01
Sync/Async : Synchronous
Reentrancy : Reentrant
Parameters:
versioninfo - Pointer to where to store the version information of this module.
Returns:
None
Return: None
5.15.4.2. function Lin_Init
void Lin_Init(
const Lin_ConfigType * Config
)
Brief: This function initializes the LIN module.
Service ID[hex] : 0x00
Sync/Async : Synchronous
Reentrancy : Non Reentrant
Parameters:
Config - Pointer to LIN driver configuration set.
Returns:
None
Return: None
5.15.4.3. function Lin_CheckWakeup
Std_ReturnType Lin_CheckWakeup(
uint8 Channel
)
Brief: This function checks if a wakeup has occurred on the addressed LIN channel.
Service ID[hex] : 0x0a
Sync/Async : Synchronous
Reentrancy : Non Reentrant
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: Std_ReturnType
5.15.4.4. function Lin_SendFrame
Std_ReturnType Lin_SendFrame(
uint8 Channel,
const Lin_PduType * PduInfoPtr
)
Brief: 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.
Service ID[hex] : 0x04
Sync/Async : Asynchronous
Reentrancy : Non Reentrant
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: Std_ReturnType
5.15.4.5. function Lin_GoToSleep
Std_ReturnType Lin_GoToSleep(
uint8 Channel
)
Brief: The service instructs the driver to transmit a go-to-sleep-command on the addressed LIN channel.
Service ID[hex] : 0x06
Sync/Async : Asynchronous
Reentrancy : Non Reentrant
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: Std_ReturnType
5.15.4.6. function Lin_GoToSleepInternal
Std_ReturnType Lin_GoToSleepInternal(
uint8 Channel
)
Brief: 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.
Service ID[hex] : 0x09
Sync/Async : Synchronous
Reentrancy : Non Reentrant
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: Std_ReturnType
5.15.4.7. function Lin_Wakeup
Std_ReturnType Lin_Wakeup(
uint8 Channel
)
Brief: Generates a wake up pulse and sets the channel state to LIN_CH_OPERATIONAL.
Service ID[hex] : 0x07
Sync/Async : Asynchronous
Reentrancy : Non Reentrant
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: Std_ReturnType
5.15.4.8. function Lin_WakeupInternal
Std_ReturnType Lin_WakeupInternal(
uint8 Channel
)
Brief: Generates a wake up pulse and sets the channel state to LIN_CH_OPERATIONAL without generating a wake up pulse.
Service ID[hex] : 0x0b
Sync/Async : Asynchronous
Reentrancy : Non Reentrant
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: Std_ReturnType
5.15.4.9. function Lin_GetStatus
Lin_StatusType Lin_GetStatus(
uint8 Channel,
uint8 ** Lin_SduPtr
)
Brief: Gets the status of the LIN driver.
Service ID[hex] : 0x08
Sync/Async : Synchronous
Reentrancy : Non Reentrant
Parameters:
Channel - LIN channel to be addressed.
Lin_SduPtr - Pointer to point 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: Lin_StatusType
5.15.4.10. function Lin_RegisterReadback
Std_ReturnType Lin_RegisterReadback(
uint8 Channel,
Lin_RegisterReadbackType * RegRbPtr
)
Brief: This function reads the important registers of the hardware unit and returns the value in the structure. This API is used to check the status of critical registers which do not change during program execution.
Service ID[hex] : 0x0C
Sync/Async : Synchronous
Reentrancy : Reentrant
This function reads the important registers of the hardware unit and returns the value in the structure. This API is used to check the status of critical registers which do not change during program execution.
Parameters:
Channel - LIN channel to be addressed.
RegRbPtr - Pointer to where to store the readback values. If this pointer is NULL, then the API will return E_NOT_OK.
Returns:
E_OK Register read back has been done successfully
E_NOT_OK Register read back failed
Return: Std_ReturnType