Low level layer consists of functions that call LIN driver API.
This layer contains the implementation of LIN hardware initialization and deinitialization, getting LIN node's current state, sending wakeup signals, enabling and disabling interrupts, sending frame data from a buffer, receiving frame data into a buffer, handling timeout and callbacks from LIN driver.
|
enum | lin_lld_event_id_t {
LIN_LLD_PID_OK = 0x00U,
LIN_LLD_TX_COMPLETED = 0x01U,
LIN_LLD_RX_COMPLETED = 0x02U,
LIN_LLD_PID_ERR = 0x03U,
LIN_LLD_FRAME_ERR = 0x04U,
LIN_LLD_CHECKSUM_ERR = 0x05U,
LIN_LLD_READBACK_ERR = 0x06U,
LIN_LLD_NODATA_TIMEOUT = 0x07U,
LIN_LLD_BUS_ACTIVITY_TIMEOUT = 0x08U
} |
| Event id Implements : lin_lld_event_id_t_Class. More...
|
|
enum | lin_protocol_handle_t { LIN_PROTOCOL_21 = 0x00U,
LIN_PROTOCOL_J2602 = 0x01U
} |
| List of protocols Implements : lin_protocol_handle_t_Class. More...
|
|
enum | lin_diagnostic_class_t { LIN_DIAGNOSTIC_CLASS_I = 0x01U,
LIN_DIAGNOSTIC_CLASS_II = 0x02U,
LIN_DIAGNOSTIC_CLASS_III = 0x03U
} |
| List of diagnostic classes Implements : lin_diagnostic_class_t_Class. More...
|
|
enum | lin_frame_type_t { LIN_FRM_UNCD = 0x00U,
LIN_FRM_EVNT = 0x01U,
LIN_FRM_SPRDC = 0x10U,
LIN_FRM_DIAG = 0x11U
} |
| Types of frame Implements : lin_frame_type_t_Class. More...
|
|
enum | lin_frame_response_t { LIN_RES_PUB = 0x00U,
LIN_RES_SUB = 0x01U
} |
| LIN frame response Implements : lin_frame_response_t_Class. More...
|
|
enum | lin_sch_tbl_type_t {
LIN_SCH_TBL_NULL = 0x00U,
LIN_SCH_TBL_NORM = 0x01U,
LIN_SCH_TBL_DIAG = 0x02U,
LIN_SCH_TBL_GO_TO_SLEEP = 0x03U,
LIN_SCH_TBL_COLL_RESOLV = 0x04U
} |
| Types of schedule tables Implements : lin_sch_tbl_type_t_Class. More...
|
|
enum | l_diagnostic_mode_t { DIAG_NONE = 0x00U,
DIAG_INTERLEAVE_MODE = 0x01U,
DIAG_ONLY_MODE = 0x02U
} |
| Diagnostic mode Implements : l_diagnostic_mode_t_Class. More...
|
|
enum | lin_service_status_t { LD_SERVICE_BUSY = 0x00U,
LD_REQUEST_FINISHED = 0x01U,
LD_SERVICE_IDLE = 0x02U,
LD_SERVICE_ERROR = 0x03U
} |
| Status of the last configuration call for LIN 2.1 Implements : lin_service_status_t_Class. More...
|
|
enum | lin_last_cfg_result_t { LD_SUCCESS = 0x00U,
LD_NEGATIVE = 0x01U,
LD_NO_RESPONSE = 0x02U,
LD_OVERWRITTEN = 0x03U
} |
| Status of the last configuration call completed Implements : lin_last_cfg_result_t_Class. More...
|
|
enum | lin_tl_event_id_t {
TL_MAKE_RES_DATA = 0x00U,
TL_SLAVE_GET_ACTION = 0x01U,
TL_TX_COMPLETED = 0x02U,
TL_RX_COMPLETED = 0x03U,
TL_ERROR = 0x04U,
TL_TIMEOUT_SERVICE = 0x05U,
TL_HANDLER_INTERLEAVE_MODE = 0x06U,
TL_RECEIVE_MESSAGE = 0x07U
} |
| Transport layer event IDs Implements : lin_tl_event_id_t_Class. More...
|
|
enum | lin_tl_callback_return_t { TL_ACTION_NONE = 0x00U,
TL_ACTION_ID_IGNORE = 0x01U
} |
| Transport layer event IDs Implements : lin_tl_callback_return_t_Class. More...
|
|
enum | ld_queue_status_t {
LD_NO_DATA = 0x00U,
LD_DATA_AVAILABLE = 0x01U,
LD_RECEIVE_ERROR = 0x02U,
LD_QUEUE_FULL = 0x03U,
LD_QUEUE_AVAILABLE = 0x04U,
LD_QUEUE_EMPTY = 0x05U,
LD_TRANSMIT_ERROR = 0x06U,
LD_TRANSFER_ERROR = 0x07U
} |
| Status of queue Implements : ld_queue_status_t_Class. More...
|
|
enum | lin_message_status_t {
LD_NO_MSG = 0x00U,
LD_IN_PROGRESS = 0x01U,
LD_COMPLETED = 0x02U,
LD_FAILED = 0x03U,
LD_N_AS_TIMEOUT = 0x04U,
LD_N_CR_TIMEOUT = 0x05U,
LD_WRONG_SN = 0x06U
} |
| Status of LIN message Implements : lin_message_status_t_Class. More...
|
|
enum | lin_diagnostic_state_t {
LD_DIAG_IDLE = 0x01U,
LD_DIAG_TX_PHY = 0x02U,
LD_DIAG_TX_FUNCTIONAL = 0x03U,
LD_DIAG_TX_INTERLEAVED = 0x04U,
LD_DIAG_RX_PHY = 0x05U,
LD_DIAG_RX_FUNCTIONAL = 0x06U,
LD_DIAG_RX_INTERLEAVED = 0x07U
} |
| LIN diagnostic state Implements : lin_diagnostic_state_t_Class. More...
|
|
enum | lin_message_timeout_type_t { LD_NO_CHECK_TIMEOUT = 0x00U,
LD_CHECK_N_AS_TIMEOUT = 0x01U,
LD_CHECK_N_CR_TIMEOUT = 0x02U
} |
| Types of message timeout Implements : lin_message_timeout_type_t_Class. More...
|
|
enum | diag_interleaved_state_t { DIAG_NOT_START = 0x00U,
DIAG_NO_RESPONSE = 0x01U,
DIAG_RESPONSE = 0x02U
} |
| State of diagnostic interleaved mode Implements : diag_interleaved_state_t_Class. More...
|
|
|
lin_tl_callback_return_t | lin_tl_callback_handler (l_ifc_handle iii, lin_tl_event_id_t tl_event_id, l_u8 id) |
|
l_u8 | ld_read_by_id_callout (l_ifc_handle iii, l_u8 id, l_u8 *data) |
|
static l_u16 | lin_calc_max_header_timeout_cnt (l_u32 baudRate) |
| Computes maximum header timeout. More...
|
|
static l_u16 | lin_calc_max_res_timeout_cnt (l_u32 baudRate, l_u8 size) |
| Computes the maximum response timeout. More...
|
|
l_u8 | lin_process_parity (l_u8 pid, l_u8 typeAction) |
| Makes or checks parity bits. If action is checking parity, the function returns ID value if parity bits are correct or 0xFF if parity bits are incorrect. If action is making parity bits, then from input value of ID, the function returns PID. More...
|
|
void | lin_pid_resp_callback_handler (l_ifc_handle iii, const lin_lld_event_id_t event_id, l_u8 id) |
| Callback handler for low level events. More...
|
|
l_bool | lin_lld_init (l_ifc_handle iii) |
| This function initializes a LIN hardware instance for operation. This function will initialize the run-time state structure to keep track of the on-going transfers, initialize the module to user defined settings and default settings, configure the IRQ state structure and enable the module-level interrupt to the core, and enable the LIN hardware module transmitter and receiver. More...
|
|
l_u8 | lin_lld_deinit (l_ifc_handle iii) |
| This function disconnect the node from the cluster and free all hardware used. More...
|
|
l_u8 | lin_lld_int_enable (l_ifc_handle iii) |
| Enable the interrupt related to the interface. More...
|
|
l_u8 | lin_lld_int_disable (l_ifc_handle iii) |
| Disable the interrupt related to the interface. More...
|
|
l_u8 | lin_lld_get_state (l_ifc_handle iii) |
| This function gets current state of an interface. More...
|
|
l_u8 | lin_lld_tx_header (l_ifc_handle iii, l_u8 id) |
| This function sends frame header for the input PID. More...
|
|
l_u8 | lin_lld_tx_wake_up (l_ifc_handle iii) |
| This function send a wakeup signal. More...
|
|
l_u8 | lin_lld_ignore_response (l_ifc_handle iii) |
| This function terminates an on-going data transmission/reception. More...
|
|
l_u8 | lin_lld_set_low_power_mode (l_ifc_handle iii) |
| Let the low level driver go to low power mode. More...
|
|
l_u8 | lin_lld_set_response (l_ifc_handle iii, l_u8 response_length) |
| This function sends frame data that is contained in LIN_lld_response_buffer[iii]. More...
|
|
l_u8 | lin_lld_rx_response (l_ifc_handle iii, l_u8 response_length) |
| This function receives frame data into the LIN_lld_response_buffer[iii] buffer. More...
|
|
void | lin_lld_timeout_service (l_ifc_handle iii) |
| Callback function for Timer Interrupt Handler In timer IRQ handler, call this function. Used to check if frame timeout has occurred during frame data transmission and reception, to check for N_As and N_Cr timeout for LIN 2.1 and above. This function also check if there is no LIN bus communication (no headers and no frame data transferring) for Idle timeout (s), then put LIN node to Sleep mode. Users may initialize a timer (for example FTM)with period of Timeout unit (default: 500 micro seconds) to call lin_lld_timeout_service(). For an interface iii, Idle timeout (s) = max_idle_timeout_cnt * Timeout unit (us) frame timeout (us) = frame_timeout_cnt * Timeout unit (us) N_As timeout (us) = N_As_timeout * Timeout unit (us) N_Cr timeout (us) = N_Cr_timeout * Timeout unit (us) More...
|
|
static l_u16 lin_calc_max_header_timeout_cnt |
( |
l_u32 |
baudRate | ) |
|
|
inlinestatic |
Computes maximum header timeout.
Theader_Maximum = 1.4 * THeader_Nominal, THeader_Nominal = 34 * TBit, (13 nominal bits of break; 1 nominal bit of break delimiter; 10 bits for SYNC and 10 bits of PID) TIME_OUT_UNIT_US is in micro second
- Parameters
-
[in] | baudRate | LIN network baud rate |
- Returns
- maximum timeout for the selected baud rate
Implements : lin_calc_max_header_timeout_cnt_Activity
Definition at line 629 of file lin.h.
static l_u16 lin_calc_max_res_timeout_cnt |
( |
l_u32 |
baudRate, |
|
|
l_u8 |
size |
|
) |
| |
|
inlinestatic |
Computes the maximum response timeout.
TResponse_Maximum = 1.4 * TResponse_Nominal, TResponse_Nominal = 10 * (NData+ 1) * TBit
- Parameters
-
[in] | baudRate | LIN network baud rate |
[in] | size | frame size in bytes |
- Returns
- maximum response timeout for the given baud rate and frame size
Implements : lin_calc_max_res_timeout_cnt_Activity
Definition at line 645 of file lin.h.
void lin_lld_timeout_service |
( |
l_ifc_handle |
iii | ) |
|
Callback function for Timer Interrupt Handler In timer IRQ handler, call this function. Used to check if frame timeout has occurred during frame data transmission and reception, to check for N_As and N_Cr timeout for LIN 2.1 and above. This function also check if there is no LIN bus communication (no headers and no frame data transferring) for Idle timeout (s), then put LIN node to Sleep mode. Users may initialize a timer (for example FTM)with period of Timeout unit (default: 500 micro seconds) to call lin_lld_timeout_service(). For an interface iii, Idle timeout (s) = max_idle_timeout_cnt * Timeout unit (us) frame timeout (us) = frame_timeout_cnt * Timeout unit (us) N_As timeout (us) = N_As_timeout * Timeout unit (us) N_Cr timeout (us) = N_Cr_timeout * Timeout unit (us)
- Parameters
-
[in] | iii | LIN interface that is being handled |
- Returns
- void
Definition at line 433 of file lin.c.