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
|