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

Subversion Repositories adv_debug_sys

[/] [adv_debug_sys/] [trunk/] [Software/] [adv_jtag_bridge/] [adv_jtag_bridge.c] - Diff between revs 42 and 51

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

Rev 42 Rev 51
Line 39... Line 39...
#include "or32_selftest.h"
#include "or32_selftest.h"
#include "bsdl.h"
#include "bsdl.h"
#include "errcodes.h"
#include "errcodes.h"
#include "hardware_monitor.h"
#include "hardware_monitor.h"
#include "jsp_server.h"
#include "jsp_server.h"
 
#include "hwp_server.h"
 
 
#define debug(...) //fprintf(stderr, __VA_ARGS__ )
#define debug(...) //fprintf(stderr, __VA_ARGS__ )
 
 
// How many command-line IR length settings to create by default
// How many command-line IR length settings to create by default
#define IR_START_SETS 16
#define IR_START_SETS 16
Line 82... Line 83...
#ifdef ENABLE_JSP
#ifdef ENABLE_JSP
char *jspport = NULL;
char *jspport = NULL;
char default_jspport[] = "9944";
char default_jspport[] = "9944";
#endif
#endif
 
 
 
char *hwpport = NULL;
 
char default_hwpport[] = "9928";
 
 
// Force altera virtual jtag mode on(1) or off(-1)
// Force altera virtual jtag mode on(1) or off(-1)
int force_alt_vjtag = 0;
int force_alt_vjtag = 0;
 
 
 
 
// Pointer to the command line arg used as the cable name
// Pointer to the command line arg used as the cable name
Line 282... Line 286...
  printf("Options:\n");
  printf("Options:\n");
  printf("\t-g [port]     : port number for GDB (default: %s)\n", default_port);
  printf("\t-g [port]     : port number for GDB (default: %s)\n", default_port);
#ifdef ENABLE_JSP
#ifdef ENABLE_JSP
  printf("\t-j [port]     : port number for JSP Server (default: %s)\n", default_jspport);
  printf("\t-j [port]     : port number for JSP Server (default: %s)\n", default_jspport);
#endif
#endif
 
  printf("\t-w [port]     : port number for HWP server (default: %s)\n", default_hwpport);
  printf("\t-x [index]    : Position of the target device in the scan chain\n");
  printf("\t-x [index]    : Position of the target device in the scan chain\n");
  printf("\t-a [0 / 1]    : force Altera virtual JTAG mode off (0) or on (1)\n");
  printf("\t-a [0 / 1]    : force Altera virtual JTAG mode off (0) or on (1)\n");
  printf("\t-l [<index>:<bits>]     : Specify length of IR register for device\n");
  printf("\t-l [<index>:<bits>]     : Specify length of IR register for device\n");
  printf("\t                <index>, override autodetect (if any)\n");
  printf("\t                <index>, override autodetect (if any)\n");
  printf("\t-c [hex cmd]  : Debug command for target TAP, override autodetect\n");
  printf("\t-c [hex cmd]  : Debug command for target TAP, override autodetect\n");
Line 313... Line 318...
#endif
#endif
  force_alt_vjtag = 0;
  force_alt_vjtag = 0;
  cmd_line_cmd_debug = -1;
  cmd_line_cmd_debug = -1;
 
 
  /* Parse the global arguments (if-any) */
  /* Parse the global arguments (if-any) */
  while((c = getopt(argc, argv, "+g:j:x:a:l:c:v:r:b:th")) != -1) {
  while((c = getopt(argc, argv, "+g:j:w:x:a:l:c:v:r:b:th")) != -1) {
    switch(c) {
    switch(c) {
    case 'h':
    case 'h':
      print_usage(argv[0]);
      print_usage(argv[0]);
      exit(0);
      exit(0);
      break;
      break;
Line 327... Line 332...
#ifdef ENABLE_JSP
#ifdef ENABLE_JSP
    case 'j':
    case 'j':
      jspport = optarg;
      jspport = optarg;
      break;
      break;
#endif
#endif
 
    case 'w':
 
      hwpport = optarg;
 
      break;
    case 'x':
    case 'x':
      target_dev_pos = atoi(optarg);
      target_dev_pos = atoi(optarg);
      break;
      break;
    case 'l':
    case 'l':
      get_ir_opts(optarg, &idx, &val);        // parse the option
      get_ir_opts(optarg, &idx, &val);        // parse the option
Line 378... Line 386...
#ifdef ENABLE_JSP
#ifdef ENABLE_JSP
  if(jspport == NULL)
  if(jspport == NULL)
    jspport = default_jspport;
    jspport = default_jspport;
#endif
#endif
 
 
 
  if(hwpport == NULL)
 
    hwpport = default_hwpport;
 
 
  int found_cable = 0;
  int found_cable = 0;
  char* start_str = argv[optind];
  char* start_str = argv[optind];
  int start_idx = optind;
  int start_idx = optind;
  for(i = optind; i < argc; i++) {
  for(i = optind; i < argc; i++) {
    if(cable_select(argv[i]) == APP_ERR_NONE) {
    if(cable_select(argv[i]) == APP_ERR_NONE) {
Line 393... Line 404...
    }
    }
  }
  }
 
 
 
 
  if(!found_cable) {
  if(!found_cable) {
    fprintf(stderr, "No valid cable specified.\n");
    fprintf(stderr, "Error: No valid cable specified.\n");
 
    print_usage(argv[0]);
    exit(1);
    exit(1);
  }
  }
 
 
  optind = start_idx+1;  // reset the parse index
  optind = start_idx+1;  // reset the parse index
 
 
Line 488... Line 500...
 
 
  jsp_init(jspserverport);
  jsp_init(jspserverport);
  jsp_server_start();
  jsp_server_start();
#endif
#endif
 
 
 
  long int hwpserverport;
 
  hwpserverport = strtol(hwpport,&s,10);
 
  if(*s) {
 
    printf("Failed to get HWP server port \'%s\', using default \'%s\'.\n", jspport, default_jspport);
 
    serverPort = strtol(default_hwpport,&s,10);
 
    if(*s) {
 
      printf("Failed to get default HWP port, exiting.\n");
 
      return -1;
 
    }
 
  }
 
 
 
  hwp_init(hwpserverport);
 
  hwp_server_start();
 
 
  printf("JTAG bridge ready!\n");
  printf("JTAG bridge ready!\n");
 
 
  // This handles requests from GDB.  I'd prefer the while() loop to be in the function
  // This handles requests from GDB.  I'd prefer the while() loop to be in the function
  // with the select()/poll(), but the or1ksim rsp code (ported for use here) doesn't work 
  // with the select()/poll(), but the or1ksim rsp code (ported for use here) doesn't work 
  // that way, and I don't want to rework that code (to make it easier to import fixes
  // that way, and I don't want to rework that code (to make it easier to import fixes

powered by: WebSVN 2.1.0

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