AM261x MCU+ SDK: APIs for LIN HLD

| AM261x MCU+ SDK 26.00.00 |

Files | Data Structures
APIs for LIN HLD
APIs for SOC Specific Device Drivers

## Introduction

This module contains APIs to program and use the LIN.

## Files
file | sci_lin.h
| This file contains the prototype of LIN driver APIs.

## Data Structures
struct | LIN_HwAttrs
struct | LIN_BaudConfigParams
struct | LIN_SCI_Frame
| LIN Frame Structure. More...
struct | LIN_SciConfigParams
struct | LIN_LinConfigParams
struct | LIN_OpenParams
struct | LIN_Object
struct | LIN_Config
| LIN Global Configuration. More...
typedef struct LIN_Config_ts * | LIN_Handle
| A handle that is returned from a LIN_open() call. More...
typedef void * | LIN_DmaChConfig
typedef void * | LIN_DmaHandle

## LIN/SCI Operational Mode
Enumeration defines the Operational Modes.
enum | LIN_OperationalMode { LIN_OPER_MODE_POLLING = 0x00U, LIN_OPER_MODE_INTERRUPT = 0x01U, LIN_OPER_MODE_DMA = 0x02U }

## LIN/SCI Transfer Mode
Enumeration defines the Transfer Modes.
enum | LIN_TransferMode { LIN_TRANSFER_MODE_BLOCKING = 0x00U, LIN_TRANSFER_MODE_CALLBACK = 0x01U }

## LIN Module Operational Mode
Enumeration defines the Operational Modes of LIN [ LIN / SCI ]
enum | LIN_HLD_ModuleMode { LIN_MODULE_OP_MODE_LIN = 0x01U, LIN_MODULE_OP_MODE_SCI = 0x00U }

## LIN Operational Mode
Enumeration defines the LIN Mode to operate in. [ COMMANDER / RESPONDER ]
enum | LIN_HLD_LinMode { LIN_MODE_HLD_LIN_COMMANDER = 0x01U, LIN_MODE_HLD_LIN_RESPONDER = 0x00U }

## LIN COMM Mode
Enumeration defines the Comm Mode options for LIN & SCI Mode.
enum | LIN_HLD_CommMode { LIN_COMM_HLD_LIN_ID4ID5LENCTL = 0x01U, LIN_COMM_HLD_LIN_USELENGTHVAL = 0x00U, LIN_COMM_HLD_SCI_ADDRBITMODE = 0x01U, LIN_COMM_HLD_SCI_IDLELINEMODE = 0x00U }

## LIN Debug Mode
Enumeration defines the Debug Mode options.
enum | LIN_HLD_DebugMode { LIN_HLD_DEBUG_FROZEN = 0x00U, LIN_HLD_DEBUG_COMPLETE = 0x01U }

## LIN Checksum Type
Enumeration defines the Checksum Type options.
enum | LIN_HLD_ChecksumType { LIN_HLD_CHECKSUM_CLASSIC = 0x00U, LIN_HLD_CHECKSUM_ENHANCED = 0x01U }

## LIN Mask Filtering Type
Enumeration defines the Mask filtering Type options.
enum | LIN_HLD_MaskFilterType { LIN_HLD_MSG_FILTER_IDBYTE = 0x00U, LIN_HLD_MSG_FILTER_IDRESPONDER = 0x01U }

## LIN SCI Parity Type
Enumeration defines the Parity Type options.
enum | LIN_HLD_SCIParityType { LIN_HLD_SCI_PARITY_ODD = 0x00U, LIN_HLD_SCI_PARITY_EVEN = 0x01U }

## LIN SCI Stop Bits
Enumeration defines the Stop Bits options.
enum | LIN_HLD_SCIStopBits { LIN_HLD_SCI_STOP_BITS_1 = 0x00U, LIN_HLD_SCI_STOP_BITS_2 = 0x01U }

