8 #ifndef HPM_LINV2_DRV_H
9 #define HPM_LINV2_DRV_H
13 #include "hpm_linv2_regs.h"
14 #include "hpm_soc_feature.h"
24 #define LIN_ID_DATA_LEN_SHIFT 4U
25 #define LIN_ID_DATA_LEN_MASK 0x30U
26 #define LIN_ID_DATA_LEN_GET(x) (((uint8_t)(x) & LIN_ID_DATA_LEN_MASK) >> LIN_ID_DATA_LEN_SHIFT)
59 uint32_t src_freq_in_hz;
69 bool data_length_from_id;
71 bool enhanced_checksum;
198 if (enhance_checksum) {
#define LINV2_TIMING_CONTROL_BUS_INACTIVE_TIME_MASK
Definition: hpm_linv2_regs.h:353
#define LINV2_TIMING_CONTROL_BUS_INACTIVE_TIME_SET(x)
Definition: hpm_linv2_regs.h:355
#define LINV2_CONTROL_STATUS_DATA_ACK_MASK
Definition: hpm_linv2_regs.h:254
#define LINV2_TIMING_CONTROL_WUP_REPEAT_TIME_SET(x)
Definition: hpm_linv2_regs.h:365
#define LINV2_DATA_LEN_ID_ID_GET(x)
Definition: hpm_linv2_regs.h:71
#define LINV2_CONTROL_STATUS_WAKEUP_REQ_MASK
Definition: hpm_linv2_regs.h:284
#define LINV2_TIMING_CONTROL_MASTER_MODE_MASK
Definition: hpm_linv2_regs.h:343
#define LINV2_DATA_LEN_ID_ENH_CHECK_MASK
Definition: hpm_linv2_regs.h:78
#define LINV2_CONTROL_STATUS_RESET_ERROR_MASK
Definition: hpm_linv2_regs.h:274
#define LINV2_CONTROL_STATUS_RESET_INT_MASK
Definition: hpm_linv2_regs.h:264
#define LINV2_DATA_LEN_ID_CHECKSUM_GET(x)
Definition: hpm_linv2_regs.h:53
#define LINV2_CONTROL_STATUS_COMPLETE_MASK
Definition: hpm_linv2_regs.h:215
#define LINV2_CONTROL_STATUS_STOP_MASK
Definition: hpm_linv2_regs.h:224
#define LINV2_CONTROL_STATUS_LIN_ACTIVE_MASK
Definition: hpm_linv2_regs.h:152
#define LINV2_CONTROL_STATUS_SLEEP_MASK
Definition: hpm_linv2_regs.h:234
#define LINV2_TIMING_CONTROL_WUP_REPEAT_TIME_MASK
Definition: hpm_linv2_regs.h:363
uint32_t hpm_stat_t
Definition: hpm_common.h:126
lin_wakeup_repeat_time_t
wakeup repeat time
Definition: hpm_lin_drv.h:51
lin_bus_inactivity_time_t
bus inactivity tome to go to sleep
Definition: hpm_lin_drv.h:41
void lin_master_transfer(LINV2_Type *ptr, lin_trans_config_t *config)
lin transfer on master mode
Definition: hpm_linv2_drv.c:99
lin_id_data_length_t
data length in ID bit4 and bit5
Definition: hpm_linv2_drv.h:31
static uint8_t lin_is_active(LINV2_Type *ptr)
lin active status
Definition: hpm_linv2_drv.h:257
static uint8_t lin_get_checksum(LINV2_Type *ptr)
lin get checksum value
Definition: hpm_linv2_drv.h:246
static uint8_t lin_get_id(LINV2_Type *ptr)
lin get ID
Definition: hpm_linv2_drv.h:235
static void lin_reset_error(LINV2_Type *ptr)
lin reset error
Definition: hpm_linv2_drv.h:106
hpm_stat_t lin_slave_receive(LINV2_Type *ptr, lin_trans_config_t *config)
lin receive data on slave mode
Definition: hpm_linv2_drv.c:313
static void lin_set_checksum_mode(LINV2_Type *ptr, bool enhance_checksum)
lin set checksum mode
Definition: hpm_linv2_drv.h:196
static uint8_t lin_get_data_byte(LINV2_Type *ptr, uint8_t index)
lin get data value in byte
Definition: hpm_linv2_drv.h:212
void lin_slave_dma_transfer(LINV2_Type *ptr, lin_trans_config_t *config)
lin slave dma transfer
Definition: hpm_linv2_drv.c:366
static void lin_set_mode(LINV2_Type *ptr, bool master)
lin set mode
Definition: hpm_linv2_drv.h:181
static void lin_slave_ack(LINV2_Type *ptr)
lin slave ack
Definition: hpm_linv2_drv.h:146
uint8_t lin_get_data_length(LINV2_Type *ptr)
get data length
Definition: hpm_linv2_drv.c:88
static uint32_t lin_get_control_and_status(LINV2_Type *ptr)
lin get control and status register value
Definition: hpm_linv2_drv.h:86
static void lin_reset_interrupt(LINV2_Type *ptr)
lin reset interrupt
Definition: hpm_linv2_drv.h:96
void lin_slave_transfer(LINV2_Type *ptr, lin_trans_config_t *config)
lin transfer on slave mode
Definition: hpm_linv2_drv.c:231
static void lin_slave_set_wakeup_repeat_time(LINV2_Type *ptr, lin_wakeup_repeat_time_t time)
lin slave set wakeup repeat time
Definition: hpm_linv2_drv.h:169
hpm_stat_t lin_master_sent(LINV2_Type *ptr, lin_trans_config_t *config)
lin send data on master mode
Definition: hpm_linv2_drv.c:128
hpm_stat_t lin_master_configure_timing(LINV2_Type *ptr, lin_timing_t *timing)
lin configure timing on master mode
Definition: hpm_linv2_drv.c:12
lin_wakeup_repeat_time_t
wakeup repeat time
Definition: hpm_linv2_drv.h:51
static void lin_write_data_byte(LINV2_Type *ptr, uint8_t index, uint8_t data)
lin write data value in byte
Definition: hpm_linv2_drv.h:224
hpm_stat_t lin_master_receive(LINV2_Type *ptr, lin_trans_config_t *config)
lin receive data on master mode
Definition: hpm_linv2_drv.c:179
static void lin_slave_stop(LINV2_Type *ptr)
lin slave stop
Definition: hpm_linv2_drv.h:136
static void lin_wakeup(LINV2_Type *ptr)
lin wakeup
Definition: hpm_linv2_drv.h:116
static void lin_slave_set_bus_inactivity_time(LINV2_Type *ptr, lin_bus_inactivity_time_t time)
lin slave set bus inactivity time
Definition: hpm_linv2_drv.h:157
lin_bus_inactivity_time_t
bus inactivity tome to go to sleep
Definition: hpm_linv2_drv.h:41
hpm_stat_t lin_slave_sent(LINV2_Type *ptr, lin_trans_config_t *config)
lin send data on slave mode
Definition: hpm_linv2_drv.c:261
static uint8_t lin_is_complete(LINV2_Type *ptr)
lin complete status
Definition: hpm_linv2_drv.h:268
hpm_stat_t lin_slave_configure_timing(LINV2_Type *ptr, uint32_t src_freq_in_hz)
lin config timing on slave mode
Definition: hpm_linv2_drv.c:42
static void lin_sleep(LINV2_Type *ptr)
lin sleep
Definition: hpm_linv2_drv.h:126
@ id_data_length_2bytes
Definition: hpm_linv2_drv.h:32
@ id_data_length_4bytes
Definition: hpm_linv2_drv.h:34
@ id_data_length_8bytes
Definition: hpm_linv2_drv.h:35
@ id_data_length_2bytes_2
Definition: hpm_linv2_drv.h:33
@ wakeup_repeat_time_240ms
Definition: hpm_linv2_drv.h:55
@ wakeup_repeat_time_200ms
Definition: hpm_linv2_drv.h:53
@ wakeup_repeat_time_180ms
Definition: hpm_linv2_drv.h:52
@ wakeup_repeat_time_220ms
Definition: hpm_linv2_drv.h:54
@ bus_inactivity_time_10s
Definition: hpm_linv2_drv.h:45
@ bus_inactivity_time_6s
Definition: hpm_linv2_drv.h:43
@ bus_inactivity_time_4s
Definition: hpm_linv2_drv.h:42
@ bus_inactivity_time_8s
Definition: hpm_linv2_drv.h:44
Definition: hpm_linv2_regs.h:12
__RW uint32_t DATA_LEN_ID
Definition: hpm_linv2_regs.h:17
__RW uint8_t DATA_BYTE[8]
Definition: hpm_linv2_regs.h:15
__RW uint32_t CONTROL_STATUS
Definition: hpm_linv2_regs.h:18
__RW uint32_t TIMING_CONTROL
Definition: hpm_linv2_regs.h:19
Definition: hpm_lin_drv.h:58
LIN config.
Definition: hpm_lin_drv.h:66