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

Go to the source code of this file.

Macros

#define ADBG_CRC_POLY   0xedb88320
 
#define ADBG_USE_HISPEED   1
 
#define BURST_READ_READY   1
 
#define CRC_LEN   4
 
#define DBG_CPU0_CMD_BREAD32   0x7
 
#define DBG_CPU0_CMD_BWRITE32   0x3
 
#define DBG_CPU0_CMD_IREG_SEL   0xd
 
#define DBG_CPU0_CMD_IREG_WR   0x9
 
#define DBG_CPU0_CMD_NOP   0x0
 
#define DBG_CPU0_OPCODE_LEN   4
 
#define DBG_CPU0_REG_SEL_LEN   1
 
#define DBG_CPU0_REG_STATUS   0
 
#define DBG_CPU1_CMD_BREAD32   0x7
 
#define DBG_CPU1_CMD_BWRITE32   0x3
 
#define DBG_CPU1_CMD_IREG_SEL   0xd
 
#define DBG_CPU1_CMD_IREG_WR   0x9
 
#define DBG_CPU1_CMD_NOP   0x0
 
#define DBG_CPU1_OPCODE_LEN   4
 
#define DBG_CPU1_REG_SEL_LEN   1
 
#define DBG_CPU1_REG_STATUS   0
 
#define DBG_CPU_CR_RESET   0x02
 
#define DBG_CPU_CR_STALL   0x01
 
#define DBG_MAX_MODULES   4
 
#define DBG_MODULE_SELECT_REG_SIZE   2
 
#define DBG_WB_CMD_BREAD16   0x6
 
#define DBG_WB_CMD_BREAD32   0x7
 
#define DBG_WB_CMD_BREAD8   0x5
 
#define DBG_WB_CMD_BWRITE16   0x2
 
#define DBG_WB_CMD_BWRITE32   0x3
 
#define DBG_WB_CMD_BWRITE8   0x1
 
#define DBG_WB_CMD_IREG_SEL   0xd
 
#define DBG_WB_CMD_IREG_WR   0x9
 
#define DBG_WB_CMD_NOP   0x0
 
#define DBG_WB_OPCODE_LEN   4
 
#define DBG_WB_REG_ERROR   0
 
#define DBG_WB_REG_SEL_LEN   1
 
#define DC_CPU0   1
 
#define DC_CPU1   2
 
#define DC_JSP   3
 
#define DC_NONE   -1
 
#define DC_WISHBONE   0
 
#define ENABLE_JSP_MULTI   4
 
#define ENABLE_JSP_SERVER   2
 
#define JSP_BANNER
 
#define MAX_BURST_SIZE   (4 * 1024)
 
#define MAX_BUS_ERRORS   2
 
#define MAX_READ_BUSY_RETRY   2
 
#define MAX_READ_CRC_RETRY   2
 
#define MAX_READ_STATUS_WAIT   10
 
#define MAX_WRITE_CRC_RETRY   2
 
#define NO_OPTION   0
 
#define STATUS_BYTES   1
 

Functions

static int adbg_burst_command (struct or1k_jtag *jtag_info, uint32_t opcode, uint32_t address, uint16_t length_words)
 
static uint32_t adbg_compute_crc (uint32_t crc, uint32_t data_in, int length_bits)
 
static int adbg_ctrl_read (struct or1k_jtag *jtag_info, uint32_t regidx, uint32_t *data, int length_bits)
 
static int adbg_ctrl_write (struct or1k_jtag *jtag_info, uint8_t regidx, uint32_t *cmd_data, int length_bits)
 
static int adbg_select_ctrl_reg (struct or1k_jtag *jtag_info, uint8_t regidx)
 
static int adbg_select_module (struct or1k_jtag *jtag_info, int chain)
 
static int adbg_wb_burst_read (struct or1k_jtag *jtag_info, int size, int count, uint32_t start_address, uint8_t *data)
 
static int adbg_wb_burst_write (struct or1k_jtag *jtag_info, const uint8_t *data, int size, int count, unsigned long start_address)
 
static int find_status_bit (void *_buf, int len)
 
static int or1k_adv_cpu_reset (struct or1k_jtag *jtag_info, int action)
 
static int or1k_adv_cpu_stall (struct or1k_jtag *jtag_info, int action)
 
static int or1k_adv_is_cpu_running (struct or1k_jtag *jtag_info, int *running)
 
static int or1k_adv_jtag_init (struct or1k_jtag *jtag_info)
 
int or1k_adv_jtag_jsp_xfer (struct or1k_jtag *jtag_info, int *out_len, unsigned char *out_buffer, int *in_len, unsigned char *in_buffer)
 
static int or1k_adv_jtag_read_cpu (struct or1k_jtag *jtag_info, uint32_t addr, int count, uint32_t *value)
 
