LIN software stack for 32-bit AVR that supports initializing the LIN bus and to transmit/receive messages.
Data Structures | |
struct | st_lin_message |
This structure allows to handle a LIN message and, at the end of the received/transmitted message, allows to call a function associated to this message, the update or the capture of "signals". More... | |
Macros | |
#define | LIN_LAST_ERR_LENGHT 0x04 |
Default length of the 'lin_last_error[]' array. More... | |
#define | LIN_OVERLOAD_INT ((U16)0x00FF) |
Error report definitions. More... | |
#define | NUMBER_OF_LIN_FRAMES_NODE0 8 |
Enumerations | |
enum | enum_lin_cmd { PUBLISH, SUBSCRIBE, IGNORE } |
This enumeration is used to select an action for a specific message declared in st_lin_message structure. Note: XXX_STAND_BY keeps the direction (PUBLISH or SUBSCRIBE) for a message that will be IGNORE. When the 'stand_by' will be finished, PUBLISH_STAND_BY would become PUBLISH and SUBSCRIBE_STAND_BY would become SUBSCRIBE. An IGNORE message could become either PUBLISH or SUBSCRIBE. More... | |
Functions | |
U8 | lin_init (bool master, U8 l_node, U16 b_rate, long pba_hz) |
This function initializes the LIN controller and, if needed, the LIN interrupts. More... | |
U8 | lin_send_cmd (U8 l_node, U8 l_id, U8 l_len) |
This function commands the sending of the LIN header, MASTER task of MASTER node. More... | |
Variables | |
volatile st_lin_message | lin_descript_list_node0 [NUMBER_OF_LIN_FRAMES_NODE0] |
Array of structure of type:'st_lin_message'. Default: 8 elements. More... | |
volatile U16 | lin_error_number_node0 |
Counter of LIN error. If an error clearly linked to a message (i.e. time-out) the status of this message is written with the error (LINERR). More... | |
volatile U8 | lin_handle_node0 |
Index in lin_descript_list[], 'lin_handle' is set after processing IDOK and verified once RXOK or TXOK rises. More... | |
volatile U16 | lin_last_errors_node0 [] |
Last error FIFO: lin_handle | status. Default: 4 elements. More... | |
LIN Versions | |
#define | LIN_2x 0 |
Lin 2.x Version. More... | |
#define | LIN_1x 1 |
Lin 1.x Version. More... | |
#define LIN_1x 1 |
Lin 1.x Version.
#define LIN_2x 0 |
Lin 2.x Version.
#define LIN_LAST_ERR_LENGHT 0x04 |
Default length of the 'lin_last_error[]' array.
Referenced by lin_int_handler_node0().
#define LIN_OVERLOAD_INT ((U16)0x00FF) |
Error report definitions.
More than ONE interrupt in the same time !
#define NUMBER_OF_LIN_FRAMES_NODE0 8 |
Referenced by lin_int_handler_node0(), lin_pdca_int_rx_handler_node0(), lin_pdca_int_tx_handler_node0(), and lin_send_cmd().
enum enum_lin_cmd |
This enumeration is used to select an action for a specific message declared in st_lin_message structure. Note: XXX_STAND_BY keeps the direction (PUBLISH or SUBSCRIBE) for a message that will be IGNORE. When the 'stand_by' will be finished, PUBLISH_STAND_BY would become PUBLISH and SUBSCRIBE_STAND_BY would become SUBSCRIBE. An IGNORE message could become either PUBLISH or SUBSCRIBE.
Enumerator | |
---|---|
PUBLISH |
The node sends the response. |
SUBSCRIBE |
The node receives the response. |
IGNORE |
The node is not concerned by the response, it doesn't send or receive. |
This function initializes the LIN controller and, if needed, the LIN interrupts.
master | true for master, false for slave |
b_rate | Baudrate Value |
l_node | Node Value |
pba_hz | PBA Value |
master | true for master, false for slave |
l_node | Node Value |
b_rate | Baudrate Value |
pba_hz | PBA Value |
Enable Interrupt for Error flags and end ID Reception
Register Interrupt for LIN
Register Interrupt for PDCA Transfer TX
Register Interrupt for PDCA Transfer RX
References Disable_global_interrupt, gpio_enable_module(), gpio_enable_pin_pull_up(), INTC_register_interrupt(), lin_int_handler_node0(), lin_pdca_int_rx_handler_node0(), lin_pdca_int_tx_handler_node0(), PASS, and usart_lin_node0.
This function commands the sending of the LIN header, MASTER task of MASTER node.
l_id | LIN identifier value. In case of `LIN_1X', the coded length is transported into the LIN identifier. |
l_len | True length (not coded), number of data bytes transported in the response. This information is not used in `LIN_1X' because it is coded in `l_id'. |
l_node | Node Value |
l_node | Node Value |
l_id | LIN identifier value. In case of `LIN_1X', the coded length is transported into the LIN identifier. |
l_len | True length (not coded), number of data bytes transported in the response. This information is not used in `LIN_1X' because it is coded in `l_id'. |
References FAIL, index, lin_rx_response(), lin_tx_header_and_response(), NUMBER_OF_LIN_FRAMES_NODE0, PASS, PUBLISH, SUBSCRIBE, usart_lin_node0, and usart_reset_status().
volatile st_lin_message lin_descript_list_node0[NUMBER_OF_LIN_FRAMES_NODE0] |
Array of structure of type:'st_lin_message'. Default: 8 elements.
volatile U16 lin_error_number_node0 |
Counter of LIN error. If an error clearly linked to a message (i.e. time-out) the status of this message is written with the error (LINERR).
Referenced by lin_int_handler_node0().
volatile U8 lin_handle_node0 |
Index in lin_descript_list[], 'lin_handle' is set after processing IDOK and verified once RXOK or TXOK rises.
Referenced by lin_int_handler_node0(), lin_pdca_int_rx_handler_node0(), and lin_pdca_int_tx_handler_node0().
volatile U16 lin_last_errors_node0[] |
Last error FIFO: lin_handle | status. Default: 4 elements.
Referenced by lin_int_handler_node0().