diff --git a/src/dev/lupio/lupio_pic.cc b/src/dev/lupio/lupio_pic.cc index d83ffcff85..6bab5e5525 100644 --- a/src/dev/lupio/lupio_pic.cc +++ b/src/dev/lupio/lupio_pic.cc @@ -90,8 +90,8 @@ LupioPIC::lupioPicRead(uint8_t addr) { uint32_t r = 0; - int cpu = addr >> LUPIO_PIC_MAX; - int reg = (addr >> 2) & (LUPIO_PIC_MAX - 1); + int cpu = addr / LUPIO_PIC_MAX; + int reg = addr % LUPIO_PIC_MAX; switch (reg) { case LUPIO_PIC_PRIO: @@ -124,8 +124,8 @@ LupioPIC::lupioPicWrite(uint8_t addr, uint64_t val64) { uint32_t val = val64; - int cpu = addr >> LUPIO_PIC_MAX; - int reg = (addr >> 2) & (LUPIO_PIC_MAX - 1); + int cpu = addr / LUPIO_PIC_MAX; + int reg = addr % LUPIO_PIC_MAX; switch (reg) { case LUPIO_PIC_MASK: diff --git a/src/dev/lupio/lupio_pic.hh b/src/dev/lupio/lupio_pic.hh index ce4815cf2e..c668336941 100644 --- a/src/dev/lupio/lupio_pic.hh +++ b/src/dev/lupio/lupio_pic.hh @@ -61,13 +61,13 @@ class LupioPIC : public BasicPioDevice private: enum { - LUPIO_PIC_PRIO, - LUPIO_PIC_MASK, - LUPIO_PIC_PEND, - LUPIO_PIC_ENAB, + LUPIO_PIC_PRIO = 0x0, + LUPIO_PIC_MASK = 0x4, + LUPIO_PIC_PEND = 0x8, + LUPIO_PIC_ENAB = 0xC, // Max offset - LUPIO_PIC_MAX, + LUPIO_PIC_MAX = 0x10, }; uint32_t pending = 0; diff --git a/src/dev/lupio/lupio_tmr.cc b/src/dev/lupio/lupio_tmr.cc index 63c002130e..58e2d11fa3 100644 --- a/src/dev/lupio/lupio_tmr.cc +++ b/src/dev/lupio/lupio_tmr.cc @@ -123,8 +123,8 @@ LupioTMR::lupioTMRRead(uint8_t addr, int size) { uint32_t r = 0; - size_t cpu = addr >> LUPIO_TMR_MAX; - size_t reg = (addr >> 2) & (LUPIO_TMR_MAX - 1); + size_t cpu = addr / LUPIO_TMR_MAX; + size_t reg = addr % LUPIO_TMR_MAX; switch (reg) { case LUPIO_TMR_TIME: @@ -159,8 +159,8 @@ LupioTMR::lupioTMRWrite(uint8_t addr, uint64_t val64, int size) { uint32_t val = val64; - size_t cpu = addr >> LUPIO_TMR_MAX; - size_t reg = (addr >> 2) & (LUPIO_TMR_MAX - 1); + size_t cpu = addr / LUPIO_TMR_MAX; + size_t reg = addr % LUPIO_TMR_MAX; switch (reg) { case LUPIO_TMR_LOAD: diff --git a/src/dev/lupio/lupio_tmr.hh b/src/dev/lupio/lupio_tmr.hh index 7a69fb7a7e..a966b299e0 100644 --- a/src/dev/lupio/lupio_tmr.hh +++ b/src/dev/lupio/lupio_tmr.hh @@ -54,13 +54,13 @@ class LupioTMR : public BasicPioDevice // Register map enum { - LUPIO_TMR_TIME, - LUPIO_TMR_LOAD, - LUPIO_TMR_CTRL, - LUPIO_TMR_STAT, + LUPIO_TMR_TIME = 0x0, + LUPIO_TMR_LOAD = 0x4, + LUPIO_TMR_CTRL = 0x8, + LUPIO_TMR_STAT = 0xC, // Max offset - LUPIO_TMR_MAX, + LUPIO_TMR_MAX = 0x10, }; struct LupioTimer