static int or1k_adv_jtag_read_memory (struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size, int count, uint8_t *buffer)
 
static int or1k_adv_jtag_write_cpu (struct or1k_jtag *jtag_info, uint32_t addr, int count, const uint32_t *value)
 
static int or1k_adv_jtag_write_memory (struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size, int count, const uint8_t *buffer)
 
int or1k_du_adv_register (void)
 

Variables

static const char *const chain_name [] = {"WISHBONE", "CPU0", "CPU1", "JSP"}
 
static struct or1k_du or1k_du_adv
 

Macro Definition Documentation

◆ ADBG_CRC_POLY

#define ADBG_CRC_POLY   0xedb88320

Definition at line 75 of file or1k_du_adv.c.

◆ ADBG_USE_HISPEED

#define ADBG_USE_HISPEED   1

Definition at line 41 of file or1k_du_adv.c.

◆ BURST_READ_READY

#define BURST_READ_READY   1

Definition at line 124 of file or1k_du_adv.c.

◆ CRC_LEN

#define CRC_LEN   4

Definition at line 130 of file or1k_du_adv.c.

◆ DBG_CPU0_CMD_BREAD32

#define DBG_CPU0_CMD_BREAD32   0x7

Definition at line 104 of file or1k_du_adv.c.

◆ DBG_CPU0_CMD_BWRITE32

#define DBG_CPU0_CMD_BWRITE32   0x3

Definition at line 103 of file or1k_du_adv.c.

◆ DBG_CPU0_CMD_IREG_SEL

#define DBG_CPU0_CMD_IREG_SEL   0xd

Definition at line 106 of file or1k_du_adv.c.

◆ DBG_CPU0_CMD_IREG_WR

#define DBG_CPU0_CMD_IREG_WR   0x9

Definition at line 105 of file or1k_du_adv.c.

◆ DBG_CPU0_CMD_NOP

#define DBG_CPU0_CMD_NOP   0x0

Definition at line 102 of file or1k_du_adv.c.

◆ DBG_CPU0_OPCODE_LEN

#define DBG_CPU0_OPCODE_LEN   4

Definition at line 101 of file or1k_du_adv.c.

◆ DBG_CPU0_REG_SEL_LEN

#define DBG_CPU0_REG_SEL_LEN   1

Definition at line 97 of file or1k_du_adv.c.

◆ DBG_CPU0_REG_STATUS

#define DBG_CPU0_REG_STATUS   0

Definition at line 98 of file or1k_du_adv.c.

◆ DBG_CPU1_CMD_BREAD32

#define DBG_CPU1_CMD_BREAD32   0x7

Definition at line 116 of file or1k_du_adv.c.

◆ DBG_CPU1_CMD_BWRITE32

#define DBG_CPU1_CMD_BWRITE32   0x3

Definition at line 115 of file or1k_du_adv.c.

◆ DBG_CPU1_CMD_IREG_SEL

#define DBG_CPU1_CMD_IREG_SEL   0xd

Definition at line 118 of file or1k_du_adv.c.

◆ DBG_CPU1_CMD_IREG_WR

#define DBG_CPU1_CMD_IREG_WR   0x9

Definition at line 117 of file or1k_du_adv.c.

◆ DBG_CPU1_CMD_NOP

#define DBG_CPU1_CMD_NOP   0x0

Definition at line 114 of file or1k_du_adv.c.

◆ DBG_CPU1_OPCODE_LEN

#define DBG_CPU1_OPCODE_LEN   4

Definition at line 113 of file or1k_du_adv.c.

◆ DBG_CPU1_REG_SEL_LEN

#define DBG_CPU1_REG_SEL_LEN   1

Definition at line 109 of file or1k_du_adv.c.

◆ DBG_CPU1_REG_STATUS

#define DBG_CPU1_REG_STATUS   0

Definition at line 110 of file or1k_du_adv.c.

◆ DBG_CPU_CR_RESET

#define DBG_CPU_CR_RESET   0x02

Definition at line 68 of file or1k_du_adv.c.

◆ DBG_CPU_CR_STALL

#define DBG_CPU_CR_STALL   0x01

Definition at line 67 of file or1k_du_adv.c.

◆ DBG_MAX_MODULES

#define DBG_MAX_MODULES   4

Definition at line 58 of file or1k_du_adv.c.

◆ DBG_MODULE_SELECT_REG_SIZE

#define DBG_MODULE_SELECT_REG_SIZE   2

Definition at line 57 of file or1k_du_adv.c.

◆ DBG_WB_CMD_BREAD16

#define DBG_WB_CMD_BREAD16   0x6

Definition at line 91 of file or1k_du_adv.c.

