Exemplo n.º 1
0
        public override byte InterruptToIrq(byte interrupt)
        {
            DebugStub.WriteLine("Pic.InterruptToIrq({0})", __arglist(interrupt));
            // hack - all h/w interrupts on ARM are routed through a common vector
            DebugStub.Assert((interrupt == ExceptionVector.Fiq) ||
                             (interrupt == ExceptionVector.Irq));

            IoResult result = IoResult.Success;

            if (interrupt == ExceptionVector.Fiq)
            {
                // read currently active FIQ
                ushort sir = intcps_sir_fiq.Read16NoThrow(ref result);
                return((byte)(sir & INTCPS_SIR_FIQ_ACTIVEFIQ_Mask));
            }
            else   // if (interrupt == ExceptionVector.Irq)

            // read currently active IRQ
            {
                ushort sir = intcps_sir_irq.Read16NoThrow(ref result);
                return((byte)(sir & INTCPS_SIR_IRQ_ACTIVEIRQ_Mask));
            }
        }
Exemplo n.º 2
0
        private void DumpRegisters()
        {
            IoResult result = IoResult.Success;

            ushort currentIrqNumber = (ushort)(intcps_sir_irq.Read16NoThrow(ref result)
                                               & INTCPS_SIR_IRQ_ACTIVEIRQ_Mask);
            ushort currentIrqPriority = (ushort)(intcps_irq_priority.Read16NoThrow(ref result)
                                                 & (ushort)INTCPS_IRQ_PRIORITY_Mask);

            DebugStub.WriteLine("PIC Current IRQ: {0:x4} Priority: {0:x4}",
                                __arglist(currentIrqNumber, currentIrqPriority));

            ushort currentFiqNumber = (ushort)(intcps_sir_fiq.Read16NoThrow(ref result)
                                               & INTCPS_SIR_FIQ_ACTIVEFIQ_Mask);
            ushort currentFiqPriority = (ushort)(intcps_fiq_priority.Read16NoThrow(ref result)
                                                 & INTCPS_FIQ_PRIORITY_Mask);

            DebugStub.WriteLine("PIC Current FIQ: {0:x4} Priority: {0:x4}",
                                __arglist(currentFiqNumber, currentFiqPriority));

            DumpBits("PIC raw interrupt status: {2:x8}{1:x8}{0:x8}", intcps_itr);
            DumpBits("PIC interrupt mask:       {2:x8}{1:x8}{0:x8}", intcps_mir);
            DumpBits("PIC software interrupts:  {2:x8}{1:x8}{0:x8}", intcps_isr_set);
            DumpBits("PIC pending IRQs:         {2:x8}{1:x8}{0:x8}", intcps_pending_irq);
            DumpBits("PIC pending FIQs:         {2:x8}{1:x8}{0:x8}", intcps_pending_fiq);

            for (uint i = 0; i < INTCPS_Vectors; ++i)
            {
                uint ilr = intcps_ilr.Read32NoThrow(i * INTCPS_ILR_Offset, ref result);

                string interruptType = ((ilr & INTCPS_ILR_FIQNIRQ) != 0) ? "fiq" : "irq";
                byte   priority      = (byte)((ilr & INTCPS_ILR_PRIORITY_Mask)
                                              >> INTCPS_ILR_PRIORITY_Shift);

                DebugStub.WriteLine("PIC ILR[{0}]: {1} Priority: {2:x2}",
                                    __arglist(i, interruptType, priority));
            }

            DebugStub.Assert(IoResult.Success == result);
        }