OpenOCD
|
Provides the implementation-independent structure that defines all of the callbacks required by OpenOCD flash drivers. More...
Public Member Functions | |
__FLASH_BANK_COMMAND ((*flash_bank_command)) | |
Finish the "flash bank" command for bank. More... | |
Data Fields | |
int(* | auto_probe )(struct flash_bank *bank) |
A more gentle flavor of flash_driver_s::probe, performing setup with less noise. More... | |
const struct command_registration * | commands |
An array of driver-specific commands to register. More... | |
int(* | erase )(struct flash_bank *bank, unsigned int first, unsigned int last) |
Bank/sector erase routine (target-specific). More... | |
int(* | erase_check )(struct flash_bank *bank) |
Check the erasure status of a flash bank. More... | |
void(* | free_driver_priv )(struct flash_bank *bank) |
Deallocates private driver structures. More... | |
int(* | info )(struct flash_bank *bank, struct command_invocation *cmd) |
Display human-readable information about the flash bank. More... | |
const char * | name |
Gives a human-readable name of this flash driver, This field is used to select and initialize the driver. More... | |
int(* | probe )(struct flash_bank *bank) |
Probe to determine what kind of flash is present. More... | |
int(* | protect )(struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
Bank/sector protection routine (target-specific). More... | |
int(* | protect_check )(struct flash_bank *bank) |
Determine if the specific bank is "protected" or not. More... | |
int(* | read )(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) |
Read data from the flash. More... | |
const char * | usage |
Gives a human-readable description of arguments. More... | |
int(* | verify )(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
Verify data in flash. More... | |
int(* | write )(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
Program data into the flash. More... | |
Provides the implementation-independent structure that defines all of the callbacks required by OpenOCD flash drivers.
Driver authors must implement the routines defined here, providing an instance with the fields filled out. After that, the instance must be registered in flash.c, so it can be used by the driver lookup system.
Specifically, the user can issue the command:
OpenOCD will search for the driver with a flash_driver_s::name
that matches DRIVERNAME
.
The flash subsystem calls some of the other drivers routines a using corresponding static flash_driver_callback()
routine in flash.c.
Definition at line 39 of file nor/driver.h.
flash_driver::__FLASH_BANK_COMMAND | ( | * | flash_bank_command | ) |
Finish the "flash bank" command for bank.
The bank parameter will have been filled in by the core flash layer when this routine is called, and the driver can store additional information in its struct flash_bank::driver_priv field.
The CMD_ARGV are:
For example, CMD_ARGV[4] = 2 (for 16 bit flash), CMD_ARGV[5] = 4 (for 32 bit bus).
If extra arguments are provided (CMD_ARGC > 6), they will start in CMD_ARGV[6]. These can be used to implement driver-specific extensions.
int(* flash_driver::auto_probe) (struct flash_bank *bank) |
A more gentle flavor of flash_driver_s::probe, performing setup with less noise.
Generally, driver routines should test to see if the bank has already been probed; if it has, the driver probably should not perform its probe a second time.
This callback is often called from the inside of other routines (e.g. GDB flash downloads) to autoprobe the flash as it is programming the flash.
bank | - the bank to probe |
Definition at line 219 of file nor/driver.h.
Referenced by COMMAND_HANDLER(), get_flash_bank_by_addr(), get_flash_bank_by_num(), and virtual_auto_probe().
const struct command_registration* flash_driver::commands |
An array of driver-specific commands to register.
When called during the "flash bank" command, the driver can register addition commands to support new flash chip functions.
Definition at line 56 of file nor/driver.h.
Referenced by COMMAND_HANDLER().
int(* flash_driver::erase) (struct flash_bank *bank, unsigned int first, unsigned int last) |
Bank/sector erase routine (target-specific).
When called, the flash driver should erase the specified sectors using whatever means are at its disposal.
bank | The bank of flash to be erased. |
first | The number of the first sector to erase, typically 0. |
last | The number of the last sector to erase, typically N-1. |
Definition at line 96 of file nor/driver.h.
Referenced by virtual_erase().
int(* flash_driver::erase_check) (struct flash_bank *bank) |
Check the erasure status of a flash bank.
When called, the driver routine must perform the required checks and then set the flash_sector_s::is_erased
field for each of the flash banks's sectors.
bank | The bank to check |
Definition at line 179 of file nor/driver.h.
Referenced by COMMAND_HANDLER(), and virtual_blank_check().
void(* flash_driver::free_driver_priv) (struct flash_bank *bank) |
Deallocates private driver structures.
Use default_flash_free_driver_priv() to simply free(bank->driver_priv)
bank | - the bank being destroyed |
Definition at line 227 of file nor/driver.h.
int(* flash_driver::info) (struct flash_bank *bank, struct command_invocation *cmd) |
Display human-readable information about the flash bank.
bank | - the bank to get info about |
cmd | - command invocation instance for which to generate the textual output |
Definition at line 204 of file nor/driver.h.
Referenced by COMMAND_HANDLER().
const char* flash_driver::name |
Gives a human-readable name of this flash driver, This field is used to select and initialize the driver.
Definition at line 44 of file nor/driver.h.
Referenced by COMMAND_HANDLER().
int(* flash_driver::probe) (struct flash_bank *bank) |
Probe to determine what kind of flash is present.
This is invoked by the "probe" script command.
bank | The bank to probe |
Definition at line 168 of file nor/driver.h.
Referenced by COMMAND_HANDLER(), and virtual_probe().
int(* flash_driver::protect) (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
Bank/sector protection routine (target-specific).
If protection is not implemented, set method to NULL
When called, the driver should enable/disable protection for MINIMUM the range covered by first..last sectors inclusive. Some chips have alignment requirements will cause the actual range to be protected / unprotected to be larger than the first..last range.
bank | The bank to protect or unprotect. |
set | If non-zero, enable protection; if 0, disable it. |
first | The first sector to (un)protect, typically 0. |
last | The last sector to (un)project, typically N-1. |
Definition at line 116 of file nor/driver.h.
int(* flash_driver::protect_check) (struct flash_bank *bank) |
Determine if the specific bank is "protected" or not.
When called, the driver routine must must perform the required protection check(s) and then set the flash_sector_s::is_protected
field for each of the flash bank's sectors.
If protection is not implemented, set method to NULL
bank | - the bank to check |
Definition at line 193 of file nor/driver.h.
Referenced by COMMAND_HANDLER(), and virtual_protect_check().
int(* flash_driver::read) (struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) |
Read data from the flash.
Note CPU address will be "bank->base + offset", while the physical address is dependent upon current target MMU mappings.
bank | The bank to read. |
buffer | The data bytes read. |
offset | The offset into the chip to read. |
count | The number of bytes to read. |
Definition at line 144 of file nor/driver.h.
const char* flash_driver::usage |
Gives a human-readable description of arguments.
Definition at line 49 of file nor/driver.h.
Referenced by COMMAND_HANDLER().
int(* flash_driver::verify) (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
Verify data in flash.
Note CPU address will be "bank->base + offset", while the physical address is dependent upon current target MMU mappings.
bank | The bank to verify |
buffer | The data bytes to verify against. |
offset | The offset into the chip to verify. |
count | The number of bytes to verify. |
Definition at line 158 of file nor/driver.h.
int(* flash_driver::write) (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
Program data into the flash.
Note CPU address will be "bank->base + offset", while the physical address is dependent upon current target MMU mappings.
bank | The bank to program |
buffer | The data bytes to write. |
offset | The offset into the chip to program. |
count | The number of bytes to write. |
Definition at line 130 of file nor/driver.h.
Referenced by virtual_write().