123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- extern "C" {
- typedef struct
- {
- uint32_t xip_offset;
- nrf_qspi_pins_t pins;
- nrf_qspi_prot_conf_t prot_if;
- nrf_qspi_phy_conf_t phy_if;
- uint8_t irq_priority;
- } nrfx_qspi_config_t;
- { \
- .xip_offset = NRFX_QSPI_CONFIG_XIP_OFFSET, \
- .pins = { \
- .sck_pin = NRFX_QSPI_PIN_SCK, \
- .csn_pin = NRFX_QSPI_PIN_CSN, \
- .io0_pin = NRFX_QSPI_PIN_IO0, \
- .io1_pin = NRFX_QSPI_PIN_IO1, \
- .io2_pin = NRFX_QSPI_PIN_IO2, \
- .io3_pin = NRFX_QSPI_PIN_IO3, \
- }, \
- .prot_if = { \
- .readoc = (nrf_qspi_readoc_t)NRFX_QSPI_CONFIG_READOC, \
- .writeoc = (nrf_qspi_writeoc_t)NRFX_QSPI_CONFIG_WRITEOC, \
- .addrmode = (nrf_qspi_addrmode_t)NRFX_QSPI_CONFIG_ADDRMODE, \
- .dpmconfig = false, \
- }, \
- .phy_if = { \
- .sck_delay = (uint8_t)NRFX_QSPI_CONFIG_SCK_DELAY, \
- .dpmen = false, \
- .spi_mode = (nrf_qspi_spi_mode_t)NRFX_QSPI_CONFIG_MODE, \
- .sck_freq = (nrf_qspi_frequency_t)NRFX_QSPI_CONFIG_FREQUENCY, \
- }, \
- .irq_priority = (uint8_t)NRFX_QSPI_CONFIG_IRQ_PRIORITY, \
- }
- { \
- .opcode = (opc), \
- .length = (len), \
- .io2_level = false, \
- .io3_level = false, \
- .wipwait = false, \
- .wren = false \
- }
- typedef enum
- {
- NRFX_QSPI_EVENT_DONE,
- } nrfx_qspi_evt_t;
- typedef void (*nrfx_qspi_handler_t)(nrfx_qspi_evt_t event, void * p_context);
- nrfx_err_t nrfx_qspi_init(nrfx_qspi_config_t const * p_config,
- nrfx_qspi_handler_t handler,
- void * p_context);
- void nrfx_qspi_uninit(void);
- nrfx_err_t nrfx_qspi_read(void * p_rx_buffer,
- size_t rx_buffer_length,
- uint32_t src_address);
- nrfx_err_t nrfx_qspi_write(void const * p_tx_buffer,
- size_t tx_buffer_length,
- uint32_t dst_address);
- nrfx_err_t nrfx_qspi_erase(nrf_qspi_erase_len_t length,
- uint32_t start_address);
- nrfx_err_t nrfx_qspi_chip_erase(void);
- nrfx_err_t nrfx_qspi_mem_busy_check(void);
- nrfx_err_t nrfx_qspi_cinstr_xfer(nrf_qspi_cinstr_conf_t const * p_config,
- void const * p_tx_buffer,
- void * p_rx_buffer);
- nrfx_err_t nrfx_qspi_cinstr_quick_send(uint8_t opcode,
- nrf_qspi_cinstr_len_t length,
- void const * p_tx_buffer);
- nrfx_err_t nrfx_qspi_lfm_start(nrf_qspi_cinstr_conf_t const * p_config);
- nrfx_err_t nrfx_qspi_lfm_xfer(void const * p_tx_buffer,
- void * p_rx_buffer,
- size_t transfer_length,
- bool finalize);
- void nrfx_qspi_irq_handler(void);
- }
|