◆ DBG_WB_CMD_BREAD32

#define DBG_WB_CMD_BREAD32   0x7

Definition at line 92 of file or1k_du_adv.c.

◆ DBG_WB_CMD_BREAD8

#define DBG_WB_CMD_BREAD8   0x5

Definition at line 90 of file or1k_du_adv.c.

◆ DBG_WB_CMD_BWRITE16

#define DBG_WB_CMD_BWRITE16   0x2

Definition at line 88 of file or1k_du_adv.c.

◆ DBG_WB_CMD_BWRITE32

#define DBG_WB_CMD_BWRITE32   0x3

Definition at line 89 of file or1k_du_adv.c.

◆ DBG_WB_CMD_BWRITE8

#define DBG_WB_CMD_BWRITE8   0x1

Definition at line 87 of file or1k_du_adv.c.

◆ DBG_WB_CMD_IREG_SEL

#define DBG_WB_CMD_IREG_SEL   0xd

Definition at line 94 of file or1k_du_adv.c.

◆ DBG_WB_CMD_IREG_WR

#define DBG_WB_CMD_IREG_WR   0x9

Definition at line 93 of file or1k_du_adv.c.

◆ DBG_WB_CMD_NOP

#define DBG_WB_CMD_NOP   0x0

Definition at line 86 of file or1k_du_adv.c.

◆ DBG_WB_OPCODE_LEN

#define DBG_WB_OPCODE_LEN   4

Definition at line 85 of file or1k_du_adv.c.

◆ DBG_WB_REG_ERROR

#define DBG_WB_REG_ERROR   0

Definition at line 82 of file or1k_du_adv.c.

◆ DBG_WB_REG_SEL_LEN

#define DBG_WB_REG_SEL_LEN   1

Definition at line 81 of file or1k_du_adv.c.

◆ DC_CPU0

#define DC_CPU0   1

Definition at line 62 of file or1k_du_adv.c.

◆ DC_CPU1

#define DC_CPU1   2

Definition at line 63 of file or1k_du_adv.c.

◆ DC_JSP

#define DC_JSP   3

Definition at line 64 of file or1k_du_adv.c.

◆ DC_NONE

#define DC_NONE   -1

Definition at line 60 of file or1k_du_adv.c.

◆ DC_WISHBONE

#define DC_WISHBONE   0

Definition at line 61 of file or1k_du_adv.c.

◆ ENABLE_JSP_MULTI

#define ENABLE_JSP_MULTI   4

Definition at line 52 of file or1k_du_adv.c.

◆ ENABLE_JSP_SERVER

#define ENABLE_JSP_SERVER   2

Definition at line 47 of file or1k_du_adv.c.

◆ JSP_BANNER

#define JSP_BANNER
Value:
"\n\r" \
"******************************\n\r" \
"** JTAG Serial Port **\n\r" \
"******************************\n\r" \
"\n\r"

Definition at line 28 of file or1k_du_adv.c.

◆ MAX_BURST_SIZE

#define MAX_BURST_SIZE   (4 * 1024)

Definition at line 127 of file or1k_du_adv.c.

◆ MAX_BUS_ERRORS

#define MAX_BUS_ERRORS   2

Definition at line 125 of file or1k_du_adv.c.

◆ MAX_READ_BUSY_RETRY

#define MAX_READ_BUSY_RETRY   2

Definition at line 121 of file or1k_du_adv.c.

◆ MAX_READ_CRC_RETRY

#define MAX_READ_CRC_RETRY   2

Definition at line 122 of file or1k_du_adv.c.

◆ MAX_READ_STATUS_WAIT

#define MAX_READ_STATUS_WAIT   10

Definition at line 120 of file or1k_du_adv.c.

◆ MAX_WRITE_CRC_RETRY

#define MAX_WRITE_CRC_RETRY   2

Definition at line 123 of file or1k_du_adv.c.

◆ NO_OPTION

#define NO_OPTION   0

Definition at line 34 of file or1k_du_adv.c.

◆ STATUS_BYTES

#define STATUS_BYTES   1

Definition at line 129 of file or1k_du_adv.c.

Function Documentation

◆ adbg_burst_command()

static int adbg_burst_command ( struct or1k_jtag jtag_info,
uint32_t  opcode,
uint32_t  address,
uint16_t  length_words 
)
static

◆ adbg_compute_crc()

static uint32_t adbg_compute_crc ( uint32_t  crc,
uint32_t  data_in,
int  length_bits 
)
static

Definition at line 136 of file or1k_du_adv.c.

References ADBG_CRC_POLY.

Referenced by adbg_wb_burst_read(), and adbg_wb_burst_write().

◆ adbg_ctrl_read()

◆ adbg_ctrl_write()

