URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/or_debug_proxy
- from Rev 79 to Rev 94
- ↔ Reverse comparison
Rev 79 → Rev 94
/includes/usb_functions.h
72,6 → 72,7
int usb_dbg_ctrl_read(uint32_t *reset, uint32_t *stall); |
int usb_dbg_go(unsigned char *data, uint16_t len, uint32_t read); |
|
int usb_dbg_wb_read8(uint32_t adr, uint8_t *data); |
int usb_dbg_wb_read32(uint32_t adr, uint32_t *data); |
int usb_dbg_wb_read_block32(uint32_t adr, uint32_t *data, uint32_t len); |
int usb_dbg_wb_write8(uint32_t adr, uint8_t data); |
/includes/or_debug_proxy.h
132,6 → 132,8
int dbg_set_chain(uint32_t chain); |
/* read a byte from wishbone */ |
int dbg_wb_write8(uint32_t adr, uint8_t data); |
/* read a byte from wishbone */ |
int dbg_wb_read8(uint32_t adr, uint8_t *data); |
/* read a word from wishbone */ |
int dbg_wb_read32(uint32_t adr, uint32_t *data); |
/* write a word to wishbone */ |
/src/usb_functions.c
1106,7 → 1106,17
return DBG_ERR_OK; |
} |
|
|
/* read a word from wishbone */ |
int usb_dbg_wb_read8(uint32_t adr, uint8_t *data) { |
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err; |
if ((err = usb_dbg_command(DBG_WB_READ8, adr, 1))) return err; |
if ((err = usb_dbg_go((unsigned char*)data, 1, 1))) return err; |
//*data = ntohl(*data); |
return err; |
} |
|
/* read a word from wishbone */ |
int usb_dbg_wb_read32(uint32_t adr, uint32_t *data) { |
// uint32_t err; |
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err; |
1116,7 → 1126,7
return err; |
} |
|
/* write a word to wishbone */ |
/* write a byte to wishbone */ |
int usb_dbg_wb_write8(uint32_t adr, uint8_t data) { |
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err; |
if ((err = usb_dbg_command(DBG_WB_WRITE8, adr, 1))) return err; |
/src/or_debug_proxy.c
286,6 → 286,18
return DBG_ERR_INVALID_ENDPOINT; |
} |
|
/* read a byte from wishbone */ |
int dbg_wb_read8(uint32_t adr, uint8_t *data) { |
#ifdef USB_ENDPOINT_ENABLED |
if (endpoint_target == ENDPOINT_TARGET_USB) return usb_dbg_wb_read8(adr, data); |
#endif |
#ifdef VPI_ENDPOINT_ENABLED |
if (endpoint_target == ENDPOINT_TARGET_VPI) return vpi_dbg_wb_read32(adr, data); |
#endif |
return DBG_ERR_INVALID_ENDPOINT; |
} |
|
|
/* read a word from wishbone */ |
int dbg_wb_read32(uint32_t adr, uint32_t *data) { |
#ifdef USB_ENDPOINT_ENABLED |
/src/gdb.c
346,6 → 346,7
static int gdb_set_chain(int chain); |
static int gdb_write_byte(uint32_t adr, uint8_t data); |
static int gdb_write_reg(uint32_t adr, uint32_t data); |
static int gdb_read_byte(uint32_t adr, uint8_t *data); |
static int gdb_read_reg(uint32_t adr, uint32_t *data); |
static int gdb_write_block(uint32_t adr, uint32_t *data, int len); |
static int gdb_read_block(uint32_t adr, uint32_t *data, int len); |
2185,6 → 2186,7
int len_cpy; |
/* Couple of temps we might need when doing aligning/leftover accesses */ |
uint32_t tmp_word; |
uint8_t tmp_byte; |
char *tmp_word_ptr = (char*) &tmp_word; |
|
|
2224,50 → 2226,28
len_cpy = len; |
rec_buf_ptr = rec_buf; // Need to save a copy of pointer |
|
if (addr & 0x3) // address not aligned at the start |
if (addr & 0x3) // address not word-aligned, do byte accesses first |
{ |
// Have to read from the word-aligned address first and fetch the bytes |
// we need. |
if (DEBUG_GDB) |
printf("rsp_read_mem: unaligned address read - reading before bytes\n", |
err); |
|
int num_bytes_to_align = bytes_per_word - (addr & 0x3); |
uint32_t aligned_addr = addr & ~0x3; |
|
if (DEBUG_GDB) |
printf("rsp_read_mem: reading first %d of %d overall, from 0x%.8x\n", |
num_bytes_to_align, len_cpy, aligned_addr); |
|
err = gdb_read_reg(aligned_addr, &tmp_word); |
|
if (DEBUG_GDB) printf("rsp_read_mem: first word 0x%.8x\n", tmp_word); |
|
if(err){ |
put_str_packet ("E01"); |
return; |
} |
int bytes_to_read = (num_bytes_to_align >= len_cpy) ? |
len_cpy : num_bytes_to_align; |
|
// Pack these bytes in first |
if (num_bytes_to_align > len_cpy) num_bytes_to_align = len_cpy; |
|
// Data returns back in big endian format. |
if (DEBUG_GDB_BLOCK_DATA)printf("rsp_read_mem: packing first bytes "); |
i=addr&0x3; int buf_ctr = 0; |
while (buf_ctr < num_bytes_to_align) |
for (i=0;i<bytes_to_read;i++) |
{ |
rec_buf_ptr[buf_ctr] = tmp_word_ptr[i]; |
if (DEBUG_GDB_BLOCK_DATA)printf("i=%d=0x%x, ", i, |
tmp_word_ptr[bytes_per_word-1-i]); |
i++; |
buf_ctr++; |
} |
err = gdb_read_byte(addr++, (uint8_t*) &rec_buf[i]); |
if(err){ |
put_str_packet ("E01"); |
return; |
} |
} |
|
if (DEBUG_GDB_BLOCK_DATA)printf("\n"); |
|
// Adjust our status |
len_cpy -= num_bytes_to_align; addr += num_bytes_to_align; |
len_cpy -= bytes_to_read; |
rec_buf_ptr += num_bytes_to_align; |
} |
|
if (len_cpy/bytes_per_word) // Now perform all full word accesses |
{ |
int words_to_read = len_cpy/bytes_per_word; // Full words to read |
2289,27 → 2269,17
} |
if (len_cpy) // Leftover bytes |
{ |
if (DEBUG_GDB) |
printf("rsp_read_mem: reading %d left-over bytes from 0x%.8x\n", |
len_cpy, addr); |
for (i=0;i<len_cpy;i++) |
{ |
err = gdb_read_byte(addr++, (uint8_t*) &rec_buf_ptr[i]); |
if(err){ |
put_str_packet ("E01"); |
return; |
} |
} |
|
err = gdb_read_reg(addr, &tmp_word); |
|
// Big endian - top byte first! |
for(i=0;i<len_cpy;i++) |
rec_buf_ptr[i] = tmp_word_ptr[i]; |
|
} |
|
if (DEBUG_GDB) |
printf("rsp_read_mem: err: %d\n",err); |
|
|
if(err){ |
put_str_packet ("E01"); |
return; |
} |
|
/* Refill the buffer with the reply */ |
for( off = 0 ; off < len ; off ++ ) { |
; |
3519,7 → 3489,21
default: return JTAG_PROXY_INVALID_CHAIN; |
} |
} |
int gdb_read_byte(uint32_t adr, uint8_t *data) { |
|
#ifdef OR32_KERNEL_DBG_COMPAT |
if (IS_VM_ADDR(adr)) |
adr = adr & ~OR32_LINUX_VM_MASK; |
#endif |
|
switch (gdb_chain) { |
case SC_WISHBONE: return dbg_wb_read8(adr, data) ? ERR_CRC : ERR_NONE; |
case SC_TRACE: *data = 0; return 0; |
default: return JTAG_PROXY_INVALID_CHAIN; |
} |
} |
|
|
int gdb_write_reg(uint32_t adr, uint32_t data) { |
|
#ifdef OR32_KERNEL_DBG_COMPAT |
/Makefile
54,7 → 54,7
|
# Common Flags |
COMMON_CPPFLAGS = -I./includes |
COMMON_CXXFLAGS = -O2 |
COMMON_CXXFLAGS = -O3 |
COMMON_LDFLAGS = |
|
# Flags for static library |