55 #if ((SUPPORT_TRANSPORT_LAYER != 1U) || (SUPPORT_DIAG_SERVICE != 1U))
56 #define UNUSED(x) (void)(x)
60 #define SERVICE_ASSIGN_NAD 0xB0U
61 #define SERVICE_ASSIGN_FRAME_ID 0xB1U
62 #define SERVICE_READ_BY_IDENTIFY 0xB2U
63 #define SERVICE_CONDITIONAL_CHANGE_NAD 0xB3U
64 #define SERVICE_SAVE_CONFIGURATION 0xB6U
65 #define SERVICE_ASSIGN_FRAME_ID_RANGE 0xB7U
67 #define SERVICE_READ_DATA_BY_IDENTIFY 0x22U
68 #define SERVICE_WRITE_DATA_BY_IDENTIFY 0x2EU
69 #define SERVICE_SESSION_CONTROL 0x10U
70 #define SERVICE_IO_CONTROL_BY_IDENTIFY 0x2FU
71 #define SERVICE_FAULT_MEMORY_READ 0x19U
72 #define SERIVCE_FAULT_MEMORY_CLEAR 0x14U
75 #define PCI_SAVE_CONFIGURATION 0x01U
78 #define PCI_RES_READ_BY_IDENTIFY 0x06U
79 #define PCI_RES_SAVE_CONFIGURATION 0x01U
80 #define PCI_RES_ASSIGN_FRAME_ID_RANGE 0x01U
83 #define LIN_READ_USR_DEF_MIN 32U
84 #define LIN_READ_USR_DEF_MAX 63U
87 #define LD_ID_NO_RESPONSE 0x52U
88 #define LD_NEGATIVE_RESPONSE 0x53U
89 #define LD_POSITIVE_RESPONSE 0x54U
92 #define LIN_LLD_OK 0x00U
93 #define LIN_LLD_ERROR 0xFFU
99 typedef l_u8 lin_tl_pdu_data_t[8];
152 unsigned int error_in_res : 1;
153 unsigned int successful_transfer : 1;
154 unsigned int overrun : 1;
155 unsigned int go_to_sleep_flg : 1;
156 unsigned int bus_activity : 1;
157 unsigned int event_trigger_collision_flg : 1;
158 unsigned int save_config_flg : 1;
159 unsigned int reserved : 1;
160 unsigned int last_pid : 8;
374 #define LIN_TL_CALLBACK_HANDLER(iii, tl_event_id, id) lin_tl_callback_handler((iii), (tl_event_id), (id))
447 #define INTERLEAVE_MAX_TIMEOUT (l_u16)(1000000U/TIME_OUT_UNIT_US)
530 #if (SUPPORT_TRANSPORT_LAYER == 1U)
593 #if (SUPPORT_SLAVE_MODE == 1U)
597 #if (SUPPORT_MASTER_MODE == 1U)
629 return (
l_u16)((14U * 34U * 100000U / (TIME_OUT_UNIT_US * baudRate)) + 1U);
648 return (
l_u16)((a * 1000000U / (TIME_OUT_UNIT_US * baudRate)) + 1U);
685 #define CALLBACK_HANDLER(iii, event_id, id) lin_pid_resp_callback_handler((iii), (event_id), (id))
787 l_u8 response_length);
802 l_u8 response_length);
const l_ifc_handle g_lin_hardware_ifc[HARDWARE_INSTANCE_COUNT]
lin_sch_tbl_type_t
Types of schedule tables Implements : lin_sch_tbl_type_t_Class.
static l_u16 lin_calc_max_res_timeout_cnt(l_u32 baudRate, l_u8 size)
Computes the maximum response timeout.
lin_frame_type_t
Types of frame Implements : lin_frame_type_t_Class.
l_u8 * list_identifiers_RAM_ptr
diag_interleaved_state_t
State of diagnostic interleaved mode Implements : diag_interleaved_state_t_Class. ...
lin_product_id_t product_id
lin_sch_tbl_type_t sch_tbl_type
lin_tl_event_id_t
Transport layer event IDs Implements : lin_tl_event_id_t_Class.
l_ifc_master_handle master_ifc_handle
lin_serial_number_t serial_number
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 bi...
lin_word_status_str_t word_status
lin_tl_callback_return_t
Transport layer event IDs Implements : lin_tl_callback_return_t_Class.
lin_product_id_t * product_id_ptr
lin_protocol_state_t g_lin_protocol_state_array[LIN_NUM_OF_IFCS]
LIN schedule structure Implements : lin_schedule_data_t_Class.
lin_service_status_t
Status of the last configuration call for LIN 2.1 Implements : lin_service_status_t_Class.
l_ifc_slave_handle slave_ifc_handle
l_u8 lin_tl_queue_t[8]
LIN transport layer queue Implements : lin_tl_queue_t_Class.
lin_protocol_handle_t language_version
lin_master_data_t g_lin_master_data_array[LIN_NUM_OF_MASTER_IFCS]
lin_message_timeout_type_t
Types of message timeout Implements : lin_message_timeout_type_t_Class.
const l_u16 * list_identifiers_ROM_ptr
l_u8 lin_lld_tx_header(l_ifc_handle iii, l_u8 id)
This function sends frame header for the input PID.
l_u16 * receive_message_length_ptr
const lin_timer_get_time_interval_t timerGetTimeIntervalCallbackArr[LIN_NUM_OF_IFCS]
l_diagnostic_mode_t diagnostic_mode
l_bool send_slave_res_flg
lin_tl_pdu_data_t * tl_pdu_ptr
const l_u8 * service_supported_ptr
LIN master configuration structure Implements : lin_master_data_t_Class.
unsigned long l_u32
Unsigned 32 bit integer Implements : l_u32_Class.
const lin_node_attribute_t g_lin_node_attribute_array[LIN_NUM_OF_SLAVE_IFCS]
l_u8 previous_schedule_id
Schedule table description Implements : lin_schedule_t_Class.
const lin_frame_t * frame_tbl_ptr
l_u8 g_lin_frame_data_buffer[LIN_FRAME_BUF_SIZE]
const lin_associate_frame_t * frame_data_ptr
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]. ...
lin_diagnostic_class_t
List of diagnostic classes Implements : lin_diagnostic_class_t_Class.
lin_tl_queue_t tl_queue_data
l_u16 interleave_timeout_counter
lin_tl_descriptor_t g_lin_tl_descriptor_array[LIN_NUM_OF_IFCS]
lin_diagnostic_state_t
LIN diagnostic state Implements : lin_diagnostic_state_t_Class.
lin_message_status_t
Status of LIN message Implements : lin_message_status_t_Class.
uint32_t(* lin_timer_get_time_interval_t)(uint32_t *nanoSeconds)
Callback function to get time interval in nanoseconds Implements : lin_timer_get_time_interval_t_Clas...
l_u8 lin_lld_set_low_power_mode(l_ifc_handle iii)
Let the low level driver go to low power mode.
l_u8 num_frame_have_esignal
l_u8 lin_lld_int_disable(l_ifc_handle iii)
Disable the interrupt related to the interface.
l_bool lin_lld_init(l_ifc_handle iii)
This function initializes a LIN hardware instance for operation. This function will initialize the ru...
lin_tl_pdu_data_t * tl_tx_queue_data_ptr
l_u8 * resp_err_frm_id_ptr
Configuration structure Implements : lin_protocol_user_config_t_Class.
Serial number Implements : lin_serial_number_t_Class.
lin_message_status_t rx_msg_status
l_bool event_trigger_collision_flg
diag_interleaved_state_t diag_interleave_state
l_u8 g_lin_flag_handle_tbl[LIN_FLAG_BUF_SIZE]
lin_frame_response_t
LIN frame response Implements : lin_frame_response_t_Class.
lin_message_timeout_type_t check_timeout_type
lin_frame_type_t frm_type
l_u8 * response_buffer_ptr
lin_diagnostic_class_t diagnostic_class
l_u8 * response_error_bit_offset_ptr
l_signal_handle response_error
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)
Product id structure Implements : lin_product_id_t_Class.
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.
static l_u16 lin_calc_max_header_timeout_cnt(l_u32 baudRate)
Computes maximum header timeout.
l_u8 lin_lld_tx_wake_up(l_ifc_handle iii)
This function send a wakeup signal.
LIN protocol status structure Implements : lin_protocol_state_t_Class.
Transport layer queue Implements : lin_transport_layer_queue_t_Class.
l_u8 * configured_NAD_ptr
l_u8 num_of_processed_frame
ld_queue_status_t
Status of queue Implements : ld_queue_status_t_Class.
l_u8 * response_error_byte_offset_ptr
l_u8 num_of_associated_uncond_frames
const lin_protocol_user_config_t g_lin_protocol_user_cfg_array[LIN_NUM_OF_IFCS]
Informations of associated frame Implements : lin_associate_frame_t_Class.
ld_queue_status_t queue_status
l_diagnostic_mode_t
Diagnostic mode Implements : l_diagnostic_mode_t_Class.
unsigned char l_u8
Unsigned 8 bit integer Implements : l_u8_Class.
lin_tl_callback_return_t lin_tl_callback_handler(l_ifc_handle iii, lin_tl_event_id_t tl_event_id, l_u8 id)
lin_transport_layer_queue_t tl_tx_queue
const lin_schedule_t * schedule_tbl
const l_signal_handle * fault_state_signal_ptr
lin_last_cfg_result_t
Status of the last configuration call completed Implements : lin_last_cfg_result_t_Class.
LIN hardware configuration structure Implements : lin_user_config_t_Class.
lin_protocol_handle_t
List of protocols Implements : lin_protocol_handle_t_Class.
lin_diagnostic_state_t diag_state
lin_user_config_t * lin_user_config_ptr
const lin_schedule_data_t * ptr_sch_data_ptr
l_u16 max_idle_timeout_cnt
l_u8 lin_lld_deinit(l_ifc_handle iii)
This function disconnect the node from the cluster and free all hardware used.
l_bool send_functional_request_flg
l_u8 lin_lld_int_enable(l_ifc_handle iii)
Enable the interrupt related to the interface.
lin_transport_layer_queue_t tl_rx_queue
lin_protocol_handle_t protocol_version
lin_tl_pdu_data_t * tl_rx_queue_data_ptr
lin_message_status_t tx_msg_status
lin_service_status_t service_status
Attributes of LIN node Implements : lin_node_attribute_t_Class.
l_u8 ld_read_by_id_callout(l_ifc_handle iii, l_u8 id, l_u8 *data)
l_u8 lin_tl_pdu_data_t[8]
PDU data. Implements : lin_tl_pdu_data_t_Class.
bool l_bool
0 is false, and non-zero (>0) is true Implements : l_bool_Class
const l_u32 g_lin_virtual_ifc[LIN_NUM_OF_IFCS]
status of LIN bus Implements : lin_word_status_str_t_Class
lin_frame_response_t frm_response
l_u8 lin_lld_ignore_response(l_ifc_handle iii)
This function terminates an on-going data transmission/reception.
const l_frame_handle * associated_uncond_frame_ptr
l_u8 number_of_configurable_frames
l_u8 lin_lld_get_state(l_ifc_handle iii)
This function gets current state of an interface.
l_bool g_lin_frame_flag_handle_tbl[LIN_NUM_OF_FRMS]
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.
lin_lld_event_id_t
Event id Implements : lin_lld_event_id_t_Class.
l_u8 num_of_fault_state_signal
Frame description structure Implements : lin_frame_t_Class.
l_u8 * schedule_start_entry_ptr
l_u8 * receive_message_ptr
unsigned short int l_u16
Unsigned 16 bit integer Implements : l_u16_Class.
Transport layer description Implements : lin_tl_descriptor_t_Class.
l_bool transmit_error_resp_sig_flg
lin_last_cfg_result_t last_cfg_result