Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
QSPI HAL
[Hal]
Data Structures | |
struct | qspi_command |
QSPI command. More... | |
Typedefs | |
typedef struct qspi_s | qspi_t |
QSPI HAL object. | |
typedef enum qspi_bus_width | qspi_bus_width_t |
QSPI Bus width. | |
typedef enum qspi_address_size | qspi_address_size_t |
Address size in bits. | |
typedef uint8_t | qspi_alt_size_t |
Alternative size in bits. | |
typedef struct qspi_command | qspi_command_t |
QSPI command. | |
typedef enum qspi_status | qspi_status_t |
QSPI return status. | |
Enumerations | |
enum | qspi_bus_width |
QSPI Bus width. More... | |
enum | qspi_address_size |
Address size in bits. More... | |
enum | qspi_status { QSPI_STATUS_ERROR = -1, QSPI_STATUS_INVALID_PARAMETER = -2, QSPI_STATUS_OK = 0 } |
QSPI return status. More... | |
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. | |
qspi_status_t | qspi_init_direct (qspi_t *obj, const qspi_pinmap_t *pinmap, uint32_t hz, uint8_t mode) |
Initialize QSPI peripheral. | |
qspi_status_t | qspi_free (qspi_t *obj) |
Deinitilize QSPI peripheral. | |
qspi_status_t | qspi_frequency (qspi_t *obj, int hz) |
Set the QSPI baud rate. | |
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. | |
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. | |
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. | |
const PinMap * | qspi_master_sclk_pinmap (void) |
Get the pins that support QSPI SCLK. | |
const PinMap * | qspi_master_ssel_pinmap (void) |
Get the pins that support QSPI SSEL. | |
const PinMap * | qspi_master_data0_pinmap (void) |
Get the pins that support QSPI DATA0. | |
const PinMap * | qspi_master_data1_pinmap (void) |
Get the pins that support QSPI DATA1. | |
const PinMap * | qspi_master_data2_pinmap (void) |
Get the pins that support QSPI DATA2. | |
const PinMap * | qspi_master_data3_pinmap (void) |
Get the pins that support QSPI DATA3. |
Typedef Documentation
typedef enum qspi_address_size qspi_address_size_t |
Address size in bits.
typedef uint8_t qspi_alt_size_t |
Alternative size in bits.
Definition at line 79 of file qspi_api.h.
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.
Enumeration Type Documentation
enum qspi_address_size |
Address size in bits.
Definition at line 70 of file qspi_api.h.
enum qspi_bus_width |
QSPI Bus width.
Some parts of commands provide variable bus width
Definition at line 62 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 118 of file qspi_api.h.
Function Documentation
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
- Parameters:
-
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
- Returns:
- QSPI_STATUS_OK if the data has been succesfully sent QSPI_STATUS_INVALID_PARAMETER if invalid parameter found QSPI_STATUS_ERROR otherwise
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
- Parameters:
-
obj QSPI object
- Returns:
- QSPI_STATUS_OK if deinitialisation successfully executed QSPI_STATUS_INVALID_PARAMETER if invalid parameter found QSPI_STATUS_ERROR otherwise
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
- Parameters:
-
obj The SPI object to configure hz The baud rate in Hz
- Returns:
- QSPI_STATUS_OK if frequency was set QSPI_STATUS_INVALID_PARAMETER if invalid parameter found QSPI_STATUS_ERROR otherwise
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
- Parameters:
-
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)
- Returns:
- QSPI_STATUS_OK if initialisation successfully executed QSPI_STATUS_INVALID_PARAMETER if invalid parameter found QSPI_STATUS_ERROR otherwise
qspi_status_t qspi_init_direct | ( | qspi_t * | obj, |
const qspi_pinmap_t * | pinmap, | ||
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
- Parameters:
-
obj QSPI object pinmap pointer to structure which holds static pinmap hz The bus frequency mode Clock polarity and phase mode (0 - 3)
- Returns:
- QSPI_STATUS_OK if initialisation successfully executed QSPI_STATUS_INVALID_PARAMETER if invalid parameter found QSPI_STATUS_ERROR otherwise
Definition at line 90 of file static_pinmap.cpp.
const PinMap* qspi_master_data0_pinmap | ( | void | ) |
Get the pins that support QSPI DATA0.
Return a PinMap array of pins that support QSPI DATA0 in master mode. The array is terminated with {NC, NC, 0}.
- Returns:
- PinMap array
const PinMap* qspi_master_data1_pinmap | ( | void | ) |
Get the pins that support QSPI DATA1.
Return a PinMap array of pins that support QSPI DATA1 in master mode. The array is terminated with {NC, NC, 0}.
- Returns:
- PinMap array
const PinMap* qspi_master_data2_pinmap | ( | void | ) |
Get the pins that support QSPI DATA2.
Return a PinMap array of pins that support QSPI DATA2 in master mode. The array is terminated with {NC, NC, 0}.
- Returns:
- PinMap array
const PinMap* qspi_master_data3_pinmap | ( | void | ) |
Get the pins that support QSPI DATA3.
Return a PinMap array of pins that support QSPI DATA3 in master mode. The array is terminated with {NC, NC, 0}.
- Returns:
- PinMap array
const PinMap* qspi_master_sclk_pinmap | ( | void | ) |
Get the pins that support QSPI SCLK.
Return a PinMap array of pins that support QSPI SCLK in master mode. The array is terminated with {NC, NC, 0}.
- Returns:
- PinMap array
const PinMap* qspi_master_ssel_pinmap | ( | void | ) |
Get the pins that support QSPI SSEL.
Return a PinMap array of pins that support QSPI SSEL in master mode. The array is terminated with {NC, NC, 0}.
- Returns:
- PinMap array
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.
- Parameters:
-
obj QSPI object command QSPI command data RX buffer [in,out] length in - RX buffer length in bytes, out - number of bytes read
- Returns:
- QSPI_STATUS_OK if data has been succesfully received QSPI_STATUS_INVALID_PARAMETER if invalid parameter found QSPI_STATUS_ERROR otherwise
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.
- Parameters:
-
obj QSPI object command QSPI command data TX buffer [in,out] length in - TX buffer length in bytes, out - number of bytes written
- Returns:
- QSPI_STATUS_OK if the data has been succesfully sent QSPI_STATUS_INVALID_PARAMETER if invalid parameter found QSPI_STATUS_ERROR otherwise
Generated on Tue Jul 12 2022 13:55:25 by
