Lecture 10 MPC 555 InterruptInterrupt System Design: Hardware issuesInterrupt System Design: Software IssuesMPC555 Interrupt OverviewPowerPC Internal I/O ModulesUIMB: U-bus to IMB InterfaceSlide 7External InterruptsUnified System Interface UnitInterrupt ControllerSlide 11USIU Internal Interrupt SourcesConnecting To PowerPC CoreSlide 14MPC555 Interrupt All TogetherMPC555 Interrupt SummaryRecall Software IssuesInterrupt Priority And CodesUSIU Internal interruptsUse SIVEC and IRQ TableMachine State RegisterPPC Exception RegistersSlide 23Enable Interrupt and Save Exception RegistersMPC555 Interrupt Example: Periodic Interrupt Timer (PIT)PICSR: Periodic Interrupt Control & Select RegisterPITC: PIT CounterPITR: Periodic Interrupt Timer RegisterPIT Block DiagramPIT InitializationPIT Initialization (corrected)1Lecture 10MPC 555 Interrupt2Interrupt System Design: Hardware issuesConnect interrupt sources to processor core.Determine ISR addresses using exception vector table.Help software determine interrupt source.Disable/enable interrupts.Mask interrupts.3Interrupt System Design: Software IssuesInterrupt setupSet up interrupt levelSet up exception vector tableSet up interrupt maskEnable interruptDevice-specific setupInterrupt ProcessingCreate/destroy stack frameSave/restore machine states and EPCMask interrupt (optional)Enable interrupt (optional)Save/restore registers contentsDetermine interrupt sourceDetermine ISR addressDevice-specific processing4MPC555 Interrupt OverviewInternal I/OProcessor CoreUSIUExternal I/OMPC555 Interrupt Sources:1. External I/O devices2. Internal I/O device3. From USIU inside (Unified System Interface unit)USIU includes interrupt controlhandlermemory2135PowerPC Internal I/O ModulesTPU3: Time Processor Units, 3rd version; versatile functions, e.g. counting pulsesMIOS1: Modular I/O System; QADC64: Queued Analog-to-digital converterTouCAN: Control Area Network, two-wire, up to 1Mbps and 40m; e.g. network inside vehicleQSMCM: Queued Serial Multi-channel ModuleIMB3 bus: Inter-Module BusTPU3 TPU3 MIOS1 QADC64 QADC64 TouCAN TouCAN QSMCMIMB3 Bus16UIPENDUIMB: U-bus to IMB Interface•UIMB: U-bus to IMB interface•UIPEND: Interrupt pending reg.•U-bus: Unified bus, connecting multiple internal buses•UMCR[IRQUX]: Enable level 7-31IMB3 BusU-Busaddr/dataOther busInterruptcontroller2328UMCR[IRQUX]7UIMB: U-bus to IMB InterfaceThe interface converts 32 interrupt levels on IMB3 Bus to 8 interrupt levels on U-BusLevel 0-6 to U-Bus level 0-6Level 7-31 to U-Bus level 7Interrupt handler reads full UIPEND through memory-mapped I/O8External InterruptsOther I/O device:Hard drive, video card, …IRQ[0]: connect to resetUSIUU-BUS88IRQ[0:7]externalIRQResetTimer1113249Unified System Interface UnitThe USIU controls system start-up, system initialization and operation, system protection, and the external system bus. MPC555 USIU functions:System configuration and protectionInterrupt controllerSystem reset monitoring and generationClock synthesizerPower managementExternal bus interface (EBI) controlMemory controllerDebug supportInternal I/OProcessor CoreUSIU10Interrupt ControllerUSIU4TimebaseClockPITPLLSW watchdogDecrementerSIPENDSIMASKSIVECInternal I/Othrough U-busExternal IRQNMI controlIREQresetDecr timerNote: External IRQ is controlled by SIEL – triggered by falling edge or low level11Interrupt ControllerSIPEND[0:31]: Interrupt pending registerHandler accesses SIPEND for source of interruptBits 0-15 record interrupt source; 16-31 reserved External IRQ[0:7]: accessing SIPEND is enoughInternal IMB3 device: further accessing UIPENDSIMASK: mask registerIf SIMASK[i]= 0, then SIPEND[i] is blockedSIMASK[0] = 0 has no effectSIVEC: interrupt vector registerIndex to exception vector tableAccessed by interrupt service routine (ISR)NMI control: non-maskable interrupt controlExternal IRQ[0] is non-maskableSW watchdog is non-maskable12USIU Internal Interrupt SourcesMPC 555 has a crystal of 4MHz or 20MHzTime base: timer interrupt based on the clock; cannot be resetReal-time clock: timer interrupt based on real-time clock (like a watch); cannot be resetPIT: Periodic interrupt timer – goes off every n cycles PLL change of lock: Phase lock loop, used to provide higher clock frequency; generate interrupt in abnormal situation, e.g. lost the lock of the clockSoftware watch dog: Used to monitor help avoid software deadlockDecrementer: Another timer interrupt, but is processed by a special handler (less overhead)13Connecting To PowerPC CoreMSR[EE]Vector tablen+0x100n+0x500n+0x900&SSR1SSR0Inst bufferinstaddrto memIREQNMIDecrementer5123instThree interrupt lines to processor core: IREQ, NMI, and DecrementerMSR[EE]: Enable external interrupt IREQ: External interruptNMI: Non-maskable interrupt (e.g. reset button is pushed)Decrementer: fast timer interruptOther processor components not shownFinally!14Connecting To PowerPC CoreRefers to three handlers for1. Maskable Interrupt2. Non-maskable interrupt3. Decrementer (low-overhead timer)When an interrupt happens, hardware:Waits for current inst to complete Saves MSR[EE] to SSR0, Clears MSR[EE]Saves PC to SSR1Transfer control to n+0x100, n+0x500, or n+0x900, respectivelyThe rest is left to software handlerAll I/O interrupts share the same interrupt handler15MPC555 Interrupt All Together5142316MPC555 Interrupt Summary L7 for 7-31UIPENDL0L1L2L3L4L5L6From IMB3 peripheralsI0External IRQ[0:7]I1 I2 I3 I4 I5 I6 I7I0 L0 I1 L1 I2 L2 I3 L3 I4 L4 I5 L5 I6 L6 I7 L7 reserved1631SIPENDI0 L0 I1 L1 I2 L2 I3 L3 I4 L4 I5 L5 I6 L6 I7 L7 reserved1631SIMASKIRQPriority arbiter8-bit vector: SIVEC17Recall Software IssuesInterrupt setupSet up interrupt levelSet up exception vector tableSet up interrupt maskEnable interruptDevice-specific setupInterrupt ProcessingCreate/destroy stack frameSave/restore machine states and EPCMask interrupt (optional)Enable interrupt (optional)Save/restore registers contentsDetermine interrupt sourceDetermine ISR addressDevice-specific processing18Interrupt Priority And CodesSIVEC contains a 8-bit interrupt code or vector for each sourcePriority Int. source Int. Code0 (highest) IRQ[0] 0x01 Level 0 0x42 IRQ[1] 0x83 Level 1 0xC4 IRQ[2] 0x10… … …15 Level 7 0x3cHelp determine interrupt source19USIU Internal interruptsCome
View Full Document