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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [tests/] [ethmac/] [board/] [ethmac-ping.c] - Diff between revs 425 and 435

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

Rev 425 Rev 435
Line 68... Line 68...
 
 
//#define DEST_IP_BYTES 0xc0,0xa8,0x64,0x69 // 192 .168.100.105
//#define DEST_IP_BYTES 0xc0,0xa8,0x64,0x69 // 192 .168.100.105
#define DEST_IP_BYTES 0xc0,0xa8,0x01,0x08 // 192 .168.1.8
#define DEST_IP_BYTES 0xc0,0xa8,0x01,0x08 // 192 .168.1.8
//#define DEST_IP_BYTES 0xac,0x1e,0x0,0x01 // 172.30.0.1
//#define DEST_IP_BYTES 0xac,0x1e,0x0,0x01 // 172.30.0.1
 
 
 
#define BCAST_DEST_IP_BYTES 0xc0,0xa8,0x01,0xff // 192 .168.1.255
 
 
/* Functions in this file */
/* Functions in this file */
void ethmac_setup(void);
void ethmac_setup(void);
void oeth_printregs(void);
void oeth_printregs(void);
void ethphy_init(void);
void ethphy_init(void);
void oeth_dump_bds();
void oeth_dump_bds();
Line 861... Line 863...
    OETH_INT_MASK_RXF   |
    OETH_INT_MASK_RXF   |
    OETH_INT_MASK_RXE   |
    OETH_INT_MASK_RXE   |
    OETH_INT_MASK_BUSY  |
    OETH_INT_MASK_BUSY  |
    OETH_INT_MASK_TXC   |
    OETH_INT_MASK_TXC   |
    OETH_INT_MASK_RXC;
    OETH_INT_MASK_RXC;
#ifndef RTLSIM  
 
  printf("\nafter config\n\n");
 
  oeth_printregs();
 
#endif
 
  // Buffer setup stuff
  // Buffer setup stuff
  volatile oeth_bd *tx_bd, *rx_bd;
  volatile oeth_bd *tx_bd, *rx_bd;
  int i,j,k;
  int i,j,k;
 
 
  /* Initialize TXBD pointer
  /* Initialize TXBD pointer
Line 1130... Line 1129...
  0x00,0x00,
  0x00,0x00,
  0x40,
  0x40,
  0x00,
  0x00,
  0x40,
  0x40,
  0x01,
  0x01,
  0xee,0xf5,
  0xb5,0x8f,
  OUR_IP_BYTES, /* Source IP */
  OUR_IP_BYTES, /* Source IP */
  0xc0,0xa8,0x64,0xff, /* Dest. IP */
  BCAST_DEST_IP_BYTES, /* Dest. IP */
  /* ICMP Message body */
  /* ICMP Message body */
  0x08,0x00,0x7d,0x65,0xa7,0x20,0x00,0x01,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
  0x08,0x00,0x7d,0x65,0xa7,0x20,0x00,0x01,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
  15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
  15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
  40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,
  40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,
  65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,
  65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,
Line 1898... Line 1897...
 
 
      c = uart_getc(DEFAULT_UART);
      c = uart_getc(DEFAULT_UART);
 
 
      if (c == 's')
      if (c == 's')
        tx_packet((void*) ping_packet, 98);
        tx_packet((void*) ping_packet, 98);
      if (c == 'S')
      else if (c == 'S')
        tx_packet((void*)big_ping_packet, 1514);
        tx_packet((void*)big_ping_packet, 1514);
if (c == 'h')
      else if (c == 'h')
        scan_ethphys();
        scan_ethphys();
      if (c == 'i')
      else if (c == 'i')
        ethphy_init();
        ethphy_init();
      if (c == 'P')
      else if (c == 'P')
        {
        {
          print_packet_contents = print_packet_contents ? 0 : 1;
          print_packet_contents = print_packet_contents ? 0 : 1;
          if (print_packet_contents)
          if (print_packet_contents)
            printf("Enabling packet dumping\n");
            printf("Enabling packet dumping\n");
          else
          else
            printf("Packet dumping disabled\n");
            printf("Packet dumping disabled\n");
        }
        }
      if (c == 'p')
      else if (c == 'p')
        oeth_printregs();
        oeth_printregs();
      if (c == '0')
      else if (c == '0')
        scan_ethphy(0);
        scan_ethphy(0);
      if (c == '1')
      else if (c == '1')
        scan_ethphy(1);
        scan_ethphy(1);
      if (c == '7')
      else if (c == '7')
        {
        {
          //scan_ethphy(7);
          //scan_ethphy(7);
          //ethphy_print_status(7);
          //ethphy_print_status(7);
          printf("ext_sr 0x%x\n",eth_mii_read(0x7, 0x1b));
          printf("ext_sr 0x%x\n",eth_mii_read(0x7, 0x1b));
        }
        }
      if (c == 'r')
      else if (c == 'r')
        {
        {
          ethphy_reset(7);
          ethphy_reset(7);
          printf("PHY reset\n");
          printf("PHY reset\n");
        }
        }
      if (c == 'R')
      else if (c == 'R')
        {
        {
          //oeth_reset_tx_bd_pointer();
          //oeth_reset_tx_bd_pointer();
          ethmac_setup();
          ethmac_setup();
          printf("MAC reset\n");
          printf("MAC reset\n");
        }
        }
      if (c == 'n')
      else if (c == 'n')
        ethphy_reneg(7);
        ethphy_reneg(7);
      if (c == 'N')
      else if (c == 'N')
        ethphy_set_autoneg(7);
        ethphy_set_autoneg(7);
      if (c == 'm')
      else if (c == 'm')
        ethmac_togglehugen();
        ethmac_togglehugen();
      if (c == 't')
      else if (c == 't')
        ethphy_set_10mbit(0);
        ethphy_set_10mbit(0);
      if (c == 'w')
      else if (c == 'w')
        {
        {
          // Play with HWCFG mode of Alaska 88e1111 Phy
          // Play with HWCFG mode of Alaska 88e1111 Phy
          c = uart_getc(DEFAULT_UART);
          c = uart_getc(DEFAULT_UART);
          short newvalue;
          short newvalue;
          // c is an ascii char, let's convert it to actual hex value
          // c is an ascii char, let's convert it to actual hex value
Line 1966... Line 1965...
          ext_sr &= ~MII_M1111_HWCFG_MODE_MASK;
          ext_sr &= ~MII_M1111_HWCFG_MODE_MASK;
          ext_sr |= (short) newvalue;
          ext_sr |= (short) newvalue;
          eth_mii_write(0x7, MII_M1111_PHY_EXT_SR, ext_sr);
          eth_mii_write(0x7, MII_M1111_PHY_EXT_SR, ext_sr);
          printf("ext_sr updated to - 0x%x\n",eth_mii_read(0x7, MII_M1111_PHY_EXT_SR));
          printf("ext_sr updated to - 0x%x\n",eth_mii_read(0x7, MII_M1111_PHY_EXT_SR));
        }
        }
      if ( c == 'b' )
      else if ( c == 'b' )
        {
        {
          printf("\n\t---\n");
          printf("\n\t---\n");
          oeth_dump_bds();
          oeth_dump_bds();
          printf("\t---\n");
          printf("\t---\n");
        }
        }
 
 
 
      else if ( c == 'B' )
 
        {
 
          tx_packet((void*) broadcast_ping_packet, 298);
 
        }
 
 
    }
    }
 
 
}
}
 
 
 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.