Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

QSPI 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

Address size in bits.

typedef uint8_t qspi_alt_size_t

Alternative size in bits.

Definition at line 79 of file qspi_api.h.

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

Address size in bits.

Definition at line 70 of file qspi_api.h.

QSPI Bus width.

Some parts of commands provide variable bus width

Definition at line 62 of file qspi_api.h.

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:
objQSPI object
commandQSPI command
tx_dataTX buffer
tx_sizeTX buffer length in bytes
rx_dataRX buffer
rx_sizeRX 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:
objQSPI 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:
objThe SPI object to configure
hzThe 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:
objQSPI object
io0Data pin 0
io1Data pin 1
io2Data pin 2
io3Data pin 3
sclkThe clock pin
sselThe chip select pin
hzThe bus frequency
modeClock 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:
objQSPI object
pinmappointer to structure which holds static pinmap
hzThe bus frequency
modeClock 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:
objQSPI object
commandQSPI command
dataRX buffer
[in,out]lengthin - 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:
objQSPI object
commandQSPI command
dataTX buffer
[in,out]lengthin - 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