Download Thesis file... - CS 4 - Friedrich-Alexander

Transcript
Exception
number
Interrupt
number
1
2
3
4
5
6
7–10
11
12
13
14
15
16
17
...
16+N
0
1
...
N
Name
Priority
Reset
NMI
HardFault
MemManage
BusFault
UsageFault
(reserved)
SVCall
Debug Monitor
(reserved)
PendSV
SysTick
−3
−2
−1
configurable
configurable
configurable
External Interrupt 0
External Interrupt 1
...
External Interrupt N
configurable
configurable
...
configurable
configurable
configurable
configurable
configurable
Figure 2.1: Exceptions provided by the Nested Vectored Interrupt Controller. While the priorities of Reset, NMI, and HardFault are fixed, all other priorities can be configured.
tem Control Space (SCS), in which internal system components are configured. Accesses in this
memory region are strongly-ordered, which means the transactions will be performed in program
order. Reading and writing these registers is limited to privileged execution level only. These
registers control masking of individual interrupts, set and clear their pending state and configure
their priorities. Each interrupt source can be triggered asynchronously from connected peripheral
devices or with synchronous instructions from software.
The NVIC provides multiple registers as listed in Table 2.1, controlling interrupt masks and
their pending state. A particular interrupt can be masked using the ISER (Interrupt Set-Enable
Register) and ICER (Interrupt Clear-Enable Register) bit fields. These are organized in groups,
so that each bit in a 32-bit register corresponds to one interrupt. There will be as many bit fields
as required for the number of interrupt sources implemented by the hardware manufacturer. A
single read or write operation can retrieve or manipulate the state of each interrupt in the specific
group. Writing a 1 to the corresponding bit position enables respectively disables the interrupt,
and reading the value returns the current state of the interrupts. A disabled interrupt can still
be asserted as pending, but it will not be dispatched.
Additionally, the NVIC offers bit fields named ISPR (Interrupt Set-Pending Register) and
ICPR (Interrupt Clear-Pending Register) to read and change the pending state of external interrupts. They follow the same write and read semantics as ISER and ICER, where reading the
value returns the current pending state of the interrupts. Writing to ISPR allows software to
trigger interrupts from software. Additionally, STIR (Software Triggered Interrupt Register) can
be used to trigger interrupts in software without privileged access.
Priority levels are configured in the IPR (Interrupt Priority Register) bit fields. The priorities
of interrupts can be set individually using 8-bit fields, which are organized in groups of four to
8