OpenOCD
arc_jtag.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  arc_jtag
 

Macros

#define ARC_JTAG_ADDRESS_REG   0xA /* SoC address to access */
 
#define ARC_JTAG_AUX_REG   0x1
 
#define ARC_JTAG_CMD_NOP   0x3
 
#define ARC_JTAG_CORE_REG   0x0
 
#define ARC_JTAG_DATA_REG   0xB /* Data read/written from SoC */
 
#define ARC_JTAG_READ_FROM_AUX_REG   0x6
 
#define ARC_JTAG_READ_FROM_CORE_REG   0x5
 
#define ARC_JTAG_READ_FROM_MEMORY   0x4
 
#define ARC_JTAG_STAT_RU   0x10
 
#define ARC_JTAG_STATUS_REG   0x8
 
#define ARC_JTAG_WRITE_TO_AUX_REG   0x2
 
#define ARC_JTAG_WRITE_TO_CORE_REG   0x1
 
#define ARC_JTAG_WRITE_TO_MEMORY   0x0
 
#define ARC_TRANSACTION_CMD_REG   0x9 /* Command to perform */
 
#define ARC_TRANSACTION_CMD_REG_LENGTH   4
 

Functions

int arc_jtag_read_aux_reg (struct arc_jtag *jtag_info, uint32_t *addr, uint32_t count, uint32_t *buffer)
 Read AUX registers. More...
 
int arc_jtag_read_aux_reg_one (struct arc_jtag *jtag_info, uint32_t addr, uint32_t *value)
 Wrapper function to ease reading of one AUX register. More...
 
int arc_jtag_read_core_reg (struct arc_jtag *jtag_info, uint32_t *addr, uint32_t count, uint32_t *buffer)
 Read core registers. More...
 
int arc_jtag_read_core_reg_one (struct arc_jtag *jtag_info, uint32_t addr, uint32_t *buffer)
 Wrapper function to ease reading of one core register. More...
 
int arc_jtag_read_memory (struct arc_jtag *jtag_info, uint32_t addr, uint32_t count, uint32_t *buffer, bool slow_memory)
 Read a sequence of 4-byte words from target memory. More...
 
int arc_jtag_startup (struct arc_jtag *jtag_info)
 
int arc_jtag_status (struct arc_jtag *const jtag_info, uint32_t *const value)
 Read STATUS register. More...
 
int arc_jtag_write_aux_reg (struct arc_jtag *jtag_info, uint32_t *addr, uint32_t count, const uint32_t *buffer)
 Write AUX registers. More...
 
int arc_jtag_write_aux_reg_one (struct arc_jtag *jtag_info, uint32_t addr, uint32_t value)
 Wrapper function to ease writing of one AUX register. More...
 
int arc_jtag_write_core_reg (struct arc_jtag *jtag_info, uint32_t *addr, uint32_t count, const uint32_t *buffer)
 Write core registers. More...
 
int arc_jtag_write_core_reg_one (struct arc_jtag *jtag_info, uint32_t addr, const uint32_t buffer)
 Wrapper function to ease writing of one core register. More...
 
int arc_jtag_write_memory (struct arc_jtag *jtag_info, uint32_t addr, uint32_t count, const uint32_t *buffer)
 Write a sequence of 4-byte words into target memory. More...
 

Macro Definition Documentation

◆ ARC_JTAG_ADDRESS_REG

#define ARC_JTAG_ADDRESS_REG   0xA /* SoC address to access */

Definition at line 19 of file arc_jtag.h.

◆ ARC_JTAG_AUX_REG

#define ARC_JTAG_AUX_REG   0x1

Definition at line 35 of file arc_jtag.h.

◆ ARC_JTAG_CMD_NOP

#define ARC_JTAG_CMD_NOP   0x3

Definition at line 29 of file arc_jtag.h.

◆ ARC_JTAG_CORE_REG

#define ARC_JTAG_CORE_REG   0x0

Definition at line 34 of file arc_jtag.h.

◆ ARC_JTAG_DATA_REG

#define ARC_JTAG_DATA_REG   0xB /* Data read/written from SoC */

Definition at line 20 of file arc_jtag.h.

◆ ARC_JTAG_READ_FROM_AUX_REG

#define ARC_JTAG_READ_FROM_AUX_REG   0x6

Definition at line 32 of file arc_jtag.h.