## Module LoopBack Mode
Enumeration defines the Loopback Mode options.
enum | LIN_HLD_LoopbackMode { LIN_HLD_LOOPBACK_INTERNAL = 0x00U, LIN_HLD_LOOPBACK_EXTERNAL = 0x01U }

## Module LoopBack type
Enumeration defines the Loopback Type options.
enum | LIN_HLD_LoopbackType { LIN_HLD_LOOPBACK_DIGITAL = 0x00U, LIN_HLD_LOOPBACK_ANALOG = 0x01U }

## Module LoopBack Path in Analog loopback Mode
Enumeration defines the Loopback path Type options.
enum | LIN_HLD_LoopbackPath { LIN_HLD_ANALOG_LOOP_TX = 0x00U, LIN_HLD_ANALOG_LOOP_RX = 0x01U }

## LIN Commander Mode Sync Delimiter
Enumeration defines LIN Commander Mode Sync Break field Length.
enum | LIN_HLD_Sync_Delimiter { LIN_HLD_SYNC_DELIMITER_LEN_1 = 0x0U, LIN_HLD_SYNC_DELIMITER_LEN_2 = 0x1U, LIN_HLD_SYNC_DELIMITER_LEN_3 = 0x2U, LIN_HLD_SYNC_DELIMITER_LEN_4 = 0x3U }
enum | LIN_HLD_Sync_Break { LIN_HLD_SYNC_BREAK_LEN_13 = 0x0U, LIN_HLD_SYNC_BREAK_LEN_14 = 0x1U, LIN_HLD_SYNC_BREAK_LEN_15 = 0x2U, LIN_HLD_SYNC_BREAK_LEN_16 = 0x3U, LIN_HLD_SYNC_BREAK_LEN_17 = 0x4U, LIN_HLD_SYNC_BREAK_LEN_18 = 0x5U, LIN_HLD_SYNC_BREAK_LEN_19 = 0x6U, LIN_HLD_SYNC_BREAK_LEN_20 = 0x7U }

## LIN/SCI Transaction Status
Enumeration defines LIN/SCI Transaction Status.
enum | LIN_HLD_Txn_Status { LIN_HLD_TXN_STS_SUCCESS = 0x00U, LIN_HLD_TXN_STS_FAILURE = 0x01U, LIN_HLD_TXN_STS_TIMEOUT = 0x02U, LIN_HLD_TXN_PHY_BUS_ERR = 0x03U, LIN_HLD_TXN_FRAMING_ERR = 0x04U, LIN_HLD_TXN_OVERRUN_ERR = 0x05U, LIN_HLD_TXN_PARITY_ERR = 0x06U, LIN_HLD_TXN_CHECKSUM_ERR = 0x07U, LIN_HLD_TXN_NO_RES_ERR = 0x08U, LIN_HLD_TXN_BIT_ERR = 0x09U }

## LIN/SCI Transaction Type
Enumeration defines LIN/SCI Transaction Types.
enum | LIN_HLD_Txn_Type { LIN_HLD_TXN_TYPE_WRITE = 0x00U, LIN_HLD_TXN_TYPE_READ = 0x01U }

## LIN/SCI Driver State
Enumeration defines LIN/SCI Driver States.
enum | LIN_HLD_State { LIN_HLD_STATE_RESET = (uint8_t)0U, LIN_HLD_STATE_IDLE = (uint8_t)1U, LIN_HLD_STATE_BUSY = (uint8_t)2U, LIN_HLD_STATE_ERROR = (uint8_t)3U }

## LIN Baud Configuration Parameters
Data structure defines the Baud Rate configuration parameters.
typedef void(* | LIN_IdMatchCallbackFxn) (LIN_Handle handle, LIN_SCI_Frame *frame)
| The definition of a callback function used by the LIN driver when used in LIN_TRANSFER_MODE_CALLBACK. More...
typedef void(* | LIN_TransferCompleteCallbackFxn) (LIN_Handle handle, LIN_SCI_Frame *frame)
| The definition of a callback function used by the LIN driver when used in LIN_TRANSFER_MODE_CALLBACK. More...

