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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [peripheral/] [eth.c] - Diff between revs 1390 and 1461

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

Rev 1390 Rev 1461
Line 862... Line 862...
{
{
  struct eth_device *eth = dat;
  struct eth_device *eth = dat;
  eth->base_vapi_id = val.int_val;
  eth->base_vapi_id = val.int_val;
}
}
 
 
 
void eth_enabled(union param_val val, void *dat)
 
{
 
  struct eth_device *eth = dat;
 
  eth->enabled = val.int_val;
 
}
 
 
void *eth_sec_start(void)
void *eth_sec_start(void)
{
{
  struct eth_device *new = malloc(sizeof(struct eth_device));
  struct eth_device *new = malloc(sizeof(struct eth_device));
 
 
  if(!new) {
  if(!new) {
    fprintf(stderr, "Peripheral Eth: Run out of memory\n");
    fprintf(stderr, "Peripheral Eth: Run out of memory\n");
    exit(-1);
    exit(-1);
  }
  }
 
 
 
  new->enabled = 1;
 
 
  return new;
  return new;
}
}
 
 
void eth_sec_end(void *dat)
void eth_sec_end(void *dat)
{
{
  struct eth_device *eth = dat;
  struct eth_device *eth = dat;
 
 
 
  if(!eth->enabled) {
 
    free(dat);
 
    return;
 
  }
 
 
  register_memoryarea( eth->baseaddr, ETH_ADDR_SPACE, 4, 0, eth_read32, eth_write32, dat );
  register_memoryarea( eth->baseaddr, ETH_ADDR_SPACE, 4, 0, eth_read32, eth_write32, dat );
  reg_sim_stat( eth_status, dat );
  reg_sim_stat( eth_status, dat );
  reg_sim_reset( eth_reset, dat );
  reg_sim_reset( eth_reset, dat );
}
}
 
 
void reg_ethernet_sec(void)
void reg_ethernet_sec(void)
{
{
  struct config_section *sec = reg_config_sec("ethernet", eth_sec_start, eth_sec_end);
  struct config_section *sec = reg_config_sec("ethernet", eth_sec_start, eth_sec_end);
 
 
  reg_config_param(sec, "irq", paramt_int, eth_irq);
  reg_config_param(sec, "irq", paramt_int, eth_irq);
 
  reg_config_param(sec, "enabled", paramt_int, eth_enabled);
  reg_config_param(sec, "baseaddr", paramt_int, eth_baseaddr);
  reg_config_param(sec, "baseaddr", paramt_int, eth_baseaddr);
  reg_config_param(sec, "dma", paramt_int, eth_dma);
  reg_config_param(sec, "dma", paramt_int, eth_dma);
  reg_config_param(sec, "rtx_type", paramt_int, eth_rtx_type);
  reg_config_param(sec, "rtx_type", paramt_int, eth_rtx_type);
  reg_config_param(sec, "rx_channel", paramt_int, eth_rx_channel);
  reg_config_param(sec, "rx_channel", paramt_int, eth_rx_channel);
  reg_config_param(sec, "tx_channel", paramt_int, eth_tx_channel);
  reg_config_param(sec, "tx_channel", paramt_int, eth_tx_channel);

powered by: WebSVN 2.1.0

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