Commit 77c0525fa53ac81daaf277593767cc5659e2e43e
authorMichel Pollet <buserror@gmail.com>
Sun, 2 Jun 2013 17:29:45 +0000 (18:29 +0100)
committerMichel Pollet <buserror@gmail.com>
Sun, 2 Jun 2013 17:29:45 +0000 (18:29 +0100)
avr_iomem_getirq() now takes a 'name' for the IRQs. The elf loader now
passes down the trace name so the irq gets named properly.

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

index 90afccf54031563392101297f9f28435bde80acc..3f5882559556008ffd61326fe108b61d8536bb18 100644 (file)
@@ -79,7 +79,10 @@ void avr_load_firmware(avr_t * avr, elf_firmware_t * firmware)
        for (int ti = 0; ti < firmware->tracecount; ti++) {
                if (firmware->trace[ti].mask == 0xff || firmware->trace[ti].mask == 0) {
                        // easy one
-                       avr_irq_t * all = avr_iomem_getirq(avr, firmware->trace[ti].addr, AVR_IOMEM_IRQ_ALL);
+                       avr_irq_t * all = avr_iomem_getirq(avr,
+                                       firmware->trace[ti].addr,
+                                       firmware->trace[ti].name,
+                                       AVR_IOMEM_IRQ_ALL);
                        if (!all) {
                                AVR_LOG(avr, LOG_ERROR, "ELF: %s: unable to attach trace to address %04x\n",
                                        __FUNCTION__, firmware->trace[ti].addr);
@@ -93,7 +96,10 @@ void avr_load_firmware(avr_t * avr, elf_firmware_t * firmware)
                                        count++;
                        for (int bi = 0; bi < 8; bi++)
                                if (firmware->trace[ti].mask & (1 << bi)) {
-                                       avr_irq_t * bit = avr_iomem_getirq(avr, firmware->trace[ti].addr, bi);
+                                       avr_irq_t * bit = avr_iomem_getirq(avr,
+                                                       firmware->trace[ti].addr,
+                                                       firmware->trace[ti].name,
+                                                       bi);
                                        if (!bit) {
                                                AVR_LOG(avr, LOG_ERROR, "ELF: %s: unable to attach trace to address %04x\n",
                                                        __FUNCTION__, firmware->trace[ti].addr);
index 00c647e3a9d7f1de4a66efe075fcd54387f104bc..f3fff7cd5ce1e9d237243e444238ff3aadfaa410 100644 (file)
@@ -158,8 +158,11 @@ avr_irq_t *
 avr_iomem_getirq(
                avr_t * avr,
                avr_io_addr_t addr,
+               const char * name,
                int index)
 {
+       if (index > 8)
+               return NULL;
        avr_io_addr_t a = AVR_DATA_TO_IO(addr);
        if (avr->io[a].irq == NULL) {
                /*
@@ -182,7 +185,15 @@ avr_iomem_getirq(
                for (int i = 0; i < 8; i++)
                        avr->io[a].irq[i].flags |= IRQ_FLAG_FILTERED;
        }
-       return index < 9 ? avr->io[a].irq + index : NULL;
+       // if given a name, replace the default one...
+       if (name) {
+               int l = strlen(name);
+               char n[l + 10];
+               sprintf(n, "avr.io.%s", name);
+               free((void*)avr->io[a].irq[index].name);
+               avr->io[a].irq[index].name = strdup(n);
+       }
+       return avr->io[a].irq + index;
 }
 
 avr_irq_t *
index f0d44e64dc4bbb42f624530caf2d0ae7ed0901ad..32541ab1800d344664d41ed1c7136fcb6bd760f9 100644 (file)
@@ -113,6 +113,7 @@ avr_irq_t *
 avr_iomem_getirq(
                avr_t * avr,
                avr_io_addr_t addr,
+               const char * name /* Optional, if NULL, "ioXXXX" will be used */ ,
                int index);
 
 // Terminates all IOs and remove from them from the io chain