From: Michel Pollet Date: Tue, 15 Sep 2015 13:33:33 +0000 (+0100) Subject: io: No functional changes X-Git-Tag: v1.3~10 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=ea3f62f95e23172124b5f71e37f29e0839356586;p=sx%2Fsimavr.git io: No functional changes Just reformating Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/sim_io.c b/simavr/sim/sim_io.c index 8991790..57e3970 100644 --- a/simavr/sim/sim_io.c +++ b/simavr/sim/sim_io.c @@ -63,8 +63,12 @@ avr_register_io_read( 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(); } @@ -98,8 +102,9 @@ avr_register_io_write( 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(); } /* @@ -112,11 +117,14 @@ avr_register_io_write( // 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; @@ -125,8 +133,10 @@ avr_register_io_write( } 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; diff --git a/simavr/sim/sim_io.h b/simavr/sim/sim_io.h index 32541ab..cfe5bc5 100644 --- a/simavr/sim/sim_io.h +++ b/simavr/sim/sim_io.h @@ -44,7 +44,7 @@ typedef struct avr_io_t { 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 @@ -99,7 +99,11 @@ avr_ioctl( 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