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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [debug/] [gdbcomm.c] - Diff between revs 1550 and 1557

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

Rev 1550 Rev 1557
Line 66... Line 66...
  struct hostent *hp;
  struct hostent *hp;
  int sockfd;
  int sockfd;
  char myname[256];
  char myname[256];
  int flags;
  int flags;
  char sTemp[256];
  char sTemp[256];
 
  socklen_t len;
 
 
  /* First, get the protocol number of TCP */
  /* First, get the protocol number of TCP */
  if(!(protocol = getprotobyname(proto)))
  if(!(protocol = getprotobyname(proto)))
    {
    {
      sprintf(sTemp,"Unable to load protocol \"%s\"",proto);
      sprintf(sTemp,"Unable to load protocol \"%s\"",proto);
Line 140... Line 141...
      perror(sTemp);
      perror(sTemp);
      close(sockfd);
      close(sockfd);
      return 0;
      return 0;
    }
    }
  serverIP = sa.sin_addr.s_addr;
  serverIP = sa.sin_addr.s_addr;
  flags = sizeof(struct sockaddr_in);
  len = sizeof(struct sockaddr_in);
  if(getsockname(sockfd,(struct sockaddr*)&sa,&flags) < 0)
  if(getsockname(sockfd,(struct sockaddr*)&sa,&len) < 0)
    {
    {
      sprintf(sTemp,"Unable to get socket information for socket %d",sockfd);
      sprintf(sTemp,"Unable to get socket information for socket %d",sockfd);
      perror(sTemp);
      perror(sTemp);
      close(sockfd);
      close(sockfd);
      return 0;
      return 0;
Line 224... Line 225...
        case 0: /* Nothing interesting going on */
        case 0: /* Nothing interesting going on */
          data_on_stdin = true; /* Can only get here if nonblocking */
          data_on_stdin = true; /* Can only get here if nonblocking */
          break;
          break;
        default:
        default:
          /* Make sure to handle the gdb port first! */
          /* Make sure to handle the gdb port first! */
          if((fds[0].revents && (gdb_fd && !o_serv_fd) ||
          if((fds[0].revents && gdb_fd && !o_serv_fd) ||
              fds[1].revents && (server_fd && gdb_fd)))
             (fds[1].revents && server_fd && gdb_fd))
            {
            {
              int revents = o_serv_fd ? fds[1].revents : fds[0].revents;
              int revents = o_serv_fd ? fds[1].revents : fds[0].revents;
 
 
              if(revents & POLLIN)
              if(revents & POLLIN)
                GDBRequest();
                GDBRequest();
Line 262... Line 263...
 
 
void JTAGRequest(void)
void JTAGRequest(void)
{
{
  struct sockaddr_in sa;
  struct sockaddr_in sa;
  struct sockaddr* addr = (struct sockaddr*)&sa;
  struct sockaddr* addr = (struct sockaddr*)&sa;
  int n = sizeof(struct sockaddr_in);
  socklen_t len = sizeof(struct sockaddr_in);
  int fd = accept(server_fd,addr,&n);
  int fd = accept(server_fd,addr,&len);
  int on_off = 0; /* Turn off Nagel's algorithm on the socket */
  int on_off = 0; /* Turn off Nagel's algorithm on the socket */
  int flags;
  int flags;
  char sTemp[256];
  char sTemp[256];
 
 
  if(fd < 0)
  if(fd < 0)
Line 569... Line 570...
{
{
  char buf[4096];
  char buf[4096];
 
 
  err = htonl(err);
  err = htonl(err);
  if((gdb_read(buf,length) < 0) ||
  if((gdb_read(buf,length) < 0) ||
      (gdb_write(&err,sizeof(err)) < 0) && gdb_fd)
      ((gdb_write(&err,sizeof(err)) < 0) && gdb_fd))
    {
    {
      perror("gdb socket - 9");
      perror("gdb socket - 9");
      close(gdb_fd);
      close(gdb_fd);
      gdb_fd = 0;
      gdb_fd = 0;
    }
    }
Line 658... Line 659...
    }
    }
  }
  }
  return 0;
  return 0;
}
}
 
 
int gdbcomm_init (void)
void gdbcomm_init (void)
{
{
  serverPort = config.debug.server_port;
  serverPort = config.debug.server_port;
  if((server_fd = GetServerSocket("or1ksim","tcp",serverPort)))
  if((server_fd = GetServerSocket("or1ksim","tcp",serverPort)))
    PRINTF("JTAG Proxy server started on port %d\n",serverPort);
    PRINTF("JTAG Proxy server started on port %d\n",serverPort);
  else
  else

powered by: WebSVN 2.1.0

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