OpenCores

Subversion Repositories ha1588

[/] [ha1588/] [trunk/] [sim/] [top/] [ptp_drv_bfm/] [ptp_drv_bfm.c] - Diff between revs 23 and 24

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

Rev 23 Rev 24
Line 30... Line 30...
  // RESET RTC
  // RESET RTC
  cpu_addr_i = 0x00000000;
  cpu_addr_i = 0x00000000;
  cpu_data_i = 0x0;
  cpu_data_i = 0x0;
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_addr_i = 0x00000000;
  cpu_addr_i = 0x00000000;
  cpu_data_i = 0x10;
  cpu_data_i = 0xA10;
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_wr(cpu_addr_i, cpu_data_i);
  // LOAD RTC SEC AND NS
  // LOAD RTC SEC AND NS
  cpu_addr_i = 0x00000010;
  cpu_addr_i = 0x00000010;
  cpu_data_i = 0x0;
  cpu_data_i = 0x0;
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_wr(cpu_addr_i, cpu_data_i);
Line 74... Line 74...
  cpu_data_i = 0x0;
  cpu_data_i = 0x0;
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_addr_i = 0x00000000;
  cpu_addr_i = 0x00000000;
  cpu_data_i = 0x1;
  cpu_data_i = 0x1;
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_wr(cpu_addr_i, cpu_data_i);
 
  do {
 
    cpu_addr_i = 0x00000000;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
 
    //printf("%08x\n", (cpu_data_o & 0x1));
 
  } while ((cpu_data_o & 0x1) == 0x0);
  cpu_addr_i = 0X00000040;
  cpu_addr_i = 0X00000040;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_addr_i = 0X00000044;
  cpu_addr_i = 0X00000044;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_addr_i = 0X00000048;
  cpu_addr_i = 0X00000048;
Line 90... Line 94...
  cpu_data_i = 0x0;
  cpu_data_i = 0x0;
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_addr_i = 0x00000000;
  cpu_addr_i = 0x00000000;
  cpu_data_i = 0x1;
  cpu_data_i = 0x1;
  cpu_wr(cpu_addr_i, cpu_data_i);
  cpu_wr(cpu_addr_i, cpu_data_i);
 
  do {
 
    cpu_addr_i = 0x00000000;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
 
    //printf("%08x\n", (cpu_data_o & 0x1));
 
  } while ((cpu_data_o & 0x1) == 0x0);
  cpu_addr_i = 0X00000040;
  cpu_addr_i = 0X00000040;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_addr_i = 0X00000044;
  cpu_addr_i = 0X00000044;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_addr_i = 0X00000048;
  cpu_addr_i = 0X00000048;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_addr_i = 0X0000004C;
  cpu_addr_i = 0X0000004C;
  cpu_rd(cpu_addr_i, &cpu_data_o);
  cpu_rd(cpu_addr_i, &cpu_data_o);
 
 
 
  int i;
 
  // POLL TSU RX STATUS
 
  int rx_queue_num;
 
  do {
 
    cpu_addr_i = 0x00000004;
 
    cpu_rd(cpu_addr_i, &cpu_data_o);
 
    rx_queue_num = cpu_data_o;
 
    //printf("%08x\n", rx_queue_num);
 
  } while (!(rx_queue_num > 0x2));
 
  // READ TSU RX FIFO
 
  for (i=rx_queue_num; i>=0; i--) {
 
      cpu_addr_i = 0x00000000;
 
      cpu_data_i = 0x0;
 
      cpu_wr(cpu_addr_i, cpu_data_i);
 
      cpu_addr_i = 0x00000000;
 
      cpu_data_i = 0x400;
 
      cpu_wr(cpu_addr_i, cpu_data_i);
 
      cpu_addr_i = 0x00000050;
 
      cpu_rd(cpu_addr_i, &cpu_data_o);
 
      cpu_addr_i = 0x00000054;
 
      cpu_rd(cpu_addr_i, &cpu_data_o);
 
  }
 
  // POLL TSU TX STATUS
 
  int tx_queue_num;
 
  do {
 
    cpu_addr_i = 0x00000008;
 
    cpu_rd(cpu_addr_i, &cpu_data_o);
 
    tx_queue_num = cpu_data_o;
 
    //printf("%08x\n", tx_queue_num);
 
  } while (!(tx_queue_num > 0x2));
 
  // READ TSU TX FIFO
 
  for (i=tx_queue_num; i>=0; i--) {
 
      cpu_addr_i = 0x00000000;
 
      cpu_data_i = 0x0;
 
      cpu_wr(cpu_addr_i, cpu_data_i);
 
      cpu_addr_i = 0x00000000;
 
      cpu_data_i = 0x100;
 
      cpu_wr(cpu_addr_i, cpu_data_i);
 
      cpu_addr_i = 0x00000058;
 
      cpu_rd(cpu_addr_i, &cpu_data_o);
 
      cpu_addr_i = 0x0000005C;
 
      cpu_rd(cpu_addr_i, &cpu_data_o);
 
  }
 
 
  // READ BACK ALL REGISTERS
  // READ BACK ALL REGISTERS
  for (;;)
  for (;;)
  {
  {
    int t;
    int t;
    for (t=0; t<=0x5c; t=t+4)
    for (t=0; t<=0x5c; t=t+4)
    {
    {
 
      cpu_hd(10);
 
 
      cpu_addr_i = t;
      cpu_addr_i = t;
      cpu_rd(cpu_addr_i, &cpu_data_o);
      cpu_rd(cpu_addr_i, &cpu_data_o);
 
 
      cpu_hd(10);
 
    }
    }
  }
  }
 
 
  return(0); /* Return success (required by tasks) */
  return(0); /* Return success (required by tasks) */
}
}

powered by: WebSVN 2.1.0

© copyright 1999-2014 OpenCores.org, equivalent to ORSoC AB, all rights reserved. OpenCores®, registered trademark.