LIN Middleware
Node Configuration

General Description

Functions

__STATIC_INLINE void mtb_lin_register_read_by_id_callback (mtb_cb_lin_read_by_id_t callback, mtb_stc_lin_context_t *context)
 Registers a callback function for ld_read_by_id_callout(). More...
 
l_u8 ld_read_configuration (l_ifc_handle iii, l_u8 *pData, l_u8 *const length, const mtb_stc_lin_context_t *context)
 This function reads the NAD and PID values from the volatile memory. More...
 
l_u8 ld_set_configuration (l_ifc_handle iii, const l_u8 *const pData, l_u16 length, mtb_stc_lin_context_t *context)
 This call does not transport anything to the bus. More...
 
l_u8 ld_read_by_id_callout (l_ifc_handle iii, l_u8 id, l_u8 *frame_data, l_u8 *data_length, const mtb_stc_lin_context_t *context)
 This function calls out when Master node transmits a "read" by an identifier request with the identifier in the user-defined area. More...
 

Function Documentation

◆ mtb_lin_register_read_by_id_callback()

__STATIC_INLINE void mtb_lin_register_read_by_id_callback ( mtb_cb_lin_read_by_id_t  callback,
mtb_stc_lin_context_t context 
)

Registers a callback function for ld_read_by_id_callout().

To remove the callback function, pass a NULL as the function pointer.

Parameters
callbackThe pointer to a callback function.
contextThe pointer to the context structure mtb_stc_lin_context_t allocated by the user. This structure is used during LIN Slave operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ ld_read_configuration()

l_u8 ld_read_configuration ( l_ifc_handle  iii,
l_u8 pData,
l_u8 *const  length,
const mtb_stc_lin_context_t context 
)

This function reads the NAD and PID values from the volatile memory.

This function reads the current configuration data, and saves this data into the non-volatile (flash) memory. The application saves the configuration data to the flash when the "Save Configuration" bit is set in the LIN status register (returned by l_ifc_read_status_LINS). The configuration data that is read is a series of bytes. The first byte is the current NAD of slave. The next bytes are the current PID values for the frames that the Slave responds to. The PID values are in the order in which the frames appear in the LDF or NCF file.

Parameters
iiiThe name of the interface handle. The parameter is not used within the middleware as the interface is defined by the context parameter. See l_ifc_handle.
pDataThe pointer to data.
lengthThe length of the configuration bytes.
contextThe pointer to the context structure mtb_stc_lin_context_t allocated by the user. This structure is used during LIN Slave operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
Node Configuration Status

◆ ld_set_configuration()

l_u8 ld_set_configuration ( l_ifc_handle  iii,
const l_u8 *const  pData,
l_u16  length,
mtb_stc_lin_context_t context 
)

This call does not transport anything to the bus.

The function configures NAD and PIDs accordingly to the configuration given by data. The intended usage is to restore the saved configuration or set initial configuration (e.g. coded by I/O pins).

The function is called after calling l_ifc_init.

The caller must set the size of the data area before calling the function.

The data contains NAD and PIDs each occupying one byte. The data structure is: NAD and all PIDs for the frames. The PIDs order is the same as the frame list in LDF, Section 9.2.2.2, and NCF, Section 8.2.5.

Parameters
iiiThe name of the interface handle. The parameter is not used within the middleware as the interface is defined by the context parameter. See l_ifc_handle.
pDataThe pointer to data.
lengthThe length of the configuration bytes.
contextThe pointer to the context structure mtb_stc_lin_context_t allocated by the user. This structure is used during LIN Slave operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
Node Configuration Status

◆ ld_read_by_id_callout()

l_u8 ld_read_by_id_callout ( l_ifc_handle  iii,
l_u8  id,
l_u8 frame_data,
l_u8 data_length,
const mtb_stc_lin_context_t context 
)

This function calls out when Master node transmits a "read" by an identifier request with the identifier in the user-defined area.

Slave node application is called from the driver when such a request is received.

Parameters
iiiThe name of the interface handle. The parameter is not used within the middleware as the interface is defined by the context parameter. See l_ifc_handle.
idThe ID parameter is the identifier in the user–defined area (32 to 63), from the "read" by an identifier configuration request.
frame_dataThe data pointer points to a data area with 5 bytes. This area is used by the application to set up a positive response.
data_lengthThe data pointer, which points to a data length in response. The length is 4 LSB bits in PCI ([bit0 - bit3]). The RSID byte is added by FW, the user must set just the data size.
contextThe pointer to the context structure mtb_stc_lin_context_t allocated by the user. This structure is used during LIN Slave operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
Node Identification Status