-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforce_external_interrupt_2.adb
More file actions
33 lines (25 loc) · 1.2 KB
/
force_external_interrupt_2.adb
File metadata and controls
33 lines (25 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
with Kernel.Peripherals.Registers;
-- to get definitions of MEC registers such as:
-- Test_Control
-- Interrupt_Mask
-- Interrupt_Force
procedure Force_External_Interrupt_2 is
package KPR renames Kernel.Peripherals.Registers;
-- The MEC registers must be accesses as a whole.
-- The workaround used to force GNAT to generate proper instructions is:
-- Registers type definition are cualified with pragma Atomic
-- and auxiliary objects are used to write the MEC registers
Test_Control_Auxiliary : KPR.Test_Control_Register :=
KPR.Test_Control;
Interrupt_Mask_Auxiliary : KPR.Interrupt_Mask_Register :=
KPR.Interrupt_Mask;
Interrupt_Force_Auxiliary : KPR.Interrupt_Force_Register :=
KPR.Interrupt_Force;
begin
Test_Control_Auxiliary.Interrupt_Force_Register_Write_Enable := True;
Interrupt_Mask_Auxiliary.External_Interrupt_2 := False;
Interrupt_Force_Auxiliary.External_Interrupt_2 := True;
KPR.Test_Control := Test_Control_Auxiliary;
KPR.Interrupt_Mask := Interrupt_Mask_Auxiliary;
KPR.Interrupt_Force := Interrupt_Force_Auxiliary;
end Force_External_Interrupt_2;