OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | qn908x_flash_bank |
struct | qn908x_flash_page_lock |
Enumerations | |
enum | qn908x_info_page_flash_size { QN908X_FLASH_SIZE_512K = 0xfffff0ff , QN908X_FLASH_SIZE_256K = 0xffffe0ff } |
Functions | |
struct qn908x_flash_page_lock | __attribute__ ((packed)) |
COMMAND_HANDLER (qn908x_handle_allow_brick_command) | |
COMMAND_HANDLER (qn908x_handle_disable_wdog_command) | |
COMMAND_HANDLER (qn908x_handle_mass_erase_command) | |
FLASH_BANK_COMMAND_HANDLER (qn908x_flash_bank_command) | |
static int | is_flash_protected (struct flash_bank *bank, bool *is_protected) |
static int | qn908x_auto_probe (struct flash_bank *bank) |
static int | qn908x_busy_check (struct target *target) |
static int | qn908x_erase (struct flash_bank *bank, unsigned int first, unsigned int last) |
static int | qn908x_get_info (struct flash_bank *bank, struct command_invocation *cmd) |
static int | qn908x_init_flash (struct target *target) |
static int | qn908x_load_lock_stat (struct target *target) |
static int | qn908x_probe (struct flash_bank *bank) |
static int | qn908x_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | qn908x_protect_check (struct flash_bank *bank) |
static int | qn908x_read_page_lock (struct flash_bank *bank) |
static int | qn908x_setup_erase (struct target *target) |
static int | qn908x_status_check (struct target *target) |
static int | qn908x_update_reg (struct target *target, target_addr_t reg, uint32_t mask, uint32_t value) |
static int | qn908x_wait_for_idle (struct target *target, int64_t timeout_ms) |
static int | qn908x_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
Variables | |
struct qn908x_flash_bank | __attribute__ |
uint8_t | _reserved [3] |
uint8_t | bits [QN908X_FLASH_MAX_BLOCKS *QN908X_FLASH_PAGES_PER_BLOCK/8] |
uint8_t | nvds_size [4] |
uint8_t | protection |
static const struct command_registration | qn908x_command_handlers [] |
static const struct command_registration | qn908x_exec_command_handlers [] |
const struct flash_driver | qn908x_flash |
#define QN908X_FLASH_BLOCK_SIZE (QN908X_FLASH_PAGES_PER_BLOCK * QN908X_FLASH_PAGE_SIZE) |
#define QN908X_FLASH_IRQ_VECTOR_CHECKSUM_END (QN908X_FLASH_IRQ_VECTOR_CHECKSUM_POS + QN908X_FLASH_IRQ_VECTOR_CHECKSUM_SIZE) |
#define QN908X_FLASH_LOCK_ADDR (QN908X_FLASH_BASE + 0x7f820) |
#define QN908X_FMC_DEBUG_PASSWORD (QN908X_FMC_BASE + 0xa8) |
#define QN908X_FMC_ERASE_CTRL (QN908X_FMC_BASE + 0x04) |
#define QN908X_FMC_ERASE_PASSWORD (QN908X_FMC_BASE + 0xac) |
#define QN908X_FMC_ERASE_TIME (QN908X_FMC_BASE + 0x08) |
#define QN908X_FMC_INI_RD_EN (QN908X_FMC_BASE + 0x00) |
#define QN908X_FMC_INT_STAT (QN908X_FMC_BASE + 0x18) |
#define QN908X_FMC_LOCK_STAT_0 (QN908X_FMC_BASE + 0x20) |
#define QN908X_FMC_LOCK_STAT_1 (QN908X_FMC_BASE + 0x24) |
#define QN908X_FMC_LOCK_STAT_2 (QN908X_FMC_BASE + 0x28) |
#define QN908X_FMC_LOCK_STAT_3 (QN908X_FMC_BASE + 0x2c) |
#define QN908X_FMC_LOCK_STAT_4 (QN908X_FMC_BASE + 0x30) |
#define QN908X_FMC_LOCK_STAT_5 (QN908X_FMC_BASE + 0x34) |
#define QN908X_FMC_LOCK_STAT_6 (QN908X_FMC_BASE + 0x38) |
#define QN908X_FMC_LOCK_STAT_7 (QN908X_FMC_BASE + 0x3c) |
#define QN908X_FMC_LOCK_STAT_8 (QN908X_FMC_BASE + 0x40) |
#define QN908X_FMC_SMART_CTRL (QN908X_FMC_BASE + 0x10) |
#define QN908X_FMC_SMART_CTRL_MAX_ERASE | ( | x | ) |
#define QN908X_FMC_SMART_CTRL_MAX_WRITE | ( | x | ) |
#define QN908X_FMC_STATUS1 (QN908X_FMC_BASE + 0x48) |
#define QN908X_FMC_TIME_CTRL (QN908X_FMC_BASE + 0x0c) |
#define QN908X_FMC_TIME_CTRL_PRGM_CYCLE | ( | x | ) |
#define QN908X_FMC_TIME_CTRL_TIME_BASE | ( | x | ) |
#define QN908X_INFO_PAGE_BLUETOOTH_ADDR (QN908X_INFO_PAGE_BASE + 0x7fa) |
#define QN908X_INFO_PAGE_BOOTLOADER_VER (QN908X_INFO_PAGE_BASE + 0x704) |
#define QN908X_INFO_PAGE_CRC32 (QN908X_INFO_PAGE_BASE + 0x700) |
#define QN908X_INFO_PAGE_CRC_END (QN908X_INFO_PAGE_BASE + 0x800) |
#define QN908X_INFO_PAGE_CRC_START (QN908X_INFO_PAGE_BASE + 0x704) |
#define QN908X_INFO_PAGE_FLASH_SIZE (QN908X_INFO_PAGE_BASE + 0x708) |
#define QN908X_SYSCON_CHIP_ID (QN908X_SYSCON_BASE + 0x108u) |
#define QN908X_SYSCON_CLK_CTRL (QN908X_SYSCON_BASE + 0x010u) |
#define QN908X_SYSCON_CLK_EN (QN908X_SYSCON_BASE + 0x00cu) |
#define QN908X_SYSCON_XTAL_CTRL (QN908X_SYSCON_BASE + 0x180u) |
#define QN908X_WDT_CTRL (QN908X_WDT_BASE + 0x08u) |
#define QN908X_WDT_LOCK (QN908X_WDT_BASE + 0x20u) |
struct qn908x_flash_page_lock __attribute__ | ( | (packed) | ) |
COMMAND_HANDLER | ( | qn908x_handle_allow_brick_command | ) |
Definition at line 985 of file qn908x.c.
References qn908x_flash_bank::allow_swd_disabled, bank, CMD_ARGC, CMD_CTX, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, get_current_target(), get_flash_bank_by_addr(), LOG_WARNING, NULL, and QN908X_FLASH_BASE.
COMMAND_HANDLER | ( | qn908x_handle_disable_wdog_command | ) |
Definition at line 1010 of file qn908x.c.
References CMD, CMD_ARGC, CMD_CTX, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ERROR_TARGET_NOT_HALTED, get_current_target(), QN908X_WDT_CTRL, QN908X_WDT_LOCK, target::state, TARGET_HALTED, and target_write_u32().
COMMAND_HANDLER | ( | qn908x_handle_mass_erase_command | ) |
Definition at line 1037 of file qn908x.c.
References CMD_ARGC, CMD_ARGV, CMD_CTX, ERROR_COMMAND_ARGUMENT_INVALID, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, get_current_target(), LOG_DEBUG, LOG_INFO, QN908X_DEFAULT_TIMEOUT_MS, QN908X_FLASH_LOCK_ADDR, QN908X_FLASH_LOCK_ENABLE_MASS_ERASE, QN908X_FMC_DEBUG_PASSWORD, QN908X_FMC_ERASE_CTRL, QN908X_FMC_ERASE_CTRL_HALF_ERASEH_EN_SHIFT, QN908X_FMC_ERASE_CTRL_HALF_ERASEL_EN_SHIFT, QN908X_FMC_LOCK_STAT_8, QN908X_FMC_LOCK_STAT_8_MASS_ERASE_LOCK_EN, QN908X_FMC_SMART_CTRL, QN908X_FMC_SMART_CTRL_PRGMH_EN_MASK, QN908X_FMC_SMART_CTRL_SMART_WRITEH_EN_MASK, qn908x_init_flash(), qn908x_load_lock_stat(), qn908x_setup_erase(), qn908x_status_check(), qn908x_wait_for_idle(), target_read_u32(), and target_write_u32().
FLASH_BANK_COMMAND_HANDLER | ( | qn908x_flash_bank_command | ) |
Definition at line 352 of file qn908x.c.
References qn908x_flash_bank::allow_swd_disabled, bank, qn908x_flash_bank::calc_checksum, CMD_ARGC, CMD_ARGV, ERROR_COMMAND_ARGUMENT_INVALID, ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, LOG_ERROR, qn908x_flash_bank::num_blocks, qn908x_flash_bank::page_lock_loaded, QN908X_FLASH_BASE, TARGET_ADDR_FMT, and qn908x_flash_bank::user_bank_size.
|
static |
Definition at line 807 of file qn908x.c.
References bank, ERROR_OK, QN908X_FMC_LOCK_STAT_8, QN908X_FMC_LOCK_STAT_8_PROTECT_ANY, and target_read_u32().
Referenced by qn908x_probe().
|
static |
Definition at line 915 of file qn908x.c.
References bank, ERROR_OK, LOG_DEBUG, qn908x_flash_bank::num_blocks, and qn908x_probe().
|
static |
Definition at line 416 of file qn908x.c.
References ERROR_FLASH_BUSY, ERROR_OK, QN908X_FMC_STATUS1, QN908X_FMC_STATUS1_FSH_ERA_BUSY_H_MASK, QN908X_FMC_STATUS1_FSH_ERA_BUSY_L_MASK, QN908X_FMC_STATUS1_FSH_WR_BUSY_H_MASK, QN908X_FMC_STATUS1_FSH_WR_BUSY_L_MASK, and target_read_u32().
Referenced by qn908x_wait_for_idle().
|
static |
Definition at line 524 of file qn908x.c.
References bank, BIT, ERROR_FLASH_BANK_NOT_PROBED, ERROR_FLASH_SECTOR_INVALID, ERROR_OK, LOG_DEBUG, qn908x_flash_bank::num_blocks, QN908X_DEFAULT_TIMEOUT_MS, QN908X_FLASH_PAGES_PER_BLOCK, QN908X_FMC_ERASE_CTRL, QN908X_FMC_ERASE_CTRL_PAGE_ERASEH_EN_SHIFT, QN908X_FMC_ERASE_CTRL_PAGE_ERASEL_EN_SHIFT, QN908X_FMC_ERASE_CTRL_PAGE_IDXH_SHIFT, QN908X_FMC_ERASE_CTRL_PAGE_IDXL_SHIFT, qn908x_probe(), qn908x_setup_erase(), qn908x_status_check(), qn908x_wait_for_idle(), and target_write_u32().
Referenced by qn908x_protect().
|
static |
Definition at line 942 of file qn908x.c.
References bank, cmd, command_print_sameline(), ERROR_OK, qn908x_flash_bank::num_blocks, QN908X_INFO_PAGE_BLUETOOTH_ADDR, QN908X_INFO_PAGE_BOOTLOADER_VER, QN908X_SYSCON_CHIP_ID, target_read_memory(), and target_read_u32().
|
static |
Definition at line 297 of file qn908x.c.
References CLOCK_16MHZ, CLOCK_32KHZ, CLOCK_32MHZ, ERROR_FAIL, ERROR_OK, LOG_DEBUG, QN908X_FMC_TIME_CTRL, QN908X_FMC_TIME_CTRL_PRGM_CYCLE, QN908X_FMC_TIME_CTRL_TIME_BASE, qn908x_load_lock_stat(), QN908X_SYSCON_CLK_CTRL, QN908X_SYSCON_XTAL_CTRL, SYSCON_CLK_CTRL_AHB_DIV_MASK, SYSCON_CLK_CTRL_AHB_DIV_SHIFT, SYSCON_CLK_CTRL_CLK_OSC32M_DIV_MASK, SYSCON_CLK_CTRL_CLK_XTAL_SEL_MASK, SYSCON_CLK_CTRL_SYS_CLK_SEL_MASK, SYSCON_CLK_CTRL_SYS_CLK_SEL_SHIFT, SYSCON_XTAL_CTRL_XTAL_DIV_MASK, target_read_u32(), and target_write_u32().
Referenced by COMMAND_HANDLER(), and qn908x_probe().
|
static |
Definition at line 271 of file qn908x.c.
References addr, ERROR_OK, LOG_DEBUG, QN908X_FMC_INI_RD_EN, QN908X_FMC_INI_RD_EN_INI_RD_EN_MASK, QN908X_FMC_LOCK_STAT_0, QN908X_FMC_STATUS1, QN908X_FMC_STATUS1_FSH_STA_MASK, QN908X_FMC_STATUS1_INI_RD_DONE_MASK, target_read_u32(), and target_write_u32().
Referenced by COMMAND_HANDLER(), qn908x_init_flash(), and qn908x_protect().
|
static |
Definition at line 822 of file qn908x.c.
References alloc_block_array(), bank, crc32_le(), CRC32_POLY_LE, ERROR_FAIL, ERROR_OK, is_flash_protected(), LOG_ERROR, LOG_INFO, qn908x_flash_bank::num_blocks, QN908X_FLASH_BLOCK_SIZE, QN908X_FLASH_PAGE_SIZE, QN908X_FLASH_PAGES_PER_BLOCK, QN908X_FLASH_SIZE_256K, QN908X_FLASH_SIZE_512K, QN908X_INFO_PAGE_CRC32, QN908X_INFO_PAGE_CRC_END, QN908X_INFO_PAGE_CRC_START, QN908X_INFO_PAGE_FLASH_SIZE, qn908x_init_flash(), target_buffer_get_u32(), target_read_memory(), and target_read_u32().
Referenced by qn908x_auto_probe(), and qn908x_erase().
|
static |
Definition at line 576 of file qn908x.c.
References bank, qn908x_flash_page_lock::bits, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_DEBUG, LOG_ERROR, LOG_WARNING, mask, qn908x_flash_bank::num_blocks, qn908x_flash_bank::page_lock, qn908x_flash_bank::page_lock_loaded, qn908x_flash_page_lock::protection, qn908x_erase(), QN908X_FLASH_PAGE_SIZE, QN908X_FLASH_PAGES_PER_BLOCK, QN908X_FMC_LOCK_STAT_8_PROTECT_ANY, qn908x_load_lock_stat(), qn908x_read_page_lock(), qn908x_write(), and TARGET_HALTED.
|
static |
Definition at line 924 of file qn908x.c.
References bank, qn908x_flash_page_lock::bits, ERROR_OK, qn908x_flash_bank::num_blocks, qn908x_flash_bank::page_lock, QN908X_FLASH_PAGES_PER_BLOCK, and qn908x_read_page_lock().
|
static |
Definition at line 389 of file qn908x.c.
References bank, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_DEBUG, LOG_ERROR, qn908x_flash_bank::num_blocks, qn908x_flash_bank::page_lock, qn908x_flash_bank::page_lock_loaded, qn908x_flash_page_lock::protection, QN908X_FLASH_BLOCK_SIZE, QN908X_FLASH_PAGE_SIZE, TARGET_HALTED, and target_read_memory().
Referenced by qn908x_protect(), and qn908x_protect_check().
|
static |
Definition at line 486 of file qn908x.c.
References ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_ERROR, QN908X_DEFAULT_TIMEOUT_MS, QN908X_FMC_ERASE_TIME, QN908X_FMC_SMART_CTRL, QN908X_FMC_SMART_CTRL_MAX_ERASE, QN908X_FMC_SMART_CTRL_MAX_ERASE_RETRIES, QN908X_FMC_SMART_CTRL_MAX_WRITE, QN908X_FMC_SMART_CTRL_MAX_WRITE_RETRIES, QN908X_FMC_SMART_CTRL_SMART_ERASEH_EN_MASK, QN908X_FMC_SMART_CTRL_SMART_ERASEL_EN_MASK, QN908X_SYSCON_CLK_EN, QN908X_SYSCON_CLK_EN_CLK_DP_EN_MASK, qn908x_update_reg(), qn908x_wait_for_idle(), target::state, TARGET_HALTED, and target_write_u32().
Referenced by COMMAND_HANDLER(), and qn908x_erase().
|
static |
Definition at line 431 of file qn908x.c.
References ERROR_FAIL, ERROR_OK, LOG_ERROR, QN908X_FMC_INT_STAT, QN908X_FMC_INT_STAT_AHBL_INT_MASK, QN908X_FMC_INT_STAT_ERASE_FAIL_H_INT_MASK, QN908X_FMC_INT_STAT_ERASE_FAIL_L_INT_MASK, QN908X_FMC_INT_STAT_LOCKL_INT_MASK, QN908X_FMC_INT_STAT_WRITE_FAIL_L_INT_MASK, and target_read_u32().
Referenced by COMMAND_HANDLER(), qn908x_erase(), and qn908x_write().
|
static |
Definition at line 236 of file qn908x.c.
References ERROR_OK, LOG_DEBUG, mask, TARGET_ADDR_FMT, target_read_u32(), and target_write_u32().
Referenced by qn908x_setup_erase().
|
static |
Definition at line 468 of file qn908x.c.
References ERROR_FLASH_BUSY, ERROR_OK, ERROR_TIMEOUT_REACHED, LOG_ERROR, qn908x_busy_check(), and timeval_ms().
Referenced by COMMAND_HANDLER(), qn908x_erase(), qn908x_setup_erase(), and qn908x_write().
|
static |
Definition at line 671 of file qn908x.c.
References qn908x_flash_bank::allow_swd_disabled, bank, buf_get_u32(), buffer, qn908x_flash_bank::calc_checksum, count, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, keep_alive(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, qn908x_flash_bank::num_blocks, offset, QN908X_DEFAULT_TIMEOUT_MS, QN908X_FLASH_IRQ_VECTOR_CHECKSUM_END, QN908X_FLASH_IRQ_VECTOR_CHECKSUM_POS, QN908X_FLASH_PAGE_SIZE, QN908X_FMC_SMART_CTRL, QN908X_FMC_SMART_CTRL_MAX_WRITE, QN908X_FMC_SMART_CTRL_MAX_WRITE_RETRIES, QN908X_FMC_SMART_CTRL_PRGMH_EN_MASK, QN908X_FMC_SMART_CTRL_PRGML_EN_MASK, QN908X_FMC_SMART_CTRL_SMART_WRITEH_EN_MASK, QN908X_FMC_SMART_CTRL_SMART_WRITEL_EN_MASK, qn908x_status_check(), qn908x_wait_for_idle(), TARGET_HALTED, target_write_buffer(), and target_write_u32().
Referenced by qn908x_protect().
uint8_t bits[QN908X_FLASH_MAX_BLOCKS *QN908X_FLASH_PAGES_PER_BLOCK/8] |
Definition at line 0 of file qn908x.c.
Referenced by armjtagew_tap_ensure_space(), armv4_5_get_cpsr(), avr32_ocd_clearbits(), avr32_ocd_setbits(), bitbang_execute_tms(), buspirate_tap_make_space(), COMMAND_HELPER(), gowin_read_fs_file_bitsequence(), jtag_check_value_inner(), jtag_vpi_queue_tdi(), jtag_vpi_queue_tdi_xfer(), jtag_vpi_tms_seq(), opendous_tap_append_step(), opendous_tap_ensure_space(), openjtag_add_scan(), openjtag_execute_tap_queue(), poll_target(), syncbb_execute_tms(), tap_state_queue_run(), target_address_max(), ublast_queue_tdi(), ublast_tms_seq(), vsllink_tms(), wait_for_debugint_clear(), xds110_flush(), xlnx_pcie_xvc_execute_tms(), xtensa_core_status_clear(), and xtensa_dm_core_status_clear().
uint8_t protection |
Definition at line 1 of file qn908x.c.
Referenced by COMMAND_HANDLER(), em357_protect(), em357_protect_check(), get_psoc4_info(), get_silicon_id(), protection_to_str(), psoc4_decode_chip_protection(), psoc4_get_silicon_id(), stm32x_protect(), stm32x_protect_check(), and xmc4xxx_protect_check().
|
static |
|
static |
const struct flash_driver qn908x_flash |