11 #ifndef OPENOCD_FLASH_NOR_CORE_H
12 #define OPENOCD_FLASH_NOR_CORE_H
59 #define FLASH_WRITE_ALIGN_SECTOR UINT32_MAX
62 #define FLASH_WRITE_CONTINUOUS 0
63 #define FLASH_WRITE_GAP_SECTOR UINT32_MAX
174 struct image *
image, uint32_t *written,
bool erase);
279 unsigned int num_blocks);
target_addr_t flash_write_align_start(struct flash_bank *bank, target_addr_t addr)
Align start address of a flash write region according to bank requirements.
int default_flash_verify(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default verify implementation for flash memory.
struct flash_bank * get_flash_bank_by_name_noprobe(const char *name)
Returns the flash bank specified by name, which matches the driver name and a suffix (option) specify...
struct flash_sector * alloc_block_array(uint32_t offset, uint32_t size, unsigned int num_blocks)
Allocate and fill an array of sectors or protection blocks.
target_addr_t flash_write_align_end(struct flash_bank *bank, target_addr_t addr)
Align end address of a flash write region according to bank requirements.
void flash_set_dirty(void)
Forces targets to re-examine their erase/protection state.
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
int flash_unlock_address_range(struct target *target, target_addr_t addr, uint32_t length)
struct flash_bank * get_flash_bank_by_num_noprobe(unsigned int num)
Returns the flash bank like get_flash_bank_by_num(), without probing.
void flash_free_all_banks(void)
Deallocates all flash banks.
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
unsigned int flash_get_bank_count(void)
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
int get_flash_bank_by_addr(struct target *target, target_addr_t addr, bool check, struct flash_bank **result_bank)
Returns the flash bank located at a specified address.
COMMAND_HELPER(flash_command_get_bank, unsigned name_index, struct flash_bank **bank)
Retrieves bank from a command argument, reporting errors parsing the bank identifier or retrieving th...
int flash_erase_address_range(struct target *target, bool pad, target_addr_t addr, uint32_t length)
Erases length bytes in the target flash, starting at addr.
int flash_write(struct target *target, struct image *image, uint32_t *written, bool erase)
Writes image into the target flash.
int get_flash_bank_by_name(const char *name, struct flash_bank **bank_result)
Returns the flash bank specified by name, which matches the driver name and a suffix (option) specify...
int get_flash_bank_by_num(unsigned int num, struct flash_bank **bank)
Returns the flash bank like get_flash_bank_by_name(), without probing.
int flash_register_commands(struct command_context *cmd_ctx)
Registers the 'flash' subsystem commands.
size_t size
Size of the control block search area.
Provides details of a flash bank, available either on-chip or through a major interface.
uint32_t write_end_alignment
Required alignment of flash write end address.
unsigned int num_prot_blocks
The number of protection blocks in this bank.
struct flash_sector * sectors
Array of sectors, allocated and initialized by the flash driver.
uint8_t default_padded_value
Default padded value used, normally this matches the flash erased value.
const struct flash_driver * driver
Driver for this bank.
unsigned int chip_width
Width of the chip in bytes (1,2,4 bytes)
target_addr_t base
The base address of this bank.
void * driver_priv
Private driver storage pointer.
uint32_t size
The size of this chip bank, in bytes.
unsigned int num_sectors
The number of sectors on this chip.
uint32_t write_start_alignment
Required alignment of flash write start address.
struct flash_sector * prot_blocks
Array of protection blocks, allocated and initialized by the flash driver.
unsigned int bus_width
Maximum bus width, in bytes (1,2,4 bytes)
struct flash_bank * next
The next flash bank on this chip.
struct target * target
Target to which this bank belongs.
uint32_t minimal_write_gap
Minimal gap between sections to discontinue flash write Default FLASH_WRITE_GAP_SECTOR splits the wri...
uint8_t erased_value
Erased value.
unsigned int bank_number
The 'bank' (or chip number) of this instance.
Provides the implementation-independent structure that defines all of the callbacks required by OpenO...
Describes the geometry and status of a single flash sector within a flash bank.
int is_erased
Indication of erasure status: 0 = not erased, 1 = erased, other = unknown.
uint32_t offset
Bus offset from start of the flash chip (in bytes).
int is_protected
Indication of protection status: 0 = unprotected/unlocked, 1 = protected/locked, other = unknown.
uint32_t size
Number of bytes in this flash sector.