QSPI

QSPI API Reference

Header File

Functions

bk_err_t bk_qspi_driver_init(void)

Init the QSPI driver.

This API init the resoure common:

  • Init QSPI driver control memory

Attention

1. This API should be called before any other QSPI APIs.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_driver_deinit(void)

Deinit the QSPI driver.

This API free all resource related to QSPI and disable QSPI.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_init(const qspi_config_t *config)

Init the QSPI.

This API init the QSPI:

  • Power up the QSPI

  • Configure the QSPI clock

  • Map the QSPI to dedicated GPIO port

  • Enabel QSPI interrupt

参数

config – QSPI parameter settings

返回

  • BK_OK: succeed

  • BK_ERR_QSPI_NOT_INIT: QSPI driver not init

  • BK_ERR_NULL_PARAM: QSPI config parameter is NULL

  • others: other errors.

bk_err_t bk_qspi_deinit(void)

Deinit the QSPI.

This API deinit the QSPI:

  • Disable the QSPI interrupt

  • Power down the QSPI

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_command(const qspi_cmd_t *cmd)

Init the QSPI command.

参数

cmd – QSPI device command

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_write(const void *data, uint32_t size)

QSPI indirect mode write.

参数
  • base_addr – QSPI write address

  • data – QSPI write data

  • size – the size of QSPI write data

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_read(void *data, uint32_t size)

QSPI indirect mode read.

参数
  • base_addr – QSPI read address

  • data – QSPI read data

  • size – the size of QSPI read data

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_register_tx_isr(qspi_isr_t isr, void *param)

Register the TX interrupt service routine for QSPI.

参数
  • isr – QSPI TX callback

  • param – QSPI TX callback parameter

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_register_rx_isr(qspi_isr_t isr, void *param)

Register the RX interrupt service routine for QSPI.

参数
  • isr – QSPI RX callback

  • param – QSPI RX callback parameter

返回

  • BK_OK: succeed

  • others: other errors.

QSPI PSRAM API Reference

Header File

Functions

bk_err_t bk_qspi_psram_init(void)

Init the QSPI psram.

返回

  • BK_OK: succeed

  • BK_ERR_QSPI_NOT_INIT: QSPI driver not init

  • others: other errors.

bk_err_t bk_qspi_psram_deinit(void)

Deinit the QSPI psram.

返回

  • BK_OK: succeed

  • BK_ERR_QSPI_NOT_INIT: QSPI driver not init

  • others: other errors.

bk_err_t bk_qspi_psram_enter_quad_mode(void)

QSPI psram enter quad mode.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_psram_exit_quad_mode(void)

QSPI psram exit quad mode.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_psram_quad_write(void)

QSPI psram init quad write.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_psram_single_write(void)

QSPI psram init single write.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_psram_quad_read(void)

QSPI psram init quad read.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_psram_single_read(void)

QSPI psram init single read.

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_psram_write(uint32_t base_addr, const void *data, uint32_t size)

QSPI psram write data.

参数
  • base_addr – QSPI write address

  • data – QSPI write data

  • size – the size of QSPI write data

返回

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_qspi_psram_read(uint32_t base_addr, void *data, uint32_t size)

QSPI psram read data.

参数
  • base_addr – QSPI read address

  • data – QSPI read data

  • size – the size of QSPI read data

返回

  • BK_OK: succeed

  • others: other errors.

QSPI API Typedefs

Header File

Structures

struct qspi_driver_t
struct qspi_callback_t

Macros

BK_ERR_QSPI_NOT_INIT

QSPI driver not init

BK_ERR_QSPI_ID_NOT_INIT

QSPI id not init

Type Definitions

typedef void (*qspi_isr_t)(qspi_id_t id, void *param)

QSPI interrupt service routine.

Header File

Structures

struct qspi_config_t

Public Members

qspi_src_clk_t src_clk

QSPI source clock

uint32_t src_clk_div

QSPI source clock divide number

uint32_t clk_div

QSPI controller clock divide number

struct qspi_cmd_t

Public Members

qspi_wire_mode_t wire_mode

wire mode

qspi_work_mode work_mode

work mode

qspi_op_t op

QSPI operation

uint32_t cmd

QSPI command

uint32_t addr

QSPI address

uint32_t dummy_cycle

QSPI dummy cycle

uint32_t data_len

QSPI data length

qspi_device_t device

QSPI slave device

Type Definitions

typedef uint8_t qspi_unit_t

QSPI uint id

typedef uint8_t qspi_id_t

QSPI id

Enumerations

enum qspi_op_t

Values:

enumerator QSPI_READ

QSPI read operation

enumerator QSPI_WRITE

QSPI write operation

enum qspi_src_clk_t

Values:

enumerator QSPI_SCLK_DCO

QSPI source clock dco

enumerator QSPI_SCLK_XTAL_26M

QSPI source clock xtal 26M

enumerator QSPI_SCLK_80M

QSPI source clock 80M

enumerator QSPI_SCLK_120M

QSPI source clock 120M

enumerator QSPI_SCLK_320M

QSPI source clock 320M

enumerator QSPI_SCLK_480M

QSPI source clock 480M

enum qspi_work_mode

Values:

enumerator MEMORY_MAPPED_MODE
enumerator INDIRECT_MODE
enum qspi_wire_mode_t

Values:

enumerator QSPI_1WIRE

QSPI 1_wire mode, standard SPI

enumerator QSPI_2WIRE

QSPI 2_wire mode, DUAL SPI

enumerator QSPI_4WIRE

QSPI 4_wire mode, QUAD SPI

enum qspi_device_t

Values:

enumerator QSPI_PSRAM

QSPI PSRAM

enumerator QSPI_FLASH

QSPI FLASH

enumerator QSPI_OLED

QSPI OLED