1
1
with System ;
2
2
with HAL ; use HAL;
3
3
4
- with Cortex_M_SVD.Debug ;
5
- with NRF_SVD.CLOCK ;
6
- with NRF_SVD.FICR ;
7
- with NRF_SVD.TEMP ;
4
+ with Cortex_M_SVD.Debug ; use Cortex_M_SVD.Debug;
5
+ with NRF_SVD.CLOCK ; use NRF_SVD.CLOCK;
6
+ with NRF_SVD.FICR ; use NRF_SVD.FICR;
7
+ with NRF_SVD.POWER ; use NRF_SVD.POWER;
8
+ with NRF_SVD.TEMP ; use NRF_SVD.TEMP;
8
9
9
10
package body nRF.Device is
10
11
12
+ Undocumented_Reg_FE0: UInt32
13
+ with Address => System'To_Address (16#F0000FE0# );
14
+ Undocumented_Reg_FE4: UInt32
15
+ with Address => System'To_Address (16#F0000FE4# );
16
+ Undocumented_Reg_FE8: UInt32
17
+ with Address => System'To_Address (16#F0000FE8# );
18
+ FE0_Is_Six: constant Boolean := (Undocumented_Reg_FE0 and 16#FF# ) = 6 ;
19
+ FE4_Is_Zero: constant Boolean := (Undocumented_Reg_FE0 and 16#0F# ) = 0 ;
20
+
11
21
function Errata_12 return Boolean is
12
- Undocumented_Reg_FE0: UInt32
13
- with Address => System'To_Address (16#F0000FE0# );
14
- Undocumented_Reg_FE4: UInt32
15
- with Address => System'To_Address (16#F0000FE4# );
16
- Undocumented_Reg_FE8: UInt32
17
- with Address => System'To_Address (16#F0000FE8# );
18
- FE0_Check: constant Boolean := (Undocumented_Reg_FE0 and 16#FF# ) = 6 ;
19
- FE4_Check: constant Boolean := (Undocumented_Reg_FE0 and 16#0F# ) = 0 ;
20
22
begin
21
- if FE0_Check and FE4_Check then
23
+ if FE0_Is_Six and FE4_Is_Zero then
22
24
case Undocumented_Reg_FE8 and 16#F0# is
23
25
when 16#30# => return True;
24
26
when 16#40# => return True;
@@ -36,15 +38,18 @@ package body nRF.Device is
36
38
37
39
function Errata_16 return Boolean is
38
40
begin
39
- return True;
41
+ if FE0_Is_Six and FE4_Is_Zero and Undocumented_Reg_FE8 = 16#30# then
42
+ return True;
43
+ end if ;
44
+ return False;
40
45
end Errata_16 ;
41
46
42
47
E16_Undocumented_Reg_074: UInt32
43
48
with Address => System'To_Address (16#4007C074# );
44
49
45
50
function Errata_31 return Boolean is
46
51
begin
47
- return True ;
52
+ return Errata_12 ;
48
53
end Errata_31 ;
49
54
50
55
E31_Undocumented_CLOCK_Reg_53C: UInt32 with
@@ -54,25 +59,25 @@ package body nRF.Device is
54
59
55
60
function Errata_32 return Boolean is
56
61
begin
57
- return True ;
62
+ return Errata_16 ;
58
63
end Errata_32 ;
59
64
60
65
function Errata_36 return Boolean is
61
66
begin
62
- return True ;
67
+ return Errata_12 ;
63
68
end Errata_36 ;
64
69
65
70
function Errata_37 return Boolean is
66
71
begin
67
- return True ;
72
+ return Errata_16 ;
68
73
end Errata_37 ;
69
74
70
75
E37_Undocumented_Reg_5A0: UInt32 with
71
76
Address => System'To_Address (16#400005A0# );
72
77
73
78
function Errata_57 return Boolean is
74
79
begin
75
- return True ;
80
+ return Errata_16 ;
76
81
end Errata_57 ;
77
82
78
83
E57_Undocumented_NFCT_Reg_610: UInt32 with
@@ -86,52 +91,72 @@ package body nRF.Device is
86
91
87
92
function Errata_66 return Boolean is
88
93
begin
89
- return True;
94
+ if FE0_Is_Six and FE4_Is_Zero and Undocumented_Reg_FE8 = 16#50# then
95
+ return True;
96
+ end if ;
97
+ return False;
90
98
end Errata_66 ;
91
99
92
100
function Errata_108 return Boolean is
93
101
begin
94
- return True ;
102
+ return Errata_12 ;
95
103
end Errata_108 ;
96
104
105
+ E108_Undocumented_Reg_EE4: UInt32 with
106
+ Address => System'To_Address (16#40000EE4# );
107
+ E108_Undocumented_FICR_Reg_258: UInt32 with
108
+ Address => System'To_Address (16#10000258# );
109
+
97
110
function Errata_136 return Boolean is
98
111
begin
99
- return True ;
112
+ return Errata_12 ;
100
113
end Errata_136 ;
101
114
102
115
function Errata_182 return Boolean is
116
+ Undocumented_FICR_Reg_130: UInt32
117
+ with Address => System'To_Address (16#10000130# );
118
+ Undocumented_FICR_Reg_134: UInt32
119
+ with Address => System'To_Address (16#10000130# );
103
120
begin
104
- return True ;
121
+ return Undocumented_FICR_Reg_130 = 6 and Undocumented_FICR_Reg_134 = 6 ;
105
122
end Errata_182 ;
106
123
124
+ E182_Undocumented_Reg_73C: UInt32 with
125
+ Address => System'To_Address (16#4000173C# );
126
+
107
127
begin
108
128
if Errata_12 then
109
- -- Workaround for Errata 12 "COMP: Reference ladder not correctly calibrated"
129
+ -- Workaround for Errata 12 "COMP: Reference ladder not correctly
130
+ -- calibrated"
110
131
E12_Undocumented_COMP_Reg_540 :=
111
132
Shift_Right(E12_Undocumented_FICR_Reg_324 and 16#1F00# , 8 );
112
133
end if ;
113
134
114
135
if Errata_16 then
115
- -- Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU IDLE"
136
+ -- Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU
137
+ -- IDLE"
116
138
E16_Undocumented_Reg_074 := 3131961357 ;
117
139
end if ;
118
140
119
141
if Errata_31 then
120
- -- Workaround for Errata 31 "CLOCK: Calibration values are not correctly loaded from FICR at reset"
142
+ -- Workaround for Errata 31 "CLOCK: Calibration values are not correctly
143
+ -- loaded from FICR at reset"
121
144
E31_Undocumented_CLOCK_Reg_53C :=
122
145
Shift_Right(E31_Undocumented_FICR_Reg_244 and 16#E000# , 13 );
123
146
end if ;
124
147
125
148
if Errata_32 then
126
- -- Workaround for Errata 32 "DIF: Debug session automatically enables TracePort pins"
127
- Cortex_M_SVD.Debug.Debug_Periph.DEMCR.TRCENA := False;
149
+ -- Workaround for Errata 32 "DIF: Debug session automatically enables
150
+ -- TracePort pins"
151
+ Debug_Periph.DEMCR.TRCENA := False;
128
152
end if ;
129
153
130
154
if Errata_36 then
131
- -- Workaround for Errata 36 "CLOCK: Some registers are not reset when expected"
132
- NRF_SVD.CLOCK.CLOCK_Periph.EVENTS_DONE.EVENTS_DONE := False;
133
- NRF_SVD.CLOCK.CLOCK_Periph.EVENTS_CTTO.EVENTS_CTTO := False;
134
- NRF_SVD.CLOCK.CLOCK_Periph.CTIV.CTIV := 0 ;
155
+ -- Workaround for Errata 36 "CLOCK: Some registers are not reset when
156
+ -- expected"
157
+ CLOCK_Periph.EVENTS_DONE.EVENTS_DONE := False;
158
+ CLOCK_Periph.EVENTS_CTTO.EVENTS_CTTO := False;
159
+ CLOCK_Periph.CTIV.CTIV := 0 ;
135
160
end if ;
136
161
137
162
if Errata_37 then
@@ -148,41 +173,48 @@ begin
148
173
end if ;
149
174
150
175
if Errata_66 then
151
- -- Workaround for Errata 66 "TEMP: Linearity specification not met with default settings"
152
- NRF_SVD.TEMP.TEMP_Periph.A0.A0 := NRF_SVD.FICR.FICR_Periph.TEMP.A0.A;
153
- NRF_SVD.TEMP.TEMP_Periph.A1.A1 := NRF_SVD.FICR.FICR_Periph.TEMP.A1.A;
154
- NRF_SVD.TEMP.TEMP_Periph.A2.A2 := NRF_SVD.FICR.FICR_Periph.TEMP.A2.A;
155
- NRF_SVD.TEMP.TEMP_Periph.A3.A3 := NRF_SVD.FICR.FICR_Periph.TEMP.A3.A;
156
- NRF_SVD.TEMP.TEMP_Periph.A4.A4 := NRF_SVD.FICR.FICR_Periph.TEMP.A4.A;
157
- NRF_SVD.TEMP.TEMP_Periph.A5.A5 := NRF_SVD.FICR.FICR_Periph.TEMP.A5.A;
158
-
159
- NRF_SVD.TEMP.TEMP_Periph.B0.B0 := NRF_SVD.FICR.FICR_Periph.TEMP.B0.B;
160
- NRF_SVD.TEMP.TEMP_Periph.B1.B1 := NRF_SVD.FICR.FICR_Periph.TEMP.B1.B;
161
- NRF_SVD.TEMP.TEMP_Periph.B2.B2 := NRF_SVD.FICR.FICR_Periph.TEMP.B2.B;
162
- NRF_SVD.TEMP.TEMP_Periph.B3.B3 := NRF_SVD.FICR.FICR_Periph.TEMP.B3.B;
163
- NRF_SVD.TEMP.TEMP_Periph.B4.B4 := NRF_SVD.FICR.FICR_Periph.TEMP.B4.B;
164
- NRF_SVD.TEMP.TEMP_Periph.B5.B5 := NRF_SVD.FICR.FICR_Periph.TEMP.B5.B;
165
-
166
- NRF_SVD.TEMP.TEMP_Periph.T0.T0 := NRF_SVD.FICR.FICR_Periph.TEMP.T0.T;
167
- NRF_SVD.TEMP.TEMP_Periph.T1.T1 := NRF_SVD.FICR.FICR_Periph.TEMP.T1.T;
168
- NRF_SVD.TEMP.TEMP_Periph.T2.T2 := NRF_SVD.FICR.FICR_Periph.TEMP.T2.T;
169
- NRF_SVD.TEMP.TEMP_Periph.T3.T3 := NRF_SVD.FICR.FICR_Periph.TEMP.T3.T;
170
- NRF_SVD.TEMP.TEMP_Periph.T4.T4 := NRF_SVD.FICR.FICR_Periph.TEMP.T4.T;
176
+ -- Workaround for Errata 66 "TEMP: Linearity specification not met with
177
+ -- default settings"
178
+ TEMP_Periph.A0.A0 := FICR_Periph.TEMP.A0.A;
179
+ TEMP_Periph.A1.A1 := FICR_Periph.TEMP.A1.A;
180
+ TEMP_Periph.A2.A2 := FICR_Periph.TEMP.A2.A;
181
+ TEMP_Periph.A3.A3 := FICR_Periph.TEMP.A3.A;
182
+ TEMP_Periph.A4.A4 := FICR_Periph.TEMP.A4.A;
183
+ TEMP_Periph.A5.A5 := FICR_Periph.TEMP.A5.A;
184
+
185
+ TEMP_Periph.B0.B0 := FICR_Periph.TEMP.B0.B;
186
+ TEMP_Periph.B1.B1 := FICR_Periph.TEMP.B1.B;
187
+ TEMP_Periph.B2.B2 := FICR_Periph.TEMP.B2.B;
188
+ TEMP_Periph.B3.B3 := FICR_Periph.TEMP.B3.B;
189
+ TEMP_Periph.B4.B4 := FICR_Periph.TEMP.B4.B;
190
+ TEMP_Periph.B5.B5 := FICR_Periph.TEMP.B5.B;
191
+
192
+ TEMP_Periph.T0.T0 := FICR_Periph.TEMP.T0.T;
193
+ TEMP_Periph.T1.T1 := FICR_Periph.TEMP.T1.T;
194
+ TEMP_Periph.T2.T2 := FICR_Periph.TEMP.T2.T;
195
+ TEMP_Periph.T3.T3 := FICR_Periph.TEMP.T3.T;
196
+ TEMP_Periph.T4.T4 := FICR_Periph.TEMP.T4.T;
171
197
end if ;
172
198
173
199
if Errata_108 then
174
- -- Workaround for Errata 108 "RAM: RAM content cannot be trusted upon waking up from System ON Idle or System OFF mode"
175
- null ;
200
+ -- Workaround for Errata 108 "RAM: RAM content cannot be trusted upon
201
+ -- waking up from System ON Idle or System OFF mode"
202
+ E108_Undocumented_Reg_EE4 := E108_Undocumented_FICR_Reg_258 and 16#4F# ;
176
203
end if ;
177
204
178
205
if Errata_136 then
179
- -- Workaround for Errata 136 "System: Bits in RESETREAS are set when they should not be"
180
- null ;
206
+ -- Workaround for Errata 136 "System: Bits in RESETREAS are set when they
207
+ -- should not be"
208
+ if POWER_Periph.RESETREAS.RESETPIN = Detected then
209
+ POWER_Periph.RESETREAS.RESETPIN := Notdetected;
210
+ end if ;
181
211
end if ;
182
212
183
213
if Errata_182 then
184
- -- Workaround for Errata 182 "RADIO: Fixes for anomalies #102, #106, and #107 do not take effect"
185
- null ;
214
+ -- Workaround for Errata 182 "RADIO: Fixes for anomalies #102, #106, and
215
+ -- #107 do not take effect"
216
+ E182_Undocumented_Reg_73C :=
217
+ E182_Undocumented_Reg_73C or Shift_Left(1 , 10 );
186
218
end if ;
187
219
188
220
end nRF.Device ;
0 commit comments