16#define SOFTPERIPHERAL_EMMC (1)
17#if SOFTPERIPHERAL_EMMC
19#define NRF_EMMC_Type NRF_SP_EMMC_Type
21#define NRF_EMMC_Type NRF_EMMC_Type
162 const uint32_t * response);
165 uint32_t * response);
177 uint32_t error_mask);
187#ifndef NRF_DECLARE_ONLY
191 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
211 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
212 nrf_event_readback((uint8_t *)p_reg + (uint32_t)event);
217 return nrf_event_check(p_reg, event);
223 return nrf_task_event_address_get(p_reg, event);
228 p_reg->INTEN |= mask;
233 return p_reg->INTEN & mask;
238 p_reg->INTEN &= ~mask;
244 p_reg->CONFIG.CLKFREQHZ = p_config->
clkfreqhz;
245 p_reg->CONFIG.BUSWIDTH = ((uint32_t)p_config->
bus_width) &
247 p_reg->CONFIG.READDELAY = (uint32_t)p_config->
read_delay;
256 p_config->
clkfreqhz = p_reg->CONFIG.CLKFREQHZ;
259 p_config->
read_delay = p_reg->CONFIG.READDELAY;
266 p_reg->CONFIG.TIMEOUT = timeout_us;
272 p_reg->CONFIG.TIMEOUT = 0;
293 p_reg->COMMAND.CMD = ((p_cmd->
idx
301 p_reg->COMMAND.ARG = p_cmd->
arg;
302 p_reg->COMMAND.RESPONSEADDR = p_cmd->
resp_addr;
307 uint32_t cmd_reg = p_reg->COMMAND.CMD;
315 p_cmd->
arg = p_reg->COMMAND.ARG;
316 p_cmd->
resp_addr = p_reg->COMMAND.RESPONSEADDR;
320 const uint32_t * response)
324 p_reg->COMMAND.RESPONSE[i] = response[i];
333 response[i] = p_reg->COMMAND.RESPONSE[i];
342 p_reg->DATA.BLOCKNUM = p_data->
block_num;
343 p_reg->DATA.BLOCKSDONE = 0;
344 p_reg->DATA.DIRECTION = (uint32_t)p_data->
direction &
356 p_data->
block_num = p_reg->DATA.BLOCKNUM;
366 return p_reg->DATA.BLOCKSDONE;
372 p_reg->STATUS.STATUS = error_mask;
377 return p_reg->STATUS.STATUS;
390 p_reg->SPSYNC.AUX[idx] = val;
395 return p_reg->SPSYNC.AUX[idx];
NRF_STATIC_INLINE void nrf_emmc_event_clear(NRF_SP_EMMC_Type *p_reg, nrf_emmc_event_t event)
Definition nrf_emmc.h:209
NRF_STATIC_INLINE uint32_t nrf_emmc_int_enable_check(NRF_SP_EMMC_Type const *p_reg, uint32_t mask)
Definition nrf_emmc.h:231
NRF_STATIC_INLINE void nrf_emmc_polling_set(NRF_SP_EMMC_Type *p_reg, uint32_t timeout_us)
Definition nrf_emmc.h:263
nrf_emmc_response_proc_t
EMMC response processing types.
Definition nrf_emmc.h:70
@ NRF_EMMC_RESPONSE_PROC_PROCESS
Definition nrf_emmc.h:71
@ NRF_EMMC_RESPONSE_PROC_IGNORE
Definition nrf_emmc.h:72
NRF_STATIC_INLINE void nrf_emmc_status_set(NRF_SP_EMMC_Type *p_reg, uint32_t error_mask)
Definition nrf_emmc.h:369
NRF_STATIC_INLINE bool nrf_emmc_event_check(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_event_t event)
Definition nrf_emmc.h:215
nrf_emmc_int_mask_t
EMMC interrupt masks.
Definition nrf_emmc.h:48
@ NRF_EMMC_INT_XFERCOMPLETE_MASK
Definition nrf_emmc.h:49
@ NRF_EMMC_INT_ABORTED_MASK
Definition nrf_emmc.h:50
@ NRF_EMMC_INT_READYTOTRANSFER_MASK
Definition nrf_emmc.h:51
NRF_STATIC_INLINE void nrf_emmc_config_set(NRF_SP_EMMC_Type *p_reg, nrf_emmc_config_t const *p_config)
Definition nrf_emmc.h:241
NRF_STATIC_INLINE void nrf_emmc_enable(NRF_SP_EMMC_Type *p_reg)
Definition nrf_emmc.h:194
NRF_STATIC_INLINE uint32_t nrf_emmc_handshake_get(NRF_SP_EMMC_Type const *p_reg, uint8_t idx)
Definition nrf_emmc.h:393
NRF_STATIC_INLINE void nrf_emmc_command_get_response(NRF_SP_EMMC_Type const *p_reg, uint32_t *response)
Definition nrf_emmc.h:328
NRF_STATIC_INLINE void nrf_emmc_polling_clear(NRF_SP_EMMC_Type *p_reg)
Definition nrf_emmc.h:269
NRF_STATIC_INLINE void nrf_emmc_config_set_ready_to_transfer(NRF_SP_EMMC_Type *p_reg, nrf_emmc_config_t const *p_config)
Definition nrf_emmc.h:275
NRF_STATIC_INLINE uint32_t nrf_emmc_event_address_get(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_event_t event)
Definition nrf_emmc.h:220
NRF_STATIC_INLINE uint32_t nrf_emmc_get_num_blocks_done(NRF_SP_EMMC_Type const *p_reg)
Definition nrf_emmc.h:364
nrf_emmc_event_t
EMMC events.
Definition nrf_emmc.h:40
@ NRF_EMMC_EVENT_ABORTED
Definition nrf_emmc.h:42
@ NRF_EMMC_EVENT_READYTOTRANSFER
Definition nrf_emmc.h:43
@ NRF_EMMC_EVENT_XFERCOMPLETE
Definition nrf_emmc.h:41
nrf_emmc_response_type_t
EMMC response types.
Definition nrf_emmc.h:56
@ NRF_EMMC_RESPONSE_R6
Definition nrf_emmc.h:64
@ NRF_EMMC_RESPONSE_R1B
Definition nrf_emmc.h:59
@ NRF_EMMC_RESPONSE_R4
Definition nrf_emmc.h:62
@ NRF_EMMC_RESPONSE_NONE
Definition nrf_emmc.h:57
@ NRF_EMMC_RESPONSE_R3
Definition nrf_emmc.h:61
@ NRF_EMMC_RESPONSE_R2
Definition nrf_emmc.h:60
@ NRF_EMMC_RESPONSE_R7
Definition nrf_emmc.h:65
@ NRF_EMMC_RESPONSE_R1
Definition nrf_emmc.h:58
@ NRF_EMMC_RESPONSE_R5
Definition nrf_emmc.h:63
NRF_STATIC_INLINE void nrf_emmc_command_set_response(NRF_SP_EMMC_Type *p_reg, const uint32_t *response)
Definition nrf_emmc.h:319
NRF_STATIC_INLINE void nrf_emmc_command_set(NRF_SP_EMMC_Type *p_reg, nrf_emmc_command_t const *p_cmd)
Definition nrf_emmc.h:291
NRF_STATIC_INLINE void nrf_emmc_handshake_set(NRF_SP_EMMC_Type *p_reg, uint32_t val, uint8_t idx)
Definition nrf_emmc.h:388
NRF_STATIC_INLINE void nrf_emmc_config_get(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_config_t *p_config)
Definition nrf_emmc.h:253
NRF_STATIC_INLINE bool nrf_emmc_enable_check(NRF_SP_EMMC_Type const *p_reg)
Definition nrf_emmc.h:204
NRF_STATIC_INLINE uint32_t nrf_emmc_status_get(NRF_SP_EMMC_Type const *p_reg)
Definition nrf_emmc.h:375
nrf_emmc_bus_width_t
EMMC bus width configurations.
Definition nrf_emmc.h:77
@ NRF_EMMC_BUS_WIDTH_4_LANES
Definition nrf_emmc.h:79
@ NRF_EMMC_BUS_WIDTH_1_LANE
Definition nrf_emmc.h:78
@ NRF_EMMC_BUS_WIDTH_8_LANES
Definition nrf_emmc.h:80
nrf_emmc_direction_t
EMMC data transfer direction.
Definition nrf_emmc.h:85
@ NRF_EMMC_DIRECTION_RD
Definition nrf_emmc.h:87
@ NRF_EMMC_DIRECTION_WR
Definition nrf_emmc.h:86
nrf_emmc_task_t
EMMC tasks.
Definition nrf_emmc.h:32
@ NRF_EMMC_TASK_RESET
Definition nrf_emmc.h:34
@ NRF_EMMC_TASK_START
Definition nrf_emmc.h:33
NRF_STATIC_INLINE void nrf_emmc_int_enable(NRF_SP_EMMC_Type *p_reg, uint32_t mask)
Definition nrf_emmc.h:226
NRF_STATIC_INLINE bool nrf_emmc_status_error_check(uint32_t status)
Definition nrf_emmc.h:380
NRF_STATIC_INLINE void nrf_emmc_data_set(NRF_SP_EMMC_Type *p_reg, nrf_emmc_data_t const *p_data)
Definition nrf_emmc.h:337
NRF_STATIC_INLINE void nrf_emmc_int_disable(NRF_SP_EMMC_Type *p_reg, uint32_t mask)
Definition nrf_emmc.h:236
NRF_STATIC_INLINE void nrf_emmc_config_get_ready_to_transfer(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_config_t *p_config)
Definition nrf_emmc.h:283
NRF_STATIC_INLINE void nrf_emmc_command_get(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_command_t *p_cmd)
Definition nrf_emmc.h:305
NRF_STATIC_INLINE void nrf_emmc_disable(NRF_SP_EMMC_Type *p_reg)
Definition nrf_emmc.h:199
NRF_STATIC_INLINE void nrf_emmc_task_trigger(NRF_SP_EMMC_Type *p_reg, nrf_emmc_task_t task)
Definition nrf_emmc.h:189
NRF_STATIC_INLINE void nrf_emmc_data_get(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_data_t *p_data)
Definition nrf_emmc.h:351
#define NRF_EMMC_Type
Definition nrf_emmc.h:19
#define SP_EMMC_INTEN_ABORTED_Msk
Definition nrf_sp_emmc.h:604
#define SP_EMMC_ENABLE_ENABLE_Disabled
Definition nrf_sp_emmc.h:627
#define SP_EMMC_DATA_DIRECTION_DIRECTION_WR
Definition nrf_sp_emmc.h:239
#define SP_EMMC_COMMAND_CMD_RESPTYPE_Pos
Definition nrf_sp_emmc.h:124
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R5
Definition nrf_sp_emmc.h:134
#define SP_EMMC_DATA_SKIPDATACRC_SKIPDATACRC_Msk
Definition nrf_sp_emmc.h:247
#define SP_EMMC_COMMAND_CMD_IDX_Msk
Definition nrf_sp_emmc.h:121
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_EIGHTLANES
Definition nrf_sp_emmc.h:73
#define SP_EMMC_CONFIG_READYTOTRANSFER_READYTOTRANSFER_Ready
Definition nrf_sp_emmc.h:49
#define SP_EMMC_INTEN_READYTOTRANSFER_Msk
Definition nrf_sp_emmc.h:612
#define SP_EMMC_DATA_SKIPDATACRC_SKIPDATACRC_CHECKDATACRC
Definition nrf_sp_emmc.h:253
#define SP_EMMC_DATA_DIRECTION_DIRECTION_RD
Definition nrf_sp_emmc.h:240
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R7
Definition nrf_sp_emmc.h:136
#define SP_EMMC_STATUS_STATUS_PROTOCOLERR_Msk
Definition nrf_sp_emmc.h:285
#define SP_EMMC_CONFIG_READYTOTRANSFER_READYTOTRANSFER_Msk
Definition nrf_sp_emmc.h:42
#define SP_EMMC_COMMAND_CMD_RESPTYPE_Msk
Definition nrf_sp_emmc.h:125
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R1B
Definition nrf_sp_emmc.h:130
#define SP_EMMC_COMMAND_CMD_RESPPROC_PROCESS
Definition nrf_sp_emmc.h:143
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_Msk
Definition nrf_sp_emmc.h:66
#define SP_EMMC_CONFIG_POLLMODE_POLLMODE_POLL
Definition nrf_sp_emmc.h:94
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_ONELANE
Definition nrf_sp_emmc.h:71
#define SP_EMMC_COMMAND_RESPONSE_MinIndex
Definition nrf_sp_emmc.h:168
#define SP_EMMC_CONFIG_READYTOTRANSFER_READYTOTRANSFER_NotReady
Definition nrf_sp_emmc.h:48
#define SP_EMMC_STATUS_STATUS_DATACRCERROR_Msk
Definition nrf_sp_emmc.h:280
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_FOURLANES
Definition nrf_sp_emmc.h:72
#define SP_EMMC_CONFIG_POLLMODE_POLLMODE_NOPOLL
Definition nrf_sp_emmc.h:93
#define SP_EMMC_ENABLE_ENABLE_Msk
Definition nrf_sp_emmc.h:624
#define SP_EMMC_STATUS_STATUS_CMDCRCERROR_Msk
Definition nrf_sp_emmc.h:275
#define SP_EMMC_DATA_SKIPDATACRC_SKIPDATACRC_SKIPDATACRC
Definition nrf_sp_emmc.h:254
#define SP_EMMC_ENABLE_ENABLE_Enabled
Definition nrf_sp_emmc.h:628
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R1
Definition nrf_sp_emmc.h:129
#define SP_EMMC_COMMAND_RESPONSE_MaxCount
Definition nrf_sp_emmc.h:166
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R6
Definition nrf_sp_emmc.h:135
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R3
Definition nrf_sp_emmc.h:132
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R4
Definition nrf_sp_emmc.h:133
#define SP_EMMC_COMMAND_CMD_RESPPROC_IGNORE
Definition nrf_sp_emmc.h:144
#define SP_EMMC_COMMAND_CMD_RESPPROC_Msk
Definition nrf_sp_emmc.h:140
#define SP_EMMC_DATA_DIRECTION_DIRECTION_Msk
Definition nrf_sp_emmc.h:235
#define SP_EMMC_INTEN_XFERCOMPLETE_Msk
Definition nrf_sp_emmc.h:596
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R2
Definition nrf_sp_emmc.h:131
#define SP_EMMC_STATUS_STATUS_CMDTIMEOUT_Msk
Definition nrf_sp_emmc.h:270
#define SP_EMMC_COMMAND_CMD_RESPTYPE_NONE
Definition nrf_sp_emmc.h:128
#define SP_EMMC_COMMAND_CMD_IDX_Pos
Definition nrf_sp_emmc.h:120
#define SP_EMMC_COMMAND_CMD_RESPPROC_Pos
Definition nrf_sp_emmc.h:139
uint32_t resp_addr
Definition nrf_emmc.h:106
nrf_emmc_response_proc_t resp_proc
Definition nrf_emmc.h:104
nrf_emmc_response_type_t resp_type
Definition nrf_emmc.h:103
uint32_t arg
Definition nrf_emmc.h:105
uint16_t idx
Definition nrf_emmc.h:102
EMMC command structure.
Definition nrf_emmc.h:101
uint32_t clkfreqhz
Definition nrf_emmc.h:93
nrf_emmc_bus_width_t bus_width
Definition nrf_emmc.h:94
uint32_t read_delay
Definition nrf_emmc.h:96
bool ready_to_transfer
Definition nrf_emmc.h:95
EMMC configuration structure.
Definition nrf_emmc.h:92
uint32_t block_num
Definition nrf_emmc.h:115
nrf_emmc_direction_t direction
Definition nrf_emmc.h:117
uint32_t block_size
Definition nrf_emmc.h:114
uint32_t blocks_done
Definition nrf_emmc.h:116
uint32_t buffer_addr
Definition nrf_emmc.h:112
bool skipdatacrc
Definition nrf_emmc.h:118
EMMC data transfer structure.
Definition nrf_emmc.h:111