diff options
author | Ingo Albrecht <prom@berlin.ccc.de> | 2010-07-19 12:00:58 +0200 |
---|---|---|
committer | Ingo Albrecht <prom@berlin.ccc.de> | 2010-07-20 14:41:21 +0200 |
commit | 58e8f9e5b000d9bda60fb9c9dcf7acf7ad16184c (patch) | |
tree | a11dd5a5d9c56fe7e5e56322f64b8144e8a79880 /src/target/firmware/include/flash | |
parent | 5182fff914993f3f07ac19abe616a437790ac65a (diff) |
firmware: moved cfi_flash header to flash subdirectory
Diffstat (limited to 'src/target/firmware/include/flash')
-rw-r--r-- | src/target/firmware/include/flash/cfi_flash.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/target/firmware/include/flash/cfi_flash.h b/src/target/firmware/include/flash/cfi_flash.h new file mode 100644 index 00000000..9d8b33ae --- /dev/null +++ b/src/target/firmware/include/flash/cfi_flash.h @@ -0,0 +1,41 @@ + +#ifndef _CFI_FLASH_H +#define _CFI_FLASH_H + +#include <stdint.h> + +#define FLASH_MAX_REGIONS 4 + +typedef struct { + void *fr_base; + size_t fr_bnum; + size_t fr_bsize; +} flash_region_t; + +typedef struct { + void *f_base; + size_t f_size; + + size_t f_nregions; + flash_region_t f_regions[FLASH_MAX_REGIONS]; +} flash_t; + +typedef enum { + FLASH_UNLOCKED = 0, + FLASH_LOCKED, + FLASH_LOCKED_DOWN +} flash_lock_t; + +int flash_init(flash_t *flash, void *base_addr); + +flash_lock_t flash_block_getlock(flash_t *flash, uint32_t block_offset); + +int flash_block_unlock(flash_t *flash, uint32_t block_offset); +int flash_block_lock(flash_t *flash, uint32_t block_offset); +int flash_block_lockdown(flash_t *flash, uint32_t block_offset); + +int flash_block_erase(flash_t *flash, uint32_t block_offset); + +int flash_program(flash_t *flash, uint32_t dst_offset, void *src, uint32_t nbytes); + +#endif |