◆ adbg_select_ctrl_reg()

◆ adbg_select_module()

◆ adbg_wb_burst_read()

◆ adbg_wb_burst_write()

◆ find_status_bit()

static int find_status_bit ( void *  _buf,
int  len 
)
static

Definition at line 150 of file or1k_du_adv.c.

References count.

Referenced by adbg_wb_burst_read().

◆ or1k_adv_cpu_reset()

static int or1k_adv_cpu_reset ( struct or1k_jtag jtag_info,
int  action 
)
static

◆ or1k_adv_cpu_stall()

static int or1k_adv_cpu_stall ( struct or1k_jtag jtag_info,
int  action 
)
static

◆ or1k_adv_is_cpu_running()

static int or1k_adv_is_cpu_running ( struct or1k_jtag jtag_info,
int *  running 
)
static

◆ or1k_adv_jtag_init()

◆ or1k_adv_jtag_jsp_xfer()

int or1k_adv_jtag_jsp_xfer ( struct or1k_jtag jtag_info,
int *  out_len,
unsigned char *  out_buffer,
int *  in_len,
unsigned char *  in_buffer 
)

◆ or1k_adv_jtag_read_cpu()

static int or1k_adv_jtag_read_cpu ( struct or1k_jtag jtag_info,
uint32_t  addr,
int  count,
uint32_t *  value 
)
static

◆ or1k_adv_jtag_read_memory()

static int or1k_adv_jtag_read_memory ( struct or1k_jtag jtag_info,
uint32_t  addr,
uint32_t  size,
int  count,
uint8_t *  buffer 
)
static

◆ or1k_adv_jtag_write_cpu()

static int or1k_adv_jtag_write_cpu ( struct or1k_jtag jtag_info,
uint32_t  addr,
int  count,
const uint32_t *  value 
)
static

◆ or1k_adv_jtag_write_memory()

static int or1k_adv_jtag_write_memory ( struct or1k_jtag jtag_info,
uint32_t  addr,
uint32_t  size,
int  count,
const uint8_t *  buffer 
)
static

◆ or1k_du_adv_register()

int or1k_du_adv_register ( void  )

Definition at line 1083 of file or1k_du_adv.c.

References du_list, or1k_du::list, list_add_tail(), and or1k_du_adv.

Referenced by or1k_target_create().

Variable Documentation

◆ chain_name

const char* const chain_name[] = {"WISHBONE", "CPU0", "CPU1", "JSP"}
static

Definition at line 134 of file or1k_du_adv.c.

Referenced by adbg_select_module().

◆ or1k_du_adv

static struct or1k_du or1k_du_adv
static
Initial value:
= {
.name = "adv",
.options = NO_OPTION,
.or1k_jtag_init = or1k_adv_jtag_init,
.or1k_is_cpu_running = or1k_adv_is_cpu_running,
.or1k_cpu_stall = or1k_adv_cpu_stall,
.or1k_cpu_reset = or1k_adv_cpu_reset,
.or1k_jtag_read_cpu = or1k_adv_jtag_read_cpu,
.or1k_jtag_write_cpu = or1k_adv_jtag_write_cpu,
.or1k_jtag_read_memory = or1k_adv_jtag_read_memory,
.or1k_jtag_write_memory = or1k_adv_jtag_write_memory
}
static int or1k_adv_jtag_read_cpu(struct or1k_jtag *jtag_info, uint32_t addr, int count, uint32_t *value)
Definition: or1k_du_adv.c:730
static int or1k_adv_is_cpu_running(struct or1k_jtag *jtag_info, int *running)
Definition: or1k_du_adv.c:794
static int or1k_adv_jtag_read_memory(struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size, int count, uint8_t *buffer)
Definition: or1k_du_adv.c:858
static int or1k_adv_cpu_reset(struct or1k_jtag *jtag_info, int action)
Definition: or1k_du_adv.c:828
#define NO_OPTION
Definition: or1k_du_adv.c:34
static int or1k_adv_jtag_write_cpu(struct or1k_jtag *jtag_info, uint32_t addr, int count, const uint32_t *value)
Definition: or1k_du_adv.c:747
static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size, int count, const uint8_t *buffer)
Definition: or1k_du_adv.c:913
static int or1k_adv_jtag_init(struct or1k_jtag *jtag_info)
Definition: or1k_du_adv.c:170
static int or1k_adv_cpu_stall(struct or1k_jtag *jtag_info, int action)
Definition: or1k_du_adv.c:764

Definition at line 1 of file or1k_du_adv.c.

Referenced by adbg_wb_burst_read(), adbg_wb_burst_write(), or1k_adv_jtag_init(), or1k_adv_jtag_jsp_xfer(), and or1k_du_adv_register().