15 #define SWM050_DELAY 100
17 #define SWM050_FLASH_PAGE_SIZE 0x200
18 #define SWM050_FLASH_PAGES 16
20 #define SWM050_CPU_ID 0xE000ED00
21 #define SWM050_CPU_ID_VAL 0x410CC200
23 #define SWM050_FLASH_REG1 0x1F000000
24 #define SWM050_FLASH_REG2 0x1F000038
25 #define SWM050_FLASH_KEY 0xAAAAAAAA
27 #define SWM050_SYSCTL_CFG_0 0x400F0000
28 #define SWM050_SYSCTL_DBLF 0x400F0008
46 for (
unsigned int curr_page = first; curr_page <= last; curr_page++) {
149 bank->write_start_alignment = 4;
150 bank->write_end_alignment = 4;
158 for (
unsigned int i = 0; i <
bank->num_sectors; i++)
159 bank->sectors[i].is_protected = 0;
166 .
name =
"mass_erase",
167 .handler = swm050_handle_mass_erase_command,
170 .help =
"Erase entire flash device.",
179 .help =
"swm050 flash command group",
189 .flash_bank_command = swm050_flash_bank_command,
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CALL_COMMAND_HANDLER(name, extra ...)
Use this to macro to call a command helper (or a nested handler).
#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 COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
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.
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
void alive_sleep(uint64_t ms)
#define LOG_ERROR(expr ...)
Provides details of a flash bank, available either on-chip or through a major interface.
Provides the implementation-independent structure that defines all of the callbacks required by OpenO...
const char * name
Gives a human-readable name of this flash driver, This field is used to select and initialize the dri...
static int swm050_mass_erase(struct flash_bank *bank)
static int swm050_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
const struct flash_driver swm050_flash
FLASH_BANK_COMMAND_HANDLER(swm050_flash_bank_command)
static const struct command_registration swm050_command_handlers[]
#define SWM050_FLASH_REG2
COMMAND_HANDLER(swm050_handle_mass_erase_command)
static const struct command_registration swm050_exec_command_handlers[]
#define SWM050_FLASH_PAGE_SIZE
#define SWM050_FLASH_REG1
static int swm050_probe(struct flash_bank *bank)
#define SWM050_FLASH_PAGES
static int swm050_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
int target_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Write count items of size bytes to the memory of target at the address given.
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
#define ERROR_TARGET_NOT_HALTED