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 int code_size, unsigned int 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

◆ arm_code_to_working_area()

static int arm_code_to_working_area ( struct target target,
const uint32_t *  code,
unsigned int  code_size,
unsigned int  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 33 of file arm_io.c.

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

Referenced by arm_nandread(), and arm_nandwrite().

◆ arm_nandread()

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 190 of file arm_io.c.

References working_area::address, arm::arch, target::arch_info, ARM_ARCH_V4, 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, arm_algorithm::common_magic, armv7m_algorithm::common_magic, arm_nand_data::copy_area, arm_algorithm::core_mode, armv7m_algorithm::core_mode, arm_algorithm::core_state, arm_nand_data::data, destroy_reg_param(), ERROR_OK, init_reg_param(), is_armv7m(), LOG_ERROR, NULL, arm_nand_data::op, PARAM_IN, size, 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().

◆ arm_nandwrite()

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 80 of file arm_io.c.

References working_area::address, arm::arch, target::arch_info, ARM_ARCH_V4, 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, arm_algorithm::common_magic, armv7m_algorithm::common_magic, arm_nand_data::copy_area, arm_algorithm::core_mode, armv7m_algorithm::core_mode, arm_algorithm::core_state, arm_nand_data::data, destroy_reg_param(), ERROR_OK, init_reg_param(), is_armv7m(), LOG_ERROR, NULL, arm_nand_data::op, PARAM_IN, size, 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().