Академический Документы
Профессиональный Документы
Культура Документы
PIF
PTE: PIT enable PITC: PIT count value PIE: PIT interrupt enable
PIF: PIT freeze PS: PIT status PITR: leftover value in the counter
7
2.
3.
PISCR: Periodic Status & Control Register MPC555 PIT Interrupt Programming
0x002FC240
Interrupt level for PIT 1 2 3 PIRQ PS PIE 13 PITF 14 PTE 15 4 PInterrupt Enable 0: disable interrupt 1: enable interrupt 5 6 7
10
11
12
PIT Freeze 0: no effect 1: disable decrement counter if internal signal FREEZE is asserted
PITC
PIT Time-out period = (PITC+1)/(PIT Frequency); assume 1MHZ oscillator PIT Period = 1/(1MHz) = 1 microsecond Put 33000 in PITC to get 33 milliseconds interrupt period.
10
0x2F C248
0 15 16 31
PIT
Reserved
PIT: Leftover (current) count in PIT counter Writes to PITR have no effect: read only.
11
12
Other ESR
Other ESR
ISR n
13
15
areas
16
17
Puts the ESR address into PC (forces a jump to the ESR) Change MSR bits PR 0: Switches to supervisor mode (0: supervisor, 1: user) EE 0: Disables further external interrupts RI 0: Indicates not recoverable
18
Can use stack But the CPU has changed the contents of PC and MSR!
19
The CPU saves PC to SRR0, MSR to SRR1* The ESR saves SRR0/SRR1 into stack
20
21
Nested Interrupts
If the interrupt ESR or an ISR is running, can the CPU accept another interrupt?
Is it desirable to accept another interrupt? When cannot the CPU accept another exception?
22
Nested Interrupts
EE bit: Tell the CPU not to accept another interrupt
External interrupt Enable bit Reset to zero: The external interrupt exception is ignored; the CPU keeps running
The CPU automatically resets the EE bit upon an exception But the ESR may re-enable the EE bit
23
Recoverable Exceptions
Other exceptions may happen during an interrupt processing Scenario: Stack overflow during the interrupt processing
Interrupt processing is not always recoverable Scenario: The stack overflow happens before saving SRR0/SRR1 Solution: Use the RI bit
The CPU automatically resets the RI bit The ESR may re-enable it
24