## LIN Object
SCI/LIN object Used by the Driver. The application must not access any member variables of this Structure.
void | LIN_init (void)
| Initialize each driver instance object and create driver lock. More...
void | LIN_deinit (void)
| De-initialize each driver instance object and delete driver lock. More...
void | LIN_Params_init (LIN_OpenParams *openParams)
| API to initialize the LIN_OpenParams struct to its defaults. More...
LIN_Handle | LIN_open (uint32_t index, LIN_OpenParams *openParams)
| API to Open a given LIN Instance. More...
void | LIN_close (LIN_Handle handle)
| API to Close the LIN Instance specified by the handle. More...
void | LIN_SCI_Frame_init (LIN_SCI_Frame *frame)
| API to set default values of LIN_SCI_Frame in frame. More...
int32_t | LIN_SCI_transferFrame (LIN_Handle handle, LIN_SCI_Frame *frame)
| API to initiate a LIN/SCI frame transfer. More...
LIN_Handle | LIN_getHandle (uint32_t index)
| API to get the handle of an open LIN instance from the instance index. More...

## Typedef Documentation

## ◆ LIN_Handle

typedef struct LIN_Config_ts* LIN_Handle

A handle that is returned from a LIN_open() call.

## ◆ LIN_DmaChConfig

typedef void* LIN_DmaChConfig

## ◆ LIN_DmaHandle

typedef void* LIN_DmaHandle

## ◆ LIN_IdMatchCallbackFxn

typedef void(* LIN_IdMatchCallbackFxn) (LIN_Handle handle, LIN_SCI_Frame *frame)

The definition of a callback function used by the LIN driver when used in LIN_TRANSFER_MODE_CALLBACK.

Parameters

  handle | LIN_Handle
  frame | Pointer to a LIN_SCI_Frame

## ◆ LIN_TransferCompleteCallbackFxn

typedef void(* LIN_TransferCompleteCallbackFxn) (LIN_Handle handle, LIN_SCI_Frame *frame)

The definition of a callback function used by the LIN driver when used in LIN_TRANSFER_MODE_CALLBACK.

Parameters

  handle | LIN_Handle
  frame | Pointer to a LIN_SCI_Frame

## Enumeration Type Documentation

## ◆ LIN_OperationalMode

enum LIN_OperationalMode

Enumerator
LIN_OPER_MODE_POLLING | Module to carry out transfers in Polling Mode
LIN_OPER_MODE_INTERRUPT | Module to carry out transfers in Interrupt Mode
LIN_OPER_MODE_DMA | Module to carry out transfers in DMA Mode

## ◆ LIN_TransferMode

enum LIN_TransferMode

Enumerator
LIN_TRANSFER_MODE_BLOCKING | Module to transfers in Blocking Mode
LIN_TRANSFER_MODE_CALLBACK | Module to transfers in Callback Mode

## ◆ LIN_HLD_ModuleMode

enum LIN_HLD_ModuleMode

Enumerator
LIN_MODULE_OP_MODE_LIN | Module to Operate in LIN Mode
LIN_MODULE_OP_MODE_SCI | Module to Operate in SCI Compatible Mode

## ◆ LIN_HLD_LinMode

enum LIN_HLD_LinMode

Enumerator
LIN_MODE_HLD_LIN_COMMANDER | Module to Operate as LIN Commander
LIN_MODE_HLD_LIN_RESPONDER | Module to Operate as LIN Responder

## ◆ LIN_HLD_CommMode

enum LIN_HLD_CommMode

Enumerator
LIN_COMM_HLD_LIN_ID4ID5LENCTL | Module to use ID4 & ID5 for length control in LIN Mode.
LIN_COMM_HLD_LIN_USELENGTHVAL | Module to use length value for length control in LIN Mode.
LIN_COMM_HLD_SCI_ADDRBITMODE | Module to use Address-bit mode in SCI Mode.
LIN_COMM_HLD_SCI_IDLELINEMODE | Module to use Idle-line mode in SCI Mode.

## ◆ LIN_HLD_DebugMode

