void print_report ()
{
  int stat;
  /* Removed to compile cleanly with -Wall */
  //double rtt, krtt;
  char str[NI_MAXHOST];
      
  stat = sock_cmp_addr (sarecv, salast, salen);

  /* if this reply comes from source different from the previous
     one, print the full host information */

  if (stat != 0) {
    stat = getnameinfo (sarecv, salen, str, sizeof(str), NULL, 0, 0);
    if (stat == 0) {
      printf (" %s (%s)", str, Sock_ntop_host (sarecv, salen));
    } else {
      printf (" %s", Sock_ntop_host (sarecv, salen));
    }
    memcpy (salast, sarecv, salen);
  }

  /* calculate and print the round trip time using user-level timestamps */

  sub_tv (recvtv, sendtv, difftv);
  /* Removed to compile cleanly with -Wall */
  //rtt = time_to_double (difftv);

  printf ("  %.3f", time_to_double (difftv));
}
Esempio n. 2
0
static int spinit (double stime) {    /* loops for stime seconds and returns */
   struct timespec tcurrent;
   double tend, tnow;

   if (stime == 0.0)
      return 0;
   if (clock_gettime(CLOCK_REALTIME, &tcurrent) == -1)
      return -1;
   tnow = time_to_double(tcurrent);
   tend = tnow + stime;
   while (tnow < tend) {
      if (clock_gettime(CLOCK_REALTIME, &tcurrent)  == -1)
         return -1;
      tnow = time_to_double(tcurrent);
   }
   return 0;
}
Esempio n. 3
0
static void nps_main_init(void) {

  nps_main.sim_time = 0.;
  nps_main.display_time = 0.;
  struct timeval t;
  gettimeofday (&t, NULL);
  nps_main.real_initial_time = time_to_double(&t);
  nps_main.scaled_initial_time = time_to_double(&t);
  nps_main.host_time_factor = HOST_TIME_FACTOR;

  nps_ivy_init();
  nps_fdm_init(SIM_DT);
  nps_sensors_init(nps_main.sim_time);

  enum NpsRadioControlType rc_type;
  char* rc_dev = NULL;
  if (nps_main.js_dev) {
    rc_type = JOYSTICK;
    rc_dev = nps_main.js_dev;
  }
  else if (nps_main.spektrum_dev) {
    rc_type = SPEKTRUM;
    rc_dev = nps_main.spektrum_dev;
  }
  else {
    rc_type = SCRIPT;
  }
  nps_autopilot_init(rc_type, nps_main.rc_script, rc_dev);

  if (nps_main.fg_host)
    nps_flightgear_init(nps_main.fg_host, nps_main.fg_port);

#if DEBUG_NPS_TIME
  printf("host_time_factor,host_time_elapsed,host_time_now,scaled_initial_time,sim_time_before,display_time_before,sim_time_after,display_time_after\n");
#endif

}
Esempio n. 4
0
static gboolean nps_main_periodic(gpointer data __attribute__ ((unused))) {
  struct timeval tv_now;
  double  host_time_now;

  if (pauseSignal) {
    char line[128];
    double tf = 1.0;
    double t1, t2, irt;

    gettimeofday(&tv_now, NULL);
    t1 = time_to_double(&tv_now);
    /* unscale to initial real time*/
    irt = t1 - (t1 - nps_main.scaled_initial_time)*nps_main.host_time_factor;

    printf("Press <enter> to continue (or CTRL-Z to suspend).\nEnter a new time factor if needed (current: %f): ", nps_main.host_time_factor);
    fflush(stdout);
    if (fgets(line,127,stdin)) {
      if ((sscanf(line," %le ", &tf) == 1)) {
        if (tf > 0 && tf < 1000)
          nps_main.host_time_factor = tf;
      }
    printf("Time factor is %f\n", nps_main.host_time_factor);
    }
    gettimeofday(&tv_now, NULL);
    t2 = time_to_double(&tv_now);
    /* add the pause to initial real time */
    irt += t2 - t1;
    nps_main.real_initial_time += t2 - t1;
    /* convert to scaled initial real time */
    nps_main.scaled_initial_time = t2 - (t2 - irt)/nps_main.host_time_factor;
    pauseSignal = 0;
  }

  gettimeofday (&tv_now, NULL);
  host_time_now = time_to_double(&tv_now);
  double host_time_elapsed = nps_main.host_time_factor *(host_time_now  - nps_main.scaled_initial_time);

#if DEBUG_NPS_TIME
  printf("%f,%f,%f,%f,%f,%f,",nps_main.host_time_factor,host_time_elapsed,host_time_now,nps_main.scaled_initial_time,nps_main.sim_time,nps_main.display_time);
#endif

  int cnt = 0;
  static int prev_cnt = 0;
  static int grow_cnt = 0;
  while (nps_main.sim_time <= host_time_elapsed) {
    nps_main_run_sim_step();
    nps_main.sim_time += SIM_DT;
    if (nps_main.display_time < (host_time_now - nps_main.real_initial_time)) {
      nps_main_display();
      nps_main.display_time += DISPLAY_DT;
    }
    cnt++;
  }

  /* Check to make sure the simulation doesn't get too far behind real time looping */
  if (cnt > (prev_cnt)) {grow_cnt++;}
  else { grow_cnt--;}
  if (grow_cnt < 0) {grow_cnt = 0;}
  prev_cnt = cnt;

  if (grow_cnt > 10) {
    printf("Warning: The time factor is too large for efficient operation! Please reduce the time factor.\n");
  }

#if DEBUG_NPS_TIME
  printf("%f,%f\n",nps_main.sim_time,nps_main.display_time);
#endif

  return TRUE;

}
Esempio n. 5
0
int main(int argc, char *argv[])
{
  int                ret = 0;
  const float        mclk_freq = 33.0f;
  ADMXRC2_STATUS     status;
  ADMXRC2_CARD_INFO  cardInfo;
  ADMXRC2_SPACE_INFO spInfo;
  ADMXRC2_BANK_INFO  bankInfo, bankInfo2;
  const char*        filename;
  Option             options[8];
  Arguments          arguments;
  float              freq, min_freq, max_freq;
  unsigned long      i;
  uint32_t           sizeReg;
  BOOLEAN            dma;
  BOOLEAN            use64bit;
  BOOLEAN            speed;
  unsigned long      nrep;
  BOOLEAN            failed;

  /* Set up expected options */
  options[0].key = "banks";
  options[0].type = Option_hex;
  options[0].def.hexVal = 0xffffffff;
  options[0].meaning = "bitmask of banks to test";
  options[1].key = "card";
  options[1].type = Option_uint;
  options[1].def.uintVal = 0;
  options[1].meaning = "ID of card to use";
  options[2].key = "index";
  options[2].type = Option_uint;
  options[2].def.uintVal = 0;
  options[2].meaning = "index of card to use";
  options[3].key = "lclk";
  options[3].type = Option_float;
  options[3].def.floatVal = 33.0;
  options[3].meaning = "local bus clock speed (MHz)";
  options[4].key = "repeat";
  options[4].type = Option_uint;
  options[4].def.uintVal = 1;
  options[4].meaning = "number of repetitions";
  options[5].key = "speed";
  options[5].type = Option_boolean;
  options[5].def.booleanVal = TRUE;
  options[5].meaning = "TRUE => measure access speed";
  options[6].key = "usedma";
  options[6].type = Option_boolean;
  options[6].def.booleanVal = TRUE;
  options[6].meaning = "TRUE => use DMA transfers";
  options[7].key = "64";
  options[7].type = Option_boolean;
  options[7].def.booleanVal = FALSE;
  options[7].meaning = "TRUE => use 64-bit local bus";
  arguments.nOption = 8;
  arguments.option = options;
  arguments.nParamType = 0;
  arguments.minNParam = 0;
	
  /* Parse command line */
  parse_command_line("memtest", argc, argv, &arguments);
	
  if (options[1].specified && options[2].specified) {
    printf("*** Do not specify both /card and /index\n");
    ret = -1;
    //goto done;
  }
	
  if (!options[2].specified) {
    ADMXRC2_CARDID cardID = options[1].value.uintVal;
		
    status = ADMXRC2_OpenCard(cardID, &card);
    if (status != ADMXRC2_SUCCESS) {
      printf("*** Failed to open card with ID %ld: %s\n",
	     (unsigned long) cardID, ADMXRC2_GetStatusString(status));
      ret = -1;
      //goto done;
    }
  } else {
    unsigned int index = options[2].value.uintVal;
		
    status = ADMXRC2_OpenCardByIndex(index, &card);
    if (status != ADMXRC2_SUCCESS) {
      printf("*** Failed to open card with index %ld: %s\n",
	     (unsigned long) index, ADMXRC2_GetStatusString(status));
      ret = -1;
     // goto done;
    }
  }
	
  freq = options[3].value.floatVal;
  nrep = options[4].value.uintVal;
  speed = options[5].value.booleanVal;
  dma = options[6].value.booleanVal;
  use64bit = options[7].value.booleanVal;

  /*
  ** Find out if we're running on a big-endian machine
  */
  bBigEndian = (os_cpu_to_le32(0x1U) != 0x1U);

  /* 
  ** Get card information, specifically for device fitted and
  ** number of SSRAM banks
  */
  status = ADMXRC2_GetCardInfo(card, &cardInfo);
  if (status != ADMXRC2_SUCCESS) {
    printf("*** Failed to get card info: %s\n", ADMXRC2_GetStatusString(status));
    return -1;
  }
	
  switch (cardInfo.BoardType) {
  case ADMXRC2_BOARD_ADMXRC:
  case ADMXRC2_BOARD_ADMXRC_P:
  case ADMXRC2_BOARD_ADMXRC2_LITE:
    min_freq = 25.0;
    max_freq = 40.0;
    break;

  case ADMXRC2_BOARD_ADMXRC2:
  case ADMXRC2_BOARD_ADMXRC4LS:
  case ADMXRC2_BOARD_ADMXRC4LX:
  case ADMXRC2_BOARD_ADMXRC4SX:
    min_freq = 24.0;
    max_freq = 66.0;
    break;

  case ADMXRC2_BOARD_ADMXPL:
    min_freq = 24.0;
    max_freq = 80.0;
    break;

  default:
    printf("*** This example must be run on one of the following cards:\n\n");
    printf("\tADM-XRC\n");
    printf("\tADM-XRC-P\n");
    printf("\tADM-XRCII-Lite\n");
    printf("\tADM-XRCII\n");
    printf("\tADM-XPL\n");
    printf("\tADM-XRC4LX\n");
    printf("\tADM-XRC4SX\n");
    ret = -1;
    //goto done;
  }
	
  if (freq > max_freq || freq < min_freq) {
    printf("*** LCLK frequency of %.1f MHz is not supported\n", freq);
    ret = -1;
   // goto done;
  }
	
  if (use64bit && cardInfo.BoardType != ADMXRC2_BOARD_ADMXPL) {
    printf("*** 64-bit local bus is not supported on the specified card.\n");
    ret = -1;
    //goto done;
  }

  /* Get the address of FPGA space */
  status = ADMXRC2_GetSpaceInfo(card, 0, &spInfo);
  if (status != ADMXRC2_SUCCESS) {
    printf("Failed to get space 0 info: %s\n",
	   ADMXRC2_GetStatusString(status));
    return -1;
  }
  fpgaSpace = (volatile uint32_t*) spInfo.VirtualBase;

  fpgaSpace[6] = os_cpu_to_le32(0);
  fpgaSpace[6];
  fpgaSpace[7] = os_cpu_to_le32(0);
  fpgaSpace[7];




 
	
  if (!options[0].specified) {
    bankTestMask = cardInfo.RAMBanksFitted;
  } else {
    bankTestMask = options[0].value.hexVal & cardInfo.RAMBanksFitted;
  }

  /*
  ** Check that the type, size, width etc. of each SSRAM bank
  ** is the same.
  */
  numBank = 0;
  testSize = 0;
  for (i = 0; i < cardInfo.NumRAMBank; i++) {
    status = ADMXRC2_GetBankInfo(card, i, &bankInfo2);
    if (status != ADMXRC2_SUCCESS) {
      printf("*** Failed to get bank %ld info: %s\n",
	     (unsigned long) i,
	     ADMXRC2_GetStatusString(status));
      return -1;
    }

    if (!(bankInfo2.Type & (ADMXRC2_RAM_ZBTP | ADMXRC2_RAM_ZBTFT))) {
      /* Ignore any banks that are not ZBT SSRAM */
      continue;
    }

    if (!bankInfo2.Fitted) {
      printf("*** Not all SSRAM banks are fitted - aborting.\n");
      ret = -1;
      //goto done;
    }

    if (cardInfo.BoardType == ADMXRC2_BOARD_ADMXPL && !use64bit) {
      /*
      ** ADM-XPL ZBT bank width is 64 bits but the 32-bit version of design
      ** uses only the lower 32 bits of the ZBT bank.
      */
      bankInfo2.Width = 32;
    }

    if (!numBank) {
      memcpy(&bankInfo, &bankInfo2, sizeof(bankInfo));
      bankSize = (bankInfo.Width / 8) * bankInfo.Size;
    } else {
      if (bankInfo2.Type != bankInfo.Type ||
	  bankInfo2.Width != bankInfo.Width ||
	  bankInfo2.Size != bankInfo.Size) {
	printf("*** Not all SSRAM banks are the same - aborting.\n");
	ret = -1;
	//goto done;
      }
    }

    numBank++;

    if (bankTestMask & (0x1UL << i)) {
      testSize += (bankInfo.Width / 8) * bankInfo.Size;
    }
  }
	
  if (!numBank) {
    printf("*** No SSRAM banks found - aborting.\n");
    ret = -1;
    //goto done;
  }

  /*
  ** Calculate memory size in bytes
  */
  memorySize = numBank * bankSize;
  lastPageSize = memorySize & (pageSize - 1);

  /*
  ** Determine value to program into the SIZE register in the FPGA
  */
  switch (bankInfo.Size) {
  case 128*1024:
    sizeReg = 0;
    break;
  case 256*1024:
    sizeReg = 1;
    break;
  case 512*1024:
    sizeReg = 2;
    break;
  case 1024*1024:
    sizeReg = 3;
    break;
  case 2048*1024:
    sizeReg = 4;
    break;
  default:
    printf("*** SSRAM of %ld words x %ld is not supported by this application\n",
	   (unsigned long) bankInfo.Size, (unsigned long) bankInfo.Width);
    ret = -1;
    //goto done;
  }
	
  ssram = (volatile uint32_t*) (((uint8_t*) fpgaSpace) + ssramOffset);
	
  rambuf = (uint8_t*) ADMXRC2_Malloc(memorySize);
  if (rambuf == NULL) {
    printf("*** Failed to allocate RAM buffer - aborting\n");
    ret = -1;
    //goto done;
  }
  rambuf32 = (uint32_t*) rambuf;

  chkbuf = (uint8_t*) ADMXRC2_Malloc(memorySize);
  if (chkbuf == NULL) {
    printf("*** Failed to allocate RAM readback buffer - aborting\n");
    ret = -1;
    ///goto done;
  }
  chkbuf32 = (uint32_t*) chkbuf;

  status = ADMXRC2_SetClockRate(card, ADMXRC2_CLOCK_LCLK, freq * 1.0e6, NULL);
  if (status != ADMXRC2_SUCCESS) {
    printf("*** Failed to set LCLK to %.1fMHz: %s\n",
	   freq, ADMXRC2_GetStatusString(status));
    ret = -1;
    //goto done;
  }
	
  if (cardInfo.BoardType != ADMXRC2_BOARD_ADMXPL) {
    status = ADMXRC2_SetClockRate(card, 1, mclk_freq * 1.0e6, NULL);
    if (status != ADMXRC2_SUCCESS) {
      printf("*** Failed to set clock 1 to %.1fMHz: %s\n",
	     mclk_freq, ADMXRC2_GetStatusString(status));
      return -1;
    }
  }

  filename="/var/www/html/VirtualLabs/experiments/exp_4/bitfiles/user_configuration.bit";
  status = ADMXRC2_ConfigureFromFile(card, filename);
  if (status != ADMXRC2_SUCCESS) {
    printf ("*** Failed to load the bitstream '%s': %s\n",
	    filename, ADMXRC2_GetStatusString(status));
    return -1;
  }
	
  if (use64bit) {
    uint32_t config;
    
    config = ADMXRC2_SPACE_SET_WIDTH | ADMXRC2_SPACE_WIDTH_64;
    status = ADMXRC2_SetSpaceConfig(card, 0, config);
    if (status != ADMXRC2_SUCCESS) {
      printf ("*** Failed to set space configuration: %s\n",
	      ADMXRC2_GetStatusString(status));
      return -1;
    }
  }
  
  status = ADMXRC2_SetupDMA(card,
			    rambuf,
			    memorySize,
			    0,
			    &dmaDesc1);
  if (status != ADMXRC2_SUCCESS) {
    printf ("*** Failed to get a DMA descriptor: %s\n",
	    ADMXRC2_GetStatusString(status));
    return -1;
  }
	
  status = ADMXRC2_SetupDMA(card,
			    chkbuf,
			    memorySize,
			    0,
			    &dmaDesc2);
  if (status != ADMXRC2_SUCCESS) {
    printf ("*** Failed to get a DMA descriptor: %s\n",
	    ADMXRC2_GetStatusString(status));
    return -1;
  }
	
  dmaMode = ADMXRC2_BuildDMAModeWord(cardInfo.BoardType,
				     use64bit ? ADMXRC2_IOWIDTH_64 : ADMXRC2_IOWIDTH_32,
				     0,
				     ADMXRC2_DMAMODE_USEREADY | ADMXRC2_DMAMODE_USEBTERM | ADMXRC2_DMAMODE_BURSTENABLE);
	
  /* Wait for DLLs/DCMs to lock */
  sleep(1);

  /*
  ** Program the number of address bits used by the SSRAMs
  */
  fpgaSpace[ZBT_SIZE_REG] = os_cpu_to_le32(sizeReg);
  fpgaSpace[ZBT_SIZE_REG]; /* make sure it's got there */

  printf("Size reg   = 0x%8.8lx\n", (unsigned long) os_le32_to_cpu(fpgaSpace[ZBT_SIZE_REG]));
  printf("Info reg   = 0x%8.8lx\n", (unsigned long) os_le32_to_cpu(fpgaSpace[ZBT_INFO_REG]));
  printf("Status reg = 0x%8.8lx\n", (unsigned long) os_le32_to_cpu(fpgaSpace[ZBT_STATUS_REG]));
	
  failed = FALSE;
	
 // printf("Performing memory tests using %s\n",
//	 dma ? "DMA" : "programmed I/O");
	
  /* Iterate over flowthrough and pipelined */
  for (i = 0; i < 2; i++) {
    int           nError = 0;
    unsigned long j, k;
    uint32_t      exp, act;
    unsigned long rep;
		
    if (i == 0) {
      if (!(bankInfo.Type & ADMXRC2_RAM_ZBTFT)) {
	continue;
      }
			
      /*
      ** Set the FPGA to flowthrough mode
      */
      fpgaSpace[ZBT_PIPELINE_REG] = os_cpu_to_le32(0x0);
      fpgaSpace[ZBT_PIPELINE_REG]; /* make sure it's got there */
    //  printf("Testing %ld kB in flowthrough mode...\n", testSize / 1024);
    } else {
      if (!(bankInfo.Type & ADMXRC2_RAM_ZBTP)) {
	continue;
      }
			
      /*
      ** Set the FPGA to pipelined mode
      */
      fpgaSpace[ZBT_PIPELINE_REG] = os_cpu_to_le32(0x1);
      fpgaSpace[ZBT_PIPELINE_REG]; /* make sure it's got there */
      printf("Testing %ld kB in pipelined mode...\n", testSize / 1024);
    }
		

}


//////////////////////////////////////////////////////////////////////////////////////////////////////////



	  FILE *fptr;
	  char filen[30];
	  char initial[16];
	  char temp[16];
	argc --;
	if(argc > 0)
	strcpy(filen,*(argv+1));
	else 
	{
	printf(" Image file name not specified \n");
	exit(1);
	}
	
   if(!(fptr = fopen(filen,"r")))
	{
	printf(" Image file does not exist specify some other existing image file  \n");
	exit(1);
	}

    
   int row=0,col=0,count =0,j;
   int header =0;
   char ch;
    while( count!=3)
          {   
              count ++;
              ch=fgetc(fptr);
              initial[header]=ch;
              header++;
              
          } 
    ch=fgetc(fptr);
    initial[header]=ch;

    header++;
    while(ch!=32)
        { 
           col= col*10+ (ch-48) ;
           ch = fgetc(fptr); 
           initial[header]=ch;
          header++;
        }  

    ch= fgetc(fptr);
    initial[header]=ch;

    header++;
    while(ch!=10)
         { 
           row = row*10 + (ch-48);
           ch= fgetc(fptr);
           initial[header]=ch;

           header++; 
         }
    count =0; 
    while( count!=4)
          {
              count ++;
              ch=fgetc(fptr);
              initial[header]=ch;

              header++;
          } 
   initial[header]='\0';
//   printf( "\n  row === %d",row);
 //  printf( "\n  col === %d",col);
   strcpy(temp,initial);
 //  printf( "\n header len  === %d",header);
//  printf( "\n Header   === %s======%s",initial,temp);

 int matrix[row][col];

 for(i=0;i< row;i++)
       {
           for( j= 0;j< col;j++)
                matrix[i][j]=fgetc(fptr);
       }

 fclose(fptr); 

int output[row][col];
int m,n;
count = 0;

for(m=0;m<row;m++)
  {for(n=0;n<col;n++)
      { output[m][n]=0;
	rambuf[count] = matrix[m][n];
	count++;}
  }

count = 0;

for(j=0;j<2;j++)
	{
	status = writeSSRAM(rambuf + j * bankSize, j * bankSize, bankSize, dma);
	if (status != ADMXRC2_SUCCESS) {
	printf("Error: failed to write SSRAM\n");
	failed = TRUE;
	}
	}

fpgaSpace[6] = os_cpu_to_le32(1);
fpgaSpace[6];

while(fpgaSpace[7]!=os_cpu_to_le32(0x31));

fpgaSpace[6] = os_cpu_to_le32(0);
fpgaSpace[6];
sleep(10);

        
if (!failed) {
	  for (j = 0; j < 2; j++) {
	    if (!(bankTestMask & (1U << j))) {
	      continue;
	    }
						
	    status = readSSRAM(chkbuf + j * bankSize, j * bankSize, bankSize, dma);
	    if (status != ADMXRC2_SUCCESS) {
	      printf("Error: failed to read SSRAM\n");
	      failed = TRUE;
	      break;
	    }
	  }
	}
count = 0;
for(m=0;m<row;m++)
  {for(n=0;n<col;n++)
      { output[m][n]=chkbuf[count];
	count++;}
  }

//=========================================== new IMAGE FILE BUILD============================

  char newFile[] = "Converted_Imag";
  char *newfile= strncat(newFile,".pgm",4);
 
   fptr = fopen(newfile,"w");
   count=0;
  // strcpy(initial,temp);
   printf("\n %s..... %s\n",initial,temp);
   while(count!=15)
         {
            fputc(initial[count],fptr);
            count++;
         }
      for(i=0;i< row;i++)
       {
           for( j= 0;j< col;j++)
              fputc(output[i][j],fptr);
       }
   fclose(fptr); 




////////////////////////////////////////////////////////////////////////////////////////////////////////////


  if (speed) {
    /*
    ** Measure the host read and host write speeds of the SSRAM,
    ** using DMA.
    */
    float          bytes, rate;
    double         delta;
    struct timeval start, now, elapsed;
		
    printf("Measuring access speed...\n");
		
    start = get_time();
    bytes = 0.0f;
    do {
      readSSRAM(rambuf, 0, memorySize, dma);
      bytes += (float) memorySize;
      now = get_time();
      elapsed = time_subtract(&now, &start);
      delta = time_to_double(&elapsed);
    } while (delta < 2.0);
		
    rate = bytes / delta;
    printf("SSRAM to host throughput = %.1fMB/s\n", rate / 1048576.0f);
		
    start = get_time();
    bytes = 0.0f;
    do {
      writeSSRAM(rambuf, 0, memorySize, dma);
      bytes += (float) memorySize;
      now = get_time();
      elapsed = time_subtract(&now, &start);
      delta = time_to_double(&elapsed);
    } while (delta < 2.0);
		
    rate = bytes / delta;
    printf("Host to SSRAM throughput = %.1fMB/s\n", rate / 1048576.0f);
  }


 ADMXRC2_Free (rambuf);
  ADMXRC2_Free (chkbuf);
  ADMXRC2_CloseCard (card);
  exit(0);


  return 0;

}
Esempio n. 6
0
int main(int argc, char *argv[])
{
  int                ret = 0;
  const float        mclk_freq = 33.0f;
  ADMXRC2_STATUS     status;
  ADMXRC2_CARD_INFO  cardInfo;
  ADMXRC2_SPACE_INFO spInfo;
  ADMXRC2_BANK_INFO  bankInfo, bankInfo2;
  const char*        filename;
  Option             options[8];
  Arguments          arguments;
  float              freq, min_freq, max_freq;
  unsigned long      i;
  uint32_t           sizeReg;
  BOOLEAN            dma;
  BOOLEAN            use64bit;
  BOOLEAN            speed;
  unsigned long      nrep;
  BOOLEAN            failed;

  /* Set up expected options */
  options[0].key = "banks";
  options[0].type = Option_hex;
  options[0].def.hexVal = 0xffffffff;
  options[0].meaning = "bitmask of banks to test";
  options[1].key = "card";
  options[1].type = Option_uint;
  options[1].def.uintVal = 0;
  options[1].meaning = "ID of card to use";
  options[2].key = "index";
  options[2].type = Option_uint;
  options[2].def.uintVal = 0;
  options[2].meaning = "index of card to use";
  options[3].key = "lclk";
  options[3].type = Option_float;
  options[3].def.floatVal = 33.0;
  options[3].meaning = "local bus clock speed (MHz)";
  options[4].key = "repeat";
  options[4].type = Option_uint;
  options[4].def.uintVal = 1;
  options[4].meaning = "number of repetitions";
  options[5].key = "speed";
  options[5].type = Option_boolean;
  options[5].def.booleanVal = TRUE;
  options[5].meaning = "TRUE => measure access speed";
  options[6].key = "usedma";
  options[6].type = Option_boolean;
  options[6].def.booleanVal = TRUE;
  options[6].meaning = "TRUE => use 64 bit local bus";
  options[7].key = "64";
  options[7].type = Option_boolean;
  options[7].def.booleanVal = FALSE;
  options[7].meaning = "TRUE => use DMA for test";printf("Writing 0xAAAAAAAA...\n");
  arguments.nOption = 8;
  arguments.option = options;
  arguments.nParamType = 0;
  arguments.minNParam = 0;
	
  /* Parse command line */
  parse_command_line("memtest", argc, argv, &arguments);
	
 	

		
    status = ADMXRC2_OpenCardByIndex(index, &card);
    if (status != ADMXRC2_SUCCESS) {
      printf("*** Failed to open card with index %ld: %s\n",
	     (unsigned long) index, ADMXRC2_GetStatusString(status));
      ret = -1;
      goto done;
    }
  
	
  freq = options[3].value.floatVal;
  nrep = options[4].value.uintVal;
  speed = options[5].value.booleanVal;
  dma = options[6].value.booleanVal;
  use64bit = options[7].value.booleanVal;

  /* 
  ** Get card information, specifically for device fitted and
  ** number of SSRAM banks
  */
  status = ADMXRC2_GetCardInfo(card, &cardInfo);
  if (status != ADMXRC2_SUCCESS) {
    printf("*** Failed to get card info: %s\n", ADMXRC2_GetStatusString(status));
    return -1;
  }

  /* Get the address of FPGA space */
  status = ADMXRC2_GetSpaceInfo(card, 0, &spInfo);
  if (status != ADMXRC2_SUCCESS) {
    printf("Failed to get space 0 info: %s\n",
	   ADMXRC2_GetStatusString(status));
    return -1;
  }
  fpgaSpace = (volatile uint32_t*) spInfo.VirtualBase;
	
  if (!options[0].specified) {
    bankTestMask = cardInfo.RAMBanksFitted;
  } else {
    bankTestMask = options[0].value.hexVal & cardInfo.RAMBanksFitted;
  }

  /*
  ** Check that the type, size, width etc. of each SSRAM bank
  ** is the same.
  */
  numBank = 0;
  testSize = 0;
  for (i = 0; i < cardInfo.NumRAMBank; i++) {
    status = ADMXRC2_GetBankInfo(card, i, &bankInfo2);
    if (status != ADMXRC2_SUCCESS) {
      printf("*** Failed to get bank %ld info: %s\n",
	     (unsigned long) i,
	     ADMXRC2_GetStatusString(status));
      return -1;
    }

    if (!(bankInfo2.Type & (ADMXRC2_RAM_ZBTP | ADMXRC2_RAM_ZBTFT))) {
      /* Ignore any banks that are not ZBT SSRAM */
      continue;
    }

    if (!bankInfo2.Fitted) {
      printf("*** Not all SSRAM banks are fitted - aborting.\n");
      ret = -1;
      goto done;
    }

    if (!numBank) {
      memcpy(&bankInfo, &bankInfo2, sizeof(bankInfo));
      bankSize = (bankInfo.Width / 8) * bankInfo.Size / 4;
    } else {
      if (bankInfo2.Type != bankInfo.Type ||
	  bankInfo2.Width != bankInfo.Width ||
	  bankInfo2.Size != bankInfo.Size) {
	printf("*** Not all SSRAM banks are the same - aborting.\n");
	ret = -1;
	goto done;
      }
    }

    numBank++;

    if (bankTestMask & (0x1UL << i)) {
      testSize += (bankInfo.Width / 8) * bankInfo.Size / 4;
    }
  }
	
  if (!numBank) {
    printf("*** No SSRAM banks found - aborting.\n");
    ret = -1;
    goto done;
  }

  /*
  ** Calculate memory size in longwords (32-bit words)
  */
  memorySize = numBank * bankSize;
  lastPageSize = memorySize & (pageSize - 1);

  /*
  ** Determine value to program into the SIZE register in the FPGA
  */
  switch (bankInfo.Size) {
  case 128*1024:
    sizeReg = 0;
    break;
  case 256*1024:
    sizeReg = 1;
    break;
  case 512*1024:
    sizeReg = 2;
    break;
  case 1024*1024:
    sizeReg = 3;
    break;
  default:
    printf("*** SSRAM of %ld words x %ld is not supported by this application\n",
	   (unsigned long) bankInfo.Size, (unsigned long) bankInfo.Width);
    ret = -1;
    goto done;
  }
	
  ssram = (volatile uint32_t*) (((uint8_t*) fpgaSpace) + ssramOffset);
	
  rambuf = (uint32_t*) ADMXRC2_Malloc(memorySize * sizeof(uint32_t));
  if (rambuf == NULL) {
    printf("*** Failed to allocate RAM buffer - aborting\n");
    ret = -1;
    goto done;
  }
  
  chkbuf = (uint32_t*) ADMXRC2_Malloc(memorySize * sizeof(uint32_t));
  if (chkbuf == NULL) {
    printf("*** Failed to allocate RAM readback buffer - aborting\n");
    ret = -1;
    goto done;
  }
	
  status = ADMXRC2_SetClockRate(card, ADMXRC2_CLOCK_LCLK, freq * 1.0e6, NULL);
  if (status != ADMXRC2_SUCCESS) {
    printf("*** Failed to set LCLK to %.1fMHz: %s\n",
	   freq, ADMXRC2_GetStatusString(status));
    ret = -1;
    goto done;
  }
	
  if (cardInfo.BoardType != ADMXRC2_BOARD_ADMXRC2_PRO_LITE) {
    status = ADMXRC2_SetClockRate(card, 1, mclk_freq * 1.0e6, NULL);
    if (status != ADMXRC2_SUCCESS) {
      printf("*** Failed to set clock 1 to %.1fMHz: %s\n",
	     mclk_freq, ADMXRC2_GetStatusString(status));
      return -1;
    }
  }
	
  if (use64bit) {
    uint32_t config;
    
    config = ADMXRC2_SPACE_SET_WIDTH | ADMXRC2_SPACE_WIDTH_64;
    status = ADMXRC2_SetSpaceConfig(card, 0, config);
    if (status != ADMXRC2_SUCCESS) {
      printf ("*** Failed to set space configuration: %s\n",
	      ADMXRC2_GetStatusString(status));
      return -1;
    }
  }
  
  status = ADMXRC2_SetupDMA(card,
			    rambuf,
			    memorySize * sizeof(uint32_t),
			    0,
			    &dmaDesc1);
  if (status != ADMXRC2_SUCCESS) {
    printf ("*** Failed to get a DMA descriptor: %s\n",
	    ADMXRC2_GetStatusString(status));
    return -1;
  }
	
  status = ADMXRC2_SetupDMA(card,
			    chkbuf,
			    memorySize * sizeof(uint32_t),
			    0,
			    &dmaDesc2);
  if (status != ADMXRC2_SUCCESS) {
    printf ("*** Failed to get a DMA descriptor: %s\n",
	    ADMXRC2_GetStatusString(status));
    return -1;
  }
	
  dmaMode = ADMXRC2_BuildDMAModeWord(cardInfo.BoardType,
				     use64bit ? ADMXRC2_IOWIDTH_64 : ADMXRC2_IOWIDTH_32,
				     0,
				     ADMXRC2_DMAMODE_USEREADY | ADMXRC2_DMAMODE_USEBTERM | ADMXRC2_DMAMODE_BURSTENABLE);
	
  /* Wait for DLLs/DCMs to lock */
  sleep(1);

  /*
  ** Program the number of address bits used by the SSRAMs
  */
  fpgaSpace[ZBT_SIZE_REG] = sizeReg;
  fpgaSpace[ZBT_SIZE_REG]; /* make sure it's got there */

  printf("Size reg   = 0x%8.8lx\n", (unsigned long) fpgaSpace[ZBT_SIZE_REG]);
  printf("Info reg   = 0x%8.8lx\n", (unsigned long) fpgaSpace[ZBT_INFO_REG]);
  printf("Status reg = 0x%8.8lx\n", (unsigned long) fpgaSpace[ZBT_STATUS_REG]);
	
  failed = FALSE;

  /* Iterate over flowthrough and pipelined */
  for (i = 0; i < 2; i++) {
    int           nError = 0;
    unsigned long j, k;
//char m= 'a';
    uint32_t      exp, act;
    unsigned long rep;
		
    if (i == 0) {
      if (!(bankInfo.Type & ADMXRC2_RAM_ZBTFT)) {
	continue;
      }
			
      /*
      ** Set the FPGA to flowthrough mode
      */
      fpgaSpace[ZBT_PIPELINE_REG] = 0x0;
      fpgaSpace[ZBT_PIPELINE_REG]; /* make sure it's got there */
      printf("Testing %ld kB in flowthrough mode...\n", testSize * 4 / 1024);
    } else {
      if (!(bankInfo.Type & ADMXRC2_RAM_ZBTP)) {
	continue;
      }
			
      /*
      ** Set the FPGA to pipelined mode
      */
      fpgaSpace[ZBT_PIPELINE_REG] = 0x1;
      fpgaSpace[ZBT_PIPELINE_REG]; /* make sure it's got there */
      printf("Testing %ld kB in pipelined mode...\n", testSize * 4 / 1024);
    }
		
    for (rep = 0; rep < nrep; rep++) {
			
      printf("Repetition %ld\n", rep);
			
///////////////////////////////////////////STARTING//////////////////////////////////////

      
      /* Perform 0xAAAAAAA test - look for shorted/stuck data pins */
      if (!failed && nError == 0) {
	
	rambuf_8 = rambuf;

	for (j = 0; j < 50; j++) {
	  rambuf_8[j+12*bankSize] = j;
	}

	for (j = 0; j < 50; j++) {
	  rambuf[j+4*bankSize] = 0;
	}


			
	  status = writeSSRAM(rambuf, 3 * bankSize, bankSize, dma);
	  if (status != ADMXRC2_SUCCESS) {
	    printf("Error: failed to write SSRAM\n");
	    failed = TRUE;
	}
	status = writeSSRAM(rambuf, 4 * bankSize, bankSize, dma);
	  if (status != ADMXRC2_SUCCESS) {
	    printf("Error: failed to write SSRAM\n");
	    failed = TRUE;
	}
		

	fpgaSpace[6] = os_cpu_to_le32(1);
	fpgaSpace[6];

	while(fpgaSpace[7]!=os_cpu_to_le32(0x31));

	fpgaSpace[6] = os_cpu_to_le32(0);
	fpgaSpace[6];


		
	}

for (j = 0; j < numBank; j++) {
for (k = 0; k < bankSize; k++) {
unsigned long idx = j * bankSize + k;
chkbuf[idx] = 0;
}
}


	    status = readSSRAM(chkbuf, 4 * bankSize, bankSize, dma);
	    if (status != ADMXRC2_SUCCESS) {
	      printf("Error: failed to read SSRAM\n");
	      failed = TRUE;
	  }

	    status = readSSRAM(chkbuf, 3 * bankSize, bankSize, dma);
	    if (status != ADMXRC2_SUCCESS) {
	      printf("Error: failed to read SSRAM\n");
	      failed = TRUE;
	  }
			
     for (j = 0;j < 50;j++){
		printf("\n%02d     %08X     %08X   ", j,chkbuf[j+3*bankSize],chkbuf[4*bankSize+j]);

	
	}
			
      if (!failed && nError == 0) {
	printf("PASSED\n");
      } else {
	printf("*** FAILED with %ld error(s)\n", (long) nError);
	break;
      }
    }
		
    if (failed) {
      break;
    }
  }
	
  if (speed) {
    /*
    ** Measure the host read and host write speeds of the SSRAM,
    ** using DMA.
    */
    float          bytes, rate;
    double         delta;
    struct timeval start, now, elapsed;
		
    printf("Measuring access speed...\n");
		
    start = get_time();
    bytes = 0.0f;
    do {
      readSSRAM(rambuf, 0, memorySize, dma);
      bytes += (float) (memorySize * sizeof(uint32_t));
      now = get_time();
      elapsed = time_subtract(&now, &start);
      delta = time_to_double(&elapsed);
    } while (delta < 2.0);
		
    rate = bytes / delta;
    printf("SSRAM to host throughput = %.1fMB/s\n", rate / 1048576.0f);
		
    start = get_time();
    bytes = 0.0f;
    do {
      writeSSRAM(rambuf, 0, memorySize, dma);
      bytes += (float) (memorySize * sizeof(uint32_t));
      now = get_time();
      elapsed = time_subtract(&now, &start);
      delta = time_to_double(&elapsed);
    } while (delta < 2.0);
		
    rate = bytes / delta;
    printf("Host to SSRAM throughput = %.1fMB/s\n", rate / 1048576.0f);
  }
	
 done:
  if (rambuf != NULL) {
    ADMXRC2_Free(rambuf);
  }

  if (chkbuf != NULL) {
    ADMXRC2_Free(chkbuf);
  }

  if (dmaDesc1Valid) {
    ADMXRC2_UnsetupDMA(card, dmaDesc1);
  }

  if (dmaDesc2Valid) {
    ADMXRC2_UnsetupDMA(card, dmaDesc2);
  }

  if (card != ADMXRC2_HANDLE_INVALID_VALUE) {
    ADMXRC2_CloseCard(card);
  }
	
  return ret;
}
Esempio n. 7
0
/* THE MAIN */
int main (const int argc, const char * argv[]) {

  /* Socket data */
  soc_token soc = init_soc;
  soc_host lan;
  soc_port port;
  int soc_fd, fd;

  /* Socket message */
  msg_type msg;

  /* Times and timeouts */
  timeout_t start_time, end_time, current_time;
  timeout_t wait_timeout;
  double local_time, remote_time;

  /* Dynamic list of server infos */
  dlist list;
  info_type info;

  /* Utilities */
  boolean for_read;
  char buff[256];
  int res;
  char *index;

  /*********/
  /* Start */
  /*********/
  /* Save prog name */
  strcpy (prog, argv[0]);
  strcpy (prog, basename (prog));

  /*******************/
  /* Parse arguments */
  /*******************/
  /* Check args */
  if (argc != 2) {
    error ("Invalid argument");
  }
  /* Parse IPM address and port */
  strcpy (buff, argv[1]);
  index = strstr (buff, ":");
  if (index == NULL) {
     error ("Invalid argument");
  }
  *index = '\0';
  index++;
  if (soc_str2host (buff, &lan) != SOC_OK) {
    sprintf (buff, "Invalid ipm address %s", buff);
    error (buff);
  }
  if (soc_str2port (index, &port) != SOC_OK) {
    sprintf (buff, "Invalid port num %s", index);
    error (buff);
  }

  /**************/
  /* Initialize */
  /**************/
  /* Init dynamic list */
  dlist_init (& list, sizeof(info_type));
  /* Init socket */
  if (soc_open (&soc, udp_socket) != SOC_OK) {
    perror ("opening socket");
    error ("Socket initialization failed");
  }
  if (soc_set_dest_host_port (soc, &lan, port) != SOC_OK) {
    perror ("setting destination");
    error ("Socket initialization failed");
  }
  if (soc_link_port (soc, port) != SOC_OK) {
    perror ("linking to port");
    error ("Socket initialization failed");
  }
  if (soc_get_dest_host (soc, &lan) != SOC_OK) {
    perror ("getting dest lan");
    error ("Socket initialization failed");
  }
  if (soc_get_dest_port (soc, &port) != SOC_OK) {
    perror ("getting dest port");
    error ("Socket initialization failed");
  }
  /* Add socket to waiting point */
  if (soc_get_id(soc, &soc_fd) != SOC_OK) {
    perror ("getting socket id");
    error ("Socket initialization failed");

  }
  if (evt_add_fd(soc_fd, TRUE) != WAIT_OK) {
    perror("Adding fd");
    error ("Socket initialization failed");
  }
  /* Activate signal catching */
  activate_signal_handling();
  /* Report starting */
  buff[0]='\0';
  addr_image (&lan, buff);
  printf ("%s mcasting at address %s on port %d.\n", prog, buff, (int) port);
  /* Init times */
  get_time (&start_time);
  current_time = start_time;
  end_time = start_time;
  incr_time (&end_time, DELAY_CLIENT_MS);
  /* Send initial ping request */
  msg.ping = TRUE;
  msg.time = start_time;
  if (soc_send (soc, (soc_message) &msg, sizeof(msg)) != SOC_OK) {
    perror ("sending ping");
    error ("Sending ping request failed");
  }

  /*************/
  /* Main loop */
  /*************/
  for (;;) {
    /* First step is to loop until timeout */
    if (wait_timeout.tv_sec != -1) {
      wait_timeout = end_time;
      res = sub_time (&wait_timeout, &current_time);
      if (res <= 0) {
        break;
      }
    }
    if (evt_wait (&fd, &for_read, &wait_timeout) != WAIT_OK) {
      perror ("waiting for event");
      error ("Waiting for events failed");
    }
    if (! for_read) {
      error ("Write event received");
    }
    /* Termination signal */
    if (fd == SIG_EVENT) {
      if (get_signal () == SIG_TERMINATE) {
        break;
      }
    } else if (fd == NO_EVENT) {
      /* Timeout: first step ends with a dump of servers */
      if (dlist_length(&list) != 0) {
        dlist_rewind (&list, TRUE);
        for (;;) {
          dlist_read (&list, &info);
          /* Get host name if possible, else dump address */
          res = soc_host_name_of (&info.host, buff, sizeof(buff));
          if (res != SOC_OK) {
            buff[0]='\0';
            addr_image (&info.host, buff);
          }
          /* Compute (Start_time + Reception_time) / 2 */
          local_time = (time_to_double (&start_time)
                        + time_to_double (&info.reception_time) ) / 2.0;
          remote_time = time_to_double (&info.server_time);
          printf ("Host %s is shifted by %4.03fs\n", buff, remote_time - local_time);

          /* Done when last record has been put */
          if (dlist_get_pos (&list, FALSE) == 1) {
            break;
          }
          dlist_move (&list, TRUE);
        }
      }
      /* Now entering second step: infinite timeout */
      wait_timeout.tv_sec = -1;
      wait_timeout.tv_usec = -1;
      printf ("%s ready.\n", prog);
    } else if (fd != soc_fd) {
      sprintf (buff, "Invalid fd %d received", fd);
      error (buff);
    } else {
      /* Now this is the socket, read message */
      res = soc_receive (soc, (soc_message) &msg, sizeof(msg), TRUE);
      if (res < 0) {
        perror ("reading from socket");
        error ("Reading message failed");
      } else if (res != sizeof(msg)) {
        sprintf (buff, "Invalid size received, expected %d, got %d",
                       (int)sizeof(msg), res);
        error (buff);
      }
      get_time (&current_time);
      /* Client and server different behaviours */
      if ((wait_timeout.tv_sec != -1) && !msg.ping) {
        /* First step: store the address and time of server, if pong */
        if (soc_get_dest_host (soc, &(info.host)) != SOC_OK) {
          perror ("getting dest host");
          error ("Getting server address failed");
        }
        info.server_time = msg.time;
        info.reception_time = current_time;
        dlist_insert (&list, &info, TRUE);

      } else if ( (wait_timeout.tv_sec == -1) && msg.ping) {
        /* Second step: reply pong and time to ping */
        msg.time = current_time;
        msg.ping = FALSE;
        if (soc_send (soc, (soc_message) &msg, sizeof(msg)) != SOC_OK) {
          perror ("sending pong");
          error ("Sending pong request failed");
        }
      }
    }
  } /* End of main loop */


  /* Clean - Close */
  dlist_delete_all (&list);
  (void) evt_del_fd (soc_fd, TRUE);
  (void) soc_close (&soc);
  printf ("Done.\n");
  exit (0);
}
Esempio n. 8
0
int main (int argc, char **argv, char **env) {
	pid_t pid, err = 0;
	int i, status = 0, printed_kill = 0, printed_grace = 0;
	char f;
	double diff, wait = 1, grace = 1;
	struct timeval start, now;
	unsigned int c = 0, nonpass = 1, wrap = 0;
	if (argc < 2) {
		fprintf(stderr, usage, argv[0]);
		return 1;
	}
	for (i = 1; i < argc; i++) {
		if (argv[i][0] != '-') break;
		nonpass++;
		f = argv[i][1];
		if (f == '-') f = argv[i][2];
		if (verbose>1) fprintf(stderr,"Got flag %c\n",f);
		switch (f) {
			case 'v':
				verbose++;
				break;
			case 's':
				if (verbose>1) fprintf(stderr,"Numeric status\n");
				numeric_status++;
				break;
			case 't':
			case 'g':
				if (i+1 >= argc) {
					fprintf(stderr,usage,argv[0]);
					return 2;
				}
				if (f == 't') {
					wait = atof(argv[++i]);
					if (verbose>1) fprintf(stderr,"Wait=%f\n",wait);
				} else {
					grace = atof(argv[++i]);
					if (verbose>1) fprintf(stderr,"Grace=%f\n",grace);
				}
				nonpass++;
				break;
			default:
				do {
					fprintf(stderr,"Unknown argument: %s\n",argv[i]);
					if (wrap++) return 3;
					fprintf(stderr,usage,argv[0]);
				} while (wrap++);
		}
	}
	if (nonpass > argc-1) {
		fprintf(stderr,usage,argv[0]);
		return 4;
	}
	if (gettimeofday(&start,NULL)) {
		fprintf(stderr,"Couldn't get time of day\n");
		return 5;
	}
	pid = fork();
	if (pid == -1) {
		fprintf(stderr, "Couldn't fork\n");
		return 2;
	}
	if (verbose>1) fprintf(stderr,"Start:%f\n",time_to_double(start));
	if (pid) {
		while (1) {
			if (gettimeofday(&now,NULL)) {
				fprintf(stderr,"Couldn't get time of day\n");
				return my_exit(EXIT_THISPROG);
			}
			err = waitpid(pid,&status,WNOHANG);
			if (err && err != pid) {
				fprintf(stderr, "Waitpid error\n");
				return my_exit(EXIT_THISPROG);
			} else if (err == pid) {
				if (WIFEXITED(status)) {
					if (verbose>1) fprintf(stderr,"Child exited normally\n");
					err = WEXITSTATUS(status);
				} else if (WIFSIGNALED(status)) {
					if (verbose>1) fprintf(stderr,"Child was signalled\n");
					err = EXIT_SIGNALED;
				}
				if (verbose>1) fprintf(stderr,"Returning %d (status=%d)\n",err,status);
				return my_exit(err);
			} else {
				diff = time_to_double(now) - time_to_double(start);
				if (diff >= wait) {
					if (!c++) {
						if (verbose>1) fprintf(stderr,"now:%f\n",time_to_double(now));
						if (verbose>1) fprintf(stderr,"now:%ld.%06ld\n",now.tv_sec,now.tv_usec);
						if (verbose>1) fprintf(stderr,"Time limit reached (diff=%f)\n",diff);
						kill(pid,grace?SIGTERM:SIGKILL);
						continue;
					}
					if (verbose>1 && !printed_kill++) fprintf(stderr,"Killed but not dead\n");
					if (diff >= wait + grace) {
						if (verbose>1 && !printed_grace++)
							fprintf(stderr,"Grace period exceeded (diff=%f)\n",diff);
						kill(pid,SIGKILL);
					}
				} else {
					if (verbose>1) fprintf(stderr,"Diff: %f\n",diff);
				}
			}
		}
	} else {
		argv+=nonpass;
		if (verbose>1) {
			fprintf(stderr,"About to execvp\n");
			for (i = 0; i < argc-nonpass; i++)
				fprintf(stderr,"argv[%d]=<%s>\n",i,argv[i]);
		}
		execvp(argv[0], argv);
		fprintf(stderr, "Couldn't execvp\n");
		return my_exit(EXIT_EXECVP);
	}
}