◆ ARC_JTAG_READ_FROM_CORE_REG

#define ARC_JTAG_READ_FROM_CORE_REG   0x5

Definition at line 31 of file arc_jtag.h.

◆ ARC_JTAG_READ_FROM_MEMORY

#define ARC_JTAG_READ_FROM_MEMORY   0x4

Definition at line 30 of file arc_jtag.h.

◆ ARC_JTAG_STAT_RU

#define ARC_JTAG_STAT_RU   0x10

Definition at line 23 of file arc_jtag.h.

◆ ARC_JTAG_STATUS_REG

#define ARC_JTAG_STATUS_REG   0x8

Definition at line 18 of file arc_jtag.h.

◆ ARC_JTAG_WRITE_TO_AUX_REG

#define ARC_JTAG_WRITE_TO_AUX_REG   0x2

Definition at line 28 of file arc_jtag.h.

◆ ARC_JTAG_WRITE_TO_CORE_REG

#define ARC_JTAG_WRITE_TO_CORE_REG   0x1

Definition at line 27 of file arc_jtag.h.

◆ ARC_JTAG_WRITE_TO_MEMORY

#define ARC_JTAG_WRITE_TO_MEMORY   0x0

Definition at line 26 of file arc_jtag.h.

◆ ARC_TRANSACTION_CMD_REG

#define ARC_TRANSACTION_CMD_REG   0x9 /* Command to perform */

Definition at line 14 of file arc_jtag.h.

◆ ARC_TRANSACTION_CMD_REG_LENGTH

#define ARC_TRANSACTION_CMD_REG_LENGTH   4

Definition at line 15 of file arc_jtag.h.

Function Documentation

◆ arc_jtag_read_aux_reg()

int arc_jtag_read_aux_reg ( struct arc_jtag jtag_info,
uint32_t *  addr,
uint32_t  count,
uint32_t *  buffer 
)

Read AUX registers.

addr is an array of addresses, and those addresses can be in any order, though it is recommended that they are in sequential order where possible, as this reduces number of JTAG commands to transfer.

Parameters
jtag_info
addrArray of AUX register numbers.
countAmount of registers in arrays.
bufferArray of register values.

Definition at line 414 of file arc_jtag.c.

References addr, ARC_JTAG_AUX_REG, arc_jtag_read_registers(), buffer, and count.

Referenced by arc_jtag_read_aux_reg_one(), and arc_save_context().

◆ arc_jtag_read_aux_reg_one()

int arc_jtag_read_aux_reg_one ( struct arc_jtag jtag_info,
uint32_t  addr,
uint32_t *  value 
)

◆ arc_jtag_read_core_reg()

int arc_jtag_read_core_reg ( struct arc_jtag jtag_info,
uint32_t *  addr,
uint32_t  count,
uint32_t *  buffer 
)

Read core registers.

addr is an array of addresses, and those addresses can be in any order, though it is recommended that they are in sequential order where possible, as this reduces number of JTAG commands to transfer.

Parameters
jtag_info
addrArray of core register numbers.
countAmount of registers in arrays.
bufferArray of register values.

Definition at line 366 of file arc_jtag.c.

References addr, ARC_JTAG_CORE_REG, arc_jtag_read_registers(), buffer, and count.

Referenced by arc_jtag_read_core_reg_one(), and arc_save_context().

◆ arc_jtag_read_core_reg_one()

int arc_jtag_read_core_reg_one ( struct arc_jtag jtag_info,
uint32_t  addr,
uint32_t *  buffer 
)

Wrapper function to ease reading of one core register.

Definition at line 350 of file arc_jtag.c.

References addr, and arc_jtag_read_core_reg().

Referenced by arc_get_register(), and jim_arc_get_core_reg().

◆ arc_jtag_read_memory()

int arc_jtag_read_memory ( struct arc_jtag jtag_info,
uint32_t  addr,
uint32_t  count,
uint32_t *  buffer,
bool  slow_memory 
)

Read a sequence of 4-byte words from target memory.

We can read only 4byte words via JTAG.

This function read directly from the memory, so it can read invalid data if data cache hasn't been flushed before hand. It is responsibility of upper level to resolve this.

Parameters
jtag_info
addrAddress of first word to read from.
countAmount of words to read.
bufferArray of words to read into.
slow_memoryWhether this is a slow memory (DDR) or fast (CCM).

