S32 SDK
lin.c File Reference
#include "lin.h"

Go to the source code of this file.

Functions

static void CallbackHandler (uint32_t instance, void *linState)
 
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...
 
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_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_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_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...
 

Variables

lin_tl_descriptor_t g_lin_tl_descriptor_array [LIN_NUM_OF_IFCS]
 
lin_protocol_state_t g_lin_protocol_state_array [LIN_NUM_OF_IFCS]
 
lin_master_data_t g_lin_master_data_array [LIN_NUM_OF_MASTER_IFCS]
 
static lin_state_t s_lin_state_array [LIN_NUM_OF_IFCS]
 
static volatile l_u16 s_lin_max_header_timeout [LIN_NUM_OF_IFCS]
 
static l_u16 s_lin_max_frame_res_timeout_val [LIN_NUM_OF_IFCS][8]
 
static l_bool s_baudrate_adjusted_flg [LIN_NUM_OF_IFCS]
 

Function Documentation

static void CallbackHandler ( uint32_t  instance,
void *  linState 
)
static

Definition at line 515 of file lin.c.

Variable Documentation

l_bool s_baudrate_adjusted_flg[LIN_NUM_OF_IFCS]
static

Definition at line 60 of file lin.c.

l_u16 s_lin_max_frame_res_timeout_val[LIN_NUM_OF_IFCS][8]
static

Global 2-dimensions array for storing the response timeout for all frame sizes for each interface

Definition at line 57 of file lin.c.

volatile l_u16 s_lin_max_header_timeout[LIN_NUM_OF_IFCS]
static

Global array for storing the frame header timeout for each interface

Definition at line 56 of file lin.c.

lin_state_t s_lin_state_array[LIN_NUM_OF_IFCS]
static

Global array for storing the status of all available LIN interfaces

Definition at line 55 of file lin.c.