20#ifndef MBED_OSPI_API_H
21#define MBED_OSPI_API_H
40typedef struct ospi_s ospi_t;
73typedef enum ospi_bus_width {
78 OSPI_CFG_BUS_OCTA_DTR,
83typedef enum ospi_inst_size {
85 OSPI_CFG_INST_SIZE_16,
90typedef enum ospi_address_size {
92 OSPI_CFG_ADDR_SIZE_16,
93 OSPI_CFG_ADDR_SIZE_24,
94 OSPI_CFG_ADDR_SIZE_32,
99typedef uint8_t ospi_alt_size_t;
103#define OSPI_CFG_ALT_SIZE_8 8u
104#define OSPI_CFG_ALT_SIZE_16 16u
105#define OSPI_CFG_ALT_SIZE_24 24u
106#define OSPI_CFG_ALT_SIZE_32 32u
112typedef struct ospi_command {
114 ospi_bus_width_t bus_width;
115 ospi_inst_size_t size;
120 ospi_bus_width_t bus_width;
121 ospi_address_size_t size;
126 ospi_bus_width_t bus_width;
127 ospi_alt_size_t size;
133 ospi_bus_width_t bus_width;
139typedef enum ospi_status {
140 OSPI_STATUS_ERROR = -1,
141 OSPI_STATUS_INVALID_PARAMETER = -2,
167ospi_status_t ospi_init(ospi_t *obj, PinName io0, PinName io1, PinName io2, PinName io3, PinName io4, PinName io5, PinName io6, PinName io7,
168 PinName sclk, PinName ssel, PinName dqs, uint32_t hz, uint8_t mode);
182ospi_status_t ospi_init_direct(ospi_t *obj,
const ospi_pinmap_t *pinmap, uint32_t hz, uint8_t mode);
193ospi_status_t ospi_free(ospi_t *obj);
205ospi_status_t ospi_frequency(ospi_t *obj,
int hz);
217ospi_status_t ospi_write(ospi_t *obj,
const ospi_command_t *command,
const void *data,
size_t *length);
231ospi_status_t ospi_command_transfer(ospi_t *obj,
const ospi_command_t *command,
const void *tx_data,
size_t tx_size,
void *rx_data,
size_t rx_size);
243ospi_status_t ospi_read(ospi_t *obj,
const ospi_command_t *command,
void *data,
size_t *length);
252const PinMap *ospi_master_sclk_pinmap(
void);
261const PinMap *ospi_master_ssel_pinmap(
void);
270const PinMap *ospi_master_dqs_pinmap(
void);
279const PinMap *ospi_master_data0_pinmap(
void);
288const PinMap *ospi_master_data1_pinmap(
void);
297const PinMap *ospi_master_data2_pinmap(
void);
306const PinMap *ospi_master_data3_pinmap(
void);
315const PinMap *ospi_master_data4_pinmap(
void);
324const PinMap *ospi_master_data5_pinmap(
void);
333const PinMap *ospi_master_data6_pinmap(
void);
342const PinMap *ospi_master_data7_pinmap(
void);