Commit ea3f62f95e23172124b5f71e37f29e0839356586
authorMichel Pollet <buserror@gmail.com>
Tue, 15 Sep 2015 13:33:33 +0000 (14:33 +0100)
committerMichel Pollet <buserror@gmail.com>
Fri, 2 Oct 2015 06:24:53 +0000 (07:24 +0100)
Just reformating

Signed-off-by: Michel Pollet <buserror@gmail.com>
2 files changed:
simavr/sim/sim_io.c
simavr/sim/sim_io.h

index 8991790fca3b45ea00f19c29e695a9250c2ba5c0..57e39705cfadda67e382884f39c5bfa54c4c7996 100644 (file)
@@ -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;
index 32541ab1800d344664d41ed1c7136fcb6bd760f9..cfe5bc5bcebbc80a74edc641b9273d84abacb976 100644 (file)
@@ -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