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
146 const uint32_t * response);
149 uint32_t * response);
165 uint32_t error_mask);
175#ifndef NRF_DECLARE_ONLY
179 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
199 *((
volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
200 nrf_event_readback((uint8_t *)p_reg + (uint32_t)event);
205 return nrf_event_check(p_reg, event);
211 return nrf_task_event_address_get(p_reg, event);
216 p_reg->INTEN |= mask;
221 return p_reg->INTEN & mask;
226 p_reg->INTEN &= ~mask;
232 p_reg->CONFIG.CLKFREQHZ = p_config->
clkfreqhz;
233 p_reg->CONFIG.BUSWIDTH = ((uint32_t)p_config->
bus_width) &
235 p_reg->CONFIG.READDELAY = (uint32_t)p_config->
read_delay;
244 p_config->
clkfreqhz = p_reg->CONFIG.CLKFREQHZ;
247 p_config->
read_delay = p_reg->CONFIG.READDELAY;
269 p_reg->COMMAND.CMD = ((p_cmd->
idx
277 p_reg->COMMAND.ARG = p_cmd->
arg;
278 p_reg->COMMAND.RESPONSEADDR = p_cmd->
resp_addr;
283 uint32_t cmd_reg = p_reg->COMMAND.CMD;
291 p_cmd->
arg = p_reg->COMMAND.ARG;
292 p_cmd->
resp_addr = p_reg->COMMAND.RESPONSEADDR;
296 const uint32_t * response)
300 p_reg->COMMAND.RESPONSE[i] = response[i];
309 response[i] = p_reg->COMMAND.RESPONSE[i];
318 p_reg->DATA.BLOCKNUM = p_data->
block_num;
326 p_data->
block_num = p_reg->DATA.BLOCKNUM;
332 p_reg->DATA.BLOCKNUM = p_data->
block_num;
338 p_data->
block_num = p_reg->DATA.BLOCKNUM;
344 p_reg->STATUS.STATUS = error_mask;
349 return p_reg->STATUS.STATUS;
363 p_reg->SPSYNC.AUX[idx] = val;
368 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:197
NRF_STATIC_INLINE uint32_t nrf_emmc_int_enable_check(NRF_SP_EMMC_Type const *p_reg, uint32_t mask)
Definition nrf_emmc.h:219
nrf_emmc_response_proc_t
EMMC response processing types.
Definition nrf_emmc.h:68
@ NRF_EMMC_RESPONSE_PROC_PROCESS
Definition nrf_emmc.h:69
@ NRF_EMMC_RESPONSE_PROC_IGNORE
Definition nrf_emmc.h:70
NRF_STATIC_INLINE void nrf_emmc_status_set(NRF_SP_EMMC_Type *p_reg, uint32_t error_mask)
Definition nrf_emmc.h:341
NRF_STATIC_INLINE bool nrf_emmc_event_check(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_event_t event)
Definition nrf_emmc.h:203
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:229
NRF_STATIC_INLINE void nrf_emmc_enable(NRF_SP_EMMC_Type *p_reg)
Definition nrf_emmc.h:182
NRF_STATIC_INLINE uint32_t nrf_emmc_handshake_get(NRF_SP_EMMC_Type const *p_reg, uint8_t idx)
Definition nrf_emmc.h:366
NRF_STATIC_INLINE void nrf_emmc_command_get_response(NRF_SP_EMMC_Type const *p_reg, uint32_t *response)
Definition nrf_emmc.h:304
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:251
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:208
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_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_R1
Definition nrf_emmc.h:58
@ NRF_EMMC_RESPONSE_R5
Definition nrf_emmc.h:63
NRF_STATIC_INLINE void nrf_emmc_get_num_blocks(NRF_SP_EMMC_Type const *p_reg, nrf_emmc_data_t *p_data)
Definition nrf_emmc.h:335
NRF_STATIC_INLINE void nrf_emmc_command_set_response(NRF_SP_EMMC_Type *p_reg, const uint32_t *response)
Definition nrf_emmc.h:295
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:267
NRF_STATIC_INLINE void nrf_emmc_handshake_set(NRF_SP_EMMC_Type *p_reg, uint32_t val, uint8_t idx)
Definition nrf_emmc.h:361
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:241
NRF_STATIC_INLINE bool nrf_emmc_enable_check(NRF_SP_EMMC_Type const *p_reg)
Definition nrf_emmc.h:192
NRF_STATIC_INLINE uint32_t nrf_emmc_status_get(NRF_SP_EMMC_Type const *p_reg)
Definition nrf_emmc.h:347
nrf_emmc_bus_width_t
EMMC bus width configurations.
Definition nrf_emmc.h:75
@ NRF_EMMC_BUS_WIDTH_4_LANES
Definition nrf_emmc.h:77
@ NRF_EMMC_BUS_WIDTH_1_LANE
Definition nrf_emmc.h:76
@ NRF_EMMC_BUS_WIDTH_8_LANES
Definition nrf_emmc.h:78
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:214
NRF_STATIC_INLINE bool nrf_emmc_status_error_check(uint32_t status)
Definition nrf_emmc.h:352
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:313
NRF_STATIC_INLINE void nrf_emmc_set_num_blocks(NRF_SP_EMMC_Type *p_reg, nrf_emmc_data_t const *p_data)
Definition nrf_emmc.h:329
NRF_STATIC_INLINE void nrf_emmc_int_disable(NRF_SP_EMMC_Type *p_reg, uint32_t mask)
Definition nrf_emmc.h:224
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:259
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:281
NRF_STATIC_INLINE void nrf_emmc_disable(NRF_SP_EMMC_Type *p_reg)
Definition nrf_emmc.h:187
NRF_STATIC_INLINE void nrf_emmc_task_trigger(NRF_SP_EMMC_Type *p_reg, nrf_emmc_task_t task)
Definition nrf_emmc.h:177
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:321
#define NRF_EMMC_Type
Definition nrf_emmc.h:19
#define SP_EMMC_INTEN_ABORTED_Msk
Definition nrf_sp_emmc.h:448
#define SP_EMMC_ENABLE_ENABLE_Disabled
Definition nrf_sp_emmc.h:471
#define SP_EMMC_COMMAND_CMD_RESPTYPE_Pos
Definition nrf_sp_emmc.h:115
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R5
Definition nrf_sp_emmc.h:125
#define SP_EMMC_COMMAND_CMD_IDX_Msk
Definition nrf_sp_emmc.h:112
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_EIGHTLANES
Definition nrf_sp_emmc.h:72
#define SP_EMMC_CONFIG_READYTOTRANSFER_READYTOTRANSFER_Ready
Definition nrf_sp_emmc.h:48
#define SP_EMMC_INTEN_READYTOTRANSFER_Msk
Definition nrf_sp_emmc.h:456
#define SP_EMMC_STATUS_STATUS_PROTOCOLERR_Msk
Definition nrf_sp_emmc.h:250
#define SP_EMMC_STATUS_STATUS_RETRYEXCEEDED_Msk
Definition nrf_sp_emmc.h:245
#define SP_EMMC_CONFIG_READYTOTRANSFER_READYTOTRANSFER_Msk
Definition nrf_sp_emmc.h:41
#define SP_EMMC_COMMAND_CMD_RESPTYPE_Msk
Definition nrf_sp_emmc.h:116
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R1B
Definition nrf_sp_emmc.h:121
#define SP_EMMC_COMMAND_CMD_RESPPROC_PROCESS
Definition nrf_sp_emmc.h:132
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_Msk
Definition nrf_sp_emmc.h:65
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_ONELANE
Definition nrf_sp_emmc.h:70
#define SP_EMMC_COMMAND_RESPONSE_MinIndex
Definition nrf_sp_emmc.h:156
#define SP_EMMC_CONFIG_READYTOTRANSFER_READYTOTRANSFER_NotReady
Definition nrf_sp_emmc.h:47
#define SP_EMMC_STATUS_STATUS_DATACRCERROR_Msk
Definition nrf_sp_emmc.h:240
#define SP_EMMC_CONFIG_BUSWIDTH_BUSWIDTH_FOURLANES
Definition nrf_sp_emmc.h:71
#define SP_EMMC_ENABLE_ENABLE_Msk
Definition nrf_sp_emmc.h:468
#define SP_EMMC_STATUS_STATUS_CMDCRCERROR_Msk
Definition nrf_sp_emmc.h:235
#define SP_EMMC_ENABLE_ENABLE_Enabled
Definition nrf_sp_emmc.h:472
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R1
Definition nrf_sp_emmc.h:120
#define SP_EMMC_COMMAND_RESPONSE_MaxCount
Definition nrf_sp_emmc.h:154
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R3
Definition nrf_sp_emmc.h:123
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R4
Definition nrf_sp_emmc.h:124
#define SP_EMMC_COMMAND_CMD_RESPPROC_IGNORE
Definition nrf_sp_emmc.h:133
#define SP_EMMC_COMMAND_CMD_RESPPROC_Msk
Definition nrf_sp_emmc.h:129
#define SP_EMMC_INTEN_XFERCOMPLETE_Msk
Definition nrf_sp_emmc.h:440
#define SP_EMMC_COMMAND_CMD_RESPTYPE_R2
Definition nrf_sp_emmc.h:122
#define SP_EMMC_STATUS_STATUS_CMDTIMEOUT_Msk
Definition nrf_sp_emmc.h:230
#define SP_EMMC_COMMAND_CMD_RESPTYPE_NONE
Definition nrf_sp_emmc.h:119
#define SP_EMMC_COMMAND_CMD_IDX_Pos
Definition nrf_sp_emmc.h:111
#define SP_EMMC_COMMAND_CMD_RESPPROC_Pos
Definition nrf_sp_emmc.h:128
uint32_t resp_addr
Definition nrf_emmc.h:97
nrf_emmc_response_proc_t resp_proc
Definition nrf_emmc.h:95
nrf_emmc_response_type_t resp_type
Definition nrf_emmc.h:94
uint32_t arg
Definition nrf_emmc.h:96
uint16_t idx
Definition nrf_emmc.h:93
EMMC command structure.
Definition nrf_emmc.h:92
uint32_t clkfreqhz
Definition nrf_emmc.h:84
nrf_emmc_bus_width_t bus_width
Definition nrf_emmc.h:85
uint32_t read_delay
Definition nrf_emmc.h:87
bool ready_to_transfer
Definition nrf_emmc.h:86
EMMC configuration structure.
Definition nrf_emmc.h:83
uint32_t block_num
Definition nrf_emmc.h:106
uint32_t block_size
Definition nrf_emmc.h:105
uint32_t buffer_addr
Definition nrf_emmc.h:103
EMMC data transfer structure.
Definition nrf_emmc.h:102