20 #include "platform/platform.h" 22 #if DEVICE_QSPI || defined(DOXYGEN_ONLY) 24 #include "hal/qspi_api.h" 25 #include "platform/PlatformMutex.h" 26 #include "platform/SingletonPtr.h" 27 #include "platform/NonCopyable.h" 29 #define ONE_MHZ 1000000 92 QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel = NC,
int mode = 0);
157 qspi_status_t read(
int instruction,
int alt,
int address,
char *rx_buffer,
size_t *rx_length);
170 qspi_status_t write(
int instruction,
int alt,
int address,
const char *tx_buffer,
size_t *tx_length);
184 qspi_status_t command_transfer(
int instruction,
int address,
const char *tx_buffer,
size_t tx_length,
const char *rx_buffer,
size_t rx_length);
186 #if !defined(DOXYGEN_ONLY) 190 virtual void lock(
void);
194 virtual void unlock(
void);
208 unsigned int _num_dummy_cycles;
212 PinName _qspi_io0, _qspi_io1, _qspi_io2, _qspi_io3, _qspi_clk, _qspi_cs;
224 inline void _build_qspi_command(
int instruction,
int address,
int alt);
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.
struct qspi_s qspi_t
QSPI HAL object.
qspi_status_t write(int address, const char *tx_buffer, size_t *tx_length)
Write to QSPI peripheral using custom write instruction.
Prevents generation of copy constructor and copy assignment operator in derived classes.
enum qspi_alt_size qspi_alt_size_t
Alternative size in bits.
enum qspi_address_size qspi_address_size_t
Address size in bits.
enum qspi_bus_width qspi_bus_width_t
QSPI Bus width.
qspi_status_t command_transfer(int 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...
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.
A QSPI Driver, used for communicating with QSPI slave devices.
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.
enum qspi_status qspi_status_t
QSPI return status.