16#define SOFTPERIPHERAL_CAN (1)
19#define NRF_CAN_Type NRF_SP_CAN_Type
21#define NRF_CAN_Type NRF_CAN_Type
211#ifndef NRF_DECLARE_ONLY
215 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
220 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x0UL;
240 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
241 nrf_event_readback((uint8_t *)p_reg + (uint32_t)event);
246 return nrf_event_check(p_reg, event);
252 return nrf_task_event_address_get(p_reg, event);
257 p_reg->INTEN |= mask;
262 return p_reg->INTEN & mask;
267 p_reg->INTEN &= ~mask;
285 p_rxfilter->
filter = p_reg->RXFILTER[index].IDFILTER &
288 p_rxfilter->
filterwidth = (p_reg->RXFILTER[index].IDMASK &
297 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
317 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
337 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
357 p_reg->RXFILTER[index].IDMASK = (p_reg->RXFILTER[index].IDMASK &
392 p_reg->CONFIG.TIMING = p_config->
timing;
393 p_reg->CONFIG.REQUEST = ((uint32_t)p_config->
request) &
395 p_reg->CONFIG.MODE = (((uint32_t)p_config->
mode) &
401 p_config->
timing = p_reg->CONFIG.TIMING;
412 p_reg->TXFRAME[idx].IDENTIFIER = (p_frame->
identifier
416 p_reg->TXFRAME[idx].TXDATAL = ((uint32_t)p_frame->
data[0] << 0) | ((uint32_t)p_frame->
data[1]
418 ((uint32_t)p_frame->
data[2]
419 << 16) | ((uint32_t)p_frame->
data[3] << 24);
421 p_reg->TXFRAME[idx].TXDATAH = ((uint32_t)p_frame->
data[4] << 0) | ((uint32_t)p_frame->
data[5]
423 ((uint32_t)p_frame->
data[6]
424 << 16) | ((uint32_t)p_frame->
data[7] << 24);
432 (((uint32_t)p_frame->
length
443 uint32_t identifier = p_reg->TXFRAME[idx].IDENTIFIER;
448 uint32_t datal = p_reg->TXFRAME[idx].TXDATAL;
449 p_frame->
data[0] = (uint8_t)(datal >> 0);
450 p_frame->
data[1] = (uint8_t)(datal >> 8);
451 p_frame->
data[2] = (uint8_t)(datal >> 16);
452 p_frame->
data[3] = (uint8_t)(datal >> 24);
454 uint32_t datah = p_reg->TXFRAME[idx].TXDATAH;
455 p_frame->
data[4] = (uint8_t)(datah >> 0);
456 p_frame->
data[5] = (uint8_t)(datah >> 8);
457 p_frame->
data[6] = (uint8_t)(datah >> 16);
458 p_frame->
data[7] = (uint8_t)(datah >> 24);
460 uint32_t metadata = p_reg->TXFRAME[idx].METADATA;
475 p_reg->RXFRAME[idx].IDENTIFIER = (p_frame->
identifier
479 p_reg->RXFRAME[idx].RXDATAL = ((uint32_t)p_frame->
data[0] << 0) | ((uint32_t)p_frame->
data[1]
481 ((uint32_t)p_frame->
data[2]
482 << 16) | ((uint32_t)p_frame->
data[3] << 24);
484 p_reg->RXFRAME[idx].RXDATAH = ((uint32_t)p_frame->
data[4] << 0) | ((uint32_t)p_frame->
data[5]
486 ((uint32_t)p_frame->
data[6]
487 << 16) | ((uint32_t)p_frame->
data[7] << 24);
495 (((uint32_t)p_frame->
length
506 uint32_t identifier = p_reg->RXFRAME[idx].IDENTIFIER;
511 uint32_t datal = p_reg->RXFRAME[idx].RXDATAL;
512 p_frame->
data[0] = (uint8_t)(datal >> 0);
513 p_frame->
data[1] = (uint8_t)(datal >> 8);
514 p_frame->
data[2] = (uint8_t)(datal >> 16);
515 p_frame->
data[3] = (uint8_t)(datal >> 24);
517 uint32_t datah = p_reg->RXFRAME[idx].RXDATAH;
518 p_frame->
data[4] = (uint8_t)(datah >> 0);
519 p_frame->
data[5] = (uint8_t)(datah >> 8);
520 p_frame->
data[6] = (uint8_t)(datah >> 16);
521 p_frame->
data[7] = (uint8_t)(datah >> 24);
523 uint32_t metadata = p_reg->RXFRAME[idx].METADATA;
542 return (p_reg->STATUS.STATUS & 0x1FF);
556 p_reg->SPSYNC.AUX[idx] = val;
561 return p_reg->SPSYNC.AUX[idx];
NRF_STATIC_INLINE void nrf_can_txframe_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx, nrf_can_frame_t *p_frame)
Definition nrf_can.h:439
NRF_STATIC_INLINE void nrf_can_config_set(NRF_SP_CAN_Type *p_reg, nrf_can_config_t const *p_config)
Definition nrf_can.h:390
NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_SP_CAN_Type const *p_reg, uint32_t mask)
Definition nrf_can.h:260
NRF_STATIC_INLINE void nrf_can_rxfilter_get(NRF_SP_CAN_Type const *p_reg, nrf_can_rxfilter_t *p_rxfilter, uint8_t index)
Definition nrf_can.h:281
NRF_STATIC_INLINE void nrf_can_int_enable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:255
NRF_STATIC_INLINE uint32_t nrf_can_event_address_get(NRF_SP_CAN_Type const *p_reg, nrf_can_event_t event)
Definition nrf_can.h:249
nrf_can_task_t
CAN tasks.
Definition nrf_can.h:32
@ NRF_CAN_TASK_START
Definition nrf_can.h:33
@ NRF_CAN_TASK_RESET
Definition nrf_can.h:34
NRF_STATIC_INLINE void nrf_can_rxfilter_inmailbox_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:333
NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:213
NRF_STATIC_INLINE void nrf_can_rxframe_set(NRF_SP_CAN_Type *p_reg, uint8_t idx, nrf_can_frame_t const *p_frame)
Definition nrf_can.h:471
NRF_STATIC_INLINE void nrf_can_config_get(NRF_SP_CAN_Type const *p_reg, nrf_can_config_t *p_config)
Definition nrf_can.h:399
NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:534
nrf_can_state_t
Definition nrf_can.h:82
@ NRF_CAN_STATE_ERRORACTIVE
Definition nrf_can.h:83
@ NRF_CAN_STATE_ERRORPASSIVE
Definition nrf_can.h:85
@ NRF_CAN_STATE_BUSOFF
Definition nrf_can.h:86
@ NRF_CAN_STATE_ERRORWARNING
Definition nrf_can.h:84
@ NRF_CAN_STATE_STOPPED
Definition nrf_can.h:87
NRF_STATIC_INLINE void nrf_can_enable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:223
NRF_STATIC_INLINE void nrf_can_disable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:228
NRF_STATIC_INLINE void nrf_can_txframe_set(NRF_SP_CAN_Type *p_reg, uint8_t idx, nrf_can_frame_t const *p_frame)
Definition nrf_can.h:408
NRF_STATIC_INLINE void nrf_can_rxframe_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx, nrf_can_frame_t *p_frame)
Definition nrf_can.h:502
NRF_STATIC_INLINE void nrf_can_set_parsing_dppi(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:385
NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:323
NRF_STATIC_INLINE uint8_t nrf_can_rxfilter_filterwidth_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:363
NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:218
NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:233
NRF_STATIC_INLINE void nrf_can_rxfilter_filtermatched_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:313
NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:370
nrf_can_event_t
CAN events.
Definition nrf_can.h:40
@ NRF_CAN_EVENT_TXCOMPLETE
Definition nrf_can.h:41
@ NRF_CAN_EVENT_RXCOMPLETE
Definition nrf_can.h:42
@ NRF_CAN_EVENT_STATECHANGED
Definition nrf_can.h:44
@ NRF_CAN_EVENT_ERRORDETECTED
Definition nrf_can.h:43
nrf_can_int_mask_t
CAN interrupt masks.
Definition nrf_can.h:49
@ NRF_CAN_INT_ERRORDETECTED_MASK
Definition nrf_can.h:52
@ NRF_CAN_INT_STATECHANGED_MASK
Definition nrf_can.h:53
@ NRF_CAN_INT_TXCOMPLETE_MASK
Definition nrf_can.h:50
@ NRF_CAN_INT_RXCOMPLETE_MASK
Definition nrf_can.h:51
NRF_STATIC_INLINE void nrf_can_set_parsing_rxfilter(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:380
NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:303
nrf_can_mode_t
CAN operation modes.
Definition nrf_can.h:74
@ NRF_CAN_MODE_LOOPBACK
Definition nrf_can.h:76
@ NRF_CAN_MODE_LISTENONLY
Definition nrf_can.h:77
@ NRF_CAN_MODE_ONESHOT
Definition nrf_can.h:78
@ NRF_CAN_MODE_NORMAL
Definition nrf_can.h:75
NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx)
Definition nrf_can.h:559
NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_SP_CAN_Type *p_reg, uint32_t val, uint8_t idx)
Definition nrf_can.h:554
NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:343
NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:375
nrf_can_request_t
CAN request types.
Definition nrf_can.h:58
@ NRF_CAN_REQUEST_TX
Definition nrf_can.h:60
@ NRF_CAN_REQUEST_RX
Definition nrf_can.h:59
nrf_can_parsing_t
Definition nrf_can.h:64
@ NRF_CAN_PARSING_MODE
Definition nrf_can.h:67
@ NRF_CAN_PARSING_NONE
Definition nrf_can.h:65
@ NRF_CAN_PARSING_TIMING
Definition nrf_can.h:66
@ NRF_CAN_PARSING_DPPI
Definition nrf_can.h:69
@ NRF_CAN_PARSING_RXFILTER
Definition nrf_can.h:68
NRF_STATIC_INLINE void nrf_can_rxfilter_set(NRF_SP_CAN_Type *p_reg, nrf_can_rxfilter_t const *p_rxfilter, uint8_t index)
Definition nrf_can.h:270
NRF_STATIC_INLINE bool nrf_can_event_check(NRF_SP_CAN_Type const *p_reg, nrf_can_event_t event)
Definition nrf_can.h:244
NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:540
NRF_STATIC_INLINE void nrf_can_rxfilter_filterwidth_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:353
NRF_STATIC_INLINE void nrf_can_rxfilter_usefilter_set(NRF_SP_CAN_Type *p_reg, uint8_t index, uint8_t value)
Definition nrf_can.h:293
NRF_STATIC_INLINE void nrf_can_int_disable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:265
NRF_STATIC_INLINE bool nrf_can_status_error_check(uint32_t error_mask)
Definition nrf_can.h:545
NRF_STATIC_INLINE void nrf_can_event_clear(NRF_SP_CAN_Type *p_reg, nrf_can_event_t event)
Definition nrf_can.h:238
#define NRF_CAN_Type
Definition nrf_can.h:19
#define SP_CAN_INTEN_RXCOMPLETE_Msk
Definition nrf_sp_can.h:774
#define SP_CAN_CONFIG_MODE_MODE_Msk
Definition nrf_sp_can.h:84
#define SP_CAN_CONFIG_MODE_MODE_Loopback
Definition nrf_sp_can.h:88
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:245
#define SP_CAN_STATUS_STATUS_FORMERROR_Msk
Definition nrf_sp_can.h:387
#define SP_CAN_STATUS_STATUS_STATE_ERRORPASSIVE
Definition nrf_sp_can.h:431
#define SP_CAN_STATUS_STATUS_STATE_ERRORACTIVE
Definition nrf_sp_can.h:429
#define SP_CAN_CONFIG_PARSING_REGGROUP_Timing
Definition nrf_sp_can.h:43
#define SP_CAN_CONFIG_REQUEST_REQUEST_TX
Definition nrf_sp_can.h:77
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:352
#define SP_CAN_CONFIG_MODE_MODE_ListenOnly
Definition nrf_sp_can.h:89
#define SP_CAN_INTEN_TXCOMPLETE_Msk
Definition nrf_sp_can.h:766
#define SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk
Definition nrf_sp_can.h:128
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:256
#define SP_CAN_ENABLE_ENABLE_Msk
Definition nrf_sp_can.h:801
#define SP_CAN_RXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:282
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Pos
Definition nrf_sp_can.h:116
#define SP_CAN_CONFIG_PARSING_REGGROUP_OperationMode
Definition nrf_sp_can.h:44
#define SP_CAN_RXFRAME_IDENTIFIER_IDENTIFIER_Msk
Definition nrf_sp_can.h:283
#define SP_CAN_RXFILTER_IDMASK_FILTERWIDTH_Msk
Definition nrf_sp_can.h:157
#define SP_CAN_STATUS_STATUS_STATE_Msk
Definition nrf_sp_can.h:426
#define SP_CAN_RXFILTER_IDFILTER_IDENTIFIER_Msk
Definition nrf_sp_can.h:110
#define SP_CAN_CONFIG_PARSING_REGGROUP_Dppi
Definition nrf_sp_can.h:46
#define SP_CAN_RXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:357
#define SP_CAN_RXFILTER_IDMASK_MASK_Msk
Definition nrf_sp_can.h:153
#define SP_CAN_CONFIG_PARSING_REGGROUP_None
Definition nrf_sp_can.h:42
#define SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Pos
Definition nrf_sp_can.h:127
#define SP_CAN_STATUS_STATUS_BITERROR_Msk
Definition nrf_sp_can.h:376
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Pos
Definition nrf_sp_can.h:138
#define SP_CAN_INTEN_STATECHANGED_Msk
Definition nrf_sp_can.h:790
#define SP_CAN_STATUS_STATUS_ACKERROR_Msk
Definition nrf_sp_can.h:391
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:234
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:185
#define SP_CAN_STATUS_STATUS_CRCERROR_Msk
Definition nrf_sp_can.h:395
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:233
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:331
#define SP_CAN_CONFIG_MODE_MODE_OneShot
Definition nrf_sp_can.h:90
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk
Definition nrf_sp_can.h:117
#define SP_CAN_STATUS_STATUS_STATE_BUSOFF
Definition nrf_sp_can.h:432
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Msk
Definition nrf_sp_can.h:186
#define SP_CAN_TXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:260
#define SP_CAN_CONFIG_REQUEST_REQUEST_RX
Definition nrf_sp_can.h:76
#define SP_CAN_CONFIG_PARSING_REGGROUP_RxFilters
Definition nrf_sp_can.h:45
#define SP_CAN_INTEN_ERRORDETECTED_Msk
Definition nrf_sp_can.h:782
#define SP_CAN_CONFIG_REQUEST_REQUEST_Msk
Definition nrf_sp_can.h:73
#define SP_CAN_ENABLE_ENABLE_Disabled
Definition nrf_sp_can.h:804
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk
Definition nrf_sp_can.h:139
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:353
#define SP_CAN_STATUS_STATUS_PROTOCOLERROR_Msk
Definition nrf_sp_can.h:407
#define SP_CAN_STATUS_STATUS_STATE_Pos
Definition nrf_sp_can.h:425
#define SP_CAN_RXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:358
#define SP_CAN_TXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:261
#define SP_CAN_RXFILTER_IDMASK_FILTERWIDTH_Pos
Definition nrf_sp_can.h:156
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:330
#define SP_CAN_STATUS_STATUS_STATE_STOPPED
Definition nrf_sp_can.h:433
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:342
#define SP_CAN_ENABLE_ENABLE_Enabled
Definition nrf_sp_can.h:805
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:255
#define SP_CAN_CONFIG_MODE_MODE_Normal
Definition nrf_sp_can.h:87
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:244
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:341
#define SP_CAN_STATUS_STATUS_STATE_ERRORWARNING
Definition nrf_sp_can.h:430
#define SP_CAN_STATUS_STATUS_BITSTUFFINGERROR_Msk
Definition nrf_sp_can.h:380
nrf_can_request_t request
Definition nrf_can.h:94
nrf_can_mode_t mode
Definition nrf_can.h:95
uint32_t timing
Definition nrf_can.h:93
CAN configuration structure.
Definition nrf_can.h:92
bool remote_request
Definition nrf_can.h:113
bool extended_format
Definition nrf_can.h:112
uint16_t crc
Definition nrf_can.h:111
uint8_t data[8]
Definition nrf_can.h:110
uint8_t length
Definition nrf_can.h:109
uint32_t identifier
Definition nrf_can.h:108
CAN frame structure.
Definition nrf_can.h:107
uint32_t filterwidth
Definition nrf_can.h:102
uint32_t id_mask
Definition nrf_can.h:101
uint32_t filter
Definition nrf_can.h:100