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 |
#define | NUMBER_OF_LIN_FRAMES_NODE1 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 st_lin_message | lin_descript_list_node1 [NUMBER_OF_LIN_FRAMES_NODE1] |
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 U16 | lin_error_number_node1 |
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 U8 | lin_handle_node1 |
volatile U16 | lin_last_errors_node0 [] |
Last error FIFO: lin_handle | status. Default: 4 elements. More... | |
volatile U16 | lin_last_errors_node1 [] |
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(), and lin_int_handler_node1().
#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().
#define NUMBER_OF_LIN_FRAMES_NODE1 8 |
Referenced by lin_int_handler_node1(), lin_pdca_int_rx_handler_node1(), lin_pdca_int_tx_handler_node1(), 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
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_int_handler_node1(), lin_pdca_int_rx_handler_node0(), lin_pdca_int_rx_handler_node1(), lin_pdca_int_tx_handler_node0(), lin_pdca_int_tx_handler_node1(), PASS, usart_lin_node0, USART_LIN_NODE0_PDCA_RX_IRQ, USART_LIN_NODE0_PDCA_RX_IRQ_LEVEL, USART_LIN_NODE0_PDCA_TX_IRQ, USART_LIN_NODE0_PDCA_TX_IRQ_LEVEL, USART_LIN_NODE0_RX_PIN, USART_LIN_NODE0_USART_IRQ, USART_LIN_NODE0_USART_IRQ_LEVEL, usart_lin_node1, USART_LIN_NODE1_PDCA_RX_IRQ, USART_LIN_NODE1_PDCA_RX_IRQ_LEVEL, USART_LIN_NODE1_PDCA_TX_IRQ, USART_LIN_NODE1_PDCA_TX_IRQ_LEVEL, USART_LIN_NODE1_RX_PIN, USART_LIN_NODE1_USART_IRQ, and USART_LIN_NODE1_USART_IRQ_LEVEL.
Referenced by main().
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, lin_rx_response(), lin_tx_header_and_response(), NUMBER_OF_LIN_FRAMES_NODE0, NUMBER_OF_LIN_FRAMES_NODE1, PASS, PUBLISH, SUBSCRIBE, usart_lin_node0, usart_lin_node1, and usart_reset_status().
Referenced by lin_master_task_ID12(), and lin_master_task_ID15().
volatile st_lin_message lin_descript_list_node0[NUMBER_OF_LIN_FRAMES_NODE0] |
Array of structure of type:'st_lin_message'. Default: 8 elements.
Referenced by lin_master_task_ID12(), lin_master_task_ID15(), and main().
volatile st_lin_message lin_descript_list_node1[NUMBER_OF_LIN_FRAMES_NODE1] |
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 U16 lin_error_number_node1 |
Referenced by lin_int_handler_node1().
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 U8 lin_handle_node1 |
Referenced by lin_int_handler_node1(), lin_pdca_int_rx_handler_node1(), and lin_pdca_int_tx_handler_node1().
volatile U16 lin_last_errors_node0[] |
Last error FIFO: lin_handle | status. Default: 4 elements.
Referenced by lin_int_handler_node0().
volatile U16 lin_last_errors_node1[] |
Referenced by lin_int_handler_node1().