OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | samd_family |
struct | samd_info |
struct | samd_part |
Macros | |
#define | NVMUSERROW_SAM_E5_D5_MASK ((uint64_t)0x7FFF00FF3C007FFF) |
#define | SAMD_CMDEX_KEY 0xA5UL |
#define | SAMD_DSU 0x41002000 /* Device Service Unit */ |
#define | SAMD_DSU_CTRL_EXT 0x100 /* CTRL register, external access */ |
#define | SAMD_DSU_DID 0x18 /* Device ID register */ |
#define | SAMD_DSU_STATUSA 1 /* DSU status register */ |
#define | SAMD_FAMILY_D 0x00 |
#define | SAMD_FAMILY_E 0x03 |
#define | SAMD_FLASH 0x00000000 /* physical Flash memory */ |
#define | SAMD_GET_DEVSEL(id) (id & 0xFF) |
#define | SAMD_GET_FAMILY(id) (((id >> 23) & 0x1F)) |
#define | SAMD_GET_PROCESSOR(id) (id >> 28) |
#define | SAMD_GET_SERIES(id) (((id >> 16) & 0x3F)) |
#define | SAMD_NVM_CMD(n) ((SAMD_CMDEX_KEY << 8) | (n & 0x7F)) |
#define | SAMD_NVMCTRL 0x41004000 /* Non-volatile memory controller */ |
#define | SAMD_NVMCTRL_PARAM 0x08 /* NVM parameters register */ |
#define | SAMD_PAGE_SIZE_MAX 1024 |
#define | SAMD_PROCESSOR_M0 0x01 |
#define | SAMD_PROCESSOR_M4 0x06 |
#define | SAMD_SERIES_51 0x06 |
#define | SAMD_USER_ROW 0x00804000 /* User Row of Flash */ |
#define | SAME5_NUM_PROT_BLOCKS 32 |
#define | SAME5_NVM_CMD_EB 0x01 /* Erase Block */ |
#define | SAME5_NVM_CMD_EP 0x00 /* Erase Page (User Page only) */ |
#define | SAME5_NVM_CMD_LR 0x11 /* Lock Region */ |
#define | SAME5_NVM_CMD_PBC 0x15 /* Page Buffer Clear */ |
#define | SAME5_NVM_CMD_SSB 0x16 /* Set Security Bit */ |
#define | SAME5_NVM_CMD_UR 0x12 /* Unlock Region */ |
#define | SAME5_NVM_CMD_WP 0x03 /* Write Page */ |
#define | SAME5_NVM_CMD_WQW 0x04 /* Write Quad Word */ |
#define | SAME5_NVMCTRL_ADDR 0x14 /* NVM address register */ |
#define | SAME5_NVMCTRL_CTRLA 0x00 /* NVM control A register */ |
#define | SAME5_NVMCTRL_CTRLA_WMODE_MASK 0x30 |
#define | SAME5_NVMCTRL_CTRLB 0x04 /* NVM control B register */ |
#define | SAME5_NVMCTRL_INTFLAG 0x10 /* NVM interrupt flag register */ |
#define | SAME5_NVMCTRL_INTFLAG_ADDRE (1 << 1) |
#define | SAME5_NVMCTRL_INTFLAG_DONE (1 << 0) |
#define | SAME5_NVMCTRL_INTFLAG_ECCDE (1 << 5) |
#define | SAME5_NVMCTRL_INTFLAG_ECCSE (1 << 4) |
#define | SAME5_NVMCTRL_INTFLAG_LOCKE (1 << 3) |
#define | SAME5_NVMCTRL_INTFLAG_NVME (1 << 6) |
#define | SAME5_NVMCTRL_INTFLAG_PROGE (1 << 2) |
#define | SAME5_NVMCTRL_LOCK 0x18 /* NVM Lock section register */ |
#define | SAME5_NVMCTRL_STATUS 0x12 /* NVM status register */ |
#define | SAME5_PAC 0x40000000 /* Peripheral Access Control */ |
#define | SAME5_PAGES_PER_BLOCK 16 |
#define | SAME_SERIES_51 0x01 |
#define | SAME_SERIES_53 0x03 |
#define | SAME_SERIES_54 0x04 |
Functions | |
COMMAND_HANDLER (samd_handle_reset_deassert) | |
COMMAND_HANDLER (same5_handle_bootloader_command) | |
COMMAND_HANDLER (same5_handle_chip_erase_command) | |
COMMAND_HANDLER (same5_handle_userpage_command) | |
FLASH_BANK_COMMAND_HANDLER (same5_flash_bank_command) | |
static const struct samd_family * | samd_find_family (uint32_t id) |
Gives the family structure to specific device id. More... | |
static const struct samd_part * | samd_find_part (uint32_t id) |
Gives the part structure to specific device id. More... | |
static int | samd_get_flash_page_info (struct target *target, uint32_t *sizep, int *nump) |
static int | same5_erase (struct flash_bank *bank, unsigned int first, unsigned int last) |
static int | same5_erase_block (struct target *target, uint32_t address) |
Erases a flash block or page at the given address. More... | |
static int | same5_issue_nvmctrl_command (struct target *target, uint16_t cmd) |
static int | same5_modify_user_row (struct target *target, uint32_t value, uint8_t startb, uint8_t endb) |
Modifies the user row register to the given value. More... | |
static int | same5_modify_user_row_masked (struct target *target, const uint8_t *data, const uint8_t *mask, uint32_t offset, uint32_t count) |
Modify the contents of the User Row in Flash. More... | |
static int | same5_pre_write_check (struct target *target) |
static int | same5_probe (struct flash_bank *bank) |
static int | same5_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | same5_protect_check (struct flash_bank *bank) |
static int | same5_wait_and_check_error (struct target *target) |
static int | same5_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
Variables | |
const struct flash_driver | atsame5_flash |
static const struct samd_part | samd51_parts [] |
static const struct samd_family | samd_families [] |
static const struct samd_part | same51_parts [] |
static const struct samd_part | same53_parts [] |
static const struct samd_part | same54_parts [] |
static const struct command_registration | same5_command_handlers [] |
static const struct command_registration | same5_exec_command_handlers [] |
#define NVMUSERROW_SAM_E5_D5_MASK ((uint64_t)0x7FFF00FF3C007FFF) |
#define SAMD_DSU_CTRL_EXT 0x100 /* CTRL register, external access */ |
#define SAMD_NVM_CMD | ( | n | ) | ((SAMD_CMDEX_KEY << 8) | (n & 0x7F)) |
#define SAMD_NVMCTRL 0x41004000 /* Non-volatile memory controller */ |
#define SAMD_NVMCTRL_PARAM 0x08 /* NVM parameters register */ |
#define SAME5_NVM_CMD_EP 0x00 /* Erase Page (User Page only) */ |
#define SAME5_NVMCTRL_CTRLA 0x00 /* NVM control A register */ |
#define SAME5_NVMCTRL_CTRLB 0x04 /* NVM control B register */ |
#define SAME5_NVMCTRL_INTFLAG 0x10 /* NVM interrupt flag register */ |
#define SAME5_NVMCTRL_LOCK 0x18 /* NVM Lock section register */ |
#define SAME5_NVMCTRL_STATUS 0x12 /* NVM status register */ |
#define SAME5_PAC 0x40000000 /* Peripheral Access Control */ |
COMMAND_HANDLER | ( | same5_handle_bootloader_command | ) |
Definition at line 826 of file atsame5.c.
References CMD, CMD_ARGC, CMD_ARGV, CMD_CTX, COMMAND_PARSE_NUMBER, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, get_current_target(), SAMD_USER_ROW, same5_modify_user_row(), size, and target_read_u32().
COMMAND_HANDLER | ( | same5_handle_chip_erase_command | ) |
Definition at line 758 of file atsame5.c.
References CMD, CMD_CTX, command_print(), ERROR_FAIL, ERROR_OK, get_current_target(), SAMD_DSU, SAMD_DSU_CTRL_EXT, SAME5_PAC, target_write_u32(), and target_write_u8().
COMMAND_HANDLER | ( | same5_handle_userpage_command | ) |
Definition at line 780 of file atsame5.c.
References buffer, CMD, CMD_ARGC, CMD_ARGV, CMD_CTX, COMMAND_PARSE_NUMBER, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, get_current_target(), LOG_ERROR, mask, NVMUSERROW_SAM_E5_D5_MASK, SAMD_USER_ROW, same5_modify_user_row_masked(), target_buffer_get_u64(), target_buffer_set_u64(), and target_read_memory().
FLASH_BANK_COMMAND_HANDLER | ( | same5_flash_bank_command | ) |
Definition at line 734 of file atsame5.c.
References bank, ERROR_FAIL, ERROR_OK, LOG_ERROR, samd_info::probed, SAMD_FLASH, samd_info::target, and TARGET_ADDR_FMT.
|
static |
Gives the family structure to specific device id.
id | The id of the device. |
Definition at line 191 of file atsame5.c.
References ARRAY_SIZE, samd_family::family, NULL, samd_family::processor, samd_families, SAMD_GET_FAMILY, SAMD_GET_PROCESSOR, SAMD_GET_SERIES, and samd_family::series.
Referenced by samd_find_part().
|
static |
Gives the part structure to specific device id.
id | The id of the device. |
Definition at line 212 of file atsame5.c.
References samd_family::family, NULL, samd_find_family(), and SAMD_GET_DEVSEL.
Referenced by same5_probe().
|
static |
Definition at line 244 of file atsame5.c.
References ERROR_OK, LOG_ERROR, param, SAMD_NVMCTRL, SAMD_NVMCTRL_PARAM, and target_read_u32().
Referenced by same5_modify_user_row_masked(), and same5_probe().
|
static |
Definition at line 619 of file atsame5.c.
References bank, ERROR_FLASH_BANK_NOT_PROBED, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_ERROR, samd_info::probed, same5_erase_block(), and TARGET_HALTED.
|
static |
Erases a flash block or page at the given address.
target | Pointer to the target structure. |
address | The address of the row. |
Definition at line 424 of file atsame5.c.
References ERROR_FAIL, ERROR_OK, LOG_ERROR, SAMD_NVMCTRL, SAMD_USER_ROW, same5_issue_nvmctrl_command(), SAME5_NVM_CMD_EB, SAME5_NVM_CMD_EP, SAME5_NVMCTRL_ADDR, and target_write_u32().
Referenced by same5_erase(), and same5_modify_user_row_masked().
|
static |
Definition at line 398 of file atsame5.c.
References cmd, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_ERROR, SAMD_NVM_CMD, SAMD_NVMCTRL, SAME5_NVMCTRL_CTRLB, same5_wait_and_check_error(), target::state, TARGET_HALTED, and target_write_u32().
Referenced by same5_erase_block(), same5_modify_user_row_masked(), same5_protect(), and same5_write().
|
static |
Modifies the user row register to the given value.
target | Pointer to the target structure. |
value | The value to write. |
startb | The bit-offset by which the given value is shifted. |
endb | The bit-offset of the last bit in value to write. |
Definition at line 553 of file atsame5.c.
References buf_set_u32(), and same5_modify_user_row_masked().
Referenced by COMMAND_HANDLER().
|
static |
Modify the contents of the User Row in Flash.
The User Row itself has a size of one page and contains a combination of "fuses" and calibration data. Bits which have a value of zero in the mask will not be changed.
target | Pointer to the target structure. |
data | Pointer to the value to write. |
mask | Pointer to bitmask, 0 -> value stays untouched. |
offset | Offset in user row where new data will be applied. |
count | Size of buffer and mask in bytes. |
Definition at line 482 of file atsame5.c.
References changed, count, ERROR_OK, LOG_ERROR, mask, NULL, offset, samd_info::page_size, samd_get_flash_page_info(), SAMD_PAGE_SIZE_MAX, SAMD_USER_ROW, same5_erase_block(), same5_issue_nvmctrl_command(), SAME5_NVM_CMD_WQW, same5_pre_write_check(), target_read_memory(), and target_write_memory().
Referenced by COMMAND_HANDLER(), same5_modify_user_row(), and same5_protect().
|
static |
Definition at line 446 of file atsame5.c.
References ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_ERROR, SAMD_NVMCTRL, SAME5_NVMCTRL_CTRLA, SAME5_NVMCTRL_CTRLA_WMODE_MASK, target::state, TARGET_HALTED, and target_read_u32().
Referenced by same5_modify_user_row_masked(), and same5_write().
|
static |
Definition at line 266 of file atsame5.c.
References alloc_block_array(), bank, ERROR_FAIL, ERROR_OK, id, LOG_ERROR, LOG_INFO, LOG_WARNING, samd_info::num_pages, samd_info::page_size, samd_info::probed, samd_info::prot_block_size, SAMD_DSU, SAMD_DSU_DID, samd_find_part(), samd_get_flash_page_info(), SAME5_NUM_PROT_BLOCKS, SAME5_PAGES_PER_BLOCK, same5_protect_check(), samd_info::sector_size, and target_read_u32().
|
static |
Definition at line 567 of file atsame5.c.
References bank, buf_set_u32(), ERROR_OK, ERROR_TARGET_NOT_HALTED, LOG_ERROR, LOG_WARNING, mask, SAMD_NVMCTRL, same5_issue_nvmctrl_command(), same5_modify_user_row_masked(), SAME5_NVM_CMD_LR, SAME5_NVM_CMD_UR, SAME5_NVMCTRL_ADDR, same5_protect_check(), TARGET_HALTED, and target_write_u32().
|
static |
Definition at line 227 of file atsame5.c.
References bank, ERROR_OK, SAMD_NVMCTRL, SAME5_NVMCTRL_LOCK, and target_read_u32().
Referenced by same5_probe(), and same5_protect().
|
static |
Definition at line 334 of file atsame5.c.
References ERROR_FLASH_OPER_UNSUPPORTED, ERROR_FLASH_OPERATION_FAILED, ERROR_FLASH_PROTECTED, ERROR_OK, keep_alive(), LOG_ERROR, SAMD_NVMCTRL, SAME5_NVMCTRL_INTFLAG, SAME5_NVMCTRL_INTFLAG_ADDRE, SAME5_NVMCTRL_INTFLAG_DONE, SAME5_NVMCTRL_INTFLAG_ECCDE, SAME5_NVMCTRL_INTFLAG_ECCSE, SAME5_NVMCTRL_INTFLAG_LOCKE, SAME5_NVMCTRL_INTFLAG_NVME, SAME5_NVMCTRL_INTFLAG_PROGE, target_read_u16(), target_write_u16(), and timeval_ms().
Referenced by same5_issue_nvmctrl_command().
|
static |
Definition at line 647 of file atsame5.c.
References bank, buffer, count, ERROR_FAIL, ERROR_FLASH_BANK_NOT_PROBED, ERROR_OK, LOG_ERROR, NULL, offset, samd_info::page_size, samd_info::probed, same5_issue_nvmctrl_command(), SAME5_NVM_CMD_PBC, SAME5_NVM_CMD_WP, same5_pre_write_check(), and target_write_memory().
const struct flash_driver atsame5_flash |
|
static |
|
static |
Definition at line 1 of file atsame5.c.
Referenced by samd_find_family().
|
static |
|
static |
|
static |
|
static |
|
static |