OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [drivers/] [eth.c] - Diff between revs 406 and 464

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

Rev 406 Rev 464
Line 22... Line 22...
int rx_next;  /* Next buffer to be checked for new packet and given to the user */
int rx_next;  /* Next buffer to be checked for new packet and given to the user */
void (*receive)(volatile unsigned char *add, int len); /* Pointer to function to be called
void (*receive)(volatile unsigned char *add, int len); /* Pointer to function to be called
                                        when frame is received */
                                        when frame is received */
int eth_monitor_enabled;
int eth_monitor_enabled;
 
 
//unsigned long eth_data[((ETH_TXBD_NUM + ETH_RXBD_NUM) * ETH_MAXBUF_LEN)/4] = {0};
 
//#undef ETH_DATA_BASE
 
//#define ETH_DATA_BASE ((unsigned long)eth_data)
 
 
 
 
 
static void
static void
print_packet(unsigned long add, int len)
print_packet(unsigned long add, int len)
{
{
  int truncate = (len > 256);
  int truncate = (len > 256);
  int length_to_print = truncate ? 256 : len;
  int length_to_print = truncate ? 256 : len;
Line 63... Line 58...
 
 
void init_tx_bd_pool(void)
void init_tx_bd_pool(void)
{
{
  eth_bd  *bd;
  eth_bd  *bd;
  int i;
  int i;
 
  unsigned long eth_data_base = ETH_DATA_BASE;
 
 
  bd = (eth_bd *)ETH_BD_BASE;
  bd = (eth_bd *)ETH_BD_BASE;
 
 
  for(i = 0; i < ETH_TXBD_NUM; i++) {
  for(i = 0; i < ETH_TXBD_NUM; i++) {
    /* Set Tx BD status */
    /* Set Tx BD status */
    bd[i].len_status = 0 << 16 | ETH_TX_BD_PAD | ETH_TX_BD_CRC | ETH_RX_BD_IRQ;
    bd[i].len_status = 0 << 16 | ETH_TX_BD_PAD | ETH_TX_BD_CRC | ETH_RX_BD_IRQ;
 
 
    /* Initialize Tx buffer pointer */
    /* Initialize Tx buffer pointer */
    bd[i].addr = ETH_DATA_BASE + (i * ETH_MAXBUF_LEN);
    bd[i].addr = eth_data_base + (i * ETH_MAXBUF_LEN);
  }
  }
 
 
  bd[i-1].len_status |= ETH_TX_BD_WRAP; // Last Tx BD - Wrap
  bd[i-1].len_status |= ETH_TX_BD_WRAP; // Last Tx BD - Wrap
}
}
 
 
void init_rx_bd_pool(void)
void init_rx_bd_pool(void)
{
{
  eth_bd  *bd;
  eth_bd  *bd;
  int i;
  int i;
 
  /* Set ethernet data buffers just above that of stack */
 
  unsigned long eth_data_base = ETH_DATA_BASE;
 
 
  bd = (eth_bd *)ETH_BD_BASE + ETH_TXBD_NUM;
  bd = (eth_bd *)ETH_BD_BASE + ETH_TXBD_NUM;
 
 
  for(i = 0; i < ETH_RXBD_NUM; i++){
  for(i = 0; i < ETH_RXBD_NUM; i++){
 
 
    /* Set Rx BD status */
    /* Set Rx BD status */
    bd[i].len_status = 0 << 16 | ETH_RX_BD_EMPTY | ETH_RX_BD_IRQ;
    bd[i].len_status = 0 << 16 | ETH_RX_BD_EMPTY | ETH_RX_BD_IRQ;
 
 
    /* Initialize Rx buffer pointer */
    /* Initialize Rx buffer pointer */
    bd[i].addr = ETH_DATA_BASE + ((ETH_TXBD_NUM + i) * ETH_MAXBUF_LEN);
    bd[i].addr = eth_data_base + ((ETH_TXBD_NUM + i) * ETH_MAXBUF_LEN);
  }
  }
 
 
  bd[i-1].len_status |= ETH_RX_BD_WRAP; // Last Rx BD - Wrap
  bd[i-1].len_status |= ETH_RX_BD_WRAP; // Last Rx BD - Wrap
}
}
 
 

powered by: WebSVN 2.1.0

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