Loading...
Searching...
No Matches
flashpage.h File Reference

Low-level flash page peripheral driver interface. More...

Detailed Description

#include <stddef.h>
#include <stdint.h>
#include "cpu_conf.h"
#include "periph_cpu.h"
+ Include dependency graph for flashpage.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CPU_FLASH_BASE   (0)
 Per default, we expect the internal flash to start at address 0.
 
#define FLASHPAGE_WRITE_BLOCK_SIZE
 For raw writings to the flash, this constant must define the minimum write length allowed by the MCU.
 
#define FLASHPAGE_WRITE_BLOCK_ALIGNMENT
 The buffers to be written to the flash MUST be aligned, as well as the address on which the buffer is written to the flash.
 
#define FLASHPAGE_ERASE_STATE   (0xFFU)
 State of an erased byte in memory.
 
#define PERIPH_FLASHPAGE_CUSTOM_PAGESIZES
 Defined to signal that the peripheral has non-uniform flash page sizes.
 
#define PERIPH_FLASHPAGE_NEEDS_FLASHPAGE_ADDR
 If non-uniform flash page sizes are required, defined to signal that the peripheral does not implement a custom flashpage_addr function and instead relies on the generic helper function that relies on flashpage_size.
 
#define PERIPH_FLASHPAGE_NEEDS_FLASHPAGE_PAGE
 If non-uniform flash page sizes are required, defined to signal that the peripheral does not implement a custom flashpage_page function and instead relies on the generic helper function that relies on flashpage_size.
 
#define FLASH_WRITABLE_INIT(name, size)
 Define an array in flash memory.
 

Enumerations

enum  { FLASHPAGE_OK = 0 , FLASHPAGE_NOMATCH = -1 }
 Return values used in this interface. More...
 

Functions

static size_t flashpage_size (unsigned page)
 Get the page size of the given page number.
 
static void * flashpage_addr (unsigned page)
 Translate the given page number into the page's starting address.
 
static unsigned flashpage_page (const void *addr)
 Translate the given address into the corresponding page number.
 
void flashpage_erase (unsigned page)
 Erase the given page.
 
void flashpage_write_page (unsigned page, const void *data)
 Write the given page with the given data.
 
void flashpage_write (void *target_addr, const void *data, size_t len)
 Write any number of data bytes to a given location in the flash memory.
 
void flashpage_read (unsigned page, void *data)
 Read the given page into the given memory location.
 
int flashpage_verify (unsigned page, const void *data)
 Verify the given page against the given data.
 
int flashpage_write_and_verify (unsigned page, const void *data)
 Write the given page and verify the results.