avr_io_addr_t a = AVR_DATA_TO_IO(addr);
if (avr->io[a].r.param || avr->io[a].r.c) {
if (avr->io[a].r.param != param || avr->io[a].r.c != readp) {
- AVR_LOG(avr, LOG_ERROR, "IO: avr_register_io_read(): Already registered, refusing to override.\n");
- AVR_LOG(avr, LOG_ERROR, "IO: avr_register_io_read(%04x : %p/%p): %p/%p\n", a,
+ AVR_LOG(avr, LOG_ERROR,
+ "IO: %s(): Already registered, refusing to override.\n",
+ __func__);
+ AVR_LOG(avr, LOG_ERROR,
+ "IO: %s(%04x : %p/%p): %p/%p\n",
+ __func__, a,
avr->io[a].r.c, avr->io[a].r.param, readp, param);
abort();
}
avr_io_addr_t a = AVR_DATA_TO_IO(addr);
if (a >= MAX_IOs) {
- AVR_LOG(avr, LOG_ERROR, "IO: avr_register_io_write(): IO address 0x%04x out of range (max 0x%04x).\n",
- a, MAX_IOs);
+ AVR_LOG(avr, LOG_ERROR,
+ "IO: %s(): IO address 0x%04x out of range (max 0x%04x).\n",
+ __func__, a, MAX_IOs);
abort();
}
/*
// if the muxer not already installed, allocate a new slot
if (avr->io[a].w.c != _avr_io_mux_write) {
int no = avr->io_shared_io_count++;
- if (avr->io_shared_io_count > 4) {
- AVR_LOG(avr, LOG_ERROR, "IO: avr_register_io_write(): Too many shared IO registers.\n");
+ if (avr->io_shared_io_count > ARRAY_SIZE(avr->io_shared_io)) {
+ AVR_LOG(avr, LOG_ERROR,
+ "IO: %s(): Too many shared IO registers.\n", __func__);
abort();
}
- AVR_LOG(avr, LOG_TRACE, "IO: avr_register_io_write(%04x): Installing muxer on register.\n", addr);
+ AVR_LOG(avr, LOG_TRACE,
+ "IO: %s(%04x): Installing muxer on register.\n",
+ __func__, addr);
avr->io_shared_io[no].used = 1;
avr->io_shared_io[no].io[0].param = avr->io[a].w.param;
avr->io_shared_io[no].io[0].c = avr->io[a].w.c;
}
int no = (intptr_t)avr->io[a].w.param;
int d = avr->io_shared_io[no].used++;
- if (avr->io_shared_io[no].used > 4) {
- AVR_LOG(avr, LOG_ERROR, "IO: avr_register_io_write(): Too many callbacks on %04x.\n", addr);
+ if (avr->io_shared_io[no].used > ARRAY_SIZE(avr->io_shared_io[0].io)) {
+ AVR_LOG(avr, LOG_ERROR,
+ "IO: %s(): Too many callbacks on %04x.\n",
+ __func__, addr);
abort();
}
avr->io_shared_io[no].io[d].param = param;
avr_t * avr; // avr we are attached to
const char * kind; // pretty name, for debug
- const char ** irq_names; // IRQ names
+ const char ** irq_names; // IRQ names
uint32_t irq_ioctl_get; // used to get irqs from this module
int irq_count; // number of (optional) irqs
uint32_t ctl,
void * io_param);
// get the specific irq for a module, check AVR_IOCTL_IOPORT_GETIRQ for example
-struct avr_irq_t * avr_io_getirq(avr_t * avr, uint32_t ctl, int index);
+struct avr_irq_t *
+avr_io_getirq(
+ avr_t * avr,
+ uint32_t ctl,
+ int index);
// get the IRQ for an absolute IO address
// this allows any code to hook an IRQ in any io address, for example