OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | lpcspifi_flash_bank |
Macros | |
#define | SPIFI_INIT_STACK_SIZE 512 |
#define | SSP_BSY (0x00000010) |
#define | SSP_CMD_TIMEOUT (100) |
#define | SSP_CPSR (0x10) /* Clock prescale register */ |
#define | SSP_CR0 (0x00) /* Control register 0 */ |
#define | SSP_CR1 (0x04) /* Control register 1 */ |
#define | SSP_DATA (0x08) /* Data register (TX and RX) */ |
#define | SSP_MAX_TIMEOUT (3000) |
#define | SSP_PROBE_TIMEOUT (100) |
#define | SSP_SR (0x0C) /* Status register */ |
Functions | |
FLASH_BANK_COMMAND_HANDLER (lpcspifi_flash_bank_command) | |
static int | get_lpcspifi_info (struct flash_bank *bank, struct command_invocation *cmd) |
static int | io_write_reg (struct target *target, uint32_t io_base, uint32_t offset, uint32_t value) |
static int | ioconfig_write_reg (struct target *target, uint32_t ioconfig_base, uint32_t offset, uint32_t value) |
static int | lpcspifi_auto_probe (struct flash_bank *bank) |
static int | lpcspifi_bulk_erase (struct flash_bank *bank) |
static int | lpcspifi_erase (struct flash_bank *bank, unsigned int first, unsigned int last) |
static int | lpcspifi_probe (struct flash_bank *bank) |
static int | lpcspifi_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last) |
static int | lpcspifi_protect_check (struct flash_bank *bank) |
static int | lpcspifi_read_flash_id (struct flash_bank *bank, uint32_t *id) |
static int | lpcspifi_set_hw_mode (struct flash_bank *bank) |
static int | lpcspifi_set_sw_mode (struct flash_bank *bank) |
static int | lpcspifi_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) |
static int | lpcspifi_write_enable (struct flash_bank *bank) |
static int | poll_ssp_busy (struct target *target, uint32_t ssp_base, int timeout) |
static int | read_status_reg (struct flash_bank *bank, uint32_t *status) |
static int | ssp_read_reg (struct target *target, uint32_t ssp_base, uint32_t offset, uint32_t *value) |
static int | ssp_setcs (struct target *target, uint32_t io_base, unsigned int value) |
static int | ssp_write_reg (struct target *target, uint32_t ssp_base, uint32_t offset, uint32_t value) |
static int | wait_till_ready (struct flash_bank *bank, int timeout) |
Variables | |
const struct flash_driver | lpcspifi_flash |
#define SPIFI_INIT_STACK_SIZE 512 |
Definition at line 36 of file lpcspifi.c.
#define SSP_BSY (0x00000010) |
Definition at line 27 of file lpcspifi.c.
#define SSP_CMD_TIMEOUT (100) |
Definition at line 30 of file lpcspifi.c.
#define SSP_CPSR (0x10) /* Clock prescale register */ |
Definition at line 24 of file lpcspifi.c.
#define SSP_CR0 (0x00) /* Control register 0 */ |
Definition at line 20 of file lpcspifi.c.
#define SSP_CR1 (0x04) /* Control register 1 */ |
Definition at line 21 of file lpcspifi.c.
#define SSP_DATA (0x08) /* Data register (TX and RX) */ |
Definition at line 22 of file lpcspifi.c.
#define SSP_MAX_TIMEOUT (3000) |
Definition at line 32 of file lpcspifi.c.
#define SSP_PROBE_TIMEOUT (100) |
Definition at line 31 of file lpcspifi.c.
#define SSP_SR (0x0C) /* Status register */ |
Definition at line 23 of file lpcspifi.c.
FLASH_BANK_COMMAND_HANDLER | ( | lpcspifi_flash_bank_command | ) |
Definition at line 50 of file lpcspifi.c.
References bank, CMD_ARGC, ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, LOG_ERROR, and lpcspifi_flash_bank::probed.
|
static |
Definition at line 918 of file lpcspifi.c.
References bank, cmd, command_print_sameline(), lpcspifi_flash_bank::dev, flash_device::device_id, ERROR_OK, flash_device::name, and lpcspifi_flash_bank::probed.
|
inlinestatic |
Definition at line 79 of file lpcspifi.c.
References lpcspifi_flash_bank::io_base, offset, and target_write_u32().
Referenced by lpcspifi_set_sw_mode(), and ssp_setcs().
|
inlinestatic |
Definition at line 69 of file lpcspifi.c.
References lpcspifi_flash_bank::ioconfig_base, offset, and target_write_u32().
Referenced by lpcspifi_set_sw_mode().
|
static |
Definition at line 904 of file lpcspifi.c.
References bank, ERROR_OK, lpcspifi_probe(), and lpcspifi_flash_bank::probed.
|
static |
Definition at line 370 of file lpcspifi.c.
References bank, flash_device::chip_erase_cmd, lpcspifi_flash_bank::dev, ERROR_FLASH_OPER_UNSUPPORTED, ERROR_OK, lpcspifi_flash_bank::io_base, lpcspifi_set_sw_mode(), lpcspifi_write_enable(), poll_ssp_busy(), lpcspifi_flash_bank::ssp_base, SSP_CMD_TIMEOUT, SSP_DATA, SSP_MAX_TIMEOUT, ssp_read_reg(), ssp_setcs(), ssp_write_reg(), and wait_till_ready().
Referenced by lpcspifi_erase().
|
static |
Definition at line 406 of file lpcspifi.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, bank, buf_set_u32(), flash_device::chip_erase_cmd, armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, destroy_reg_param(), lpcspifi_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, init_reg_param(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, lpcspifi_bulk_erase(), lpcspifi_set_hw_mode(), NULL, PARAM_IN_OUT, PARAM_OUT, lpcspifi_flash_bank::probed, target::state, target_alloc_working_area(), target_free_working_area(), TARGET_HALTED, target_run_algorithm(), and target_write_buffer().
|
static |
Definition at line 830 of file lpcspifi.c.
References bank, lpcspifi_flash_bank::bank_num, lpcspifi_flash_bank::dev, flash_device::device_id, ERROR_FAIL, ERROR_OK, flash_devices, lpcspifi_flash_bank::io_base, lpcspifi_flash_bank::ioconfig_base, flash_sector::is_erased, flash_sector::is_protected, LOG_ERROR, LOG_INFO, LOG_WARNING, lpcspifi_read_flash_id(), lpcspifi_set_hw_mode(), flash_device::name, NULL, flash_sector::offset, lpcspifi_flash_bank::probed, flash_device::sectorsize, flash_sector::size, flash_device::size_in_bytes, and lpcspifi_flash_bank::ssp_base.
Referenced by lpcspifi_auto_probe().
|
static |
Definition at line 562 of file lpcspifi.c.
|
static |
Definition at line 912 of file lpcspifi.c.
References ERROR_OK.
|
static |
Definition at line 758 of file lpcspifi.c.
References bank, ERROR_OK, ERROR_TARGET_NOT_HALTED, lpcspifi_flash_bank::io_base, LOG_DEBUG, LOG_ERROR, lpcspifi_set_sw_mode(), poll_ssp_busy(), SPIFLASH_READ_ID, lpcspifi_flash_bank::ssp_base, SSP_CMD_TIMEOUT, SSP_DATA, SSP_PROBE_TIMEOUT, ssp_read_reg(), ssp_setcs(), ssp_write_reg(), target::state, TARGET_HALTED, and wait_till_ready().
Referenced by lpcspifi_probe().
|
static |
Definition at line 123 of file lpcspifi.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, bank, buf_set_u32(), armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, destroy_reg_param(), ERROR_OK, init_reg_param(), LOG_DEBUG, LOG_ERROR, NULL, PARAM_OUT, SPIFI_INIT_STACK_SIZE, lpcspifi_flash_bank::ssp_base, SSP_CR1, ssp_write_reg(), TARGET_ADDR_FMT, target_alloc_working_area(), target_free_working_area(), target_run_algorithm(), target_write_buffer(), and reg_param::value.
Referenced by lpcspifi_erase(), lpcspifi_probe(), lpcspifi_set_sw_mode(), and lpcspifi_write().
|
static |
Definition at line 225 of file lpcspifi.c.
References bank, ERROR_OK, lpcspifi_flash_bank::io_base, io_write_reg(), lpcspifi_flash_bank::ioconfig_base, ioconfig_write_reg(), lpcspifi_set_hw_mode(), lpcspifi_flash_bank::ssp_base, SSP_CPSR, SSP_CR0, SSP_CR1, and ssp_write_reg().
Referenced by lpcspifi_bulk_erase(), and lpcspifi_read_flash_id().
|
static |
Definition at line 570 of file lpcspifi.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, bank, buf_set_u32(), buffer, armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, count, destroy_reg_param(), lpcspifi_flash_bank::dev, ERROR_FAIL, ERROR_OK, ERROR_TARGET_NOT_HALTED, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, init_reg_param(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, lpcspifi_set_hw_mode(), NULL, offset, flash_device::pagesize, PARAM_IN_OUT, PARAM_OUT, working_area::size, flash_device::size_in_bytes, SPIFLASH_DEF_PAGESIZE, target::state, target_alloc_working_area(), target_free_working_area(), target_get_working_area_avail(), TARGET_HALTED, target_run_flash_async_algorithm(), and target_write_buffer().
|
static |
Definition at line 336 of file lpcspifi.c.
References bank, ERROR_FAIL, ERROR_OK, lpcspifi_flash_bank::io_base, LOG_ERROR, poll_ssp_busy(), read_status_reg(), SPIFLASH_WE_BIT, SPIFLASH_WRITE_ENABLE, lpcspifi_flash_bank::ssp_base, SSP_CMD_TIMEOUT, SSP_DATA, ssp_read_reg(), ssp_setcs(), ssp_write_reg(), and status.
Referenced by lpcspifi_bulk_erase().
|
static |
Definition at line 96 of file lpcspifi.c.
References alive_sleep(), ERROR_FLASH_OPERATION_FAILED, ERROR_OK, LOG_ERROR, lpcspifi_flash_bank::ssp_base, SSP_BSY, ssp_read_reg(), SSP_SR, and timeval_ms().
Referenced by lpcspifi_bulk_erase(), lpcspifi_read_flash_id(), lpcspifi_write_enable(), and read_status_reg().
|
static |
Definition at line 279 of file lpcspifi.c.
References bank, ERROR_OK, lpcspifi_flash_bank::io_base, poll_ssp_busy(), SPIFLASH_READ_STATUS, lpcspifi_flash_bank::ssp_base, SSP_CMD_TIMEOUT, SSP_DATA, ssp_read_reg(), ssp_setcs(), ssp_write_reg(), and status.
Referenced by lpcspifi_write_enable(), and wait_till_ready().
|
inlinestatic |
Definition at line 84 of file lpcspifi.c.
References offset, lpcspifi_flash_bank::ssp_base, and target_read_u32().
Referenced by lpcspifi_bulk_erase(), lpcspifi_read_flash_id(), lpcspifi_write_enable(), poll_ssp_busy(), and read_status_reg().
|
static |
Definition at line 89 of file lpcspifi.c.
References lpcspifi_flash_bank::io_base, and io_write_reg().
Referenced by lpcspifi_bulk_erase(), lpcspifi_read_flash_id(), lpcspifi_write_enable(), and read_status_reg().
|
inlinestatic |
Definition at line 74 of file lpcspifi.c.
References offset, lpcspifi_flash_bank::ssp_base, and target_write_u32().
Referenced by lpcspifi_bulk_erase(), lpcspifi_read_flash_id(), lpcspifi_set_hw_mode(), lpcspifi_set_sw_mode(), lpcspifi_write_enable(), and read_status_reg().
|
static |
Definition at line 313 of file lpcspifi.c.
References alive_sleep(), bank, ERROR_FAIL, ERROR_OK, LOG_ERROR, read_status_reg(), SPIFLASH_BSY_BIT, status, and timeval_ms().
Referenced by lpcspifi_bulk_erase(), and lpcspifi_read_flash_id().
const struct flash_driver lpcspifi_flash |
Definition at line 918 of file lpcspifi.c.