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

Subversion Repositories or1k

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

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

Rev 1364 Rev 1461
Line 315... Line 315...
{
{
  ata_host *ata = dat;
  ata_host *ata = dat;
  ata->devices.device1.packet = val.int_val;
  ata->devices.device1.packet = val.int_val;
}
}
 
 
 
void ata_enabled(union param_val val, void *dat)
 
{
 
  ata_host *ata = dat;
 
  ata->enabled = val.int_val;
 
}
 
 
void *ata_sec_start(void)
void *ata_sec_start(void)
{
{
  ata_host *new = malloc(sizeof(ata_host));
  ata_host *new = malloc(sizeof(ata_host));
 
 
  if(!new) {
  if(!new) {
    fprintf(stderr, "Peripheral ATA: Run out of memory\n");
    fprintf(stderr, "Peripheral ATA: Run out of memory\n");
    exit(-1);
    exit(-1);
  }
  }
 
 
  memset(new, 0, sizeof(ata_host));
  memset(new, 0, sizeof(ata_host));
 
  new->enabled = 1;
  return new;
  return new;
}
}
 
 
void ata_sec_end(void *dat)
void ata_sec_end(void *dat)
{
{
  ata_host *ata = dat;
  ata_host *ata = dat;
 
 
 
  if(!ata->enabled) {
 
    free(dat);
 
    return;
 
  }
 
 
  /* Connect ata_devices.                                            */
  /* Connect ata_devices.                                            */
  ata_devices_init(&ata->devices);
  ata_devices_init(&ata->devices);
 
 
  register_memoryarea(ata->baseaddr, ATA_ADDR_SPACE, 4, 0, ata_read32, ata_write32, dat);
  register_memoryarea(ata->baseaddr, ATA_ADDR_SPACE, 4, 0, ata_read32, ata_write32, dat);
 
 
Line 345... Line 357...
 
 
void reg_ata_sec(void)
void reg_ata_sec(void)
{
{
  struct config_section *sec = reg_config_sec("ata", ata_sec_start, ata_sec_end);
  struct config_section *sec = reg_config_sec("ata", ata_sec_start, ata_sec_end);
 
 
 
  reg_config_param(sec, "enabled", paramt_int, ata_enabled);
  reg_config_param(sec, "baseaddr", paramt_addr, ata_baseaddr);
  reg_config_param(sec, "baseaddr", paramt_addr, ata_baseaddr);
  reg_config_param(sec, "irq", paramt_int, ata_irq);
  reg_config_param(sec, "irq", paramt_int, ata_irq);
  reg_config_param(sec, "dev_type0", paramt_int, ata_dev_type0);
  reg_config_param(sec, "dev_type0", paramt_int, ata_dev_type0);
  reg_config_param(sec, "dev_file0", paramt_str, ata_dev_file0);
  reg_config_param(sec, "dev_file0", paramt_str, ata_dev_file0);
  reg_config_param(sec, "dev_size0", paramt_int, ata_dev_size0);
  reg_config_param(sec, "dev_size0", paramt_int, ata_dev_size0);

powered by: WebSVN 2.1.0

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