OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | stmsmi_flash_bank |
struct | stmsmi_target |
Macros | |
#define | SMI_BANK_SIZE (0x01000000) |
#define | SMI_CLEAR_TFF() SMI_WRITE_REG(SMI_SR, ~SMI_TFF) |
#define | SMI_CMD_TIMEOUT (100) |
#define | SMI_CR1 (0x00) /* Control register 1 */ |
#define | SMI_CR2 (0x04) /* Control register 2 */ |
#define | SMI_MAX_TIMEOUT (3000) |
#define | SMI_POLL_TFF(timeout) |
#define | SMI_PROBE_TIMEOUT (100) |
#define | SMI_READ_ID 0x0000009F /* Read Flash Identification */ |
#define | SMI_READ_REG(a) |
#define | SMI_RR (0x10) /* RX */ |
#define | SMI_RSR 0x00000400 /* reads status reg */ |
#define | SMI_RX_LEN_3 0x00000030 /* data length = 3 byte */ |
#define | SMI_SEL_BANK0 0x00000000 /* Select Bank0 */ |
#define | SMI_SEL_BANK1 0x00001000 /* Select Bank1 */ |
#define | SMI_SEL_BANK2 0x00002000 /* Select Bank2 */ |
#define | SMI_SEL_BANK3 0x00003000 /* Select Bank3 */ |
#define | SMI_SEND 0x00000080 /* Send data */ |
#define | SMI_SET_HW_MODE() |
#define | SMI_SET_HWWB_MODE() |
#define | SMI_SET_SW_MODE() |
#define | SMI_SR (0x08) /* Status register */ |
#define | SMI_SW_MODE 0x10000000 /* set to enable SW Mode */ |
#define | SMI_TFF 0x00000100 /* Transfer Finished Flag */ |
#define | SMI_TR (0x0c) /* TX */ |
#define | SMI_TX_LEN_1 0x00000001 /* data length = 1 byte */ |
#define | SMI_TX_LEN_4 0x00000004 /* data length = 4 byte */ |
#define | SMI_WB_MODE 0x20000000 /* Write Burst Mode */ |
#define | SMI_WE 0x00000800 /* Write Enable */ |
#define | SMI_WRITE_REG(a, v) |
Functions | |
static uint32_t | erase_command (struct stmsmi_flash_bank *stmsmi_info, uint32_t offset) |
FLASH_BANK_COMMAND_HANDLER (stmsmi_flash_bank_command) | |
static int | get_stmsmi_info (struct flash_bank *bank, struct command_invocation *cmd) |
static int | poll_tff (struct target *target, uint32_t io_base, int timeout) |
static int | read_flash_id (struct flash_bank *bank, uint32_t *id) |
static int | read_status_reg (struct flash_bank *bank, uint32_t *status) |
static int | smi_erase_sector (struct flash_bank *bank, int sector) |
static int | smi_write_buffer (struct flash_bank *bank, const uint8_t *buffer, uint32_t address, uint32_t len) |
static int | smi_write_enable (struct flash_bank *bank) |
static int | stmsmi_auto_probe (struct flash_bank *bank) |
static int | stmsmi_erase (struct flash_bank *bank, unsigned int first, unsigned int last) |
static int | stmsmi_probe (struct flash_bank *bank) |
static int | stmsmi_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | stmsmi_protect_check (struct flash_bank *bank) |
static int | stmsmi_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | wait_till_ready (struct flash_bank *bank, int timeout) |
Variables | |
const struct flash_driver | stmsmi_flash |
static const struct stmsmi_target | target_devices [] |
#define SMI_CLEAR_TFF | ( | ) | SMI_WRITE_REG(SMI_SR, ~SMI_TFF) |
#define SMI_POLL_TFF | ( | timeout | ) |
#define SMI_READ_ID 0x0000009F /* Read Flash Identification */ |
#define SMI_READ_REG | ( | a | ) |
#define SMI_SET_HW_MODE | ( | ) |
#define SMI_SET_HWWB_MODE | ( | ) |
#define SMI_SET_SW_MODE | ( | ) |
#define SMI_WRITE_REG | ( | a, | |
v | |||
) |
|
static |
Definition at line 257 of file stmsmi.c.
References stmsmi_flash_bank::dev, flash_device::erase_cmd, le_to_h_u32(), and offset.
Referenced by smi_erase_sector().
FLASH_BANK_COMMAND_HANDLER | ( | stmsmi_flash_bank_command | ) |
Definition at line 126 of file stmsmi.c.
References bank, CMD_ARGC, ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, and stmsmi_flash_bank::probed.
|
static |
Definition at line 623 of file stmsmi.c.
References bank, cmd, command_print_sameline(), stmsmi_flash_bank::dev, flash_device::device_id, ERROR_OK, flash_device::name, and stmsmi_flash_bank::probed.
|
static |
Definition at line 149 of file stmsmi.c.
References alive_sleep(), ERROR_FLASH_OPERATION_FAILED, ERROR_OK, LOG_ERROR, SMI_READ_REG, SMI_SR, SMI_TFF, and timeval_ms().
|
static |
Definition at line 471 of file stmsmi.c.
References bank, stmsmi_flash_bank::bank_num, ERROR_OK, ERROR_TARGET_NOT_HALTED, stmsmi_flash_bank::io_base, LOG_ERROR, SMI_CLEAR_TFF, SMI_CMD_TIMEOUT, SMI_CR2, SMI_POLL_TFF, SMI_PROBE_TIMEOUT, SMI_READ_ID, SMI_READ_REG, SMI_RR, SMI_RX_LEN_3, SMI_SEND, SMI_SET_SW_MODE, SMI_TR, SMI_TX_LEN_1, SMI_WRITE_REG, target::state, TARGET_HALTED, and wait_till_ready().
Referenced by stmsmi_probe().
|
static |
Definition at line 170 of file stmsmi.c.
References bank, stmsmi_flash_bank::bank_num, ERROR_OK, stmsmi_flash_bank::io_base, SMI_CLEAR_TFF, SMI_CMD_TIMEOUT, SMI_CR2, SMI_POLL_TFF, SMI_READ_REG, SMI_RSR, SMI_SR, SMI_WRITE_REG, and status.
Referenced by smi_write_enable(), and wait_till_ready().
|
static |
Definition at line 270 of file stmsmi.c.
References bank, stmsmi_flash_bank::bank_num, cmd, erase_command(), ERROR_OK, stmsmi_flash_bank::io_base, SMI_CLEAR_TFF, SMI_CMD_TIMEOUT, SMI_CR2, SMI_MAX_TIMEOUT, SMI_POLL_TFF, SMI_SEND, SMI_SET_SW_MODE, SMI_TR, SMI_TX_LEN_4, smi_write_enable(), SMI_WRITE_REG, and wait_till_ready().
Referenced by stmsmi_erase().
|
static |
Definition at line 359 of file stmsmi.c.
References bank, buffer, ERROR_OK, stmsmi_flash_bank::io_base, LOG_DEBUG, SMI_SET_HWWB_MODE, smi_write_enable(), and target_write_buffer().
Referenced by stmsmi_write().
|
static |
Definition at line 223 of file stmsmi.c.
References bank, stmsmi_flash_bank::bank_num, ERROR_FAIL, ERROR_OK, stmsmi_flash_bank::io_base, LOG_ERROR, read_status_reg(), SMI_CLEAR_TFF, SMI_CMD_TIMEOUT, SMI_CR2, SMI_POLL_TFF, SMI_SET_HW_MODE, SMI_WE, SMI_WRITE_REG, SPIFLASH_WE_BIT, and status.
Referenced by smi_erase_sector(), and smi_write_buffer().
|
static |
Definition at line 609 of file stmsmi.c.
References bank, ERROR_OK, stmsmi_flash_bank::probed, and stmsmi_probe().
|
static |
Definition at line 304 of file stmsmi.c.
References bank, stmsmi_flash_bank::dev, flash_device::erase_cmd, ERROR_FAIL, ERROR_FLASH_BANK_NOT_PROBED, ERROR_FLASH_OPER_UNSUPPORTED, ERROR_FLASH_SECTOR_INVALID, ERROR_OK, ERROR_TARGET_NOT_HALTED, stmsmi_flash_bank::io_base, keep_alive(), LOG_DEBUG, LOG_ERROR, stmsmi_flash_bank::probed, smi_erase_sector(), SMI_SET_HW_MODE, target::state, and TARGET_HALTED.
|
static |
Definition at line 510 of file stmsmi.c.
References bank, stmsmi_flash_bank::bank_num, stmsmi_flash_bank::dev, flash_device::device_id, ERROR_FAIL, ERROR_OK, flash_devices, jtag_tap::idcode, stmsmi_flash_bank::io_base, stmsmi_target::io_base, flash_sector::is_erased, flash_sector::is_protected, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING, flash_device::name, stmsmi_target::name, NULL, flash_sector::offset, stmsmi_flash_bank::probed, read_flash_id(), flash_device::sectorsize, flash_sector::size, flash_device::size_in_bytes, SMI_BANK_SIZE, stmsmi_target::smi_base, SMI_SEL_BANK0, SMI_SEL_BANK1, SMI_SEL_BANK2, SMI_SEL_BANK3, SMI_SET_HW_MODE, target::tap, stmsmi_target::tap_idcode, TARGET_ADDR_FMT, and target_devices.
Referenced by stmsmi_auto_probe().
|
static |
|
static |
|
static |
Definition at line 384 of file stmsmi.c.
References bank, buffer, count, stmsmi_flash_bank::dev, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, stmsmi_flash_bank::io_base, keep_alive(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, offset, flash_device::pagesize, flash_device::size_in_bytes, SMI_SET_HW_MODE, smi_write_buffer(), SPIFLASH_DEF_PAGESIZE, target::state, and TARGET_HALTED.
|
static |
Definition at line 198 of file stmsmi.c.
References alive_sleep(), bank, ERROR_FAIL, ERROR_OK, LOG_ERROR, read_status_reg(), SPIFLASH_BSY_BIT, status, and timeval_ms().
Referenced by read_flash_id(), and smi_erase_sector().
const struct flash_driver stmsmi_flash |
|
static |