OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [jtag/] [gdb2.c] - Diff between revs 1322 and 1380

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 1322 Rev 1380
Line 17... Line 17...
#include <netinet/tcp.h>
#include <netinet/tcp.h>
#include <inttypes.h>
#include <inttypes.h>
#include <errno.h>
#include <errno.h>
 
 
#include "gdb.h" /* partially copied from gdb/config/or1k */
#include "gdb.h" /* partially copied from gdb/config/or1k */
 
#include "jp.h"  /* just for debug() */
#include "jp2.h"
#include "jp2.h"
 
 
 
 
/* connection to jp2 routines */
/* connection to jp2 routines */
int gdb_chain = -1;
int gdb_chain = -1;
 
 
int gdb_read_reg(unsigned long adr, unsigned long *data) {
int gdb_read_reg(unsigned long adr, unsigned long *data) {
  printf("rr %d\n", gdb_chain);
  debug("rr %d\n", gdb_chain);
  switch (gdb_chain) {
  switch (gdb_chain) {
    case SC_RISC_DEBUG: return dbg_cpu0_read(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_RISC_DEBUG: return dbg_cpu0_read(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_REGISTER:   return dbg_cpu0_read_ctrl(adr, (unsigned char*)data) ? ERR_CRC : ERR_NONE;
    case SC_REGISTER:   return dbg_cpu0_read_ctrl(adr, (unsigned char*)data) ? ERR_CRC : ERR_NONE;
    case SC_WISHBONE:   return dbg_wb_read32(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_WISHBONE:   return dbg_wb_read32(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_TRACE:      *data = 0; return 0;
    case SC_TRACE:      *data = 0; return 0;
    default:            return JTAG_PROXY_INVALID_CHAIN;
    default:            return JTAG_PROXY_INVALID_CHAIN;
  }
  }
}
}
 
 
int gdb_write_reg(unsigned long adr, unsigned long data) {
int gdb_write_reg(unsigned long adr, unsigned long data) {
  printf("wr %d\n", gdb_chain);
  debug("wr %d\n", gdb_chain);
  switch (gdb_chain) { /* remap registers, to be compatible with jp1 */
  switch (gdb_chain) { /* remap registers, to be compatible with jp1 */
    case SC_RISC_DEBUG: if (adr == JTAG_RISCOP) adr = 0x00;
    case SC_RISC_DEBUG: if (adr == JTAG_RISCOP) adr = 0x00;
                        return dbg_cpu0_write(adr, data) ? ERR_CRC : ERR_NONE;
                        return dbg_cpu0_write(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_REGISTER:   return dbg_cpu0_write_ctrl(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_REGISTER:   return dbg_cpu0_write_ctrl(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_WISHBONE:   return dbg_wb_write32(adr, data) ? ERR_CRC : ERR_NONE;
    case SC_WISHBONE:   return dbg_wb_write32(adr, data) ? ERR_CRC : ERR_NONE;
Line 47... Line 48...
    default:            return JTAG_PROXY_INVALID_CHAIN;
    default:            return JTAG_PROXY_INVALID_CHAIN;
  }
  }
}
}
 
 
int gdb_read_block(unsigned long adr, unsigned long *data, int len) {
int gdb_read_block(unsigned long adr, unsigned long *data, int len) {
  printf("rb %d\n", gdb_chain);
  debug("rb %d\n", gdb_chain);
  switch (gdb_chain) {
  switch (gdb_chain) {
    case SC_WISHBONE:   return dbg_wb_read_block32(adr, data, len) ? ERR_CRC : ERR_NONE;
    case SC_WISHBONE:   return dbg_wb_read_block32(adr, data, len) ? ERR_CRC : ERR_NONE;
    default:            return JTAG_PROXY_INVALID_CHAIN;
    default:            return JTAG_PROXY_INVALID_CHAIN;
  }
  }
}
}
 
 
int gdb_write_block(unsigned long adr, unsigned long *data, int len) {
int gdb_write_block(unsigned long adr, unsigned long *data, int len) {
  printf("wb %d\n", gdb_chain);
  debug("wb %d\n", gdb_chain);
  switch (gdb_chain) {
  switch (gdb_chain) {
    case SC_WISHBONE:   return dbg_wb_write_block32(adr, data, len) ? ERR_CRC : ERR_NONE;
    case SC_WISHBONE:   return dbg_wb_write_block32(adr, data, len) ? ERR_CRC : ERR_NONE;
    default:            return JTAG_PROXY_INVALID_CHAIN;
    default:            return JTAG_PROXY_INVALID_CHAIN;
  }
  }
}
}
 
 
int gdb_set_chain(int chain) {
int gdb_set_chain(int chain) {
  printf("set_chain %d\n", chain);
  debug("set_chain %d\n", chain);
  switch (chain) {
  switch (chain) {
    case SC_RISC_DEBUG:
    case SC_RISC_DEBUG:
    case SC_REGISTER:
    case SC_REGISTER:
    case SC_TRACE:
    case SC_TRACE:
    case SC_WISHBONE:   gdb_chain = chain;
    case SC_WISHBONE:   gdb_chain = chain;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.