Menu Toggle
v1.5.0
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
37
// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_FLASH, Enable/disable assertions in the flash module, type=bool, default=0, group=hardware_flash
38
#ifndef PARAM_ASSERTIONS_ENABLED_FLASH
39
#define PARAM_ASSERTIONS_ENABLED_FLASH 0
40
#endif
41
42
#define FLASH_PAGE_SIZE (1u << 8)
43
#define FLASH_SECTOR_SIZE (1u << 12)
44
#define FLASH_BLOCK_SIZE (1u << 16)
45
46
#define FLASH_UNIQUE_ID_SIZE_BYTES 8
47
48
// PICO_CONFIG: PICO_FLASH_SIZE_BYTES, size of primary flash in bytes, type=int, group=hardware_flash
49
50
#ifdef __cplusplus
51
extern
"C"
{
52
#endif
53
60
void
flash_range_erase
(uint32_t flash_offs,
size_t
count);
61
70
void
flash_range_program
(uint32_t flash_offs,
const
uint8_t *data,
size_t
count);
71
82
void
flash_get_unique_id
(uint8_t *id_out);
83
107
void
flash_do_cmd
(
const
uint8_t *txbuf, uint8_t *rxbuf,
size_t
count);
108
109
110
#ifdef __cplusplus
111
}
112
#endif
113
114
#endif
flash_do_cmd
void flash_do_cmd(const uint8_t *txbuf, uint8_t *rxbuf, size_t count)
Execute bidirectional flash command.
Definition:
flash.c:124
flash_range_program
void flash_range_program(uint32_t flash_offs, const uint8_t *data, size_t count)
Program flash.
Definition:
flash.c:86
pico.h
flash_get_unique_id
void flash_get_unique_id(uint8_t *id_out)
Get flash unique 64 bit identifier.
Definition:
flash.c:164
flash_range_erase
void flash_range_erase(uint32_t flash_offs, size_t count)
Erase areas of flash.
Definition:
flash.c:63