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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [peripheral/] [gpio.c] - Diff between revs 1350 and 1358

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

Rev 1350 Rev 1358
Line 301... Line 301...
 
 
  /* Switch to values for next clock */
  /* Switch to values for next clock */
  memcpy( &(gpio->curr), &(gpio->next), sizeof(gpio->curr) );
  memcpy( &(gpio->curr), &(gpio->next), sizeof(gpio->curr) );
}
}
 
 
 No newline at end of file
 No newline at end of file
 
/*---------------------------------------------------[ GPIO configuration ]---*/
 
void gpio_ngpios(union param_val val, void *dat)
 
{
 
  if (val.int_val >= 0 && val.int_val < MAX_GPIOS)
 
    config.ngpios = val.int_val;
 
  else
 
    CONFIG_ERROR("invalid number of devices.");
 
}
 
 
 
void gpio_baseaddr(union param_val val, void *dat)
 
{
 
  if (current_device >= 0 && current_device < config.ngpios)
 
    config.gpios[current_device].baseaddr = val.int_val;
 
  else
 
    CONFIG_ERROR("invalid device number.");
 
}
 
 
 
void gpio_irq(union param_val val, void *dat)
 
{
 
  if (current_device >= 0 && current_device < config.ngpios)
 
    config.gpios[current_device].irq = val.int_val;
 
  else
 
    CONFIG_ERROR("invalid device number.");
 
}
 
 
 
void gpio_base_vapi_id(union param_val val, void *dat)
 
{
 
  if (current_device >= 0 && current_device < config.ngpios)
 
    config.gpios[current_device].base_vapi_id = val.int_val;
 
  else
 
    CONFIG_ERROR("invalid device number.");
 
}
 
 
 
void reg_gpio_sec(void)
 
{
 
  struct config_section *sec = reg_config_sec("gpio", NULL, NULL);
 
 
 
  reg_config_param(sec, "ngpios", paramt_int, gpio_ngpios);
 
  reg_config_param(sec, "device", paramt_int, change_device);
 
  reg_config_param(sec, "baseaddr", paramt_addr, gpio_baseaddr);
 
  reg_config_param(sec, "irq", paramt_int, gpio_irq);
 
  reg_config_param(sec, "base_vapi_id", paramt_int, gpio_base_vapi_id);
 
  reg_config_param(sec, "enddevice", paramt_none, end_device);
 
}
 
 
 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.