nrfxlib API 3.3.99
Loading...
Searching...
No Matches
nrf_semmc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NRF_SEMMC_H__
8#define NRF_SEMMC_H__
9
10#include <stdbool.h>
11#include <stdint.h>
12#include "nrf_config_semmc.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
39typedef enum
40{
81
92
109
116
122
128
137
149typedef void (* nrf_semmc_event_handler_t)(nrf_semmc_event_t const * p_event, void * p_context);
150
162
172
180typedef struct
181{
182 void * buffer;
183 uint32_t block_size;
184 uint32_t num_blocks;
185 /*
186 * The block_addr is intentionally not included here as it's supplied in the
187 * 'arg' field of the associated command descriptor (nrf_semmc_cmd_desc_t)
188 */
190
192#define NRF_SEMMC_FLAG_HOLD_XFER (1UL << 0)
193
197typedef struct
198{
199 void * p_reg;
200 uint8_t
203
225 void * p_context);
226
238void nrf_semmc_uninit(nrf_semmc_t const * p_semmc);
239
253
267
305 nrf_semmc_cmd_desc_t * p_cmd,
306 nrf_semmc_config_t const * p_config,
307 nrf_semmc_transfer_desc_t * p_transfer,
308 size_t cmd_count,
309 uint32_t flags);
310
342 nrf_semmc_cmd_desc_t * p_cmd,
343 nrf_semmc_config_t const * p_config,
344 nrf_semmc_transfer_desc_t * p_transfer,
345 size_t cmd_count);
346
366
387
391bool nrf_semmc_is_busy(nrf_semmc_t const * p_semmc);
392
397
400#ifdef __cplusplus
401}
402#endif
403
404#endif // NRF_SEMMC_H__
nrf_semmc_error_t nrf_semmc_abort(nrf_semmc_t const *p_semmc)
Abort any ongoing eMMC operation.
nrf_semmc_error_t nrf_semmc_disable(nrf_semmc_t const *p_semmc)
Explicitly power down the controller.
nrf_semmc_error_t nrf_semmc_cmd(nrf_semmc_t const *p_semmc, nrf_semmc_cmd_desc_t *p_cmd, nrf_semmc_config_t const *p_config, nrf_semmc_transfer_desc_t *p_transfer, size_t cmd_count, uint32_t flags)
Start an asynchronous command.
nrf_semmc_bus_width_t
Definition nrf_semmc.h:111
@ NRF_SEMMC_BUS_WIDTH_4
Definition nrf_semmc.h:113
@ NRF_SEMMC_BUS_WIDTH_1
Definition nrf_semmc.h:112
@ NRF_SEMMC_BUS_WIDTH_8
Definition nrf_semmc.h:114
nrf_semmc_error_t nrf_semmc_init(nrf_semmc_t const *p_semmc, nrf_semmc_event_handler_t handler, void *p_context)
Initialize the eMMC controller driver for a given instance.
nrf_semmc_event_xfer_done_t
Definition nrf_semmc.h:124
@ NRF_SEMMC_RESULT_ABORTED
Operation was aborted.
Definition nrf_semmc.h:126
@ NRF_SEMMC_RESULT_OK
Operation finished successfully.
Definition nrf_semmc.h:125
nrf_semmc_error_t nrf_semmc_enable(nrf_semmc_t const *p_semmc)
Explicitly power up and configure the controller.
nrf_semmc_error_t
Definition nrf_semmc.h:94
@ NRF_SEMMC_ERROR_INVALID_STATE
Definition nrf_semmc.h:106
@ NRF_SEMMC_ERROR_DEVICE_REJECTED
Definition nrf_semmc.h:101
@ NRF_SEMMC_ERROR_TIMEOUT
Definition nrf_semmc.h:96
@ NRF_SEMMC_ERROR_UNSUPPORTED
Definition nrf_semmc.h:104
@ NRF_SEMMC_ERROR_ILLEGAL_CMD
Definition nrf_semmc.h:100
@ NRF_SEMMC_ERROR_CMDCRCERROR
Definition nrf_semmc.h:98
@ NRF_SEMMC_ERROR_CMDTIMEOUT
Definition nrf_semmc.h:97
@ NRF_SEMMC_SUCCESS
Definition nrf_semmc.h:95
@ NRF_SEMMC_ERROR_INVALID_PARAM
Definition nrf_semmc.h:105
@ NRF_SEMMC_ERROR_BUSY
Definition nrf_semmc.h:103
@ NRF_SEMMC_ERROR_HW_FAULT
Definition nrf_semmc.h:107
@ NRF_SEMMC_ERROR_DATACRCERROR
Definition nrf_semmc.h:99
@ NRF_SEMMC_ERROR_INTERNAL_OR_PROTOCOL
Definition nrf_semmc.h:102
uint32_t * nrf_semmc_start_task_address_get(nrf_semmc_t const *p_semmc)
Get an address of the task register to start the prepared transfer.
void nrf_semmc_irq_handler(void)
IRQ handler to be called from the eMMC interrupt vector.
nrf_semmc_event_type_t
Definition nrf_semmc.h:118
@ NRF_SEMMC_EVT_XFER_STARTED
The operation has been accepted and scheduled to be started.
Definition nrf_semmc.h:120
@ NRF_SEMMC_EVT_XFER_DONE
Transfer operation has finished.
Definition nrf_semmc.h:119
nrf_semmc_error_t nrf_semmc_cmd_prepare(nrf_semmc_t const *p_semmc, nrf_semmc_cmd_desc_t *p_cmd, nrf_semmc_config_t const *p_config, nrf_semmc_transfer_desc_t *p_transfer, size_t cmd_count)
prepare to start an asynchronous command.
bool nrf_semmc_is_busy(nrf_semmc_t const *p_semmc)
Returns true if an operation is still in progress.
nrf_semmc_resp_type_t
Definition nrf_semmc.h:83
@ NRF_SEMMC_RESP_R2
Definition nrf_semmc.h:87
@ NRF_SEMMC_RESP_R4
Definition nrf_semmc.h:89
@ NRF_SEMMC_RESP_R5
Definition nrf_semmc.h:90
@ NRF_SEMMC_RESP_R1B
Definition nrf_semmc.h:86
@ NRF_SEMMC_RESP_NONE
Definition nrf_semmc.h:84
@ NRF_SEMMC_RESP_R1
Definition nrf_semmc.h:85
@ NRF_SEMMC_RESP_R3
Definition nrf_semmc.h:88
void(* nrf_semmc_event_handler_t)(nrf_semmc_event_t const *p_event, void *p_context)
Callback function type for eMMC driver events.
Definition nrf_semmc.h:149
void nrf_semmc_uninit(nrf_semmc_t const *p_semmc)
Uninitialize the sEMMC driver instance.
nrf_semmc_cmd_t
eMMC command index definitions
Definition nrf_semmc.h:40
@ NRF_SEMMC_CMD19_BUSTEST_W
Definition nrf_semmc.h:59
@ NRF_SEMMC_CMD1_SEND_OP_COND
Definition nrf_semmc.h:42
@ NRF_SEMMC_CMD12_STOP_TRANSMISSION
Definition nrf_semmc.h:52
@ NRF_SEMMC_CMD14_BUSTEST_R
Definition nrf_semmc.h:54
@ NRF_SEMMC_CMD21_SEND_TUNING_BLOCK
Definition nrf_semmc.h:60
@ NRF_SEMMC_CMD42_LOCK_UNLOCK
Definition nrf_semmc.h:73
@ NRF_SEMMC_CMD3_SET_RELATIVE_ADDR
Definition nrf_semmc.h:44
@ NRF_SEMMC_CMD29_CLR_WRITE_PROT
Definition nrf_semmc.h:67
@ NRF_SEMMC_CMD28_SET_WRITE_PROT
Definition nrf_semmc.h:66
@ NRF_SEMMC_CMD47_EXECUTE_WRITE_TASK
Definition nrf_semmc.h:77
@ NRF_SEMMC_CMD15_GO_INACTIVE_STATE
Definition nrf_semmc.h:55
@ NRF_SEMMC_CMD17_READ_SINGLE
Definition nrf_semmc.h:57
@ NRF_SEMMC_CMD13_SEND_STATUS
Definition nrf_semmc.h:53
@ NRF_SEMMC_CMD6_SWITCH
Definition nrf_semmc.h:47
@ NRF_SEMMC_CMD5_SLEEP_AWAKE
Definition nrf_semmc.h:46
@ NRF_SEMMC_CMD49_SET_TIME
Definition nrf_semmc.h:79
@ NRF_SEMMC_CMD35_ERASE_GROUP_START
Definition nrf_semmc.h:70
@ NRF_SEMMC_CMD36_ERASE_GROUP_END
Definition nrf_semmc.h:71
@ NRF_SEMMC_CMD48_CMDQ_TASK_MGMT
Definition nrf_semmc.h:78
@ NRF_SEMMC_CMD44_QUEUED_TASK_PARAMS
Definition nrf_semmc.h:74
@ NRF_SEMMC_CMD2_ALL_SEND_CID
Definition nrf_semmc.h:43
@ NRF_SEMMC_CMD31_SEND_WRITE_PROT_TYPE
Definition nrf_semmc.h:69
@ NRF_SEMMC_CMD10_SEND_CID
Definition nrf_semmc.h:51
@ NRF_SEMMC_CMD25_WRITE_MULTIPLE
Definition nrf_semmc.h:63
@ NRF_SEMMC_CMD45_QUEUED_TASK_ADDRESS
Definition nrf_semmc.h:75
@ NRF_SEMMC_CMD4_SET_DSR
Definition nrf_semmc.h:45
@ NRF_SEMMC_CMD46_EXECUTE_READ_TASK
Definition nrf_semmc.h:76
@ NRF_SEMMC_CMD27_PROGRAM_CSD
Definition nrf_semmc.h:65
@ NRF_SEMMC_CMD18_READ_MULTIPLE
Definition nrf_semmc.h:58
@ NRF_SEMMC_CMD30_SEND_WRITE_PROT
Definition nrf_semmc.h:68
@ NRF_SEMMC_CMD8_SEND_EXT_CSD
Definition nrf_semmc.h:49
@ NRF_SEMMC_CMD9_SEND_CSD
Definition nrf_semmc.h:50
@ NRF_SEMMC_CMD26_PROGRAM_CID
Definition nrf_semmc.h:64
@ NRF_SEMMC_CMD24_WRITE_BLOCK
Definition nrf_semmc.h:62
@ NRF_SEMMC_CMD0_GO_IDLE_STATE
Definition nrf_semmc.h:41
@ NRF_SEMMC_CMD38_ERASE
Definition nrf_semmc.h:72
@ NRF_SEMMC_CMD23_SET_BLOCK_COUNT
Definition nrf_semmc.h:61
@ NRF_SEMMC_CMD16_SET_BLOCKLEN
Definition nrf_semmc.h:56
@ NRF_SEMMC_CMD7_SELECT_DESELECT
Definition nrf_semmc.h:48
#define NRF_SEMMC_RESPONSE_SIZE
NRF_SEMMC_RESPONSE_SIZE.
Definition nrf_config_semmc.h:25
nrf_semmc_resp_type_t resp_type
Response type. nrf_semmc_resp_type_t can be used to set this value.
Definition nrf_semmc.h:167
nrf_semmc_error_t err
Command error code. It will be set by API after a transfer. A subset of nrf_semmc_error_t.
Definition nrf_semmc.h:170
void * resp_buffer
Pointer to the response buffer for transfer. Used for raw response sampling, VPR must have access tho...
Definition nrf_semmc.h:168
uint8_t cmd
Command code. nrf_semmc_cmd_t can be used to set this value.
Definition nrf_semmc.h:165
uint32_t arg
Command argument.
Definition nrf_semmc.h:166
Definition nrf_semmc.h:164
nrf_semmc_bus_width_t bus_width
1, 4, or 8 bits.
Definition nrf_semmc.h:160
uint32_t read_delay
FLPR clock cycle number to delay data sampling.
Definition nrf_semmc.h:159
uint32_t clk_freq_hz
Clock frequency in Hz to set during initialization.
Definition nrf_semmc.h:158
void * spis_instance
Hardware instance pointer or base address of optional SPI slave(implementation-defined).
Definition nrf_semmc.h:156
uint32_t process_response
How to process a command's response.
Definition nrf_semmc.h:157
Configuration for initializing an eMMC driver instance.
Definition nrf_semmc.h:155
nrf_semmc_event_type_t type
Event type.
Definition nrf_semmc.h:131
nrf_semmc_event_xfer_done_t xfer_done
Data for NRF_SQSPI_EVT_XFER_DONE event.
Definition nrf_semmc.h:134
Definition nrf_semmc.h:130
void * p_reg
Pointer to a structure with sEMMC virtual register interface.
Definition nrf_semmc.h:199
uint8_t drv_inst_idx
Index of the driver instance. For internal use only.
Definition nrf_semmc.h:201
sEMMC driver instance structure.
Definition nrf_semmc.h:198
uint32_t num_blocks
Number of blocks to transfer.
Definition nrf_semmc.h:184
uint32_t block_size
Size of each block in bytes.
Definition nrf_semmc.h:183
void * buffer
MCU bus address - pointer to data buffer for transfer.
Definition nrf_semmc.h:182
Descriptor for data transfer operations.
Definition nrf_semmc.h:181