LIN Middleware
Cooked Transport Layer

General Description

Functions

void ld_send_message (l_ifc_handle iii, l_u16 length, l_u8 nad, const l_u8 *const ld_data, mtb_stc_lin_context_t *context)
 The call packs the information specified by the data and length into one or multiple diagnostic frames. More...
 
void ld_receive_message (l_ifc_handle iii, l_u16 *const length, l_u8 *const nad, l_u8 *const ld_data, mtb_stc_lin_context_t *context)
 The call prepares the LIN diagnostic module to receive one message and store it in the buffer pointed to by data. More...
 
l_u8 ld_tx_status (l_ifc_handle iii, mtb_stc_lin_context_t *context)
 The call returns the status of the last made call to ld_send_message. More...
 
l_u8 ld_rx_status (l_ifc_handle iii, mtb_stc_lin_context_t *context)
 The call returns the status of the last made call to ld_receive_message. More...
 

Function Documentation

◆ ld_send_message()

void ld_send_message ( l_ifc_handle  iii,
l_u16  length,
l_u8  nad,
const l_u8 *const  ld_data,
mtb_stc_lin_context_t context 
)

The call packs the information specified by the data and length into one or multiple diagnostic frames.

If the call is made in Master node application, the frames are transmitted to Slave node with the address NAD. If the call is made in a Slave node application, the frames are transmitted to Master node with the address NAD. The parameter NAD is not used in Slave nodes.

The value of the SID (or RSID) is the first byte in the data area.

The length must be in the range from 1 to 4095 bytes. The length also includes the SID (or RSID) value, i.e. message length plus one.

The call is asynchronous, i.e. is not suspended until the message is sent, and the buffer cannot be changed by the application as long as calls to ld_tx_status returns LD_IN_PROGRESS.

The data is transmitted in suitable frames (the master request frame for master nodes and the Slave response frame for Slave nodes).

If there is a message in progress, the call returns with no action.

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.
lengthThe size of data to be sent in bytes.
nadThe address of Slave node to which data is sent.
ld_dataThe array of data to be sent. The value of RSID is the first byte in the data area.
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_receive_message()

void ld_receive_message ( l_ifc_handle  iii,
l_u16 *const  length,
l_u8 *const  nad,
l_u8 *const  ld_data,
mtb_stc_lin_context_t context 
)

The call prepares the LIN diagnostic module to receive one message and store it in the buffer pointed to by data.

During the call, the length specifies the maximum length allowed. When the reception is completed, the length changes to the actual length and NAD to the NAD in the message.

SID (or RSID) are the first byte in the data area.

The length are in the range from 1 to 4095 bytes, but never more than the value originally set in the call. SID (or RSID) is included in the length.

The parameter NAD is not used in Slave nodes.

The call is asynchronous, i.e. it is suspended only after the message is received, and the buffer cannot be changed by the application as long as a call to ld_rx_status returns LD_IN_PROGRESS. If the call is made after the message transmission has started on the bus (i.e. the SF or FF is already transmitted), this message is received. Instead, the function waits until a next message starts.

The data is received from the succeeding suitable frames (the master request frame for Slave nodes and the Slave response frame for master nodes).

The application monitors the ld_rx_status and does not call this function until the status is LD_COMPLETED. Otherwise, this function may return inconsistent data in the parameters.

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.
lengthThe size of data to be received in bytes.
nadThe address of Slave node from which data is received.
ld_dataThe array of data to be received. The value of the SID is the first byte in the data area.
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_tx_status()

l_u8 ld_tx_status ( l_ifc_handle  iii,
mtb_stc_lin_context_t context 
)

The call returns the status of the last made call to ld_send_message.

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.
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
See: LD_IN_PROGRESS LD_COMPLETED LD_FAILED LD_N_AS_TIMEOUT
Note
Failed status (e.g. LD_FAILED) can be read only once by this function. On the next read, the status will be turned to LD_COMPLETED by the transport layer re-initialization.

◆ ld_rx_status()

l_u8 ld_rx_status ( l_ifc_handle  iii,
mtb_stc_lin_context_t context 
)

The call returns the status of the last made call to ld_receive_message.

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.
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
See: LD_IN_PROGRESS LD_COMPLETED LD_FAILED LD_N_CR_TIMEOUT LD_WRONG_SN
Note
Failed status (e.g. LD_WRONG_SN) can be read only once by this function. On the next read, the status will be turned to LD_COMPLETED by the transport layer re-initialization.