20 #ifndef MBED_OSPI_API_H 21 #define MBED_OSPI_API_H 40 typedef struct ospi_s ospi_t;
73 typedef enum ospi_bus_width {
78 OSPI_CFG_BUS_OCTA_DTR,
83 typedef enum ospi_inst_size {
85 OSPI_CFG_INST_SIZE_16,
90 typedef enum ospi_address_size {
92 OSPI_CFG_ADDR_SIZE_16,
93 OSPI_CFG_ADDR_SIZE_24,
94 OSPI_CFG_ADDR_SIZE_32,
95 } ospi_address_size_t;
99 typedef 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 112 typedef 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;
139 typedef enum ospi_status {
140 OSPI_STATUS_ERROR = -1,
141 OSPI_STATUS_INVALID_PARAMETER = -2,
167 ospi_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);
182 ospi_status_t ospi_init_direct(ospi_t *obj,
const ospi_pinmap_t *pinmap, uint32_t hz, uint8_t mode);
193 ospi_status_t ospi_free(ospi_t *obj);
205 ospi_status_t ospi_frequency(ospi_t *obj,
int hz);
217 ospi_status_t ospi_write(ospi_t *obj,
const ospi_command_t *command,
const void *data,
size_t *length);
231 ospi_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);
243 ospi_status_t ospi_read(ospi_t *obj,
const ospi_command_t *command,
void *data,
size_t *length);
252 const PinMap *ospi_master_sclk_pinmap(
void);
261 const PinMap *ospi_master_ssel_pinmap(
void);
270 const PinMap *ospi_master_dqs_pinmap(
void);
279 const PinMap *ospi_master_data0_pinmap(
void);
288 const PinMap *ospi_master_data1_pinmap(
void);
297 const PinMap *ospi_master_data2_pinmap(
void);
306 const PinMap *ospi_master_data3_pinmap(
void);
315 const PinMap *ospi_master_data4_pinmap(
void);
324 const PinMap *ospi_master_data5_pinmap(
void);
333 const PinMap *ospi_master_data6_pinmap(
void);
342 const PinMap *ospi_master_data7_pinmap(
void);