Definition at line 484 of file arc_jtag.c.

References addr, ARC_JTAG_ADDRESS_REG, ARC_JTAG_DATA_REG, arc_jtag_enque_read_dr(), arc_jtag_enque_reset_transaction(), arc_jtag_enque_set_transaction(), arc_jtag_enque_write_dr(), arc_jtag_enque_write_ir(), ARC_JTAG_READ_FROM_MEMORY, buf_get_u32(), buffer, count, ERROR_FAIL, ERROR_OK, jtag_execute_queue(), LOG_DEBUG, LOG_ERROR, arc_jtag::tap, TAP_DRPAUSE, and TAP_IDLE.

Referenced by arc_mem_read_block(), arc_mem_write_block16(), and arc_mem_write_block8().

◆ arc_jtag_startup()

int arc_jtag_startup ( struct arc_jtag jtag_info)

Definition at line 169 of file arc_jtag.c.

References arc_jtag_enque_reset_transaction(), and jtag_execute_queue().

Referenced by arc_examine().

◆ arc_jtag_status()

int arc_jtag_status ( struct arc_jtag *const  jtag_info,
uint32_t *const  value 
)

◆ arc_jtag_write_aux_reg()

int arc_jtag_write_aux_reg ( struct arc_jtag jtag_info,
uint32_t *  addr,
uint32_t  count,
const uint32_t *  buffer 
)

Write AUX registers.

addr is an array of addresses, and those addresses can be in any order, though it is recommended that they are in sequential order where possible, as this reduces number of JTAG commands to transfer.

Parameters
jtag_info
addrArray of registers numbers.
countAmount of registers in arrays.
bufferArray of register values.

Definition at line 390 of file arc_jtag.c.

References addr, ARC_JTAG_AUX_REG, arc_jtag_write_registers(), buffer, and count.

Referenced by arc_jtag_write_aux_reg_one(), and arc_restore_context().

◆ arc_jtag_write_aux_reg_one()

int arc_jtag_write_aux_reg_one ( struct arc_jtag jtag_info,
uint32_t  addr,
uint32_t  value 
)

◆ arc_jtag_write_core_reg()

int arc_jtag_write_core_reg ( struct arc_jtag jtag_info,
uint32_t *  addr,
uint32_t  count,
const uint32_t *  buffer 
)

Write core registers.

addr is an array of addresses, and those addresses can be in any order, though it is recommended that they are in sequential order where possible, as this reduces number of JTAG commands to transfer.

Parameters
jtag_info
addrArray of registers numbers.
countAmount of registers in arrays.
bufferArray of register values.

Definition at line 342 of file arc_jtag.c.

References addr, ARC_JTAG_CORE_REG, arc_jtag_write_registers(), buffer, and count.

Referenced by arc_jtag_write_core_reg_one(), and arc_restore_context().

◆ arc_jtag_write_core_reg_one()

int arc_jtag_write_core_reg_one ( struct arc_jtag jtag_info,
uint32_t  addr,
const uint32_t  buffer 
)

Wrapper function to ease writing of one core register.

Definition at line 326 of file arc_jtag.c.

References addr, and arc_jtag_write_core_reg().

◆ arc_jtag_write_memory()

int arc_jtag_write_memory ( struct arc_jtag jtag_info,
uint32_t  addr,
uint32_t  count,
const uint32_t *  buffer 
)

Write a sequence of 4-byte words into target memory.

We can write only 4byte words via JTAG, so any non-word writes should be handled at higher levels by read-modify-write.

This function writes directly to the memory, leaving any caches (if there are any) in inconsistent state. It is responsibility of upper level to resolve this.

Parameters
jtag_info
addrAddress of first word to write into.
countAmount of word to write.
bufferArray to write into memory.

Definition at line 436 of file arc_jtag.c.

References addr, ARC_JTAG_ADDRESS_REG, ARC_JTAG_DATA_REG, arc_jtag_enque_reset_transaction(), arc_jtag_enque_set_transaction(), arc_jtag_enque_write_dr(), arc_jtag_enque_write_ir(), ARC_JTAG_WRITE_TO_MEMORY, buffer, count, ERROR_OK, jtag_execute_queue(), LOG_DEBUG, TAP_DRPAUSE, and TAP_IDLE.

Referenced by arc_mem_write_block16(), arc_mem_write_block32(), and arc_mem_write_block8().