23 #ifndef LIN_LPUART_DRIVER_H
24 #define LIN_LPUART_DRIVER_H
29 #include "lpuart_hw_access.h"
42 #ifdef LPUART_ERR_IRQS
54 #define AUTOBAUD_BAUDRATE_TOLERANCE (uint32_t)2U
55 #define BIT_RATE_TOLERANCE_UNSYNC (uint32_t)14U
57 #define BIT_DURATION_MAX_19200 (uint32_t)(100000U * (100U + AUTOBAUD_BAUDRATE_TOLERANCE) / 192U)
58 #define BIT_DURATION_MIN_19200 (uint32_t)(100000U * (100U - AUTOBAUD_BAUDRATE_TOLERANCE) / 192U)
60 #define BIT_DURATION_MAX_14400 (uint32_t)(100000U * (100U + AUTOBAUD_BAUDRATE_TOLERANCE) / 144U)
61 #define BIT_DURATION_MIN_14400 (uint32_t)(100000U * (100U - AUTOBAUD_BAUDRATE_TOLERANCE) / 144U)
63 #define BIT_DURATION_MAX_9600 (uint32_t)(100000U * (100U + AUTOBAUD_BAUDRATE_TOLERANCE) / 96U)
64 #define BIT_DURATION_MIN_9600 (uint32_t)(100000U * (100U - AUTOBAUD_BAUDRATE_TOLERANCE) / 96U)
66 #define BIT_DURATION_MAX_4800 (uint32_t)(100000U * (100U + AUTOBAUD_BAUDRATE_TOLERANCE) / 48U)
67 #define BIT_DURATION_MIN_4800 (uint32_t)(100000U * (100U - AUTOBAUD_BAUDRATE_TOLERANCE) / 48U)
69 #define BIT_DURATION_MAX_2400 (uint32_t)(100000U * (100U + AUTOBAUD_BAUDRATE_TOLERANCE) / 24U)
70 #define BIT_DURATION_MIN_2400 (uint32_t)(100000U * (100U - AUTOBAUD_BAUDRATE_TOLERANCE) / 24U)
73 #define TWO_BIT_DURATION_MAX_19200 (2U * BIT_DURATION_MAX_19200)
74 #define TWO_BIT_DURATION_MIN_19200 (2U * BIT_DURATION_MIN_19200)
76 #define TWO_BIT_DURATION_MAX_14400 (2U * BIT_DURATION_MAX_14400)
77 #define TWO_BIT_DURATION_MIN_14400 (2U * BIT_DURATION_MIN_14400)
79 #define TWO_BIT_DURATION_MAX_9600 (2U * BIT_DURATION_MAX_9600)
80 #define TWO_BIT_DURATION_MIN_9600 (2U * BIT_DURATION_MIN_9600)
82 #define TWO_BIT_DURATION_MAX_4800 (2U * BIT_DURATION_MAX_4800)
83 #define TWO_BIT_DURATION_MIN_4800 (2U * BIT_DURATION_MIN_4800)
85 #define TWO_BIT_DURATION_MAX_2400 (2U * BIT_DURATION_MAX_2400)
86 #define TWO_BIT_DURATION_MIN_2400 (2U * BIT_DURATION_MIN_2400)
89 #define AUTOBAUD_BREAK_TIME_MIN (13U * BIT_DURATION_MIN_19200)
94 #if defined(__cplusplus)
158 const uint8_t * txBuff,
160 uint32_t timeoutMSec);
178 const uint8_t * txBuff,
194 uint8_t * bytesRemaining);
216 uint32_t timeoutMSec);
262 uint8_t * bytesRemaining);
316 uint32_t timeoutValue);
373 #if defined(__cplusplus)
lin_node_state_t
Define type for an enumerating LIN Node state. Implements : lin_node_state_t_Class.
status_t LIN_LPUART_DRV_GotoIdleState(uint32_t instance)
Puts current LIN node to Idle state This function changes current node state to LIN_NODE_STATE_IDLE.
void LIN_LPUART_DRV_TimeoutService(uint32_t instance)
Callback function for Timer Interrupt Handler Users shall initialize a timer (for example FTM) in Out...
lin_user_config_t * g_linUserconfigPtr[LPUART_INSTANCE_COUNT]
Table to save LIN user config structure pointers.
lin_callback_t LIN_LPUART_DRV_InstallCallback(uint32_t instance, lin_callback_t function)
Installs callback function that is used for LIN_LPUART_DRV_IRQHandler.
void(* lin_callback_t)(uint32_t instance, void *linState)
LIN Driver callback function type Implements : lin_callback_t_Class.
void LIN_LPUART_DRV_IRQHandler(uint32_t instance)
LIN_LPUART interrupt handler for RX_TX and Error interrupts.
status_t LIN_LPUART_DRV_SendFrameDataBlocking(uint32_t instance, const uint8_t *txBuff, uint8_t txSize, uint32_t timeoutMSec)
Sends Frame data out through the LIN_LPUART module using blocking method. This function will calculat...
status_t LIN_LPUART_DRV_GoToSleepMode(uint32_t instance)
This function puts current node to sleep mode This function changes current node state to LIN_NODE_ST...
status_t LIN_LPUART_DRV_SendFrameData(uint32_t instance, const uint8_t *txBuff, uint8_t txSize)
Sends frame data out through the LIN_LPUART module using non-blocking method. This enables an a-sync ...
void LIN_LPUART_DRV_SetTimeoutCounter(uint32_t instance, uint32_t timeoutValue)
Set Value for Timeout Counter that is used in LIN_LPUART_DRV_TimeoutService.
status_t LIN_LPUART_DRV_DisableIRQ(uint32_t instance)
Disables LIN_LPUART hardware interrupts.
status_t LIN_LPUART_DRV_AbortTransferData(uint32_t instance)
Aborts an on-going non-blocking transmission/reception. While performing a non-blocking transferring ...
status_t LIN_LPUART_DRV_AutoBaudCapture(uint32_t instance)
LIN_LPUART capture time interval to set baudrate automatically when enable autobaud feature...
lin_state_t * g_linStatePtr[LPUART_INSTANCE_COUNT]
Table to save LPUART state structure pointers.
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
status_t LIN_LPUART_DRV_GetReceiveStatus(uint32_t instance, uint8_t *bytesRemaining)
Get status of an on-going non-blocking reception While receiving frame data using non-blocking method...
status_t LIN_LPUART_DRV_MasterSendHeader(uint32_t instance, uint8_t id)
Sends frame header out through the LIN_LPUART module using a non-blocking method. This function sends...
status_t LIN_LPUART_DRV_Init(uint32_t instance, lin_user_config_t *linUserConfig, lin_state_t *linCurrentState)
Initializes an LIN_LPUART instance for LIN Network.
Runtime state of the LIN driver.
lin_node_state_t LIN_LPUART_DRV_GetCurrentNodeState(uint32_t instance)
Get the current LIN node state.
LIN hardware configuration structure Implements : lin_user_config_t_Class.
status_t LIN_LPUART_DRV_GetTransmitStatus(uint32_t instance, uint8_t *bytesRemaining)
Get status of an on-going non-blocking transmission While sending frame data using non-blocking metho...
#define LPUART_INSTANCE_COUNT
LPUART_Type *const g_linLpuartBase[LPUART_INSTANCE_COUNT]
Table of base addresses for LPUART instances.
const IRQn_Type g_linLpuartRxTxIrqId[LPUART_INSTANCE_COUNT]
Table to save LPUART IRQ enumeration numbers defined in the device header file.
status_t LIN_LPUART_DRV_RecvFrmDataBlocking(uint32_t instance, uint8_t *rxBuff, uint8_t rxSize, uint32_t timeoutMSec)
Receives frame data through the LIN_LPUART module using blocking method. The function does not return...
status_t LIN_LPUART_DRV_SendWakeupSignal(uint32_t instance)
Sends a wakeup signal through the LIN_LPUART interface.
status_t LIN_LPUART_DRV_RecvFrmData(uint32_t instance, uint8_t *rxBuff, uint8_t rxSize)
Receives frame data through the LIN_LPUART module using non-blocking method. This function returns im...
status_t LIN_LPUART_DRV_EnableIRQ(uint32_t instance)
Enables LIN_LPUART hardware interrupts.
status_t LIN_LPUART_DRV_Deinit(uint32_t instance)
Shuts down the LIN_LPUART by disabling interrupts and transmitter/receiver.
IRQn_Type
Defines the Interrupt Numbers definitions.