All converted to the brand new way...
Signed-off-by: Michel Pollet <buserror@gmail.com>
{
p->io = _io;
- // allocate this module's IRQ
- p->io.irq_count = ADC_IRQ_COUNT;
- p->io.irq = avr_alloc_irq(0, p->io.irq_count);
- p->io.irq_ioctl_get = AVR_IOCTL_ADC_GETIRQ;
-
avr_register_io(avr, &p->io);
avr_register_vector(avr, &p->adc);
+ // allocate this module's IRQ
+ avr_io_setirqs(&p->io, AVR_IOCTL_ADC_GETIRQ, ADC_IRQ_COUNT, NULL);
avr_register_io_write(avr, p->r_adcsra, avr_adc_write, p);
avr_register_io_read(avr, p->r_adcl, avr_adc_read_l, p);
{
p->io = _io;
- // allocate this module's IRQ
- p->io.irq_count = EXTINT_COUNT;
- p->io.irq = avr_alloc_irq(0, p->io.irq_count);
- p->io.irq_ioctl_get = AVR_IOCTL_EXTINT_GETIRQ();
-
avr_register_io(avr, &p->io);
for (int i = 0; i < EXTINT_COUNT; i++)
avr_register_vector(avr, &p->eint[i].vector);
+
+ // allocate this module's IRQ
+ avr_io_setirqs(&p->io, AVR_IOCTL_EXTINT_GETIRQ(), EXTINT_COUNT, NULL);
}
// p->name, p->r_pin,
// p->name, p->r_ddr,
// p->name, p->r_port);
-
- // allocate this module's IRQ
- p->io.irq_count = IOPORT_IRQ_COUNT;
- p->io.irq = avr_alloc_irq(0, p->io.irq_count);
- p->io.irq_ioctl_get = AVR_IOCTL_IOPORT_GETIRQ(p->name);
avr_register_io(avr, &p->io);
avr_register_vector(avr, &p->pcint);
+ // allocate this module's IRQ
+ avr_io_setirqs(&p->io, AVR_IOCTL_IOPORT_GETIRQ(p->name), IOPORT_IRQ_COUNT, NULL);
avr_register_io_write(avr, p->r_port, avr_ioport_write, p);
avr_register_io_read(avr, p->r_pin, avr_ioport_read, p);
void avr_spi_init(avr_t * avr, avr_spi_t * p)
{
p->io = _io;
+
avr_register_io(avr, &p->io);
avr_register_vector(avr, &p->spi);
-
- //printf("%s SPI%c init\n", __FUNCTION__, p->name);
-
// allocate this module's IRQ
- p->io.irq_count = SPI_IRQ_COUNT;
- p->io.irq = avr_alloc_irq(0, p->io.irq_count);
- p->io.irq_ioctl_get = AVR_IOCTL_SPI_GETIRQ(p->name);
+ avr_io_setirqs(&p->io, AVR_IOCTL_SPI_GETIRQ(p->name), SPI_IRQ_COUNT, NULL);
avr_register_io_write(avr, p->r_spdr, avr_spi_write, p);
avr_register_io_read(avr, p->r_spdr, avr_spi_read, p);
{
p->io = _io;
+ avr_register_io(avr, &p->io);
+ avr_register_vector(avr, &p->overflow);
+ avr_register_vector(avr, &p->icr);
+
// allocate this module's IRQ
- p->io.irq_count = TIMER_IRQ_COUNT;
- p->io.irq = avr_alloc_irq(0, p->io.irq_count);
- p->io.irq_ioctl_get = AVR_IOCTL_TIMER_GETIRQ(p->name);
+ avr_io_setirqs(&p->io, AVR_IOCTL_TIMER_GETIRQ(p->name), TIMER_IRQ_COUNT, NULL);
// marking IRQs as "filtered" means they don't propagate if the
// new value raised is the same as the last one.. in the case of the
p->io.irq[TIMER_IRQ_OUT_PWM0].flags |= IRQ_FLAG_FILTERED;
p->io.irq[TIMER_IRQ_OUT_PWM1].flags |= IRQ_FLAG_FILTERED;
- avr_register_io(avr, &p->io);
- avr_register_vector(avr, &p->overflow);
- avr_register_vector(avr, &p->icr);
-
if (p->wgm[0].reg) // these are not present on older AVRs
avr_register_io_write(avr, p->wgm[0].reg, avr_timer_write, p);
avr_register_io_write(avr, p->cs[0].reg, avr_timer_write, p);
//printf("%s TWI%c init\n", __FUNCTION__, p->name);
// allocate this module's IRQ
- p->io.irq_count = TWI_IRQ_COUNT;
- p->io.irq = avr_alloc_irq(0, p->io.irq_count);
- p->io.irq_ioctl_get = AVR_IOCTL_TWI_GETIRQ(p->name);
+ avr_io_setirqs(&p->io, AVR_IOCTL_TWI_GETIRQ(p->name), TWI_IRQ_COUNT, NULL);
avr_register_io_write(avr, p->r_twdr, avr_twi_write, p);
avr_register_io_read(avr, p->r_twdr, avr_twi_read, p);
// printf("%s UART%c UDR=%02x\n", __FUNCTION__, p->name, p->r_udr);
- // allocate this module's IRQ
- p->io.irq_count = UART_IRQ_COUNT;
- p->io.irq = avr_alloc_irq(0, p->io.irq_count);
- p->io.irq_ioctl_get = AVR_IOCTL_UART_GETIRQ(p->name);
-
p->flags = AVR_UART_FLAG_POOL_SLEEP|AVR_UART_FLAG_STDIO;
avr_register_io(avr, &p->io);
avr_register_vector(avr, &p->txc);
avr_register_vector(avr, &p->udrc);
+ // allocate this module's IRQ
+ avr_io_setirqs(&p->io, AVR_IOCTL_UART_GETIRQ(p->name), UART_IRQ_COUNT, NULL);
+
avr_register_io_write(avr, p->r_udr, avr_uart_write, p);
avr_register_io_read(avr, p->r_udr, avr_uart_read, p);
// monitor code that reads the rxc flag, and delay it a bit