From 7be0213030d2ce50e618e72b5a90e4c5b63c59a4 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 16 Aug 2011 13:19:29 +0200 Subject: checked in clean osmocombb lib --- .../src/target/firmware/include/flash/cfi_flash.h | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Src/osmocombb/src/target/firmware/include/flash/cfi_flash.h (limited to 'Src/osmocombb/src/target/firmware/include/flash/cfi_flash.h') diff --git a/Src/osmocombb/src/target/firmware/include/flash/cfi_flash.h b/Src/osmocombb/src/target/firmware/include/flash/cfi_flash.h new file mode 100644 index 0000000..9d8b33a --- /dev/null +++ b/Src/osmocombb/src/target/firmware/include/flash/cfi_flash.h @@ -0,0 +1,41 @@ + +#ifndef _CFI_FLASH_H +#define _CFI_FLASH_H + +#include + +#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 -- cgit v1.2.3-55-g7522