Skip to content

daisy::QSPIHandle

Module: LIBDAISY / PERIPHERAL / SERIAL

More...

#include <qspi.h>

Public Classes

Name
struct Config

Public Types

Name
enum Result
enum Status

Public Functions

Name
Result Init(const Config & config)
const Config & GetConfig() const
Result DeInit()
Result WritePage(uint32_t address, uint32_t size, uint8_t * buffer)
Result Write(uint32_t address, uint32_t size, uint8_t * buffer)
Result Erase(uint32_t start_addr, uint32_t end_addr)
Result EraseSector(uint32_t address)
Status GetStatus()
void * GetData(uint32_t offset =0)
QSPIHandle()
QSPIHandle(const QSPIHandle & other) =default
QSPIHandle & operator=(const QSPIHandle & other) =default

Detailed Description

class daisy::QSPIHandle;

Driver for QSPI peripheral to interface with external flash memory.

Currently supported QSPI Devices:

IS25LP080D

Public Types Documentation

enum Result

Enumerator Value Description
OK 0
ERR

enum Status

Enumerator Value Description
GOOD 0
E_HAL_ERROR
E_SWITCHING_MODES
E_INVALID_MODE

Parameters:

  • GOOD - No errors have been reported.
  • E_HAL_ERROR - HAL code did not return HAL_OK.
  • E_SWITCHING_MODES - An error was encountered while switching QSPI peripheral mode.
  • E_INVALID_MODE - QSPI should not be written to while the program is executing from it.

Indicates the current status of the module. Warnings are indicated by a leading W. Errors are indicated by a leading E and cause an immediate exit.

Public Functions Documentation

function Init

Result Init(
    const Config & config
)

Parameters:

  • config should be populated with the mode, device and pin_config before calling this function.

Return: Result::OK or Result::ERR

Initializes QSPI peripheral, and Resets, and prepares memory for access.


function GetConfig

const Config & GetConfig() const

Returns the current config.


function DeInit

Result DeInit()

Return: Result::OK or Result::ERR

Deinitializes the peripheral This should be called before reinitializing QSPI in a different mode.


function WritePage

Result WritePage(
    uint32_t address,
    uint32_t size,
    uint8_t * buffer
)

Parameters:

  • address Address to write to
  • size Buffer size
  • buffer Buffer to write

Return: Result::OK or Result::ERR

Writes a single page to to the specified address on the QSPI chip. For IS25LP*, page size is 256 bytes.


function Write

Result Write(
    uint32_t address,
    uint32_t size,
    uint8_t * buffer
)

Parameters:

  • address Address to write to
  • size Buffer size
  • buffer Buffer to write

Return: Result::OK or Result::ERR

Writes data in buffer to to the QSPI. Starting at address to address+size


function Erase

Result Erase(
    uint32_t start_addr,
    uint32_t end_addr
)

Parameters:

  • start_addr Address to begin erasing from
  • end_addr Address to stop erasing at

Return: Result::OK or Result::ERR

Erases the area specified on the chip. Erasures will happen by 4K, 32K or 64K increments. Smallest erase possible is 4kB at a time. (on IS25LP*)


function EraseSector

Result EraseSector(
    uint32_t address
)

Parameters:

  • address Address of sector to erase

Return: Result::OK or Result::ERR

Erases a single sector of the chip.

TODO: Document the size of this function.


function GetStatus

Status GetStatus()

Return: Status

Returns the current class status. Useful for debugging.


function GetData

void * GetData(
    uint32_t offset =0
)

Parameters:

  • offset returns the pointer starting this many bytes into the memory

Returns a pointer to the actual memory used The memory at this address is read-only to write to it use the Write function.


function QSPIHandle

inline QSPIHandle()

function QSPIHandle

QSPIHandle(
    const QSPIHandle & other
) =default

function operator=

QSPIHandle & operator=(
    const QSPIHandle & other
) =default

---

Updated on 2024-01-03 at 19:41:01 +0000