lin_commontl_api.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  */
34 #ifndef LIN_COMMONTL_API_H
35 #define LIN_COMMONTL_API_H
36 
42 #include "lin.h"
43 #include "lin_common_api.h"
44 #if (SUPPORT_TRANSPORT_LAYER == 1U)
45 
46 /*******************************************************************************
47  * Definitions
48  ******************************************************************************/
49 /* Node configuration */
50 #define LD_READ_OK 0x33U
51 #define LD_LENGTH_TOO_SHORT 0x34U
53 #define LD_DATA_ERROR 0x43U
54 #define LD_LENGTH_NOT_CORRECT 0x44U
55 #define LD_SET_OK 0x45U
57 /* For J2602 */
58 #define SERVICE_TARGET_RESET 0xB5U
59 #define RES_POSITIVE 0x40U
61 /* Identifiers of node read by identifier service */
62 #define LIN_PRODUCT_ID 0x00U
63 #define LIN_SERIAL_NUMBER 0x01U
65 /* Define wildcards */
66 #define LD_BROADCAST 0x7FU
67 #define LD_FUNCTIONAL_NAD 0x7EU
68 #define LD_ANY_SUPPLIER 0x7FFFU
69 #define LD_ANY_FUNCTION 0xFFFFU
70 #define LD_ANY_MESSAGE 0xFFFFU
72 /* For negative response */
73 #define RES_NEGATIVE 0x7FU
74 #define GENERAL_REJECT 0x10U
75 #define SERVICE_NOT_SUPPORTED 0x11U
76 #define SUBFUNCTION_NOT_SUPPORTED 0x12U
78 /* Response type from Slave */
79 #define NEGATIVE 0U
80 #define POSITIVE 1U
82 #define TRANSMITTING 0U
83 #define RECEIVING 1U
85 #if (SUPPORT_SLAVE_MODE == 1U)
86 extern void lin_diag_service_callback(l_ifc_handle iii,
87  l_u8 sid);
88 
89 #define DIAG_SERVICE_CALLBACK_HANDLER(iii, sid) lin_diag_service_callback((iii), (sid))
90 #endif /* End (SUPPORT_SLAVE_MODE == 1U) */
91 
92 /* Initialized transport layer */
107 void ld_init(l_ifc_handle iii);
108 
111 /* Transport layer RAW APIs */
127 void ld_put_raw(l_ifc_handle iii,
128  const l_u8 * const data);
129 
144 void ld_get_raw(l_ifc_handle iii,
145  l_u8 * const data);
146 
168 l_u8 ld_raw_tx_status(l_ifc_handle iii);
169 
185 l_u8 ld_raw_rx_status(l_ifc_handle iii);
186 
189 /* Transport layer COOKED APIs */
210 void ld_send_message(l_ifc_handle iii,
211  l_u16 length,
212  l_u8 NAD,
213  const l_u8 * const data);
214 
231 void ld_receive_message(l_ifc_handle iii,
232  l_u16 * const length,
233  l_u8 * const NAD,
234  l_u8 * const data);
235 
262 l_u8 ld_tx_status(l_ifc_handle iii);
263 
293 l_u8 ld_rx_status(l_ifc_handle iii);
294 
296 #endif /*end (SUPPORT_TRANSPORT_LAYER == 1U) */
297 #endif /* LIN_COMMONTL_API_H */
298 
302 /******************************************************************************/
303 /* EOF */
304 /******************************************************************************/
l_u8 ld_raw_rx_status(l_ifc_handle iii)
Get the status of the raw frame receive function.
void ld_init(l_ifc_handle iii)
Initialize or reinitialize the raw and cooked layers.
l_u8 ld_rx_status(l_ifc_handle iii)
Get the status of the last made call to ld_send_message.
void ld_receive_message(l_ifc_handle iii, l_u16 *const length, l_u8 *const NAD, l_u8 *const data)
Prepare the LIN diagnostic module to receive one message and store it in the buffer pointed to by dat...
void lin_diag_service_callback(l_ifc_handle iii, l_u8 sid)
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...
void ld_get_raw(l_ifc_handle iii, l_u8 *const data)
Copy the oldest received diagnostic frame data to the memory specified by data.
l_u8 ld_tx_status(l_ifc_handle iii)
Get the status of the last made call to ld_send_message.
unsigned char l_u8
Unsigned 8 bit integer Implements : l_u8_Class.
Definition: lin_types.h:30
l_u8 ld_raw_tx_status(l_ifc_handle iii)
Get the status of the raw frame transmission function.
void ld_put_raw(l_ifc_handle iii, const l_u8 *const data)
Queue the transmission of 8 bytes of data in one frame.
unsigned short int l_u16
Unsigned 16 bit integer Implements : l_u16_Class.
Definition: lin_types.h:36