20 LOG_ERROR(
"master flash bank '%s' does not exist", (
char *)
bank->driver_priv);
57 LOG_ERROR(
"master flash bank '%s' does not exist", bank_name);
62 bank->driver_priv = strdup(bank_name);
102 retval = master_bank->
driver->
erase(master_bank, first, last);
172 bank->driver->name, master_bank->
name, master_bank->
base);
212 .flash_bank_command = virtual_flash_bank_command,
void command_print_sameline(struct command_invocation *cmd, const char *format,...)
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define ERROR_FLASH_OPER_UNSUPPORTED
#define ERROR_FLASH_OPERATION_FAILED
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...
int flash_driver_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
#define LOG_ERROR(expr ...)
When run_command is called, a new instance will be created on the stack, filled with the proper value...
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.
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)
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.
Provides the implementation-independent structure that defines all of the callbacks required by OpenO...
int(* auto_probe)(struct flash_bank *bank)
A more gentle flavor of flash_driver::probe, performing setup with less noise.
int(* erase_check)(struct flash_bank *bank)
Check the erasure status of a flash bank.
int(* write)(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Program data into the flash.
int(* probe)(struct flash_bank *bank)
Probe to determine what kind of flash is present.
int(* erase)(struct flash_bank *bank, unsigned int first, unsigned int last)
Bank/sector erase routine (target-specific).
int(* read)(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Read data from the flash.
int(* protect_check)(struct flash_bank *bank)
Determine if the specific bank is "protected" or not.
const char * name
Gives a human-readable name of this flash driver, This field is used to select and initialize the dri...
static int virtual_protect_check(struct flash_bank *bank)
FLASH_BANK_COMMAND_HANDLER(virtual_flash_bank_command)
static int virtual_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
static int virtual_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
static struct flash_bank * virtual_get_master_bank(struct flash_bank *bank)
static int virtual_probe(struct flash_bank *bank)
static int virtual_info(struct flash_bank *bank, struct command_invocation *cmd)
const struct flash_driver virtual_flash
static int virtual_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
static int virtual_auto_probe(struct flash_bank *bank)
static void virtual_update_bank_info(struct flash_bank *bank)
static int virtual_blank_check(struct flash_bank *bank)
static int virtual_erase(struct flash_bank *bank, unsigned int first, unsigned int last)