![]() |
RA Flexible Software Package Documentation
Release v6.0.0
|
|
Interface for LIN communications.
The LIN interface provides common APIs for LIN HAL drivers. The LIN interface supports the following features:
Data Structures | |
struct | lin_transfer_params_t |
struct | lin_callback_args_t |
struct | lin_cfg_t |
struct | lin_api_t |
struct | lin_instance_t |
Typedefs | |
typedef void | lin_ctrl_t |
Enumerations | |
enum | lin_mode_t |
enum | lin_checksum_type_t |
enum | lin_event_t |
struct lin_transfer_params_t |
LIN Transfer Parameters
Data Fields | ||
---|---|---|
uint8_t | id | The unprotected frame ID associated with the data transfer. |
union lin_transfer_params_t | __unnamed__ | |
uint8_t | num_bytes | Length of buffer pointed to by p_data, in bytes. |
lin_checksum_type_t | checksum_type | Checksum type to use for checksum generation (when writing data) or validation (when reading data). See lin_checksum_type_t. |
struct lin_callback_args_t |
LIN Callback Arguments
Data Fields | ||
---|---|---|
uint32_t | channel | Channel number. |
lin_event_t | event | Event code. |
uint8_t | bytes_received |
Valid for the following events:
Contains the number of data bytes received for a data reception. |
uint8_t | pid |
For LIN slave: Contains the most recently received protected identifier For LIN master: Contains the most recently transmitted protected identifier. |
uint8_t | checksum |
Received checksum. Valid for the following events:
|
void * | p_context | Context provided to user during callback. |
struct lin_cfg_t |
LIN configuration block
Data Fields | |
uint8_t | channel |
Select a channel corresponding to the channel number of the hardware. | |
lin_mode_t | mode |
Driver mode (master or slave) | |
void(* | p_callback )(lin_callback_args_t *p_args) |
Pointer to callback function. | |
void * | p_context |
User defined context passed into callback function. | |
void const * | p_extend |
LIN hardware dependent configuration. | |
struct lin_api_t |
Interface definition for LIN
Data Fields | |
fsp_err_t(* | open )(lin_ctrl_t *const p_ctrl, lin_cfg_t const *const p_cfg) |
fsp_err_t(* | write )(lin_ctrl_t *const p_ctrl, const lin_transfer_params_t *const p_transfer_params) |
fsp_err_t(* | read )(lin_ctrl_t *const p_ctrl, lin_transfer_params_t *const p_transfer_params) |
fsp_err_t(* | communicationAbort )(lin_ctrl_t *const p_ctrl) |
fsp_err_t(* | callbackSet )(lin_ctrl_t *const p_ctrl, void(*p_callback)(lin_callback_args_t *), void *const p_context, lin_callback_args_t *const p_callback_memory) |
fsp_err_t(* | wakeupSend )(lin_ctrl_t *const p_ctrl) |
fsp_err_t(* | sleepEnter )(lin_ctrl_t *const p_ctrl) |
fsp_err_t(* | sleepExit )(lin_ctrl_t *const p_ctrl) |
fsp_err_t(* | close )(lin_ctrl_t *const p_ctrl) |
fsp_err_t(* | informationFrameRead )(lin_ctrl_t *const p_ctrl, lin_transfer_params_t *const p_transfer_params) |
fsp_err_t(* | startFrameWrite )(lin_ctrl_t *const p_ctrl, uint8_t const id) |
fsp_err_t(* | informationFrameWrite )(lin_ctrl_t *const p_ctrl, const lin_transfer_params_t *const p_transfer_params) |
fsp_err_t(* lin_api_t::open) (lin_ctrl_t *const p_ctrl, lin_cfg_t const *const p_cfg) |
Open LIN device. Transmission and reception of LIN frames is enabled upon successful return from this function.
[in,out] | p_ctrl | Pointer to the LIN control block. Must be declared by user. Value set here. |
[in] | p_cfg | Pointer to LIN configuration structure. All elements of this structure must be set by user. |
fsp_err_t(* lin_api_t::write) (lin_ctrl_t *const p_ctrl, const lin_transfer_params_t *const p_transfer_params) |
Begin non-blocking transmission of a LIN frame.
If the node is a LIN master, the LIN header is transmitted before data, if present.
For header-only transmissions (master mode), when the header transmission completes successfully, the callback is called with the event LIN_EVENT_TX_HEADER_COMPLETE.
For header+data (master mode) or data-only transmission (slave mode), when the data transmission completes successfully, the callback is called with event LIN_EVENT_TX_DATA_COMPLETE.
[in,out] | p_ctrl | Pointer to the LIN control block. |
[in] | p_transfer_params | Pointer to parameters required for the write transaction. |
fsp_err_t(* lin_api_t::read) (lin_ctrl_t *const p_ctrl, lin_transfer_params_t *const p_transfer_params) |
Begin non-blocking read of data bytes.
When a read completes successfully, the callback is called with event LIN_EVENT_RX_DATA_COMPLETE.
[in] | p_ctrl | Pointer to the LIN control block for the channel. |
[in] | p_transfer_params | Pointer to parameters required for the read transaction. |
fsp_err_t(* lin_api_t::communicationAbort) (lin_ctrl_t *const p_ctrl) |
Abort ongoing transfer.
[in] | p_ctrl | Pointer to the LIN control block. |
fsp_err_t(* lin_api_t::callbackSet) (lin_ctrl_t *const p_ctrl, void(*p_callback)(lin_callback_args_t *), void *const p_context, lin_callback_args_t *const p_callback_memory) |
Specify callback function and optional context pointer and working memory pointer.
[in] | p_ctrl | Pointer to the LIN control block. |
[in] | p_callback | Callback function |
[in] | p_context | Pointer to send to callback function |
[in] | p_working_memory | Pointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback. |
fsp_err_t(* lin_api_t::wakeupSend) (lin_ctrl_t *const p_ctrl) |
Send wakeup signal for LIN device.
[in] | p_ctrl | Pointer to the LIN control block. |
fsp_err_t(* lin_api_t::sleepEnter) (lin_ctrl_t *const p_ctrl) |
Place the LIN node in bus sleep mode.
[in] | p_ctrl | Pointer to the LIN control block. |
fsp_err_t(* lin_api_t::sleepExit) (lin_ctrl_t *const p_ctrl) |
Exit the bus sleep mode for LIN device.
[in] | p_ctrl | Pointer to the LIN control block. |
fsp_err_t(* lin_api_t::close) (lin_ctrl_t *const p_ctrl) |
Close LIN device.
[in] | p_ctrl | Pointer to the LIN control block. |
fsp_err_t(* lin_api_t::informationFrameRead) (lin_ctrl_t *const p_ctrl, lin_transfer_params_t *const p_transfer_params) |
[DEPRECATED] Use lin_api_t::read
fsp_err_t(* lin_api_t::startFrameWrite) (lin_ctrl_t *const p_ctrl, uint8_t const id) |
[DEPRECATED] Use lin_api_t::write
fsp_err_t(* lin_api_t::informationFrameWrite) (lin_ctrl_t *const p_ctrl, const lin_transfer_params_t *const p_transfer_params) |
[DEPRECATED] Use lin_api_t::write
struct lin_instance_t |
This structure encompasses everything that is needed to use an instance of this interface.
Data Fields | ||
---|---|---|
lin_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
lin_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
lin_api_t const * | p_api | Pointer to the API structure for this instance. |
typedef void lin_ctrl_t |
LIN control block. Allocate an instance specific control block to pass into the LIN API calls.
enum lin_mode_t |
enum lin_checksum_type_t |
enum lin_event_t |
LIN Event codes