20#include "platform/platform.h"
22#if DEVICE_QSPI || defined(DOXYGEN_ONLY)
24#include "hal/qspi_api.h"
25#include "rtos/Mutex.h"
26#include "platform/SingletonPtr.h"
27#include "platform/NonCopyable.h"
29#define ONE_MHZ 1000000
31#define QSPI_NO_INST (-1)
104 QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel = NC,
int mode = 0);
209#if !defined(DOXYGEN_ONLY)
213 virtual void lock(
void);
217 virtual void unlock(
void);
229 unsigned int _num_dummy_cycles;
233 PinName _qspi_io0, _qspi_io1, _qspi_io2, _qspi_io3, _qspi_clk, _qspi_cs;
235 bool (
QSPI::* _init_func)(void);
239 bool _initialize_direct();
244 inline void _build_qspi_command(
qspi_inst_t instruction,
int address,
int alt);
Prevents generation of copy constructor and copy assignment operator in derived classes.
A QSPI Driver, used for communicating with QSPI slave devices.
qspi_status_t write(qspi_inst_t instruction, int alt, int address, const char *tx_buffer, size_t *tx_length)
Write to QSPI peripheral using custom write instruction, alt values.
QSPI(const qspi_pinmap_t &pinmap, int mode=0)
Create a QSPI master connected to the specified pins.
qspi_status_t read(int address, char *rx_buffer, size_t *rx_length)
Read from QSPI peripheral with the preset read_instruction and alt_value.
qspi_status_t configure_format(qspi_bus_width_t inst_width, qspi_bus_width_t address_width, qspi_address_size_t address_size, qspi_bus_width_t alt_width, qspi_alt_size_t alt_size, qspi_bus_width_t data_width, int dummy_cycles)
Configure the data transmission format.
qspi_status_t read(qspi_inst_t instruction, int alt, int address, char *rx_buffer, size_t *rx_length)
Read from QSPI peripheral using custom read instruction, alt values.
qspi_status_t write(int address, const char *tx_buffer, size_t *tx_length)
Write to QSPI peripheral using custom write instruction.
QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel=NC, int mode=0)
Create a QSPI master connected to the specified pins.
qspi_status_t set_frequency(int hz=1000000)
Set the qspi bus clock frequency.
qspi_status_t command_transfer(qspi_inst_t instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length)
Perform a transaction to write to an address(a control register) and get the status results.
int qspi_inst_t
Type representing a QSPI instruction.
uint8_t qspi_alt_size_t
Alternative size in bits.
struct qspi_s qspi_t
QSPI HAL object.
enum qspi_status qspi_status_t
QSPI return status.
enum qspi_bus_width qspi_bus_width_t
QSPI Bus width.
enum qspi_address_size qspi_address_size_t
Address size in bits.
Utility class for creating and using a singleton.