OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | nrf51_device_spec |
struct | nrf51_info |
Macros | |
#define | NRF51_FICR_REG(offset) (NRF51_FICR_BASE + offset) |
#define | NRF51_NVMC_REG(offset) (NRF51_NVMC_BASE + offset) |
#define | NRF51_UICR_REG(offset) (NRF51_UICR_BASE + offset) |
Enumerations | |
enum | { NRF51_FLASH_BASE = 0x00000000 } |
enum | nrf51_ficr_registers { NRF51_FICR_BASE = 0x10000000, NRF51_FICR_CODEPAGESIZE = NRF51_FICR_REG(0x010), NRF51_FICR_CODESIZE = NRF51_FICR_REG(0x014), NRF51_FICR_CLENR0 = NRF51_FICR_REG(0x028), NRF51_FICR_PPFC = NRF51_FICR_REG(0x02C), NRF51_FICR_NUMRAMBLOCK = NRF51_FICR_REG(0x034), NRF51_FICR_SIZERAMBLOCK0 = NRF51_FICR_REG(0x038), NRF51_FICR_SIZERAMBLOCK1 = NRF51_FICR_REG(0x03C), NRF51_FICR_SIZERAMBLOCK2 = NRF51_FICR_REG(0x040), NRF51_FICR_SIZERAMBLOCK3 = NRF51_FICR_REG(0x044), NRF51_FICR_CONFIGID = NRF51_FICR_REG(0x05C), NRF51_FICR_DEVICEID0 = NRF51_FICR_REG(0x060), NRF51_FICR_DEVICEID1 = NRF51_FICR_REG(0x064), NRF51_FICR_ER0 = NRF51_FICR_REG(0x080), NRF51_FICR_ER1 = NRF51_FICR_REG(0x084), NRF51_FICR_ER2 = NRF51_FICR_REG(0x088), NRF51_FICR_ER3 = NRF51_FICR_REG(0x08C), NRF51_FICR_IR0 = NRF51_FICR_REG(0x090), NRF51_FICR_IR1 = NRF51_FICR_REG(0x094), NRF51_FICR_IR2 = NRF51_FICR_REG(0x098), NRF51_FICR_IR3 = NRF51_FICR_REG(0x09C), NRF51_FICR_DEVICEADDRTYPE = NRF51_FICR_REG(0x0A0), NRF51_FICR_DEVICEADDR0 = NRF51_FICR_REG(0x0A4), NRF51_FICR_DEVICEADDR1 = NRF51_FICR_REG(0x0A8), NRF51_FICR_OVERRIDEN = NRF51_FICR_REG(0x0AC), NRF51_FICR_NRF_1MBIT0 = NRF51_FICR_REG(0x0B0), NRF51_FICR_NRF_1MBIT1 = NRF51_FICR_REG(0x0B4), NRF51_FICR_NRF_1MBIT2 = NRF51_FICR_REG(0x0B8), NRF51_FICR_NRF_1MBIT3 = NRF51_FICR_REG(0x0BC), NRF51_FICR_NRF_1MBIT4 = NRF51_FICR_REG(0x0C0), NRF51_FICR_BLE_1MBIT0 = NRF51_FICR_REG(0x0EC), NRF51_FICR_BLE_1MBIT1 = NRF51_FICR_REG(0x0F0), NRF51_FICR_BLE_1MBIT2 = NRF51_FICR_REG(0x0F4), NRF51_FICR_BLE_1MBIT3 = NRF51_FICR_REG(0x0F8), NRF51_FICR_BLE_1MBIT4 = NRF51_FICR_REG(0x0FC) } |
enum | nrf51_nvmc_config_bits { NRF51_NVMC_CONFIG_REN = 0x00, NRF51_NVMC_CONFIG_WEN = 0x01, NRF51_NVMC_CONFIG_EEN = 0x02 } |
enum | nrf51_nvmc_registers { NRF51_NVMC_BASE = 0x4001E000, NRF51_NVMC_READY = NRF51_NVMC_REG(0x400), NRF51_NVMC_CONFIG = NRF51_NVMC_REG(0x504), NRF51_NVMC_ERASEPAGE = NRF51_NVMC_REG(0x508), NRF51_NVMC_ERASEALL = NRF51_NVMC_REG(0x50C), NRF51_NVMC_ERASEUICR = NRF51_NVMC_REG(0x514) } |
enum | nrf51_uicr_registers { NRF51_UICR_BASE = 0x10001000, NRF51_UICR_SIZE = 0x100, NRF51_UICR_CLENR0 = NRF51_UICR_REG(0x000), NRF51_UICR_RBPCONF = NRF51_UICR_REG(0x004), NRF51_UICR_XTALFREQ = NRF51_UICR_REG(0x008), NRF51_UICR_FWID = NRF51_UICR_REG(0x010) } |
Functions | |
COMMAND_HANDLER (nrf51_handle_mass_erase_command) | |
FLASH_BANK_COMMAND_HANDLER (nrf51_flash_bank_command) | |
static int | nrf51_auto_probe (struct flash_bank *bank) |
static int | nrf51_bank_is_probed (struct flash_bank *bank) |
static int | nrf51_code_flash_write (struct flash_bank *bank, struct nrf51_info *chip, const uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | nrf51_erase (struct flash_bank *bank, int first, int last) |
static int | nrf51_erase_all (struct nrf51_info *chip) |
static int | nrf51_erase_page (struct flash_bank *bank, struct nrf51_info *chip, struct flash_sector *sector) |
static struct flash_sector * | nrf51_find_sector_by_address (struct flash_bank *bank, uint32_t address) |
static int | nrf51_get_probed_chip_if_halted (struct flash_bank *bank, struct nrf51_info **chip) |
static int | nrf51_info (struct flash_bank *bank, char *buf, int buf_size) |
static int | nrf51_ll_flash_write (struct nrf51_info *chip, uint32_t offset, const uint8_t *buffer, uint32_t bytes) |
static int | nrf51_nvmc_erase_enable (struct nrf51_info *chip) |
static int | nrf51_nvmc_generic_erase (struct nrf51_info *chip, uint32_t erase_register, uint32_t erase_value) |
static int | nrf51_nvmc_read_only (struct nrf51_info *chip) |
static int | nrf51_nvmc_write_enable (struct nrf51_info *chip) |
static int | nrf51_probe (struct flash_bank *bank) |
static int | nrf51_protect (struct flash_bank *bank, int set, int first, int last) |
static int | nrf51_protect_check (struct flash_bank *bank) |
static int | nrf51_uicr_flash_write (struct flash_bank *bank, struct nrf51_info *chip, const uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | nrf51_wait_for_nvmc (struct nrf51_info *chip) |
static int | nrf51_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | nrf51_write_pages (struct flash_bank *bank, uint32_t start, uint32_t end, const uint8_t *buffer) |
Variables | |
static const struct command_registration | nrf51_command_handlers [] |
static const struct command_registration | nrf51_exec_command_handlers [] |
struct flash_driver | nrf51_flash |
static const uint8_t | nrf51_flash_write_code [] |
static const struct nrf51_device_spec | nrf51_known_devices_table [] |
#define NRF51_FICR_REG | ( | offset | ) | (NRF51_FICR_BASE + offset) |
#define NRF51_NVMC_REG | ( | offset | ) | (NRF51_NVMC_BASE + offset) |
#define NRF51_UICR_REG | ( | offset | ) | (NRF51_UICR_BASE + offset) |
enum nrf51_ficr_registers |
enum nrf51_nvmc_registers |
enum nrf51_uicr_registers |
COMMAND_HANDLER | ( | nrf51_handle_mass_erase_command | ) |
Definition at line 1156 of file nrf51.c.
References CMD_CTX, ERROR_FAIL, ERROR_OK, get_current_target(), get_flash_bank_by_addr(), flash_sector::is_erased, LOG_ERROR, nrf51_erase_all(), NRF51_FICR_PPFC, NRF51_FLASH_BASE, nrf51_get_probed_chip_if_halted(), nrf51_protect_check(), NRF51_UICR_BASE, NULL, flash_bank::num_sectors, flash_bank::sectors, and target_read_u32().
FLASH_BANK_COMMAND_HANDLER | ( | nrf51_flash_bank_command | ) |
Definition at line 1116 of file nrf51.c.
References nrf51_info::bank, flash_bank::bank_number, flash_bank::base, flash_bank::driver_priv, ERROR_FAIL, ERROR_OK, LOG_ERROR, nrf51_code_flash_write(), NRF51_FLASH_BASE, NRF51_UICR_BASE, nrf51_uicr_flash_write(), nrf51_info::probed, flash_bank::target, nrf51_info::target, and nrf51_info::write.
|
static |
Definition at line 745 of file nrf51.c.
References ERROR_OK, nrf51_bank_is_probed(), nrf51_probe(), and nrf51_info::probed.
|
static |
Definition at line 411 of file nrf51.c.
References nrf51_info::bank, flash_bank::bank_number, flash_bank::driver_priv, nrf51_probe(), NULL, and nrf51_info::probed.
Referenced by nrf51_auto_probe(), and nrf51_get_probed_chip_if_halted().
|
static |
Definition at line 1009 of file nrf51.c.
References nrf51_info::code_page_size, count, DIV_ROUND_UP, ERROR_OK, LOG_DEBUG, nrf51_write_pages(), flash_bank::target, and target_read_memory().
Referenced by FLASH_BANK_COMMAND_HANDLER().
|
static |
Definition at line 993 of file nrf51.c.
References ERROR_OK, nrf51_erase_page(), nrf51_get_probed_chip_if_halted(), and flash_bank::sectors.
|
static |
Definition at line 768 of file nrf51.c.
References LOG_DEBUG, NRF51_NVMC_ERASEALL, and nrf51_nvmc_generic_erase().
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 776 of file nrf51.c.
References flash_bank::base, default_flash_blank_check(), ERROR_FAIL, ERROR_OK, flash_sector::is_erased, flash_sector::is_protected, LOG_DEBUG, LOG_ERROR, NRF51_FICR_PPFC, NRF51_NVMC_ERASEPAGE, NRF51_NVMC_ERASEUICR, nrf51_nvmc_generic_erase(), NRF51_UICR_BASE, flash_sector::offset, nrf51_info::target, and target_read_u32().
Referenced by nrf51_erase(), nrf51_uicr_flash_write(), and nrf51_write_pages().
|
static |
Definition at line 757 of file nrf51.c.
References nrf51_info::code_page_size, flash_bank::driver_priv, NULL, flash_bank::num_sectors, flash_sector::offset, and flash_bank::sectors.
Referenced by nrf51_write_pages().
|
static |
Definition at line 421 of file nrf51.c.
References flash_bank::driver_priv, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_ERROR, nrf51_bank_is_probed(), nrf51_probe(), nrf51_info::probed, target::state, flash_bank::target, and TARGET_HALTED.
Referenced by COMMAND_HANDLER(), nrf51_erase(), nrf51_info(), nrf51_protect(), and nrf51_write().
|
static |
Definition at line 1214 of file nrf51.c.
References ARRAY_SIZE, ERROR_OK, LOG_ERROR, NRF51_FICR_BLE_1MBIT0, NRF51_FICR_BLE_1MBIT1, NRF51_FICR_BLE_1MBIT2, NRF51_FICR_BLE_1MBIT3, NRF51_FICR_BLE_1MBIT4, NRF51_FICR_CLENR0, NRF51_FICR_CODEPAGESIZE, NRF51_FICR_CODESIZE, NRF51_FICR_CONFIGID, NRF51_FICR_DEVICEADDR0, NRF51_FICR_DEVICEADDR1, NRF51_FICR_DEVICEADDRTYPE, NRF51_FICR_DEVICEID0, NRF51_FICR_DEVICEID1, NRF51_FICR_ER0, NRF51_FICR_ER1, NRF51_FICR_ER2, NRF51_FICR_ER3, NRF51_FICR_IR0, NRF51_FICR_IR1, NRF51_FICR_IR2, NRF51_FICR_IR3, NRF51_FICR_NRF_1MBIT0, NRF51_FICR_NRF_1MBIT1, NRF51_FICR_NRF_1MBIT2, NRF51_FICR_NRF_1MBIT3, NRF51_FICR_NRF_1MBIT4, NRF51_FICR_NUMRAMBLOCK, NRF51_FICR_OVERRIDEN, NRF51_FICR_PPFC, NRF51_FICR_SIZERAMBLOCK0, NRF51_FICR_SIZERAMBLOCK1, NRF51_FICR_SIZERAMBLOCK2, NRF51_FICR_SIZERAMBLOCK3, nrf51_get_probed_chip_if_halted(), NRF51_UICR_CLENR0, NRF51_UICR_FWID, NRF51_UICR_RBPCONF, NRF51_UICR_XTALFREQ, nrf51_info::target, and target_read_u32().
|
static |
Definition at line 850 of file nrf51.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, buf_set_u32(), armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, destroy_reg_param(), ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, init_reg_param(), LOG_DEBUG, LOG_WARNING, NRF51_FLASH_BASE, nrf51_flash_write_code, nrf51_wait_for_nvmc(), NULL, PARAM_IN_OUT, PARAM_OUT, working_area::size, nrf51_info::target, target_alloc_working_area(), target_free_working_area(), target_run_flash_async_algorithm(), target_write_buffer(), and target_write_memory().
Referenced by nrf51_uicr_flash_write(), and nrf51_write_pages().
|
static |
Definition at line 462 of file nrf51.c.
References ERROR_OK, LOG_ERROR, NRF51_NVMC_CONFIG, NRF51_NVMC_CONFIG_EEN, nrf51_wait_for_nvmc(), nrf51_info::target, and target_write_u32().
Referenced by nrf51_nvmc_generic_erase().
|
static |
Definition at line 530 of file nrf51.c.
References ERROR_FAIL, ERROR_OK, LOG_ERROR, nrf51_nvmc_erase_enable(), nrf51_nvmc_read_only(), nrf51_wait_for_nvmc(), nrf51_info::target, and target_write_u32().
Referenced by nrf51_erase_all(), and nrf51_erase_page().
|
static |
Definition at line 508 of file nrf51.c.
References ERROR_OK, LOG_ERROR, NRF51_NVMC_CONFIG, NRF51_NVMC_CONFIG_REN, nrf51_wait_for_nvmc(), nrf51_info::target, and target_write_u32().
Referenced by nrf51_nvmc_generic_erase(), nrf51_uicr_flash_write(), and nrf51_write_pages().
|
static |
Definition at line 485 of file nrf51.c.
References ERROR_OK, LOG_ERROR, NRF51_NVMC_CONFIG, NRF51_NVMC_CONFIG_WEN, nrf51_wait_for_nvmc(), nrf51_info::target, and target_write_u32().
Referenced by nrf51_uicr_flash_write(), and nrf51_write_pages().
|
static |
Definition at line 650 of file nrf51.c.
References ARRAY_SIZE, nrf51_info::bank, flash_bank::base, nrf51_device_spec::build_code, nrf51_info::code_page_size, flash_bank::driver_priv, ERROR_FLASH_BANK_NOT_PROBED, ERROR_OK, nrf51_device_spec::flash_size_kb, flash_sector::is_erased, flash_sector::is_protected, LOG_ERROR, LOG_INFO, LOG_WARNING, NRF51_FICR_CODEPAGESIZE, NRF51_FICR_CODESIZE, NRF51_FICR_CONFIGID, NRF51_FLASH_BASE, nrf51_protect_check(), NRF51_UICR_SIZE, NULL, flash_bank::num_sectors, flash_sector::offset, nrf51_device_spec::part, nrf51_info::probed, flash_bank::sectors, flash_sector::size, flash_bank::size, nrf51_info::target, target_read_u32(), and nrf51_device_spec::variant.
Referenced by nrf51_auto_probe(), nrf51_bank_is_probed(), and nrf51_get_probed_chip_if_halted().
|
static |
Definition at line 595 of file nrf51.c.
References flash_bank::base, ERROR_FAIL, ERROR_OK, LOG_ERROR, NRF51_FICR_PPFC, nrf51_get_probed_chip_if_halted(), nrf51_protect_check(), NRF51_UICR_BASE, NRF51_UICR_CLENR0, nrf51_info::target, target_read_u32(), and target_write_u32().
|
static |
Definition at line 559 of file nrf51.c.
References flash_bank::base, flash_bank::driver_priv, ERROR_OK, flash_sector::is_protected, LOG_ERROR, NRF51_FICR_CLENR0, NRF51_UICR_BASE, NRF51_UICR_CLENR0, NULL, flash_bank::num_sectors, flash_sector::offset, flash_bank::sectors, nrf51_info::target, and target_read_u32().
Referenced by COMMAND_HANDLER(), nrf51_probe(), and nrf51_protect().
|
static |
Definition at line 1060 of file nrf51.c.
References ERROR_FAIL, ERROR_OK, flash_sector::is_erased, nrf51_erase_page(), nrf51_ll_flash_write(), nrf51_nvmc_read_only(), nrf51_nvmc_write_enable(), NRF51_UICR_BASE, NRF51_UICR_SIZE, flash_bank::sectors, flash_bank::target, and target_read_memory().
Referenced by FLASH_BANK_COMMAND_HANDLER().
|
static |
Definition at line 439 of file nrf51.c.
References alive_sleep(), ERROR_FLASH_BUSY, ERROR_OK, LOG_DEBUG, LOG_ERROR, NRF51_NVMC_READY, nrf51_info::target, and target_read_u32().
Referenced by nrf51_ll_flash_write(), nrf51_nvmc_erase_enable(), nrf51_nvmc_generic_erase(), nrf51_nvmc_read_only(), and nrf51_nvmc_write_enable().
|
static |
Definition at line 1102 of file nrf51.c.
References nrf51_info::bank, flash_bank::bank_number, ERROR_OK, nrf51_get_probed_chip_if_halted(), and nrf51_info::write.
|
static |
Definition at line 943 of file nrf51.c.
References nrf51_info::code_page_size, flash_bank::driver_priv, ERROR_FAIL, ERROR_FLASH_SECTOR_INVALID, ERROR_OK, flash_sector::is_erased, flash_sector::is_protected, LOG_ERROR, nrf51_erase_page(), nrf51_find_sector_by_address(), nrf51_ll_flash_write(), nrf51_nvmc_read_only(), nrf51_nvmc_write_enable(), and flash_sector::offset.
Referenced by nrf51_code_flash_write().
|
static |
|
static |
struct flash_driver nrf51_flash |
|
static |
Definition at line 825 of file nrf51.c.
Referenced by nrf51_ll_flash_write().
|
static |