OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | samv_flash_bank |
Macros | |
#define | OFFSET_EFC_FCR 4 |
#define | OFFSET_EFC_FMR 0 |
#define | OFFSET_EFC_FRR 12 |
#define | OFFSET_EFC_FSR 8 |
#define | REG_NAME_WIDTH (12) |
#define | SAMV_CHIPID_CIDR (0x400E0940) |
#define | SAMV_CONTROLLER_ADDR (0x400e0c00) |
#define | SAMV_EFC_FCMD_CFB (0xC) /* (EFC) Clear Fuse Bit */ |
#define | SAMV_EFC_FCMD_CLB (0x9) /* (EFC) Clear Lock Bit */ |
#define | SAMV_EFC_FCMD_EA (0x5) /* (EFC) Erase All */ |
#define | SAMV_EFC_FCMD_EPA (0x7) /* (EFC) Erase pages */ |
#define | SAMV_EFC_FCMD_EUS (0x13) /* (EFC) Erase User Signature */ |
#define | SAMV_EFC_FCMD_EWP (0x3) /* (EFC) Erase Page and Write Page */ |
#define | SAMV_EFC_FCMD_EWPL (0x4) /* (EFC) Erase Page, Write Page then Lock*/ |
#define | SAMV_EFC_FCMD_GETD (0x0) /* (EFC) Get Flash Descriptor */ |
#define | SAMV_EFC_FCMD_GFB (0xD) /* (EFC) Get Fuse Bit */ |
#define | SAMV_EFC_FCMD_GLB (0xA) /* (EFC) Get Lock Bit */ |
#define | SAMV_EFC_FCMD_SFB (0xB) /* (EFC) Set Fuse Bit */ |
#define | SAMV_EFC_FCMD_SLB (0x8) /* (EFC) Set Lock Bit */ |
#define | SAMV_EFC_FCMD_SPUS (0x15) /* (EFC) Stop Read User Signature */ |
#define | SAMV_EFC_FCMD_STUS (0x14) /* (EFC) Start Read User Signature */ |
#define | SAMV_EFC_FCMD_WP (0x1) /* (EFC) Write Page */ |
#define | SAMV_EFC_FCMD_WPL (0x2) /* (EFC) Write Page and Lock */ |
#define | SAMV_EFC_FCMD_WUS (0x12) /* (EFC) Write User Signature */ |
#define | SAMV_EFC_FMR_SCOD BIT(16) /* Sequantial Code Optimalization Disable */ |
#define | SAMV_EFC_FRS_FRDY_CLR 0 |
#define | SAMV_EFC_FSR_FRDY_SET 1 |
#define | SAMV_FLASH_BASE 0x00400000 |
#define | SAMV_FLASH_SIGNATURE_BASE 0x100000000 |
#define | SAMV_FLASH_SIGNATURE_SIZE SAMV_PAGE_SIZE |
#define | SAMV_NUM_GPNVM_BITS 9 |
#define | SAMV_PAGE_SIZE 512 |
#define | SAMV_SECTOR_SIZE 16384 |
#define | TIMEOUT_MS_CMD_DEFAULT 50 /* Default timeout for command */ |
#define | TIMEOUT_MS_CMD_ERASE 24000 /* Timeout for erase commands */ |
#define | TIMEOUT_MS_FRS_CHANGE 10 /* Timeout for FRS ready bit change */ |
Functions | |
COMMAND_HANDLER (samv_handle_gpnvm_command) | |
FLASH_BANK_COMMAND_HANDLER (samv_flash_bank_command) | |
static int | samv_auto_probe (struct flash_bank *bank) |
static int | samv_clear_gpnvm (struct target *target, unsigned int gpnvm) |
static int | samv_efc_get_mode (struct target *target, uint32_t *v) |
static int | samv_efc_get_result (struct target *target, uint32_t *v) |
static int | samv_efc_get_status (struct target *target, uint32_t *v) |
static int | samv_efc_perform_command (struct target *target, uint8_t command, unsigned int argument, uint32_t *status) |
static int | samv_efc_read_sequence (struct target *target, uint8_t start_cmd, uint8_t stop_cmd, uint8_t *buf, size_t read_size) |
static int | samv_efc_set_mode (struct target *target, uint32_t v) |
static int | samv_efc_start_command (struct target *target, uint8_t command, unsigned int argument) |
static int | samv_efc_wait_status (struct target *target, uint8_t desired, int64_t timeout, uint32_t *status) |
static int | samv_erase (struct flash_bank *bank, unsigned int first, unsigned int last) |
static int | samv_erase_pages (struct target *target, int first_page, int num_pages, uint32_t *status) |
static int | samv_erase_user_signature (struct target *target) |
static int | samv_flash_lock (struct target *target, unsigned int start_sector, unsigned int end_sector) |
static int | samv_flash_unlock (struct target *target, unsigned int start_sector, unsigned int end_sector) |
static int | samv_get_device_id (struct flash_bank *bank, uint32_t *device_id) |
static int | samv_get_gpnvm (struct target *target, unsigned int gpnvm, unsigned int *out) |
static int | samv_get_info (struct flash_bank *bank, struct command_invocation *cmd) |
static int | samv_page_read (struct target *target, target_addr_t base, unsigned int page_num, uint8_t *buf) |
static int | samv_page_write (struct target *target, target_addr_t base, unsigned int pagenum, const uint8_t *buf) |
static int | samv_probe (struct flash_bank *bank) |
static int | samv_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | samv_protect_check (struct flash_bank *bank) |
static int | samv_read (struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | samv_read_standard_page (struct target *target, unsigned int page_num, uint8_t *buf) |
static int | samv_read_user_signature (struct target *target, uint8_t *buf) |
static int | samv_set_gpnvm (struct target *target, unsigned int gpnvm) |
static int | samv_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | samv_write_standard_page (struct target *target, unsigned int pagenum, const uint8_t *buf) |
static int | samv_write_user_signature (struct target *target, unsigned int pagenum, const uint8_t *buf) |
Variables | |
static const struct command_registration | atsamv_command_handlers [] |
static const struct command_registration | atsamv_exec_command_handlers [] |
const struct flash_driver | atsamv_flash |
#define SAMV_EFC_FCMD_EUS (0x13) /* (EFC) Erase User Signature */ |
#define SAMV_EFC_FCMD_EWP (0x3) /* (EFC) Erase Page and Write Page */ |
#define SAMV_EFC_FCMD_EWPL (0x4) /* (EFC) Erase Page, Write Page then Lock*/ |
#define SAMV_EFC_FCMD_GETD (0x0) /* (EFC) Get Flash Descriptor */ |
#define SAMV_EFC_FCMD_SPUS (0x15) /* (EFC) Stop Read User Signature */ |
#define SAMV_EFC_FCMD_STUS (0x14) /* (EFC) Start Read User Signature */ |
#define SAMV_EFC_FCMD_WPL (0x2) /* (EFC) Write Page and Lock */ |
#define SAMV_EFC_FCMD_WUS (0x12) /* (EFC) Write User Signature */ |
#define SAMV_EFC_FMR_SCOD BIT(16) /* Sequantial Code Optimalization Disable */ |
#define SAMV_FLASH_SIGNATURE_SIZE SAMV_PAGE_SIZE |
#define TIMEOUT_MS_CMD_ERASE 24000 /* Timeout for erase commands */ |
#define TIMEOUT_MS_FRS_CHANGE 10 /* Timeout for FRS ready bit change */ |
FLASH_BANK_COMMAND_HANDLER | ( | samv_flash_bank_command | ) |
|
static |
Definition at line 483 of file atsamv.c.
References bank, ERROR_OK, samv_flash_bank::probed, and samv_probe().
Referenced by samv_erase().
|
static |
Definition at line 300 of file atsamv.c.
References ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, NULL, SAMV_EFC_FCMD_CFB, samv_efc_perform_command(), samv_get_gpnvm(), and SAMV_NUM_GPNVM_BITS.
|
inlinestatic |
Definition at line 140 of file atsamv.c.
References OFFSET_EFC_FMR, SAMV_CONTROLLER_ADDR, and target_read_u32().
Referenced by samv_efc_read_sequence().
|
static |
Definition at line 131 of file atsamv.c.
References OFFSET_EFC_FRR, SAMV_CONTROLLER_ADDR, and target_read_u32().
Referenced by samv_get_gpnvm(), and samv_protect_check().
|
static |
Definition at line 95 of file atsamv.c.
References OFFSET_EFC_FSR, SAMV_CONTROLLER_ADDR, and target_read_u32().
Referenced by samv_efc_perform_command(), and samv_efc_wait_status().
|
static |
Definition at line 163 of file atsamv.c.
References ERROR_FAIL, ERROR_OK, SAMV_EFC_FCMD_EA, SAMV_EFC_FCMD_EPA, SAMV_EFC_FCMD_EUS, SAMV_EFC_FSR_FRDY_SET, samv_efc_get_status(), samv_efc_start_command(), samv_efc_wait_status(), status, TIMEOUT_MS_CMD_DEFAULT, and TIMEOUT_MS_CMD_ERASE.
Referenced by samv_clear_gpnvm(), samv_erase(), samv_erase_pages(), samv_erase_user_signature(), samv_flash_lock(), samv_flash_unlock(), samv_get_gpnvm(), samv_protect_check(), samv_set_gpnvm(), samv_write_standard_page(), and samv_write_user_signature().
|
static |
Definition at line 198 of file atsamv.c.
References addr, ERROR_OK, LOG_ERROR, NULL, SAMV_EFC_FMR_SCOD, SAMV_EFC_FRS_FRDY_CLR, SAMV_EFC_FSR_FRDY_SET, samv_efc_get_mode(), samv_efc_set_mode(), samv_efc_start_command(), samv_efc_wait_status(), SAMV_FLASH_BASE, target_read_memory(), and TIMEOUT_MS_FRS_CHANGE.
Referenced by samv_read_user_signature().
|
inlinestatic |
Definition at line 145 of file atsamv.c.
References OFFSET_EFC_FMR, SAMV_CONTROLLER_ADDR, and target_write_u32().
Referenced by samv_efc_read_sequence().
|
static |
Definition at line 150 of file atsamv.c.
References ERROR_OK, LOG_DEBUG, OFFSET_EFC_FCR, SAMV_CONTROLLER_ADDR, and target_write_u32().
Referenced by samv_efc_perform_command(), and samv_efc_read_sequence().
|
static |
Definition at line 101 of file atsamv.c.
References ERROR_FLASH_BUSY, ERROR_OK, LOG_ERROR, samv_efc_get_status(), status, and timeval_ms().
Referenced by samv_efc_perform_command(), and samv_efc_read_sequence().
|
static |
Definition at line 491 of file atsamv.c.
References bank, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_DEBUG, LOG_ERROR, NULL, samv_auto_probe(), SAMV_EFC_FCMD_EA, samv_efc_perform_command(), samv_erase_pages(), samv_erase_user_signature(), SAMV_FLASH_SIGNATURE_BASE, status, and TARGET_HALTED.
|
static |
Definition at line 243 of file atsamv.c.
References SAMV_EFC_FCMD_EPA, samv_efc_perform_command(), and status.
Referenced by samv_erase().
|
static |
Definition at line 340 of file atsamv.c.
References ERROR_OK, LOG_ERROR, NULL, SAMV_EFC_FCMD_EUS, and samv_efc_perform_command().
Referenced by samv_erase().
|
static |
Definition at line 371 of file atsamv.c.
References ERROR_OK, SAMV_EFC_FCMD_SLB, samv_efc_perform_command(), SAMV_PAGE_SIZE, SAMV_SECTOR_SIZE, and status.
Referenced by samv_protect().
|
static |
Definition at line 351 of file atsamv.c.
References ERROR_OK, SAMV_EFC_FCMD_CLB, samv_efc_perform_command(), SAMV_PAGE_SIZE, SAMV_SECTOR_SIZE, and status.
Referenced by samv_protect().
|
static |
Definition at line 419 of file atsamv.c.
References bank, SAMV_CHIPID_CIDR, and target_read_u32().
Referenced by samv_probe().
|
static |
Definition at line 276 of file atsamv.c.
References ERROR_FAIL, ERROR_OK, LOG_ERROR, NULL, SAMV_EFC_FCMD_GFB, samv_efc_get_result(), samv_efc_perform_command(), and SAMV_NUM_GPNVM_BITS.
Referenced by samv_clear_gpnvm(), and samv_set_gpnvm().
|
static |
Definition at line 783 of file atsamv.c.
References bank, cmd, command_print_sameline(), ERROR_OK, samv_flash_bank::probed, and samv_probe().
|
static |
Definition at line 570 of file atsamv.c.
References SAMV_FLASH_SIGNATURE_BASE, samv_read_standard_page(), and samv_read_user_signature().
Referenced by samv_write().
|
static |
Definition at line 630 of file atsamv.c.
References SAMV_FLASH_SIGNATURE_BASE, samv_write_standard_page(), and samv_write_user_signature().
Referenced by samv_write().
|
static |
Definition at line 424 of file atsamv.c.
References bank, eproc, ERROR_FAIL, ERROR_OK, LOG_ERROR, LOG_INFO, samv_flash_bank::probed, SAMV_FLASH_BASE, SAMV_FLASH_SIGNATURE_BASE, SAMV_FLASH_SIGNATURE_SIZE, samv_get_device_id(), samv_protect_check(), SAMV_SECTOR_SIZE, and samv_flash_bank::size_bytes.
Referenced by samv_auto_probe(), and samv_get_info().
|
static |
Definition at line 532 of file atsamv.c.
References bank, ERROR_TARGET_NOT_HALTED, LOG_ERROR, samv_flash_lock(), samv_flash_unlock(), and TARGET_HALTED.
|
static |
Definition at line 391 of file atsamv.c.
References bank, ERROR_OK, NULL, SAMV_EFC_FCMD_GLB, samv_efc_get_result(), and samv_efc_perform_command().
Referenced by samv_probe().
|
static |
Definition at line 642 of file atsamv.c.
References bank, buffer, count, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_DEBUG, LOG_ERROR, LOG_WARNING, offset, SAMV_FLASH_SIGNATURE_BASE, SAMV_PAGE_SIZE, samv_read_user_signature(), target::state, TARGET_HALTED, and target_read_memory().
|
static |
Definition at line 549 of file atsamv.c.
References addr, ERROR_OK, LOG_ERROR, SAMV_FLASH_BASE, SAMV_PAGE_SIZE, and target_read_memory().
Referenced by samv_page_read().
|
static |
Definition at line 560 of file atsamv.c.
References SAMV_EFC_FCMD_SPUS, SAMV_EFC_FCMD_STUS, samv_efc_read_sequence(), and SAMV_PAGE_SIZE.
Referenced by samv_page_read(), and samv_read().
|
static |
Definition at line 319 of file atsamv.c.
References ERROR_FAIL, ERROR_OK, LOG_ERROR, NULL, SAMV_EFC_FCMD_SFB, samv_efc_perform_command(), samv_get_gpnvm(), and SAMV_NUM_GPNVM_BITS.
|
static |
Definition at line 677 of file atsamv.c.
References bank, buffer, count, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_DEBUG, LOG_ERROR, offset, samv_page_read(), SAMV_PAGE_SIZE, samv_page_write(), and TARGET_HALTED.
|
static |
Definition at line 602 of file atsamv.c.
References addr, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, SAMV_EFC_FCMD_WP, samv_efc_perform_command(), SAMV_FLASH_BASE, SAMV_PAGE_SIZE, status, and target_write_memory().
Referenced by samv_page_write().
|
static |
Definition at line 582 of file atsamv.c.
References addr, ERROR_OK, LOG_ERROR, NULL, SAMV_EFC_FCMD_WUS, samv_efc_perform_command(), SAMV_FLASH_BASE, SAMV_PAGE_SIZE, and target_write_memory().
Referenced by samv_page_write().
|
static |
|
static |
const struct flash_driver atsamv_flash |