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 31 #define QSPI_NO_INST (-1) 104 QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel = NC,
int mode = 0);
185 qspi_status_t read(qspi_inst_t instruction,
int alt,
int address,
char *rx_buffer,
size_t *rx_length);
198 qspi_status_t write(qspi_inst_t instruction,
int alt,
int address,
const char *tx_buffer,
size_t *tx_length);
212 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);
214 #if !defined(DOXYGEN_ONLY) 218 virtual void lock(
void);
222 virtual void unlock(
void);
236 unsigned int _num_dummy_cycles;
240 PinName _qspi_io0, _qspi_io1, _qspi_io2, _qspi_io3, _qspi_clk, _qspi_cs;
242 bool (
QSPI::* _init_func)(void);
250 bool _initialize_direct();
255 inline void _build_qspi_command(qspi_inst_t 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.
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...
enum qspi_address_size qspi_address_size_t
Address size in bits.
int qspi_inst_t
Type representing a QSPI instruction.
uint8_t qspi_alt_size_t
Alternative size in bits.
enum qspi_bus_width qspi_bus_width_t
QSPI Bus width.
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.
qspi_status_t qspi_free(qspi_t *obj)
Deinitilize QSPI peripheral.