enum LIN_HLD_DebugMode

Enumerator
LIN_HLD_DEBUG_FROZEN | Freeze module during debug.
LIN_HLD_DEBUG_COMPLETE | Complete Tx/Rx before Freezing.

## ◆ LIN_HLD_ChecksumType

enum LIN_HLD_ChecksumType

Enumerator
LIN_HLD_CHECKSUM_CLASSIC | Module to use Classic Checksum.
LIN_HLD_CHECKSUM_ENHANCED | Module to use Enhanced Checksum.

## ◆ LIN_HLD_MaskFilterType

enum LIN_HLD_MaskFilterType

Enumerator
LIN_HLD_MSG_FILTER_IDBYTE | IDBYTE fields in the LINID register are used for detecting a Match
LIN_HLD_MSG_FILTER_IDRESPONDER | LAVETASKBYTE fields in the LINID register are used for detecting a Match

## ◆ LIN_HLD_SCIParityType

enum LIN_HLD_SCIParityType

Enumerator
LIN_HLD_SCI_PARITY_ODD | Module to use Odd Parity.
LIN_HLD_SCI_PARITY_EVEN | Module to use Even Parity.

## ◆ LIN_HLD_SCIStopBits

enum LIN_HLD_SCIStopBits

Enumerator
LIN_HLD_SCI_STOP_BITS_1 | Module to use One Stop Bit.
LIN_HLD_SCI_STOP_BITS_2 | Module to use Two Stop Bits.

## ◆ LIN_HLD_LoopbackMode

enum LIN_HLD_LoopbackMode

Enumerator
LIN_HLD_LOOPBACK_INTERNAL | Module to use Internal Loopback.
LIN_HLD_LOOPBACK_EXTERNAL | Module to use External Loopback.

## ◆ LIN_HLD_LoopbackType

enum LIN_HLD_LoopbackType

Enumerator
LIN_HLD_LOOPBACK_DIGITAL | Module to use Digital Loopback.
LIN_HLD_LOOPBACK_ANALOG | Module to use Analog Loopback.

## ◆ LIN_HLD_LoopbackPath

enum LIN_HLD_LoopbackPath

Enumerator
LIN_HLD_ANALOG_LOOP_TX | Module to use Analog loopback through transmit Pin
LIN_HLD_ANALOG_LOOP_RX | Module to use Analog loopback through receive Pin

## ◆ LIN_HLD_Sync_Delimiter

enum LIN_HLD_Sync_Delimiter

Enumerator
LIN_HLD_SYNC_DELIMITER_LEN_1 | The Sync delimiter is 1 Tbit Long
LIN_HLD_SYNC_DELIMITER_LEN_2 | The Sync delimiter is 2 Tbit Long
LIN_HLD_SYNC_DELIMITER_LEN_3 | The Sync delimiter is 3 Tbit Long
LIN_HLD_SYNC_DELIMITER_LEN_4 | The Sync delimiter is 4 Tbit Long

## ◆ LIN_HLD_Sync_Break

enum LIN_HLD_Sync_Break

Enumerator
LIN_HLD_SYNC_BREAK_LEN_13 | The Sync Break Field is 13 Tbit Long
LIN_HLD_SYNC_BREAK_LEN_14 | The Sync Break Field is 14 Tbit Long
LIN_HLD_SYNC_BREAK_LEN_15 | The Sync Break Field is 15 Tbit Long
LIN_HLD_SYNC_BREAK_LEN_16 | The Sync Break Field is 16 Tbit Long
LIN_HLD_SYNC_BREAK_LEN_17 | The Sync Break Field is 17 Tbit Long
LIN_HLD_SYNC_BREAK_LEN_18 | The Sync Break Field is 18 Tbit Long
LIN_HLD_SYNC_BREAK_LEN_19 | The Sync Break Field is 19 Tbit Long
LIN_HLD_SYNC_BREAK_LEN_20 | The Sync Break Field is 20 Tbit Long

## ◆ LIN_HLD_Txn_Status

