36 #if (SUPPORT_TRANSPORT_LAYER == 1U)
37 #if (SUPPORT_DIAG_SERVICE == 1U)
38 #if (SUPPORT_SLAVE_MODE == 1U)
42 #if (SUPPORT_PROTOCOL_21 == 1U)
57 #if (SUPPORT_PROTOCOL_J2602 == 1U)
60 l_u8 frame_id_change);
71 #if (SUPPORT_PROTOCOL_21 == 1U)
72 #if (SUPPORT_MASTER_MODE == 1U)
108 l_u8 *
const error_code)
139 const l_u8 *
const PIDs)
154 buff[1] = start_index;
209 #if (SUPPORT_SLAVE_MODE == 1U)
210 #if (SUPPORT_PROTOCOL_21 == 1U)
224 l_bool give_positive_flg = (bool)0U;
240 if ((byte > 0U) && (byte < 6U))
243 if ((byte > 0U) && (byte < 3U))
248 else if ((byte > 2U) && (byte < 5U))
259 byte = (
l_u8)((byte ^ invert) & mask);
262 give_positive_flg = (
l_bool)1U;
268 if ((byte > 0U) && (byte < 5U))
290 byte = (
l_u8)((byte ^ invert) & mask);
293 give_positive_flg = (
l_bool)1U;
303 if (give_positive_flg == (
bool)1U)
329 for (i = 0; i < 8U; i++)
335 supid = (
l_u16)(((
l_u16)lin_tl_pdu[4]) << 8U);
336 supid = (
l_u16)(supid | ((
l_u16)lin_tl_pdu[3]));
368 l_u8 cfg_frame_num = 0U;
373 for (i = 0; i < 8U; i++)
379 start_index = lin_tl_pdu[3];
389 cfg_frame_num = (
l_u8)(cfg_frame_num - 3U);
393 for (j = start_index; j < (start_index + 4U); j++)
395 if ((0xFFU != lin_tl_pdu[i++]) && (j > cfg_frame_num))
406 for (i = 4U; i < 8U; i++)
408 switch (lin_tl_pdu[i])
458 l_u8 expected_length;
467 if (temp < expected_length)
479 for (i = 1U; i < expected_length; i++)
485 *length = expected_length;
504 const l_u8 *
const data,
522 l_u16 expected_length;
531 if (length < expected_length)
543 for (i = 1U; i < expected_length; ++i)
563 #if (SUPPORT_DIAG_CLASS_II == 1U)
573 const l_u8 *
const data)
614 const l_u8 *
const data)
619 l_u8 buff[MAX_LENGTH_SERVICE];
629 if (data_length < length)
643 if ((temp == 0x0092U) || (temp == 0x0205U))
645 for (i = 0U; i < data_length; i++)
647 buff[i + 1U] = data[i];
662 #if (SUPPORT_DIAG_CLASS_III == 1U)
674 const l_u8 *
const data)
679 l_u8 buff[MAX_LENGTH_SERVICE];
688 if (data_length < length)
697 for (i = 0U; i < data_length; i++)
699 buff[i + 1U] = data[i];
721 const l_u8 *
const data)
726 l_u8 buff[MAX_LENGTH_SERVICE];
735 if (data_length < length)
744 for (i = 0U; i < data_length; i++)
746 buff[i + 1U] = data[i];
768 const l_u8 *
const data)
773 l_u8 buff[MAX_LENGTH_SERVICE];
781 if (data_length < length)
790 for (i = 0U; i < data_length; i++)
792 buff[i + 1U] = data[i];
814 const l_u8 *
const data)
819 l_u8 buff[MAX_LENGTH_SERVICE];
827 if (data_length < length)
836 for (i = 0U; i < data_length; i++)
838 buff[i + 1U] = data[i];
879 data[1] = (
l_u8)(supplier_id & 0x00FFU);
880 data[2] = (
l_u8)((supplier_id >> 8U) & 0x00FFU);
881 data[3] = (
l_u8)(function_id & 0x00FFU);
882 data[4] = (
l_u8)((function_id >> 8U) & 0x00FFU);
917 if ((
id < 32U) && ((0U < byte_data) && (byte_data < 6U)))
974 buff[2] = (
l_u8)(supplier_id & 0x00FFU);
975 buff[3] = (
l_u8)((supplier_id >> 8U) & 0x00FFU);
976 buff[4] = (
l_u8)(function_id & 0x00FFU);
977 buff[5] = (
l_u8)((function_id >> 8U) & 0x00FFU);
991 #if (SUPPORT_SLAVE_MODE == 1U)
1004 const l_u8 * service_flag;
1005 l_u8 ret_val = 0xFFU;
1014 if (flag_order < node_attr_ptr->number_support_sid)
1016 ret_val = (
l_u8)service_flag[flag_order];
1035 l_u8 * service_flag;
1045 if (flag_order < node_attr_ptr->number_support_sid)
1047 service_flag[flag_order] = 0U;
1066 l_bool sid_supported_flg = (bool)0U;
1068 const l_u8 * service_supported_ptr;
1069 l_u8 * service_flag_ptr;
1077 if (service_supported_ptr[i] == sid)
1079 service_flag_ptr[i] = 1U;
1080 sid_supported_flg = (bool)1U;
1085 if (sid_supported_flg == (
bool)1U)
1093 #if (SUPPORT_PROTOCOL_21 == 1U)
1120 #if (SUPPORT_PROTOCOL_J2602 == 1U)
1170 for (i = 0; i < 8U; i++)
1179 supid = (
l_u16)(((
l_u16)(lin_tl_pdu[5])) << 8U);
1180 supid = (
l_u16)(supid | (
l_u16)(lin_tl_pdu[4]));
1182 fid = (
l_u16)(((
l_u16)(lin_tl_pdu[7])) << 8U);
1209 l_u8 data_callout[5] = {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU};
1215 while ((i < 5U) && (data_callout[i] == 0xFFU))
1289 lin_tl_pdu[1] = 0x03U;
1291 lin_tl_pdu[3] = sid;
1292 lin_tl_pdu[4] = error_code;
1293 lin_tl_pdu[5] = 0xFFU;
1294 lin_tl_pdu[6] = 0xFFU;
1295 lin_tl_pdu[7] = 0xFFU;
1315 lin_tl_pdu[7] = ident->
variant;
1320 lin_tl_pdu[3] = serial_number->
serial_0;
1321 lin_tl_pdu[4] = serial_number->
serial_1;
1322 lin_tl_pdu[5] = serial_number->
serial_2;
1323 lin_tl_pdu[6] = serial_number->
serial_3;
1325 lin_tl_pdu[1] = 0x05U;
1331 l_u8 data_callout[5] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
1334 lin_tl_pdu[3] = data_callout[0];
1335 lin_tl_pdu[4] = data_callout[1];
1336 lin_tl_pdu[5] = data_callout[2];
1337 lin_tl_pdu[6] = data_callout[3];
1338 lin_tl_pdu[7] = data_callout[4];
1340 for (i = 5U; i > 0U; i--)
1342 if (data_callout[i - 1U] != 0xFFU)
1345 lin_tl_pdu[1] = (
l_u8)(i + 1U);
1361 lin_tl_pdu[3] = 0xFFU;
1362 lin_tl_pdu[4] = 0xFFU;
1371 lin_tl_pdu[1] = 0x01U;
1373 lin_tl_pdu[2] = 0xF0U;
1374 lin_tl_pdu[3] = 0xFFU;
1375 lin_tl_pdu[4] = 0xFFU;
1380 lin_tl_pdu[1] = 0x01U;
1382 lin_tl_pdu[2] = 0xF3U;
1383 lin_tl_pdu[3] = 0xFFU;
1384 lin_tl_pdu[4] = 0xFFU;
1386 #if (SUPPORT_PROTOCOL_21 == 1U)
1392 lin_tl_pdu[3] = 0xFFU;
1393 lin_tl_pdu[4] = 0xFFU;
1397 #if (SUPPORT_PROTOCOL_J2602 == 1U)
1399 lin_tl_pdu[1] = 0x06U;
1410 lin_tl_pdu[7] = ident->
variant;
1414 lin_tl_pdu[1] = 0x01U;
1415 lin_tl_pdu[2] = 0xF1U;
1416 lin_tl_pdu[3] = 0xFFU;
1417 lin_tl_pdu[4] = 0xFFU;
1437 #if (SUPPORT_PROTOCOL_J2602 == 1U)
1474 l_u8 *
const error_code)
1478 l_u8 retval = 0xFFU;
1502 retval = (
l_u8)temp;
1535 data[1] = (
l_u8)(supplier_id & 0x00FFU);
1536 data[2] = (
l_u8)((supplier_id >> 8U) & 0x00FFU);
1537 data[3] = (
l_u8)(message_id & 0x00FFU);
1538 data[4] = (
l_u8)((message_id >> 8U) & 0x00FFU);
1549 #if (SUPPORT_SLAVE_MODE == 1U)
1602 if (number_of_configurable_frames > 16U)
1608 else if (number_of_configurable_frames > 8U)
1611 if ((dnn == 0U) || (dnn == 4U) || (dnn == 8U))
1617 else if (number_of_configurable_frames > 4U)
1620 if ((dnn % 2U) == 0U)
1646 l_u8 frame_id_change)
1653 for (i = number_of_configurable_frames; i > 0U; i--)
1665 for (i = number_of_configurable_frames; i > 0U; i--)
1675 else if ((dnn < 8U) &&
1698 l_u8* byte_offset_temp_ptr;
1699 l_u8* bit_offset_temp_ptr;
1710 (0x01U << (*bit_offset_temp_ptr)));
1744 for (i = 0U; i < 8U; i++)
1749 supplier_id = (
l_u16)((
l_u16)lin_tl_pdu[3] | (
l_u16)(lin_tl_pdu[4] << 8U));
1750 message_id = (
l_u16)((
l_u16)lin_tl_pdu[5] | (
l_u16)(lin_tl_pdu[6] << 8U));
1752 if (supplier_id == slave_supplier_id)
#define SERVICE_SAVE_CONFIGURATION
#define LD_NEGATIVE_RESPONSE
#define LD_LENGTH_NOT_CORRECT
#define LIN_READ_USR_DEF_MAX
#define LD_ID_NO_RESPONSE
l_u8 * list_identifiers_RAM_ptr
l_u8 diag_get_flag(l_ifc_handle iii, l_u8 flag_order)
This function will return flag of diagnostic service, if LIN slave node receive master request of the...
lin_product_id_t product_id
#define SERIVCE_FAULT_MEMORY_CLEAR
static void lin_diagservice_assign_frame_id_range(l_ifc_handle iii)
#define PCI_RES_SAVE_CONFIGURATION
void diag_IO_control(l_ifc_handle iii, const l_u8 NAD, l_u16 data_length, const l_u8 *const data)
This function is used for master node only. It will pack data and send request to slave node with ser...
#define SUBFUNCTION_NOT_SUPPORTED
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...
#define SERVICE_READ_BY_IDENTIFY
#define SERVICE_NOT_SUPPORTED
#define SERVICE_FAULT_MEMORY_READ
lin_product_id_t * product_id_ptr
lin_protocol_state_t g_lin_protocol_state_array[LIN_NUM_OF_IFCS]
void ld_read_by_id(l_ifc_handle iii, l_u8 NAD, l_u16 supplier_id, l_u16 function_id, l_u8 id, lin_product_id_t *const data)
The call requests the slave node selected with the NAD to return the property associated with the id ...
#define SERVICE_ASSIGN_FRAME_ID
#define LD_POSITIVE_RESPONSE
l_ifc_slave_handle slave_ifc_handle
void diag_fault_memory_read(l_ifc_handle iii, const l_u8 NAD, l_u16 data_length, const l_u8 *const data)
This function is used for master node only. It will pack data and send request to slave node with ser...
void ld_conditional_change_NAD(l_ifc_handle iii, l_u8 NAD, l_u8 id, l_u8 byte_data, l_u8 mask, l_u8 invert, l_u8 new_NAD)
This call changes the NAD if the node properties fulfill the test specified by id, byte, mask and invert. Master node only.
#define LD_FUNCTIONAL_NAD
#define LIN_SERIAL_NUMBER
#define SERVICE_IO_CONTROL_BY_IDENTIFY
#define SERVICE_READ_DATA_BY_IDENTIFY
const l_u16 * list_identifiers_ROM_ptr
#define LIN_SLAVE
Mode of LIN node (master or slave)
static void lin_diagservice_target_reset(l_ifc_handle iii)
void ld_save_configuration(l_ifc_handle iii, l_u8 NAD)
This function to issue a save configuration request to a slave node.
static l_bool ld_change_msg_id(l_ifc_handle iii, l_u8 dnn, l_u8 frame_id_change)
lin_tl_pdu_data_t * tl_pdu_ptr
void lin_diag_service_callback(l_ifc_handle iii, l_u8 sid)
l_bool ld_is_ready_j2602(l_ifc_handle iii)
Verifies a state of node setting (using for J2602 and LIN 2.0).
l_u8 ld_set_configuration(l_ifc_handle iii, const l_u8 *const data, l_u16 length)
This function configures slave node according to data.
const l_u8 * service_supported_ptr
const lin_node_attribute_t g_lin_node_attribute_array[LIN_NUM_OF_SLAVE_IFCS]
l_bool ld_assign_NAD_j2602(l_ifc_handle iii, l_u8 dnn)
This function assigns NAD of a J2602 slave device based on input DNN that is Device Node Number...
l_u8 g_lin_frame_data_buffer[LIN_FRAME_BUF_SIZE]
l_u8 ld_check_response_j2602(l_ifc_handle iii, l_u8 *const RSID, l_u8 *const error_code)
Verifies the state of response (using for J2602 and LIN 2.0) Master node only.
lin_tl_descriptor_t g_lin_tl_descriptor_array[LIN_NUM_OF_IFCS]
#define PCI_RES_ASSIGN_FRAME_ID_RANGE
#define SERVICE_TARGET_RESET
l_u8 num_frame_have_esignal
Configuration structure Implements : lin_protocol_user_config_t_Class.
Serial number Implements : lin_serial_number_t_Class.
#define PCI_RES_READ_BY_IDENTIFY
#define LD_LENGTH_TOO_SHORT
void ld_send_message(l_ifc_handle iii, l_u16 length, l_u8 NAD, const l_u8 *const data)
Pack the information specified by data and length into one or multiple diagnostic frames...
l_u8 * response_error_bit_offset_ptr
void ld_check_response(l_ifc_handle iii, l_u8 *const RSID, l_u8 *const error_code)
This call returns the result of the last node configuration service, in the parameters RSID and error...
l_bool ld_reconfig_msg_ID(l_ifc_handle iii, l_u8 dnn)
This function reconfigures frame identifiers of a J2602 slave node based on input dnn...
Product id structure Implements : lin_product_id_t_Class.
#define PCI_SAVE_CONFIGURATION
#define SERVICE_SESSION_CONTROL
void diag_clear_flag(l_ifc_handle iii, l_u8 flag_order)
This function will clear flag of diagnostic service,.
void diag_write_data_by_identifier(l_ifc_handle iii, const l_u8 NAD, l_u16 data_length, const l_u8 *const data)
Write Data by Identifier for a specified node - Diagnostic Class II service (0x2E) ...
Transport layer queue Implements : lin_transport_layer_queue_t_Class.
#define SERVICE_ASSIGN_NAD
l_u8 * configured_NAD_ptr
l_u8 * response_error_byte_offset_ptr
const lin_protocol_user_config_t g_lin_protocol_user_cfg_array[LIN_NUM_OF_IFCS]
ld_queue_status_t queue_status
void diag_read_data_by_identifier(l_ifc_handle iii, const l_u8 NAD, const l_u8 *const data)
This function reads data by identifier, Diagnostic Class II service (0x22).
unsigned char l_u8
Unsigned 8 bit integer Implements : l_u8_Class.
static void lin_diagservice_assign_frame_id(l_ifc_handle iii)
void ld_assign_frame_id_range(l_ifc_handle iii, l_u8 NAD, l_u8 start_index, const l_u8 *const PIDs)
This function assigns the protected identifier of up to four frames.
static void lin_assign_nad(l_ifc_handle iii)
l_u8 ld_read_configuration(l_ifc_handle iii, l_u8 *const data, l_u8 *const length)
This function copies current configuration in a reserved area.
lin_last_cfg_result_t
Status of the last configuration call completed Implements : lin_last_cfg_result_t_Class.
void ld_put_raw(l_ifc_handle iii, const l_u8 *const data)
Queue the transmission of 8 bytes of data in one frame.
void ld_assign_NAD(l_ifc_handle iii, l_u8 initial_NAD, l_u16 supplier_id, l_u16 function_id, l_u8 new_NAD)
This call assigns the NAD (node diagnostic address) of all slave nodes that matches the initial_NAD...
lin_diagnostic_state_t diag_state
lin_transport_layer_queue_t tl_rx_queue
void ld_assign_frame_id(l_ifc_handle iii, l_u8 NAD, l_u16 supplier_id, l_u16 message_id, l_u8 PID)
This function assigns the protected identifier to a slave node with the address NAD and specified sup...
static void ld_make_slave_response_pdu(l_ifc_handle iii, l_u8 sid, l_u8 res_type, l_u8 error_code)
lin_protocol_handle_t protocol_version
lin_service_status_t service_status
Attributes of LIN node Implements : lin_node_attribute_t_Class.
l_u8 ld_is_ready(l_ifc_handle iii)
This call returns the status of the last requested configuration service.
l_u8 ld_read_by_id_callout(l_ifc_handle iii, l_u8 id, l_u8 *data)
void diag_fault_memory_clear(l_ifc_handle iii, const l_u8 NAD, l_u16 data_length, const l_u8 *const data)
This function is used for master node only. It will pack data and send request to slave node with ser...
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
static void lin_condittional_change_nad(l_ifc_handle iii)
#define SERVICE_CONDITIONAL_CHANGE_NAD
#define SERVICE_WRITE_DATA_BY_IDENTIFY
l_u8 number_of_configurable_frames
#define LIN_READ_USR_DEF_MIN
unsigned short int l_u16
Unsigned 16 bit integer Implements : l_u16_Class.
static void lin_diagservice_read_by_identifier(l_ifc_handle iii)
void diag_session_control(l_ifc_handle iii, const l_u8 NAD, l_u16 data_length, const l_u8 *const data)
This function is used for master node only. It will pack data and send request to slave node with ser...
Transport layer description Implements : lin_tl_descriptor_t_Class.
#define SERVICE_ASSIGN_FRAME_ID_RANGE
lin_last_cfg_result_t last_cfg_result