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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [jtag.c] - Diff between revs 194 and 362

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

Rev 194 Rev 362
Line 331... Line 331...
}
}
 
 
static int ReadResponse(int fd,void* buffer,int len)
static int ReadResponse(int fd,void* buffer,int len)
{
{
  int32_t status = 0;
  int32_t status = 0;
  int result = jtag_proxy_read(fd,&status,4);
  int result;
  char* buf = (char*)buffer;
  char* buf = (char*)buffer;
 
 
 
        result = jtag_proxy_read(fd,&status,4);
 
 
  status = ntohl(status);
  status = ntohl(status);
  *((int32_t*)buffer) = status;
  *((int32_t*)buffer) = status;
 
 
  if(result)    return result;
  if(result)    {printf("result %i %x\n", result, result); return result;}
  if(status)   return status;
  if(status)    {printf("status %i %x\n", status, status); return status;}
 
 
  result = jtag_proxy_read(fd,&buf[4],len-4);
  result = jtag_proxy_read(fd,&buf[4],len-4);
  return result;
  return result;
}
}
 
 
Line 571... Line 573...
     ULONGEST data;
     ULONGEST data;
{
{
  int crc_read, crc_write, crc_ok, retry;
  int crc_read, crc_write, crc_ok, retry;
  int result;
  int result;
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("write reg %x <- %x\n", regno, data);
 
  fflush (stdout);
 
#endif
  switch(connection.location) /* CZ */
  switch(connection.location) /* CZ */
    {
    {
    case JTAG_LOCAL:
    case JTAG_LOCAL:
      if (!select_dr)
      if (!select_dr)
        jp1_write_JTAG (1); /* SELECT_DR SCAN */
        jp1_write_JTAG (1); /* SELECT_DR SCAN */
Line 631... Line 637...
      break;
      break;
    default:
    default:
      error("jtag_write_reg called with no connection!");
      error("jtag_write_reg called with no connection!");
      break;
      break;
    }
    }
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("!write reg\n");
 
  fflush (stdout);
 
#endif
}
}
 
 
/* Reads register/memory from regno.  */
/* Reads register/memory from regno.  */
 
 
ULONGEST
ULONGEST
Line 643... Line 653...
{
{
  ULONGEST data;
  ULONGEST data;
  int crc_read, crc_write, crc_actual_read,  retry, crc_ok;
  int crc_read, crc_write, crc_actual_read,  retry, crc_ok;
  int result;
  int result;
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("read reg %x\n", regno);
 
  fflush (stdout);
 
#endif
  switch(connection.location)
  switch(connection.location)
    {
    {
    case JTAG_LOCAL:
    case JTAG_LOCAL:
      if (!select_dr)
      if (!select_dr)
        jp1_write_JTAG (1); /* SELECT_DR SCAN */
        jp1_write_JTAG (1); /* SELECT_DR SCAN */
Line 703... Line 717...
    default:
    default:
      error("jtag_write_reg called with no connection!");
      error("jtag_write_reg called with no connection!");
      break;
      break;
    }
    }
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("read reg %x\n", data);
 
  fflush (stdout);
 
#endif
  return data;  /* CZ */
  return data;  /* CZ */
}
}
 
 
int jtag_write_block(unsigned int regno,void* data,int nRegisters)
int jtag_write_block(unsigned int regno,void* data,int nRegisters)
{
{
  unsigned long* buffer = (unsigned long*)data;
  unsigned long* buffer = (unsigned long*)data;
  int i,result;
  int i,result;
 
 
 
  if(nRegisters == 1) {
 
    jtag_write_reg(regno, *buffer);
 
    return err;
 
  }
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("write block %x,%i\n", regno, nRegisters);
 
  fflush (stdout);
 
#endif
 
 
  err = 0;
  err = 0;
  switch(connection.location)
  switch(connection.location)
    {
    {
    case JTAG_LOCAL:         /* We can't do any better than this locally */
    case JTAG_LOCAL:         /* We can't do any better than this locally */
      for(i=0;i<nRegisters;i++)
      for(i=0;i<nRegisters;i++)
Line 730... Line 758...
    default:
    default:
      error("jtag_write_reg called with no connection!");
      error("jtag_write_reg called with no connection!");
      break;
      break;
    }
    }
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("!write block\n");
 
  fflush (stdout);
 
#endif
  return err;
  return err;
}
}
 
 
int jtag_read_block(unsigned int regno,void* data,int nRegisters)
int jtag_read_block(unsigned int regno,void* data,int nRegisters)
{
{
  unsigned long* buffer = (unsigned long*)data;
  unsigned long* buffer = (unsigned long*)data;
  int i,result;
  int i,result;
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("read block %x,%i\n", regno, nRegisters);
 
  fflush (stdout);
 
#endif
 
 
 
  /*  if(nRegisters == 1) {
 
    *buffer = jtag_read_reg(regno);
 
    return err;
 
    }*/
  err = 0;
  err = 0;
  switch(connection.location)
  switch(connection.location)
    {
    {
    case JTAG_LOCAL:         /* We can't do any better than this locally */
    case JTAG_LOCAL:         /* We can't do any better than this locally */
      for(i=0;i<nRegisters;i++)
      for(i=0;i<nRegisters;i++)
Line 757... Line 798...
    default:
    default:
      error("jtag_write_reg called with no connection!");
      error("jtag_write_reg called with no connection!");
      break;
      break;
    }
    }
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("read block\n");
 
  fflush (stdout);
 
#endif  
  return err;
  return err;
}
}
 
 
/* Sets scan chain.  */
/* Sets scan chain.  */
 
 
Line 768... Line 813...
jtag_set_chain (chain)
jtag_set_chain (chain)
     int chain;
     int chain;
{
{
  int result;
  int result;
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("set chain %x\n", chain);
 
  fflush (stdout);
 
#endif
  switch(connection.location)
  switch(connection.location)
    {
    {
    case JTAG_LOCAL:
    case JTAG_LOCAL:
      if (current_chain != chain)
      if (current_chain != chain)
        {
        {
Line 824... Line 873...
      break;
      break;
    default:
    default:
      error("jtag_set_chain called with no connection!");
      error("jtag_set_chain called with no connection!");
      break;
      break;
    }
    }
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("!set chain\n");
 
  fflush (stdout);
 
#endif
}
}
 
 
/* Added by CZ 24/05/01 */
/* Added by CZ 24/05/01 */
static int jtag_connect_to_server(char* hostname,char* name)
static int jtag_connect_to_server(char* hostname,char* name)
{
{
Line 950... Line 1003...
{
{
  char *ptype;
  char *ptype;
  char *port_name;
  char *port_name;
  char **argv;
  char **argv;
 
 
 
#ifdef DEBUG_JTAG
 
  printf_unfiltered ("INIT\n");
 
  fflush(stdout);
 
#endif
  if (args == 0) /* CZ */
  if (args == 0) /* CZ */
    error ( "To open a or1k remote debugging connection, you need to specify a "
    error ( "To open a or1k remote debugging connection, you need to specify a "
            "parallel port\nconnected to the target board, or else a remote "
            "parallel port\nconnected to the target board, or else a remote "
            "server which will proxy these\nservices for you.\nExample: "
            "server which will proxy these\nservices for you.\nExample: "
            "/dev/lp0 or jtag://debughost.mydomain.com:8100.\n");
            "/dev/lp0 or jtag://debughost.mydomain.com:8100.\n");
Line 1045... Line 1102...
    case JTAG_REMOTE:
    case JTAG_REMOTE:
      sync_close(connection.device.fd);
      sync_close(connection.device.fd);
      connection.device.fd = 0;
      connection.device.fd = 0;
      break;
      break;
    default:
    default:
      error("No jtag connection specified!");
 
      break;
      break;
    }
    }
  connection.location = JTAG_NOT_CONNECTED;
  connection.location = JTAG_NOT_CONNECTED;
}
}
 
 

powered by: WebSVN 2.1.0

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