Modules | |
Tests | |
QSPI tests of the HAL. | |
Data Structures | |
struct | qspi_command |
QSPI command. More... | |
Typedefs | |
typedef struct qspi_s | qspi_t |
QSPI HAL object. More... | |
typedef enum qspi_bus_width | qspi_bus_width_t |
QSPI Bus width. More... | |
typedef enum qspi_address_size | qspi_address_size_t |
Address size in bits. More... | |
typedef enum qspi_alt_size | qspi_alt_size_t |
Alternative size in bits. More... | |
typedef struct qspi_command | qspi_command_t |
QSPI command. More... | |
typedef enum qspi_status | qspi_status_t |
QSPI return status. More... | |
Enumerations |
Functions | |
qspi_status_t | qspi_init (qspi_t *obj, PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel, uint32_t hz, uint8_t mode) |
Initialize QSPI peripheral. More... | |
qspi_status_t | qspi_free (qspi_t *obj) |
Deinitilize QSPI peripheral. More... | |
qspi_status_t | qspi_frequency (qspi_t *obj, int hz) |
Set the QSPI baud rate. More... | |
qspi_status_t | qspi_write (qspi_t *obj, const qspi_command_t *command, const void *data, size_t *length) |
Send a command and block of data. More... | |
qspi_status_t | qspi_command_transfer (qspi_t *obj, const qspi_command_t *command, const void *tx_data, size_t tx_size, void *rx_data, size_t rx_size) |
Send a command (and optionally data) and get the response. More... | |
qspi_status_t | qspi_read (qspi_t *obj, const qspi_command_t *command, void *data, size_t *length) |
Receive a command and block of data. More... | |
const PinMap * | qspi_master_sclk_pinmap (void) |
Get the pins that support QSPI SCLK. More... | |
const PinMap * | qspi_master_ssel_pinmap (void) |
Get the pins that support QSPI SSEL. More... | |
const PinMap * | qspi_master_data0_pinmap (void) |
Get the pins that support QSPI DATA0. More... | |
const PinMap * | qspi_master_data1_pinmap (void) |
Get the pins that support QSPI DATA1. More... | |
const PinMap * | qspi_master_data2_pinmap (void) |
Get the pins that support QSPI DATA2. More... | |
const PinMap * | qspi_master_data3_pinmap (void) |
Get the pins that support QSPI DATA3. More... | |
typedef enum qspi_address_size qspi_address_size_t |
Address size in bits.
typedef enum qspi_alt_size qspi_alt_size_t |
Alternative size in bits.
typedef enum qspi_bus_width qspi_bus_width_t |
QSPI Bus width.
Some parts of commands provide variable bus width
typedef struct qspi_command qspi_command_t |
QSPI command.
Defines a frame format. It consists of instruction, address, alternative, dummy count and data
typedef enum qspi_status qspi_status_t |
QSPI return status.
typedef struct qspi_s qspi_t |
QSPI HAL object.
Definition at line 40 of file qspi_api.h.
enum qspi_address_size |
Address size in bits.
Definition at line 54 of file qspi_api.h.
enum qspi_alt_size |
Alternative size in bits.
Definition at line 63 of file qspi_api.h.
enum qspi_bus_width |
QSPI Bus width.
Some parts of commands provide variable bus width
Definition at line 46 of file qspi_api.h.
enum qspi_status |
QSPI return status.
Enumerator | |
---|---|
QSPI_STATUS_ERROR |
Generic error > |
QSPI_STATUS_INVALID_PARAMETER |
The parameter is invalid > |
QSPI_STATUS_OK |
Function executed sucessfully > |
Definition at line 100 of file qspi_api.h.
qspi_status_t qspi_command_transfer | ( | qspi_t * | obj, |
const qspi_command_t * | command, | ||
const void * | tx_data, | ||
size_t | tx_size, | ||
void * | rx_data, | ||
size_t | rx_size | ||
) |
Send a command (and optionally data) and get the response.
Can be used to send/receive device specific commands
obj | QSPI object |
command | QSPI command |
tx_data | TX buffer |
tx_size | TX buffer length in bytes |
rx_data | RX buffer |
rx_size | RX buffer length in bytes |
qspi_status_t qspi_free | ( | qspi_t * | obj | ) |
Deinitilize QSPI peripheral.
It should release pins that are associated with the QSPI object, and disable clocks for QSPI peripheral module that was associated with the object
obj | QSPI object |
qspi_status_t qspi_frequency | ( | qspi_t * | obj, |
int | hz | ||
) |
Set the QSPI baud rate.
Actual frequency may differ from the desired frequency due to available dividers and the bus clock Configures the QSPI peripheral's baud rate
obj | The SPI object to configure |
hz | The baud rate in Hz |
qspi_status_t qspi_init | ( | qspi_t * | obj, |
PinName | io0, | ||
PinName | io1, | ||
PinName | io2, | ||
PinName | io3, | ||
PinName | sclk, | ||
PinName | ssel, | ||
uint32_t | hz, | ||
uint8_t | mode | ||
) |
Initialize QSPI peripheral.
It should initialize QSPI pins (io0-io3, sclk and ssel), set frequency, clock polarity and phase mode. The clock for the peripheral should be enabled
obj | QSPI object |
io0 | Data pin 0 |
io1 | Data pin 1 |
io2 | Data pin 2 |
io3 | Data pin 3 |
sclk | The clock pin |
ssel | The chip select pin |
hz | The bus frequency |
mode | Clock polarity and phase mode (0 - 3) |
const PinMap* qspi_master_data0_pinmap | ( | void | ) |
const PinMap* qspi_master_data1_pinmap | ( | void | ) |
const PinMap* qspi_master_data2_pinmap | ( | void | ) |
const PinMap* qspi_master_data3_pinmap | ( | void | ) |
const PinMap* qspi_master_sclk_pinmap | ( | void | ) |
const PinMap* qspi_master_ssel_pinmap | ( | void | ) |
qspi_status_t qspi_read | ( | qspi_t * | obj, |
const qspi_command_t * | command, | ||
void * | data, | ||
size_t * | length | ||
) |
Receive a command and block of data.
obj | QSPI object | |
command | QSPI command | |
data | RX buffer | |
[in,out] | length | in - RX buffer length in bytes, out - number of bytes read |
qspi_status_t qspi_write | ( | qspi_t * | obj, |
const qspi_command_t * | command, | ||
const void * | data, | ||
size_t * | length | ||
) |
Send a command and block of data.
obj | QSPI object | |
command | QSPI command | |
data | TX buffer | |
[in,out] | length | in - TX buffer length in bytes, out - number of bytes written |