Loading...
Searching...
No Matches
flash.h File Reference
#include "pico.h"

Go to the source code of this file.

Macros

#define PARAM_ASSERTIONS_ENABLED_HARDWARE_FLASH   0
#define FLASH_PAGE_SIZE   (1u << 8)
#define FLASH_SECTOR_SIZE   (1u << 12)
#define FLASH_BLOCK_SIZE   (1u << 16)
#define FLASH_UNIQUE_ID_SIZE_BYTES   8
#define PICO_ALWAYS_INCLUDE_FLASH_ID_FUNCTIONS   0

Typedefs

typedef void(* qmi_setup_function_t) (void)

Enumerations

enum  flash_devinfo_size_t {
  FLASH_DEVINFO_SIZE_NONE = 0x0 , FLASH_DEVINFO_SIZE_8K = 0x1 , FLASH_DEVINFO_SIZE_16K = 0x2 , FLASH_DEVINFO_SIZE_32K = 0x3 ,
  FLASH_DEVINFO_SIZE_64K = 0x4 , FLASH_DEVINFO_SIZE_128K = 0x5 , FLASH_DEVINFO_SIZE_256K = 0x6 , FLASH_DEVINFO_SIZE_512K = 0x7 ,
  FLASH_DEVINFO_SIZE_1M = 0x8 , FLASH_DEVINFO_SIZE_2M = 0x9 , FLASH_DEVINFO_SIZE_4M = 0xa , FLASH_DEVINFO_SIZE_8M = 0xb ,
  FLASH_DEVINFO_SIZE_16M = 0xc , FLASH_DEVINFO_SIZE_MAX = 0xc
}

Functions

void flash_start_xip (void)
 Initialise QSPI interface and external QSPI devices for execute-in-place.
void flash_range_erase (uint32_t flash_offs, size_t count)
 Erase areas of flash.
void flash_range_program (uint32_t flash_offs, const uint8_t *data, size_t count)
 Program flash.
void flash_get_unique_id (uint8_t *id_out)
 Get flash unique 64 bit identifier.
void flash_do_cmd_cs (const uint8_t *txbuf, uint8_t *rxbuf, size_t count, uint cs)
 Execute bidirectional QSPI command.
static void flash_do_cmd (const uint8_t *txbuf, uint8_t *rxbuf, size_t count)
 Execute bidirectional flash command on chip select 0.
void flash_flush_cache (void)
bool flash_set_qmi_cs1_setup_function (qmi_setup_function_t function)
 Set the function to be called to setup the QMI CS1 configuration.
static uint32_t flash_devinfo_size_to_bytes (flash_devinfo_size_t size)
 Convert a flash/PSRAM size enum to an integer size in bytes.
static flash_devinfo_size_t flash_devinfo_bytes_to_size (uint32_t bytes)
 Convert an integer flash/PSRAM size in bytes to a size enum, as stored in OTP and used by the ROM.
flash_devinfo_size_t flash_devinfo_get_cs_size (uint cs)
 Get the size of the QSPI device attached to chip select cs, according to FLASH_DEVINFO.
void flash_devinfo_set_cs_size (uint cs, flash_devinfo_size_t size)
 Update the size of the QSPI device attached to chip select cs in the runtime copy of FLASH_DEVINFO.
bool flash_devinfo_get_d8h_erase_supported (void)
 Check whether all attached devices support D8h block erase with 64k size, according to FLASH_DEVINFO.
void flash_devinfo_set_d8h_erase_supported (bool supported)
 Specify whether all attached devices support D8h block erase with 64k size, in the runtime copy of FLASH_DEVINFO.
uint flash_devinfo_get_cs_gpio (uint cs)
 Check the GPIO allocated for each chip select, according to FLASH_DEVINFO.
void flash_devinfo_set_cs_gpio (uint cs, uint gpio)
 Update the GPIO allocated for each chip select in the runtime copy of FLASH_DEVINFO.