LIN Middleware
Interface Management

General Description

Functions

l_bool l_ifc_init (l_ifc_handle iii, mtb_stc_lin_context_t *context, cyhal_gpio_t tx, cyhal_gpio_t rx)
 The function initializes the LIN Slave middleware instance specified by the context. More...
 
void l_ifc_wake_up (l_ifc_handle iii, const mtb_stc_lin_context_t *context)
 This function transmits one wake-up signal. More...
 
mtb_lin_status_t l_ifc_ioctl (l_ifc_handle iii, l_ioctl_op op, void *pv, mtb_stc_lin_context_t *context)
 This function controls functionality not covered by the other API calls. More...
 
void l_ifc_rx (l_ifc_handle iii, mtb_stc_lin_context_t *context)
 The application program is responsible for binding the interrupt and for setting the correct interface handle. More...
 
void l_ifc_tx (l_ifc_handle iii, mtb_stc_lin_context_t *context)
 The application program is responsible for binding the interrupt and for setting the correct interface handle. More...
 
void l_ifc_aux (l_ifc_handle iii, mtb_stc_lin_context_t *context)
 This function may be used to synchronize the break/sync field sequence transmitted by Master node on the interface specified by iii. More...
 
l_u16 l_ifc_read_status (l_ifc_handle iii, mtb_stc_lin_context_t *context)
 This function is defined by the LIN specification. More...
 
mtb_lin_status_t mtb_lin_config_check_nad (l_u8 nad, const mtb_stc_lin_config_t *config)
 This function validates if preserved Node Address values are not used as NAD for Slave node. More...
 

Function Documentation

◆ l_ifc_init()

l_bool l_ifc_init ( l_ifc_handle  iii,
mtb_stc_lin_context_t context,
cyhal_gpio_t  tx,
cyhal_gpio_t  rx 
)

The function initializes the LIN Slave middleware instance specified by the context.

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.
txThe TX pin name.
rxThe RX pin name.
Returns
"false" if initialization succeeds, and "true" if it fails.

◆ l_ifc_wake_up()

void l_ifc_wake_up ( l_ifc_handle  iii,
const mtb_stc_lin_context_t context 
)

This function transmits one wake-up signal.

The wake-up signal is transmitted directly when this function is called. When you call this API function, the application is blocked until the wake-up signal is transmitted to the LIN bus. The Cy_SysLib_Delay() function is used as the timing source. The delay is calculated based on the clock configuration.

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.

◆ l_ifc_ioctl()

mtb_lin_status_t l_ifc_ioctl ( l_ifc_handle  iii,
l_ioctl_op  op,
void *  pv,
mtb_stc_lin_context_t context 
)

This function controls functionality not covered by the other API calls.

It is used for protocol specific parameters or hardware specific functionality. An example of such functionality can be switching on/off the wake-up signal detection.

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.
opThe operation to be applied Parameters of l_ifc_ioctl.
pvThe pointer to the optional parameter. See Parameters of l_ifc_ioctl.
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 mtb_lin_status_t.

◆ l_ifc_rx()

void l_ifc_rx ( l_ifc_handle  iii,
mtb_stc_lin_context_t context 
)

The application program is responsible for binding the interrupt and for setting the correct interface handle.

It may be called from a user-defined interrupt handler triggered by a UART when it receives one character of data.

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.

◆ l_ifc_tx()

void l_ifc_tx ( l_ifc_handle  iii,
mtb_stc_lin_context_t context 
)

The application program is responsible for binding the interrupt and for setting the correct interface handle.

It may be called from a user-defined interrupt handler triggered by a UART when it has transmitted one character of data. In this case, the function will perform necessary operations on the UART control registers

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.

◆ l_ifc_aux()

void l_ifc_aux ( l_ifc_handle  iii,
mtb_stc_lin_context_t context 
)

This function may be used to synchronize the break/sync field sequence transmitted by Master node on the interface specified by iii.

It may, for example, be called from a user-defined interrupt handler raised upon a flank detection on a hardware pin connected to the interface iii.

Parameters
iiiThe name of the interface handle 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.

◆ l_ifc_read_status()

l_u16 l_ifc_read_status ( l_ifc_handle  iii,
mtb_stc_lin_context_t context 
)

This function is defined by the LIN specification.

This returns the status of the specified LIN interface and clears all status bits for that interface. See Section 7.2.5.8 of the LIN 2.1 specification.

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
The status bits of the specified LIN interface are returned. These bits have the following meanings:
Bits Meaning ----------—
[15:8] Last Received PID
[7] 0
[6] Save Configuration flag
[5] 0
[4] Bus Activity flag
[3] Go To Sleep flag
[2] Overrun flag
[1] Successful Transfer flag
[0] Error in Response flag

◆ mtb_lin_config_check_nad()

mtb_lin_status_t mtb_lin_config_check_nad ( l_u8  nad,
const mtb_stc_lin_config_t config 
)

This function validates if preserved Node Address values are not used as NAD for Slave node.

For more details about allowable NAD, see specification LIN 2.2A, chapter 4.2.3.2 NAD.

Parameters
nadThis field defines Node Address for validation.
configThe pointer to the LIN configuration structure.
Returns
See mtb_lin_status_t.