16#define SOFTPERIPHERAL_CAN (1)
19#define NRF_CAN_Type NRF_SP_CAN_Type
21#define NRF_CAN_Type NRF_CAN_Type
200#ifndef NRF_DECLARE_ONLY
204 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
209 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x0UL;
229 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
230 nrf_event_readback((uint8_t *)p_reg + (uint32_t)event);
235 return nrf_event_check(p_reg, event);
241 return nrf_task_event_address_get(p_reg, event);
246 p_reg->INTEN |= mask;
251 return p_reg->INTEN & mask;
256 p_reg->INTEN &= ~mask;
279 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
280 ~SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk) |
299 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
300 ~SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk) |
319 p_reg->RXFILTER[index].IDFILTER = (p_reg->RXFILTER[index].IDFILTER &
320 ~SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk) |
352 p_reg->CONFIG.TIMING = p_config->
timing;
353 p_reg->CONFIG.REQUEST = ((uint32_t)p_config->
request) &
355 p_reg->CONFIG.MODE = (((uint32_t)p_config->
mode) &
361 p_config->
timing = p_reg->CONFIG.TIMING;
372 p_reg->TXFRAME[idx].IDENTIFIER = (p_frame->
identifier
376 p_reg->TXFRAME[idx].TXDATAL = ((uint32_t)p_frame->
data[0] << 0) | ((uint32_t)p_frame->
data[1]
378 ((uint32_t)p_frame->
data[2]
379 << 16) | ((uint32_t)p_frame->
data[3] << 24);
381 p_reg->TXFRAME[idx].TXDATAH = ((uint32_t)p_frame->
data[4] << 0) | ((uint32_t)p_frame->
data[5]
383 ((uint32_t)p_frame->
data[6]
384 << 16) | ((uint32_t)p_frame->
data[7] << 24);
392 (((uint32_t)p_frame->
length
403 uint32_t identifier = p_reg->TXFRAME[idx].IDENTIFIER;
408 uint32_t datal = p_reg->TXFRAME[idx].TXDATAL;
409 p_frame->
data[0] = (uint8_t)(datal >> 0);
410 p_frame->
data[1] = (uint8_t)(datal >> 8);
411 p_frame->
data[2] = (uint8_t)(datal >> 16);
412 p_frame->
data[3] = (uint8_t)(datal >> 24);
414 uint32_t datah = p_reg->TXFRAME[idx].TXDATAH;
415 p_frame->
data[4] = (uint8_t)(datah >> 0);
416 p_frame->
data[5] = (uint8_t)(datah >> 8);
417 p_frame->
data[6] = (uint8_t)(datah >> 16);
418 p_frame->
data[7] = (uint8_t)(datah >> 24);
420 uint32_t metadata = p_reg->TXFRAME[idx].METADATA;
435 p_reg->RXFRAME[idx].IDENTIFIER = (p_frame->
identifier
439 p_reg->RXFRAME[idx].RXDATAL = ((uint32_t)p_frame->
data[0] << 0) | ((uint32_t)p_frame->
data[1]
441 ((uint32_t)p_frame->
data[2]
442 << 16) | ((uint32_t)p_frame->
data[3] << 24);
444 p_reg->RXFRAME[idx].RXDATAH = ((uint32_t)p_frame->
data[4] << 0) | ((uint32_t)p_frame->
data[5]
446 ((uint32_t)p_frame->
data[6]
447 << 16) | ((uint32_t)p_frame->
data[7] << 24);
455 (((uint32_t)p_frame->
length
466 uint32_t identifier = p_reg->RXFRAME[idx].IDENTIFIER;
471 uint32_t datal = p_reg->RXFRAME[idx].RXDATAL;
472 p_frame->
data[0] = (uint8_t)(datal >> 0);
473 p_frame->
data[1] = (uint8_t)(datal >> 8);
474 p_frame->
data[2] = (uint8_t)(datal >> 16);
475 p_frame->
data[3] = (uint8_t)(datal >> 24);
477 uint32_t datah = p_reg->RXFRAME[idx].RXDATAH;
478 p_frame->
data[4] = (uint8_t)(datah >> 0);
479 p_frame->
data[5] = (uint8_t)(datah >> 8);
480 p_frame->
data[6] = (uint8_t)(datah >> 16);
481 p_frame->
data[7] = (uint8_t)(datah >> 24);
483 uint32_t metadata = p_reg->RXFRAME[idx].METADATA;
502 return (p_reg->STATUS.STATUS & 0x1FF);
516 p_reg->SPSYNC.AUX[idx] = val;
521 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:399
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:350
NRF_STATIC_INLINE uint32_t nrf_can_int_enable_check(NRF_SP_CAN_Type const *p_reg, uint32_t mask)
Definition nrf_can.h:249
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:267
NRF_STATIC_INLINE void nrf_can_int_enable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:244
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:238
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:315
NRF_STATIC_INLINE void nrf_can_task_trigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:202
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:431
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:359
NRF_STATIC_INLINE nrf_can_state_t nrf_can_state_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:494
nrf_can_state_t
Definition nrf_can.h:81
@ NRF_CAN_STATE_ERRORACTIVE
Definition nrf_can.h:82
@ NRF_CAN_STATE_ERRORPASSIVE
Definition nrf_can.h:84
@ NRF_CAN_STATE_BUSOFF
Definition nrf_can.h:85
@ NRF_CAN_STATE_ERRORWARNING
Definition nrf_can.h:83
@ NRF_CAN_STATE_STOPPED
Definition nrf_can.h:86
NRF_STATIC_INLINE void nrf_can_enable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:212
NRF_STATIC_INLINE void nrf_can_disable(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:217
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:368
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:462
NRF_STATIC_INLINE bool nrf_can_rxfilter_filtermatched_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:305
NRF_STATIC_INLINE void nrf_can_task_untrigger(NRF_SP_CAN_Type *p_reg, nrf_can_task_t task)
Definition nrf_can.h:207
NRF_STATIC_INLINE bool nrf_can_enable_check(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:222
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:295
NRF_STATIC_INLINE void nrf_can_set_parsing_timing(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:335
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:345
NRF_STATIC_INLINE bool nrf_can_rxfilter_usefilter_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:285
nrf_can_mode_t
CAN operation modes.
Definition nrf_can.h:73
@ NRF_CAN_MODE_LOOPBACK
Definition nrf_can.h:75
@ NRF_CAN_MODE_LISTENONLY
Definition nrf_can.h:76
@ NRF_CAN_MODE_ONESHOT
Definition nrf_can.h:77
@ NRF_CAN_MODE_NORMAL
Definition nrf_can.h:74
NRF_STATIC_INLINE uint32_t nrf_can_handshake_get(NRF_SP_CAN_Type const *p_reg, uint8_t idx)
Definition nrf_can.h:519
NRF_STATIC_INLINE void nrf_can_handshake_set(NRF_SP_CAN_Type *p_reg, uint32_t val, uint8_t idx)
Definition nrf_can.h:514
NRF_STATIC_INLINE bool nrf_can_rxfilter_inmailbox_get(NRF_SP_CAN_Type const *p_reg, uint8_t index)
Definition nrf_can.h:325
NRF_STATIC_INLINE void nrf_can_set_parsing_mode(NRF_SP_CAN_Type *p_reg)
Definition nrf_can.h:340
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_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:259
NRF_STATIC_INLINE bool nrf_can_event_check(NRF_SP_CAN_Type const *p_reg, nrf_can_event_t event)
Definition nrf_can.h:233
NRF_STATIC_INLINE uint32_t nrf_can_error_get(NRF_SP_CAN_Type const *p_reg)
Definition nrf_can.h:500
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:275
NRF_STATIC_INLINE void nrf_can_int_disable(NRF_SP_CAN_Type *p_reg, uint32_t mask)
Definition nrf_can.h:254
NRF_STATIC_INLINE bool nrf_can_status_error_check(uint32_t error_mask)
Definition nrf_can.h:505
NRF_STATIC_INLINE void nrf_can_event_clear(NRF_SP_CAN_Type *p_reg, nrf_can_event_t event)
Definition nrf_can.h:227
#define NRF_CAN_Type
Definition nrf_can.h:19
#define SP_CAN_INTEN_RXCOMPLETE_Msk
Definition nrf_sp_can.h:665
#define SP_CAN_CONFIG_MODE_MODE_Msk
Definition nrf_sp_can.h:85
#define SP_CAN_CONFIG_MODE_MODE_Loopback
Definition nrf_sp_can.h:89
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:235
#define SP_CAN_STATUS_STATUS_FORMERROR_Msk
Definition nrf_sp_can.h:377
#define SP_CAN_STATUS_STATUS_STATE_ERRORPASSIVE
Definition nrf_sp_can.h:421
#define SP_CAN_STATUS_STATUS_STATE_ERRORACTIVE
Definition nrf_sp_can.h:419
#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:78
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:342
#define SP_CAN_CONFIG_MODE_MODE_ListenOnly
Definition nrf_sp_can.h:90
#define SP_CAN_INTEN_TXCOMPLETE_Msk
Definition nrf_sp_can.h:657
#define SP_CAN_RXFILTER_IDFILTER_INMAILBOX_Msk
Definition nrf_sp_can.h:129
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:246
#define SP_CAN_ENABLE_ENABLE_Msk
Definition nrf_sp_can.h:692
#define SP_CAN_RXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:272
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Pos
Definition nrf_sp_can.h:117
#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:273
#define SP_CAN_STATUS_STATUS_STATE_Msk
Definition nrf_sp_can.h:416
#define SP_CAN_RXFILTER_IDFILTER_IDENTIFIER_Msk
Definition nrf_sp_can.h:111
#define SP_CAN_RXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:347
#define SP_CAN_RXFILTER_IDMASK_MASK_Msk
Definition nrf_sp_can.h:154
#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:128
#define SP_CAN_STATUS_STATUS_BITERROR_Msk
Definition nrf_sp_can.h:366
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Pos
Definition nrf_sp_can.h:139
#define SP_CAN_INTEN_STATECHANGED_Msk
Definition nrf_sp_can.h:681
#define SP_CAN_STATUS_STATUS_ACKERROR_Msk
Definition nrf_sp_can.h:381
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:224
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Pos
Definition nrf_sp_can.h:175
#define SP_CAN_STATUS_STATUS_CRCERROR_Msk
Definition nrf_sp_can.h:385
#define SP_CAN_TXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:223
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Msk
Definition nrf_sp_can.h:321
#define SP_CAN_CONFIG_MODE_MODE_OneShot
Definition nrf_sp_can.h:91
#define SP_CAN_RXFILTER_IDFILTER_USEFILTER_Msk
Definition nrf_sp_can.h:118
#define SP_CAN_STATUS_STATUS_STATE_BUSOFF
Definition nrf_sp_can.h:422
#define SP_CAN_TXFRAME_IDENTIFIER_IDENTIFIER_Msk
Definition nrf_sp_can.h:176
#define SP_CAN_TXFRAME_METADATA_CRC_Pos
Definition nrf_sp_can.h:250
#define SP_CAN_CONFIG_REQUEST_REQUEST_RX
Definition nrf_sp_can.h:77
#define SP_CAN_CONFIG_PARSING_REGGROUP_RxFilters
Definition nrf_sp_can.h:45
#define SP_CAN_INTEN_ERRORDETECTED_Msk
Definition nrf_sp_can.h:673
#define SP_CAN_CONFIG_REQUEST_REQUEST_Msk
Definition nrf_sp_can.h:74
#define SP_CAN_ENABLE_ENABLE_Disabled
Definition nrf_sp_can.h:695
#define SP_CAN_RXFILTER_IDFILTER_FILTERMATCHED_Msk
Definition nrf_sp_can.h:140
#define SP_CAN_RXFRAME_METADATA_DATALENGTH_Msk
Definition nrf_sp_can.h:343
#define SP_CAN_STATUS_STATUS_PROTOCOLERROR_Msk
Definition nrf_sp_can.h:397
#define SP_CAN_STATUS_STATUS_STATE_Pos
Definition nrf_sp_can.h:415
#define SP_CAN_RXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:348
#define SP_CAN_TXFRAME_METADATA_CRC_Msk
Definition nrf_sp_can.h:251
#define SP_CAN_RXFRAME_METADATA_EXTENDEDFORMAT_Pos
Definition nrf_sp_can.h:320
#define SP_CAN_STATUS_STATUS_STATE_STOPPED
Definition nrf_sp_can.h:423
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Msk
Definition nrf_sp_can.h:332
#define SP_CAN_ENABLE_ENABLE_Enabled
Definition nrf_sp_can.h:696
#define SP_CAN_TXFRAME_METADATA_DATALENGTH_Pos
Definition nrf_sp_can.h:245
#define SP_CAN_CONFIG_MODE_MODE_Normal
Definition nrf_sp_can.h:88
#define SP_CAN_TXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:234
#define SP_CAN_RXFRAME_METADATA_REMOTEREQUEST_Pos
Definition nrf_sp_can.h:331
#define SP_CAN_STATUS_STATUS_STATE_ERRORWARNING
Definition nrf_sp_can.h:420
#define SP_CAN_STATUS_STATUS_BITSTUFFINGERROR_Msk
Definition nrf_sp_can.h:370
nrf_can_request_t request
Definition nrf_can.h:93
nrf_can_mode_t mode
Definition nrf_can.h:94
uint32_t timing
Definition nrf_can.h:92
CAN configuration structure.
Definition nrf_can.h:91
bool remote_request
Definition nrf_can.h:111
bool extended_format
Definition nrf_can.h:110
uint16_t crc
Definition nrf_can.h:109
uint8_t data[8]
Definition nrf_can.h:108
uint8_t length
Definition nrf_can.h:107
uint32_t identifier
Definition nrf_can.h:106
CAN frame structure.
Definition nrf_can.h:105
uint32_t id_mask
Definition nrf_can.h:100
uint32_t filter
Definition nrf_can.h:99