OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | sim3x_info |
Macros | |
#define | CLKCTRL0_APBCLKG0_ALL (0x4002D020) |
#define | CLKCTRL0_APBCLKG0_CLR (0x4002D028) |
#define | CLKCTRL0_APBCLKG0_FLCTRLCEN_MASK (0x40000000) |
#define | CLKCTRL0_APBCLKG0_SET (0x4002D024) |
#define | CPUID_CHECK_VALUE (0x410FC230) |
#define | CPUID_CHECK_VALUE_MASK (0xFF0FFFF0) |
#define | DEVICEID0_DEVICEID0 (0x400490C0) |
#define | DEVICEID0_DEVICEID1 (0x400490D0) |
#define | DEVICEID0_DEVICEID2 (0x400490E0) |
#define | DEVICEID0_DEVICEID3 (0x400490F0) |
#define | FLASH_BASE_ADDRESS (0x00000000) |
#define | FLASH_BUSY_TIMEOUT (100) |
#define | FLASHCTRL0_CONFIG_ALL (0x4002E000) |
#define | FLASHCTRL0_CONFIG_BUSYF_MASK (0x00100000) |
#define | FLASHCTRL0_CONFIG_CLR (0x4002E008) |
#define | FLASHCTRL0_CONFIG_ERASEEN_MASK (0x00040000) |
#define | FLASHCTRL0_CONFIG_SET (0x4002E004) |
#define | FLASHCTRL0_KEY (0x4002E0C0) |
#define | FLASHCTRL0_KEY_INITIAL_UNLOCK (0x000000A5) |
#define | FLASHCTRL0_KEY_MULTIPLE_LOCK (0x0000005A) |
#define | FLASHCTRL0_KEY_MULTIPLE_UNLOCK (0x000000F2) |
#define | FLASHCTRL0_KEY_SINGLE_UNLOCK (0x000000F1) |
#define | FLASHCTRL0_WRADDR (0x4002E0A0) |
#define | FLASHCTRL0_WRDATA (0x4002E0B0) |
#define | LOCK_WORD_ADDRESS (0x0003FFFC) |
#define | LOCK_WORD_MCU_UNLOCKED (0xFFFFFFFF) |
#define | LOCK_WORD_MCU_UNLOCKED_BY_FIRMWARE (0x00000000) |
#define | RSTSRC0_RESETEN_ALL (0x4002D060) |
#define | RSTSRC0_RESETEN_CLR (0x4002D068) |
#define | RSTSRC0_RESETEN_SET (0x4002D064) |
#define | RSTSRC0_RESETEN_SWREN_MASK (0x00000040) |
#define | RSTSRC0_RESETEN_VMONREN_MASK (0x00000004) |
#define | SIM3X_AP (0x0A) |
#define | SIM3X_AP_CRC (0x0C) |
#define | SIM3X_AP_CTRL1 (0x00) |
#define | SIM3X_AP_CTRL1_MASS_ERASE_REQ (0x00000001) |
#define | SIM3X_AP_CTRL1_RESET_REQ (0x00000008) |
#define | SIM3X_AP_CTRL2 (0x04) |
#define | SIM3X_AP_DAP_IN (0x14) |
#define | SIM3X_AP_DAP_OUT (0x18) |
#define | SIM3X_AP_ID (0xFC) |
#define | SIM3X_AP_ID_VALUE (0x2430002) |
#define | SIM3X_AP_INIT_STAT (0x10) |
#define | SIM3X_AP_INIT_STAT_LOCK (0x00000004) |
#define | SIM3X_AP_LOCK (0x08) |
#define | SIM3X_FLASH_PAGE_SIZE 1024 |
#define | VMON0_CONTROL_ALL (0x4002F000) |
#define | VMON0_CONTROL_CLR (0x4002F008) |
#define | VMON0_CONTROL_SET (0x4002F004) |
#define | VMON0_CONTROL_VMONEN_MASK (0x80000000) |
#define | WDTIMER0_CONTROL_ALL (0x40030000) |
#define | WDTIMER0_CONTROL_CLR (0x40030008) |
#define | WDTIMER0_CONTROL_DBGMD_MASK (0x00000002) |
#define | WDTIMER0_CONTROL_SET (0x40030004) |
#define | WDTIMER0_KEY_ATTN (0x000000A5) |
#define | WDTIMER0_KEY_DISABLE (0x000000DD) |
#define | WDTIMER0_KEY_LOCK (0x000000FF) |
#define | WDTIMER0_KEY_RESET (0x000000CC) |
#define | WDTIMER0_KEY_START (0x000000EE) |
#define | WDTIMER0_KEY_WRITE (0x000000F1) |
#define | WDTIMER0_STATUS_ALL (0x40030010) |
#define | WDTIMER0_STATUS_CLR (0x40030018) |
#define | WDTIMER0_STATUS_KEYSTS_MASK (0x00000001) |
#define | WDTIMER0_STATUS_PRIVSTS_MASK (0x00000002) |
#define | WDTIMER0_STATUS_SET (0x40030014) |
#define | WDTIMER0_THRESHOLD (0x40030020) |
#define | WDTIMER0_WDTKEY (0x40030030) |
Functions | |
static int | ap_poll_register (struct adiv5_dap *dap, unsigned reg, uint32_t mask, uint32_t value, int timeout) |
static int | ap_read_register (struct adiv5_dap *dap, unsigned reg, uint32_t *result) |
static int | ap_write_register (struct adiv5_dap *dap, unsigned reg, uint32_t value) |
reg 31:8 - no effect reg 7:4 - bank reg 3:2 - register reg 1:0 - no effect More... | |
COMMAND_HANDLER (sim3x_lock) | |
COMMAND_HANDLER (sim3x_mass_erase) | |
FLASH_BANK_COMMAND_HANDLER (sim3x_flash_bank_command) | |
static int | sim3x_auto_probe (struct flash_bank *bank) |
static int | sim3x_erase_page (struct flash_bank *bank, uint32_t addr) |
static int | sim3x_flash_erase (struct flash_bank *bank, unsigned int first, unsigned int last) |
static int | sim3x_flash_info (struct flash_bank *bank, struct command_invocation *cmd) |
static int | sim3x_flash_lock_check (struct flash_bank *bank) |
static int | sim3x_flash_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | sim3x_flash_protect_check (struct flash_bank *bank) |
static int | sim3x_flash_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | sim3x_init (struct flash_bank *bank) |
static int | sim3x_parse_part_info (struct sim3x_info *sim3x_info) |
static int | sim3x_probe (struct flash_bank *bank) |
static int | sim3x_read_deviceid (struct flash_bank *bank) |
static int | sim3x_read_info (struct flash_bank *bank) |
static int | sim3x_write_block (struct flash_bank *bank, const uint8_t *buf, uint32_t offset, uint32_t count) |
Variables | |
static const struct command_registration | sim3x_command_handlers [] |
static const struct command_registration | sim3x_exec_command_handlers [] |
const struct flash_driver | sim3x_flash |
|
static |
Definition at line 915 of file sim3x.c.
References alive_sleep(), ap_read_register(), adiv5_ap::dap, ERROR_FAIL, ERROR_OK, LOG_DEBUG, and mask.
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 889 of file sim3x.c.
References adiv5_ap::dap, dap_get_ap(), dap_put_ap(), dap_queue_ap_read(), dap_run(), ERROR_FAIL, ERROR_OK, LOG_DEBUG, and SIM3X_AP.
Referenced by ap_poll_register(), and COMMAND_HANDLER().
|
static |
reg 31:8 - no effect reg 7:4 - bank reg 3:2 - register reg 1:0 - no effect
Definition at line 862 of file sim3x.c.
References adiv5_ap::dap, dap_get_ap(), dap_put_ap(), dap_queue_ap_write(), dap_run(), ERROR_FAIL, ERROR_OK, LOG_DEBUG, and SIM3X_AP.
Referenced by COMMAND_HANDLER().
COMMAND_HANDLER | ( | sim3x_lock | ) |
Definition at line 977 of file sim3x.c.
References ap_read_register(), armv7m_common::arm, cortex_m_common::armv7m, bank, CALL_COMMAND_HANDLER, CMD_CTX, CPUID, CPUID_CHECK_VALUE, CPUID_CHECK_VALUE_MASK, arm::dap, ERROR_FAIL, ERROR_OK, get_current_target(), LOCK_WORD_ADDRESS, LOCK_WORD_MCU_UNLOCKED, LOCK_WORD_MCU_UNLOCKED_BY_FIRMWARE, LOG_ERROR, LOG_INFO, SIM3X_AP_ID, SIM3X_AP_ID_VALUE, SIM3X_AP_INIT_STAT, SIM3X_AP_INIT_STAT_LOCK, sim3x_flash_write(), target_buffer_set_u32(), target_read_u32(), and target_to_cm().
COMMAND_HANDLER | ( | sim3x_mass_erase | ) |
Definition at line 932 of file sim3x.c.
References ap_poll_register(), ap_read_register(), ap_write_register(), armv7m_common::arm, cortex_m_common::armv7m, CMD_CTX, arm::dap, ERROR_FAIL, ERROR_OK, FLASH_BUSY_TIMEOUT, get_current_target(), LOG_ERROR, LOG_INFO, SIM3X_AP_CTRL1, SIM3X_AP_CTRL1_MASS_ERASE_REQ, SIM3X_AP_CTRL1_RESET_REQ, SIM3X_AP_ID, SIM3X_AP_ID_VALUE, and target_to_cm().
FLASH_BANK_COMMAND_HANDLER | ( | sim3x_flash_bank_command | ) |
Definition at line 135 of file sim3x.c.
References bank, CMD_ARGC, sim3x_info::device_package, sim3x_info::device_revision, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, sim3x_info::need_init, and sim3x_info::probed.
|
static |
Definition at line 813 of file sim3x.c.
References bank, ERROR_OK, sim3x_info::need_init, sim3x_info::probed, and sim3x_probe().
|
static |
Definition at line 214 of file sim3x.c.
References addr, alive_sleep(), bank, ERROR_FAIL, ERROR_OK, FLASH_BUSY_TIMEOUT, FLASHCTRL0_CONFIG_ALL, FLASHCTRL0_CONFIG_BUSYF_MASK, FLASHCTRL0_CONFIG_ERASEEN_MASK, FLASHCTRL0_CONFIG_SET, FLASHCTRL0_KEY, FLASHCTRL0_KEY_INITIAL_UNLOCK, FLASHCTRL0_KEY_SINGLE_UNLOCK, FLASHCTRL0_WRADDR, FLASHCTRL0_WRDATA, LOG_ERROR, target, target_read_u32(), and target_write_u32().
Referenced by sim3x_flash_erase().
|
static |
Definition at line 270 of file sim3x.c.
References alive_sleep(), bank, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, FLASH_BUSY_TIMEOUT, FLASHCTRL0_CONFIG_ALL, FLASHCTRL0_CONFIG_BUSYF_MASK, FLASHCTRL0_CONFIG_CLR, FLASHCTRL0_CONFIG_ERASEEN_MASK, LOG_ERROR, sim3x_info::need_init, sim3x_erase_page(), sim3x_init(), target, TARGET_HALTED, target_read_u32(), and target_write_u32().
Referenced by sim3x_flash_protect().
|
static |
Definition at line 827 of file sim3x.c.
References bank, cmd, command_print_sameline(), sim3x_info::device_package, sim3x_info::device_revision, ERROR_OK, sim3x_info::flash_size_kb, sim3x_info::part_family, sim3x_info::part_number, and sim3x_read_info().
|
static |
Definition at line 521 of file sim3x.c.
References bank, ERROR_OK, sim3x_info::flash_locked, LOCK_WORD_ADDRESS, LOG_ERROR, and target_read_u32().
Referenced by sim3x_flash_protect_check(), and sim3x_probe().
|
static |
Definition at line 562 of file sim3x.c.
References bank, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, sim3x_info::flash_locked, LOCK_WORD_ADDRESS, LOG_ERROR, LOG_INFO, sim3x_flash_erase(), sim3x_flash_protect_check(), sim3x_flash_write(), target::state, target, target_buffer_set_u32(), and TARGET_HALTED.
|
static |
Definition at line 539 of file sim3x.c.
References bank, ERROR_OK, ERROR_TARGET_NOT_HALTED, sim3x_info::flash_locked, LOG_ERROR, sim3x_flash_lock_check(), and TARGET_HALTED.
Referenced by sim3x_flash_protect().
|
static |
Definition at line 465 of file sim3x.c.
References bank, buffer, count, ERROR_FAIL, ERROR_FLASH_DST_BREAKS_ALIGNMENT, ERROR_OK, ERROR_TARGET_NOT_HALTED, sim3x_info::flash_locked, LOG_ERROR, LOG_INFO, sim3x_info::need_init, NULL, offset, sim3x_init(), sim3x_write_block(), target::state, target, and TARGET_HALTED.
Referenced by COMMAND_HANDLER(), and sim3x_flash_protect().
|
static |
Definition at line 153 of file sim3x.c.
References bank, CLKCTRL0_APBCLKG0_FLCTRLCEN_MASK, CLKCTRL0_APBCLKG0_SET, ERROR_OK, FLASHCTRL0_CONFIG_CLR, FLASHCTRL0_CONFIG_ERASEEN_MASK, sim3x_info::need_init, RSTSRC0_RESETEN_SET, RSTSRC0_RESETEN_VMONREN_MASK, target, target_write_u32(), VMON0_CONTROL_SET, VMON0_CONTROL_VMONEN_MASK, WDTIMER0_CONTROL_DBGMD_MASK, WDTIMER0_CONTROL_SET, WDTIMER0_KEY_ATTN, WDTIMER0_KEY_DISABLE, WDTIMER0_KEY_WRITE, and WDTIMER0_WDTKEY.
Referenced by sim3x_flash_erase(), and sim3x_flash_write().
|
static |
Definition at line 681 of file sim3x.c.
References ERROR_FAIL, ERROR_OK, sim3x_info::flash_size_kb, LOG_ERROR, LOG_INFO, sim3x_info::part_family, and sim3x_info::part_number.
Referenced by sim3x_read_info().
|
static |
Definition at line 776 of file sim3x.c.
References bank, ERROR_OK, FLASH_BASE_ADDRESS, sim3x_info::flash_locked, sim3x_info::flash_size_kb, sim3x_info::need_init, sim3x_info::probed, sim3x_flash_lock_check(), SIM3X_FLASH_PAGE_SIZE, and sim3x_read_info().
Referenced by sim3x_auto_probe().
|
static |
Definition at line 627 of file sim3x.c.
References bank, sim3x_info::device_package, sim3x_info::device_revision, DEVICEID0_DEVICEID0, DEVICEID0_DEVICEID1, DEVICEID0_DEVICEID2, ERROR_FAIL, ERROR_OK, sim3x_info::part_family, sim3x_info::part_number, and target_read_u32().
Referenced by sim3x_read_info().
|
static |
Definition at line 730 of file sim3x.c.
References bank, CPUID, ERROR_FAIL, ERROR_OK, sim3x_info::flash_size_kb, LOG_ERROR, LOG_INFO, LOG_WARNING, sim3x_parse_part_info(), sim3x_read_deviceid(), and target_read_u32().
Referenced by sim3x_flash_info(), and sim3x_probe().
|
static |
Definition at line 329 of file sim3x.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, bank, buf_get_u32(), buf_set_u32(), armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, count, destroy_reg_param(), ERROR_FLASH_OPERATION_FAILED, ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, FLASHCTRL0_CONFIG_ALL, init_reg_param(), LOG_ERROR, LOG_WARNING, NULL, offset, PARAM_IN_OUT, PARAM_OUT, source, target_alloc_working_area(), target_alloc_working_area_try(), target_free_working_area(), target_run_flash_async_algorithm(), and target_write_buffer().
Referenced by sim3x_flash_write().
|
static |
|
static |
const struct flash_driver sim3x_flash |