flash.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _HARDWARE_FLASH_H
8#define _HARDWARE_FLASH_H
9
10#include "pico.h"
11
36// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_FLASH, Enable/disable assertions in the flash module, type=bool, default=0, group=hardware_flash
37#ifndef PARAM_ASSERTIONS_ENABLED_FLASH
38#define PARAM_ASSERTIONS_ENABLED_FLASH 0
39#endif
40
41#define FLASH_PAGE_SIZE (1u << 8)
42#define FLASH_SECTOR_SIZE (1u << 12)
43#define FLASH_BLOCK_SIZE (1u << 16)
44
45#define FLASH_UNIQUE_ID_SIZE_BYTES 8
46
47// PICO_CONFIG: PICO_FLASH_SIZE_BYTES, size of primary flash in bytes, type=int, group=hardware_flash
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
59void flash_range_erase(uint32_t flash_offs, size_t count);
60
69void flash_range_program(uint32_t flash_offs, const uint8_t *data, size_t count);
70
81void flash_get_unique_id(uint8_t *id_out);
82
106void flash_do_cmd(const uint8_t *txbuf, uint8_t *rxbuf, size_t count);
107
108
109#ifdef __cplusplus
110}
111#endif
112
113#endif
void flash_range_program(uint32_t flash_offs, const uint8_t *data, size_t count)
Program flash.
Definition: flash.c:86
void flash_range_erase(uint32_t flash_offs, size_t count)
Erase areas of flash.
Definition: flash.c:63
void flash_get_unique_id(uint8_t *id_out)
Get flash unique 64 bit identifier.
Definition: flash.c:164
void flash_do_cmd(const uint8_t *txbuf, uint8_t *rxbuf, size_t count)
Execute bidirectional flash command.
Definition: flash.c:124