Beruflich Dokumente
Kultur Dokumente
Interrupts
Learning Objectives
Introduction to interrupts.
Types of interrupts and sources.
Interrupt timeline.
Handling and processing interrupts
using C and assembly code.
Dr. Naim
Introduction
Inst n+1
Inst n+2
:
:
Dr. Naim
Description
CPU Int
HPI Interrupt
Timer 0
Timer 1
SDRAM Refresh
External Interrupt 4
External Interrupt 5
External Interrupt 6
External Interrupt 7
DMA Channel 0
DMA Channel 1
DMA Channel 2
DMA Channel 3
McBSP Channel 0 TX
McBSP Channel 0 RX
McBSP Channel 1 TX
McBSP Channel 1 RX
RESET
NMI
reserved
reserved
INT4
INT5
INT6
INT7
INT8
INT9
INT10
INT11
INT12
INT13
INT14
INT15
High
P
r
i
o
r
i
t
y
Low
Note that there are more sources of interrupt than the CPU can handle.
Chapter 10, Slide 4
Dr. Naim
INT4
INT5
INT6
INT7
NMI
'C6x
IACK
INUM3
INUM2
INUM1
INUM0
Interrupt Selection
Sources
(HPI) DSPINT
TINT0
TINT1
SD_INT
EXT_INT4
EXT_INT5
EXT_INT6
EXT_INT7
DMA_INT0
DMA_INT1
DMA_INT2
DMA_INT3
XINT0
RINT0
XINT1
RINT1
Description
CPU Int
HPI Interrupt
Timer 0
Timer 1
SDRAM Refresh
External Interrupt 4
External Interrupt 5
External Interrupt 6
External Interrupt 7
DMA Channel 0
DMA Channel 1
DMA Channel 2
DMA Channel 3
McBSP Channel 0 TX
McBSP Channel 0 RX
McBSP Channel 1 TX
McBSP Channel 1 RX
RESET
NMI
reserved
reserved
INT4
INT5
INT6
INT7
INT8
INT9
INT10
INT11
INT12
INT13
INT14
INT15
High
P
r
i
o
r
i
t
y
Low
Dr. Naim
Interrupt Selection
24
21
INTSEL14
19
16
INTSEL13
13
10
INTSEL12
8
5
INTSEL11
3
0
INTSEL10
24
21
INTSEL8
19
16
INTSEL7
13
10
INTSEL6
5
INTSEL5
0
INTSEL4
Dr. Naim
Interrupt Selection
10
0101
0x19c0000
0x19c0004
24
21
INTSEL14
19
16
INTSEL13
13
10
INTSEL12
8
5
INTSEL11
3
0
INTSEL10
24
21
INTSEL8
19
16
INTSEL7
13
10
INTSEL6
5
INTSEL5
0
INTSEL4
Dr. Naim
Interrupt Selection
0x19c0000, A1
MVKH
0x19c0000, A1
LDW
*A1, A0
CLR
SET
SET
STW
A0, *A1
Dr. Naim
Interrupt Selection
(3) Using the GUI interface:
Dr. Naim
Interrupt Timeline
User
Responsibility
(Initialisation)
Performed by the
CPU
User
Responsibility
(Algorithm)
Configure
1. Select interrupt sources and map them.
2. Create interrupt vector table.
Enable
3. Enable individual interrupts.
4. Enable global interrupt.
5.
6.
7.
Dr. Naim
When an interrupt occurs the CPU automatically recognises the source of the interrupt and
jumps to the interrupt vector location.
In this location a program is found which instructs the processor on the action(s) to be taken.
Each vector location can accommodate eight instructions which correspond to a fetch packet.
Such a location is know as the Interrupt Service Fetch Packet (ISFP) address.
Dr. Naim
Interrupt Sources
ISFP Addresses
Reset
0x0000
NMI
0x0020
Reserved
0X0040
Reserved
0X0060
INT4
0X0080
INT5
0X00A0
INT6
0X00C0
INT7
0X00E0
INT8
0X0100
INT9
0X0120
INT10
0X0140
INT11
0X0160
INT12
0X0180
INT13
0X01A0
INT14
0X01C0
INT15
0X01E0
Dr. Naim
MVK
MVKH
LDH
LDH
MVC
STR
B IRP
NOP 5
INT15
Dr. Naim
MVK
MVKH
INT4
INT5
INT6
INT7
B IRP
MVK
MVKH
ZERO
STW
LDH
INT15
Dr. Naim
MVK
MVKH
B
ISR
LDH
MVC
STR
STR
ZERO
ISR
B IRP
NOP 5
Dr. Naim
Dr. Naim
In order to relocate the vector table, the Interrupt Service Table Pointer (ISTP) register should be set up.
Dr. Naim
31
10
ISTB
reserved
Interrupt service table ( IST )
Interrupt Sources
ISFP Addresses
Reset
ISTB + 0x0000
NMI
ISTB + 0x0020
Reserved
ISTB + 0X0040
Reserved
ISTB + 0X0060
INT4
ISTB + 0X0080
INT5
ISTB + 0X00A0
INT6
ISTB + 0X00C0
INT7
ISTB + 0X00E0
INT8
ISTB + 0X0100
INT9
ISTB + 0X0120
INT10
ISTB + 0X0140
INT11
ISTB + 0X0160
INT12
ISTB + 0X0180
INT13
ISTB + 0X01A0
INT14
ISTB + 0X01C0
INT15
ISTB + 0X01E0
Dr. Naim
MVKL
0x800, A0
MVKH
0x800, A0
MVC
A0, ISTP
Dr. Naim
16
Reserved
15
14
13
12
11
10
IE15 IE14 IE13 IE12 IE11 IE10 IE9 IE8 IE7 IE6 IE5 IE4 rsv rsv nmie
R, W, +0
R,+1
Dr. Naim
CSRGIE
RESET
C6000
CPU
NMI
INT15
GIE
Dr. Naim
IRQ_globalEnable ()
Dr. Naim
Avoids unwanted NMI interrupts occurring between the time of a reset and
the end of initialisation.
Dr. Naim
Dr. Naim
INTx
Occurrence
of Interrupt
2 cycles minimum
Interrupt
latched
Interrupt
recognized
by CPU
The interrupt must be held low for at least 2 cycles then high for at least two cycles.
Dr. Naim
IFR
RESET
IER
CSRGIE
INT7
10
INT15
C6000
CPU
GIE
Chapter 10, Slide 28
Dr. Naim
CPU Action
Description
0 IFR (bit)
GIE PGIE
0 GIE
Vector (ISTP) PC
1 IACK pin
IACK is asserted
INUM(0-3)
IACK and INUM pins are only available on the C620x and C670x.
Chapter 10, Slide 29
Dr. Naim
1
0
IFR
31
CSR
31
INT7 ->
0x0800000
0x0800004
1
0
'C6x
1
1
1
IACK
INUM3
INUM2
INUM1
INUM0
1
0
0
1
0
0x0800 0000
0x0000
2000
PC
31
IRP
0x0000
xxxx xxxx
2004
You need to use the interrupt keyword in order to inform the compiler that it is an ISR and therefore to handle the necessary register
preservation and use the IRP for returning from the interrupt.
main (void)
{
...
}
interrupt void ISR_name (void)
{
...
Dr. Naim
Insert figure
Dr. Naim
For maskable interrupts the return from interrupt address is always stored in the Interrupt Return Pointer (IRP).
For non-maskable interrupts the address is stored in the Non-maskable Return Pointer (NRP).
Dr. Naim
ldw
.
.
.
(1)
(2)
(3)
b irp
nop 5
Return
(You can also use HWI macros)
Restore
Use the
Use the
the
HWI
HWI
Dr. Naim
To set a bit you have to write to the Interrupt Set Register (ISR).
To clear a bit you have to write to Interrupt Clear Register (ICR).
Dr. Naim
0x0180, A0
MVC
A0, ISR
31
MVC
A0, ICR
31
1 1
31
IFR
1 1
A0
ICR
1 1
IFR
31
0x0180, A0
1 1
31
MVKL
1 1
A0
ISR
0 0
Dr. Naim
31
0x19C0008 EXTPOL
Dr. Naim
2, A1
MVKL
0x19c0008, A0
MVKH
0x19c0008, A0
STW
A1, *A0
Dr. Naim
Note: The XIP only affects interrupts to the CPU and has no effect on the
EDMA events.
Chapter 10, Slide 39
Dr. Naim
Dr. Naim
Chapter 10
Interrupts
- End Single and Multiple Assignment
Single Assignment:
SA:
MVKH
B
LDW
NOP
MPY
NOP
SHR
ADD
.S1 0x02,A1
.S1
SA
.D1
*A0,A1
4
.M1
A1,A2,A3
.S1
.L1
-- var(n)
A3,15,A3
A3,A4,A4
Dr. Naim
Multiple Assignment:
MA:
Dr. Naim
Single Assignment:
SA:
Multiple Assignment:
MA:
Dr. Naim
MA:
Dr. Naim
Chapter 10
Interrupts
- End -