S32 SDK
lin_diagnostic_service.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3  * Copyright 2016 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
18 
19 #ifndef LIN_DIAGNOSTIC_SERVICE_H
20 #define LIN_DIAGNOSTIC_SERVICE_H
21 
22 #include "lin_types.h"
23 #include "lin_cfg.h"
24 
25 #if (SUPPORT_TRANSPORT_LAYER == 1U)
26 #if (SUPPORT_DIAG_SERVICE == 1U)
27 
32 /*******************************************************************************
33  * API
34  ******************************************************************************/
35 #if (SUPPORT_PROTOCOL_21 == 1U)
36 #if (SUPPORT_MASTER_MODE == 1U)
37 
56 l_u8 ld_is_ready(l_ifc_handle iii);
57 
58 
72 void ld_check_response(l_ifc_handle iii,
73  l_u8 * const RSID,
74  l_u8 * const error_code);
75 
76 
89 void ld_assign_frame_id_range(l_ifc_handle iii,
90  l_u8 NAD,
91  l_u8 start_index,
92  const l_u8 * const PIDs);
93 
109 void ld_save_configuration(l_ifc_handle iii,
110  l_u8 NAD);
111 
112 #endif /* End (SUPPORT_MASTER_NODE == 1U) */
113 
114 #if (SUPPORT_SLAVE_MODE == 1U)
115 
128 l_u8 ld_read_configuration(l_ifc_handle iii,
129  l_u8 * const data,
130  l_u8 * const length);
131 
132 
147 l_u8 ld_set_configuration(l_ifc_handle iii,
148  const l_u8 * const data,
149  l_u16 length);
150 
151 #endif /* End (SUPPORT_SLAVE_NODE == 1U) */
152 
153 #if (SUPPORT_DIAG_CLASS_II == 1U)
154 /* Diagnostic class II services, they can be used in class III */
166 void diag_read_data_by_identifier(l_ifc_handle iii,
167  const l_u8 NAD,
168  const l_u8 * const data);
169 
183 void diag_write_data_by_identifier(l_ifc_handle iii,
184  const l_u8 NAD,
185  l_u16 data_length,
186  const l_u8 * const data);
187 
188 /* END diagnostic class II services */
189 #endif /*(SUPPORT_DIAG_CLASS_II == 1U) */
190 
191 /* Diagnostic class III services, these services only belong to diagnostic class III */
192 #if (SUPPORT_DIAG_CLASS_III == 1U)
193 /* Session control */
204 void diag_session_control(l_ifc_handle iii,
205  const l_u8 NAD,
206  l_u16 data_length,
207  const l_u8 * const data);
208 
209 /* Fault memory */
220 void diag_fault_memory_read(l_ifc_handle iii,
221  const l_u8 NAD,
222  l_u16 data_length,
223  const l_u8 * const data);
224 
225 /* Fault memory clear */
236 void diag_fault_memory_clear(l_ifc_handle iii,
237  const l_u8 NAD,
238  l_u16 data_length,
239  const l_u8 * const data);
240 
241 /* Input/Output control service */
252 void diag_IO_control(l_ifc_handle iii,
253  const l_u8 NAD,
254  l_u16 data_length,
255  const l_u8 * const data);
256 
257 #endif /* End (SUPPORT_DIAG_CLASS_III == 1U) */
258 #endif /* End of (LIN_PROTOCOL == PROTOCOL_21) */
259 
282 void ld_assign_NAD(l_ifc_handle iii,
283  l_u8 initial_NAD,
284  l_u16 supplier_id,
285  l_u16 function_id,
286  l_u8 new_NAD);
287 
306 void ld_conditional_change_NAD(l_ifc_handle iii,
307  l_u8 NAD,
308  l_u8 id,
309  l_u8 byte_data,
310  l_u8 mask,
311  l_u8 invert,
312  l_u8 new_NAD);
313 
337 void ld_read_by_id(l_ifc_handle iii,
338  l_u8 NAD,
339  l_u16 supplier_id,
340  l_u16 function_id,
341  l_u8 id,
342  lin_product_id_t * const data);
343 
344 
358 l_u8 diag_get_flag(l_ifc_handle iii,
359  l_u8 flag_order);
360 
368 void diag_clear_flag(l_ifc_handle iii,
369  l_u8 flag_order);
370 
372 #if (SUPPORT_PROTOCOL_J2602 == 1U)
373 
383 l_bool ld_is_ready_j2602(l_ifc_handle iii);
384 
394 l_u8 ld_check_response_j2602(l_ifc_handle iii,
395  l_u8 * const RSID,
396  l_u8 * const error_code);
397 
410 void ld_assign_frame_id(l_ifc_handle iii,
411  l_u8 NAD,
412  l_u16 supplier_id,
413  l_u16 message_id,
414  l_u8 PID);
415 #if (SUPPORT_SLAVE_MODE == 1U)
416 
428 l_bool ld_assign_NAD_j2602(l_ifc_handle iii,
429  l_u8 dnn);
430 
448 l_bool ld_reconfig_msg_ID(l_ifc_handle iii,
449  l_u8 dnn);
450 
452 #endif /* End (SUPPORT_SLAVE_MODE == 1U) */
453 #endif /* End (SUPPORT_PROTOCOL_J2602 == 1U) */
454 #endif /* End (SUPPORT_DIAG_SERVICE == 1U) */
455 #endif /* End (SUPPORT_TRANSPORT_LAYER == 1U) */
456 #endif /* LIN_DIAGNOSTIC_SERVICE_H */
457 /******************************************************************************/
458 /* EOF */
459 /******************************************************************************/
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...
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...
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 ...
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.
void ld_save_configuration(l_ifc_handle iii, l_u8 NAD)
This function to issue a save configuration request to a slave node.
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.
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 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.
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.
Definition: lin_types.h:57
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) ...
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.
Definition: lin_types.h:30
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.
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.
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...
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...
l_u8 ld_is_ready(l_ifc_handle iii)
This call returns the status of the last requested configuration service.
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...
bool l_bool
0 is false, and non-zero (>0) is true Implements : l_bool_Class
Definition: lin_types.h:48
unsigned short int l_u16
Unsigned 16 bit integer Implements : l_u16_Class.
Definition: lin_types.h:36
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...