enum LIN_HLD_Txn_Status

Enumerator
LIN_HLD_TXN_STS_SUCCESS | Transaction status Success Generic
LIN_HLD_TXN_STS_FAILURE | Transaction status Failure Generic
LIN_HLD_TXN_STS_TIMEOUT | Transaction status Timeout
LIN_HLD_TXN_PHY_BUS_ERR | Transaction status Physical Bus Error
LIN_HLD_TXN_FRAMING_ERR | Transaction status Frame Error
LIN_HLD_TXN_OVERRUN_ERR | Transaction status Overrun Error
LIN_HLD_TXN_PARITY_ERR | Transaction status Parity Error
LIN_HLD_TXN_CHECKSUM_ERR | Transaction status Checksum Error
LIN_HLD_TXN_NO_RES_ERR | Transaction status No Response Error
LIN_HLD_TXN_BIT_ERR | Transaction status Bit Error

## ◆ LIN_HLD_Txn_Type

enum LIN_HLD_Txn_Type

Enumerator
LIN_HLD_TXN_TYPE_WRITE | Transaction Type Write
LIN_HLD_TXN_TYPE_READ | Transaction Type Read

## ◆ LIN_HLD_State

enum LIN_HLD_State

Enumerator
LIN_HLD_STATE_RESET | Driver State Reset
LIN_HLD_STATE_IDLE | Driver State Idle
LIN_HLD_STATE_BUSY | Driver State Busy
LIN_HLD_STATE_ERROR | Driver State Error

## Function Documentation

## ◆ LIN_init()

void LIN_init | ( | void |  | ) |

Initialize each driver instance object and create driver lock.

## ◆ LIN_deinit()

void LIN_deinit | ( | void |  | ) |

De-initialize each driver instance object and delete driver lock.

## ◆ LIN_Params_init()

void LIN_Params_init | ( | LIN_OpenParams * | openParams | ) |

API to initialize the LIN_OpenParams struct to its defaults.

Parameters

  openParams | [IN] Pointer to LIN_OpenParams structure to be initialized

## ◆ LIN_open()

LIN_Handle LIN_open | ( | uint32_t | index,
|  | LIN_OpenParams * | openParams
| ) |  |

API to Open a given LIN Instance.

Precondition
  LIN has been initialized using LIN_init()

Parameters

  index | [IN] Index of config to be used in the LIN_Config array
  openParams | [IN] Pointer to open parameters. If NULL is passed, then default values will be used.

Returns
  LIN_Handle on Success or NULL in case of an error or already open.

See also
  LIN_init()

## ◆ LIN_close()

void LIN_close | ( | LIN_Handle | handle | ) |

API to Close the LIN Instance specified by the handle.

Precondition
  LIN_open() has to be called first

Parameters

  handle | [IN] LIN_Handle returned from LIN_open()

See also
  LIN_open()

## ◆ LIN_SCI_Frame_init()

void LIN_SCI_Frame_init | ( | LIN_SCI_Frame * | frame | ) |

API to set default values of LIN_SCI_Frame in frame.

Parameters

  frame | [IN] pointer to the structure to be initialized

## ◆ LIN_SCI_transferFrame()

int32_t LIN_SCI_transferFrame | ( | LIN_Handle | handle,
|  | LIN_SCI_Frame * | frame
| ) |  |

API to initiate a LIN/SCI frame transfer.

Precondition
  LIN_open() has to be called first

Parameters

  handle | [IN] LIN_Handle returned from LIN_open()
  frame | [IN] Pointer to the LIN_SCI_Frame

Returns
  SystemP_SUCCESS if started successfully; else error on failure

See also
  LIN_open()

## ◆ LIN_getHandle()

LIN_Handle LIN_getHandle | ( | uint32_t | index | ) |

API to get the handle of an open LIN instance from the instance index.

Parameters

  index | [IN] Index of config to use in the LIN_Config array

Returns
  A LIN_Handle on success or a NULL on an error or if the instance index has NOT been opened yet.