OpenOCD
arm_io.c File Reference
Include dependency graph for arm_io.c:

Go to the source code of this file.

Functions

static int arm_code_to_working_area (struct target *target, const uint32_t *code, unsigned code_size, unsigned additional, struct working_area **area)
 Copies code to a working area. More...
 
int arm_nandread (struct arm_nand_data *nand, uint8_t *data, uint32_t size)
 Uses an on-chip algorithm for an ARM device to read from a NAND device and store the data into the host machine's memory. More...
 
int arm_nandwrite (struct arm_nand_data *nand, uint8_t *data, int size)
 ARM-specific bulk write from buffer to address of 8-bit wide NAND. More...
 

Function Documentation

static int arm_code_to_working_area ( struct target target,
const uint32_t *  code,
unsigned  code_size,
unsigned  additional,
struct working_area **  area 
)
static

Copies code to a working area.

This will allocate room for the code plus the additional amount requested if the working area pointer is null.

Parameters
targetPointer to the target to copy code to
codePointer to the code area to be copied
code_sizeSize of the code being copied
additionalSize of the additional area to be allocated in addition to code
areaPointer to a pointer to a working area to copy code to
Returns
Success or failure of the operation

Definition at line 44 of file arm_io.c.

References ERROR_NAND_NO_BUFFER, ERROR_OK, LOG_DEBUG, NULL, target_alloc_working_area(), target_buffer_set_u32_array(), and target_write_memory().

Referenced by arm_nandread(), and arm_nandwrite().

int arm_nandread ( struct arm_nand_data nand,
uint8_t *  data,
uint32_t  size 
)

Uses an on-chip algorithm for an ARM device to read from a NAND device and store the data into the host machine's memory.

Parameters
nandPointer to the arm_nand_data struct that defines the I/O
dataPointer to the data buffer to store the read data
sizeAmount of data to be stored to the buffer.
Returns
Success or failure of the operation

Definition at line 201 of file arm_io.c.

References working_area::address, target::arch_info, arm_code_to_working_area(), ARM_COMMON_MAGIC, ARM_MODE_SVC, ARM_MODE_THREAD, ARM_NAND_READ, ARM_STATE_ARM, ARMV7M_COMMON_MAGIC, buf_set_u32(), arm_nand_data::chunk_size, armv7m_algorithm::common_magic, arm_algorithm::common_magic, arm_nand_data::copy_area, armv7m_algorithm::core_mode, arm_algorithm::core_mode, arm_algorithm::core_state, arm_nand_data::data, destroy_reg_param(), ERROR_OK, init_reg_param(), arm::is_armv4, is_armv7m(), LOG_ERROR, NULL, arm_nand_data::op, PARAM_IN, arm_nand_data::target, target_read_buffer(), target_run_algorithm(), target_to_armv7m(), and reg_param::value.

Referenced by at91sam9_read_block_data(), and nuc910_nand_read_block_data().

int arm_nandwrite ( struct arm_nand_data nand,
uint8_t *  data,
int  size 
)

ARM-specific bulk write from buffer to address of 8-bit wide NAND.

For now this supports ARMv4,ARMv5 and ARMv7-M cores.

Enhancements to target_run_algorithm() could enable:

  • ARMv6 and ARMv7 cores in ARM mode

Different code fragments could handle:

  • 16-bit wide data (needs different setup)
Parameters
nandPointer to the arm_nand_data struct that defines the I/O
dataPointer to the data to be copied to flash
sizeSize of the data being copied
Returns
Success or failure of the operation

Definition at line 91 of file arm_io.c.

References working_area::address, target::arch_info, arm_code_to_working_area(), ARM_COMMON_MAGIC, ARM_MODE_SVC, ARM_MODE_THREAD, ARM_NAND_WRITE, ARM_STATE_ARM, ARMV7M_COMMON_MAGIC, buf_set_u32(), arm_nand_data::chunk_size, armv7m_algorithm::common_magic, arm_algorithm::common_magic, arm_nand_data::copy_area, armv7m_algorithm::core_mode, arm_algorithm::core_mode, arm_algorithm::core_state, arm_nand_data::data, destroy_reg_param(), ERROR_OK, init_reg_param(), arm::is_armv4, is_armv7m(), LOG_ERROR, NULL, arm_nand_data::op, PARAM_IN, arm_nand_data::target, target_run_algorithm(), target_to_armv7m(), target_write_buffer(), and reg_param::value.

Referenced by at91sam9_write_block_data(), davinci_write_block_data(), nuc910_nand_write_block_data(), and orion_nand_fast_block_write().