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 1147 and 1308

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

Rev 1147 Rev 1308
Line 28... Line 28...
#include <sys/select.h>
#include <sys/select.h>
#include <sys/poll.h>
#include <sys/poll.h>
#include <fcntl.h>
#include <fcntl.h>
#include <netdb.h>
#include <netdb.h>
#include <netinet/tcp.h>
#include <netinet/tcp.h>
 
#include <unistd.h>
 
#include <string.h>
 
 
#include "gdb.h"
#include "gdb.h"
#include "gdbcomm.h"
#include "gdbcomm.h"
#include "vapi.h"
#include "vapi.h"
#include "sim-config.h"
#include "sim-config.h"
 
#include "debug_unit.h"
 
 
 
static int gdb_read(void* buf,int len);
 
static int gdb_write(const void* buf,int len);
 
 
static unsigned int serverIP = 0;
static unsigned int serverIP = 0;
static unsigned int serverPort = 0;
static unsigned int serverPort = 0;
static unsigned int server_fd = 0;
static unsigned int server_fd = 0;
static unsigned int gdb_fd = 0;
static unsigned int gdb_fd = 0;
Line 66... Line 72...
 
 
  /* If we weren't passed a non standard port, get the port
  /* If we weren't passed a non standard port, get the port
     from the services directory. */
     from the services directory. */
  if(!port)
  if(!port)
    {
    {
      if(service = getservbyname(name,protocol->p_name))
      if((service = getservbyname(name,protocol->p_name)))
        port = ntohs(service->s_port);
        port = ntohs(service->s_port);
    }
    }
 
 
  /* Create the socket using the TCP protocol */
  /* Create the socket using the TCP protocol */
  if((sockfd = socket(PF_INET,SOCK_STREAM,protocol->p_proto)) < 0)
  if((sockfd = socket(PF_INET,SOCK_STREAM,protocol->p_proto)) < 0)
Line 170... Line 176...
void HandleServerSocket(Boolean block)
void HandleServerSocket(Boolean block)
{
{
  struct pollfd fds[3];
  struct pollfd fds[3];
  int n = 0;
  int n = 0;
  int timeout = block ? -1 : 0;
  int timeout = block ? -1 : 0;
  int server_index = -1;
 
  int gdb_index = -1;
 
  Boolean data_on_stdin = false;
  Boolean data_on_stdin = false;
  int o_serv_fd = server_fd;
  int o_serv_fd = server_fd;
 
 
  if(!o_serv_fd && !gdb_fd)
  if(!o_serv_fd && !gdb_fd)
    return;
    return;
Line 319... Line 323...
  JTAGProxyBlockWriteMessage *msg_bwrite;
  JTAGProxyBlockWriteMessage *msg_bwrite;
  JTAGProxyBlockReadMessage msg_bread;
  JTAGProxyBlockReadMessage msg_bread;
  JTAGProxyBlockWriteResponse resp_bwrite;
  JTAGProxyBlockWriteResponse resp_bwrite;
  JTAGProxyBlockReadResponse *resp_bread;
  JTAGProxyBlockReadResponse *resp_bread;
  char *buf;
  char *buf;
  unsigned long long data;
 
  int err = 0;
  int err = 0;
  uint32_t command,length;
  uint32_t command,length;
  int len,i;
  int len,i;
 
 
  /* First, we must read the incomming command */
  /* First, we must read the incomming command */
Line 650... Line 653...
}
}
 
 
int gdbcomm_init ()
int gdbcomm_init ()
{
{
  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
    PRINTF("Cannot start JTAG proxy server on port %d\n", serverPort);
    PRINTF("Cannot start JTAG proxy server on port %d\n", serverPort);
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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