1 #ifndef NRF51_ERRATAS_H
2 #define NRF51_ERRATAS_H
3
4 /*
5
6 Copyright (c) 2010 - 2024, Nordic Semiconductor ASA All rights reserved.
7
8 SPDX-License-Identifier: BSD-3-Clause
9
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12
13 1. Redistributions of source code must retain the above copyright notice, this
14 list of conditions and the following disclaimer.
15
16 2. Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in the
18 documentation and/or other materials provided with the distribution.
19
20 3. Neither the name of Nordic Semiconductor ASA nor the names of its
21 contributors may be used to endorse or promote products derived from this
22 software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35
36 */
37
38 #include <stdint.h>
39 #include <stdbool.h>
40 #include "compiler_abstraction.h"
41
42 static bool nrf51_errata_1(void) __UNUSED;
43 static bool nrf51_errata_2(void) __UNUSED;
44 static bool nrf51_errata_3(void) __UNUSED;
45 static bool nrf51_errata_4(void) __UNUSED;
46 static bool nrf51_errata_5(void) __UNUSED;
47 static bool nrf51_errata_6(void) __UNUSED;
48 static bool nrf51_errata_7(void) __UNUSED;
49 static bool nrf51_errata_8(void) __UNUSED;
50 static bool nrf51_errata_9(void) __UNUSED;
51 static bool nrf51_errata_10(void) __UNUSED;
52 static bool nrf51_errata_11(void) __UNUSED;
53 static bool nrf51_errata_12(void) __UNUSED;
54 static bool nrf51_errata_13(void) __UNUSED;
55 static bool nrf51_errata_14(void) __UNUSED;
56 static bool nrf51_errata_15(void) __UNUSED;
57 static bool nrf51_errata_16(void) __UNUSED;
58 static bool nrf51_errata_17(void) __UNUSED;
59 static bool nrf51_errata_18(void) __UNUSED;
60 static bool nrf51_errata_19(void) __UNUSED;
61 static bool nrf51_errata_20(void) __UNUSED;
62 static bool nrf51_errata_21(void) __UNUSED;
63 static bool nrf51_errata_22(void) __UNUSED;
64 static bool nrf51_errata_23(void) __UNUSED;
65 static bool nrf51_errata_24(void) __UNUSED;
66 static bool nrf51_errata_25(void) __UNUSED;
67 static bool nrf51_errata_26(void) __UNUSED;
68 static bool nrf51_errata_27(void) __UNUSED;
69 static bool nrf51_errata_28(void) __UNUSED;
70 static bool nrf51_errata_29(void) __UNUSED;
71 static bool nrf51_errata_30(void) __UNUSED;
72 static bool nrf51_errata_31(void) __UNUSED;
73 static bool nrf51_errata_32(void) __UNUSED;
74 static bool nrf51_errata_33(void) __UNUSED;
75 static bool nrf51_errata_34(void) __UNUSED;
76 static bool nrf51_errata_35(void) __UNUSED;
77 static bool nrf51_errata_36(void) __UNUSED;
78 static bool nrf51_errata_37(void) __UNUSED;
79 static bool nrf51_errata_38(void) __UNUSED;
80 static bool nrf51_errata_39(void) __UNUSED;
81 static bool nrf51_errata_40(void) __UNUSED;
82 static bool nrf51_errata_41(void) __UNUSED;
83 static bool nrf51_errata_42(void) __UNUSED;
84 static bool nrf51_errata_43(void) __UNUSED;
85 static bool nrf51_errata_44(void) __UNUSED;
86 static bool nrf51_errata_45(void) __UNUSED;
87 static bool nrf51_errata_46(void) __UNUSED;
88 static bool nrf51_errata_47(void) __UNUSED;
89 static bool nrf51_errata_48(void) __UNUSED;
90 static bool nrf51_errata_49(void) __UNUSED;
91 static bool nrf51_errata_50(void) __UNUSED;
92 static bool nrf51_errata_51(void) __UNUSED;
93 static bool nrf51_errata_52(void) __UNUSED;
94 static bool nrf51_errata_53(void) __UNUSED;
95 static bool nrf51_errata_54(void) __UNUSED;
96 static bool nrf51_errata_55(void) __UNUSED;
97 static bool nrf51_errata_56(void) __UNUSED;
98 static bool nrf51_errata_57(void) __UNUSED;
99 static bool nrf51_errata_58(void) __UNUSED;
100 static bool nrf51_errata_59(void) __UNUSED;
101 static bool nrf51_errata_60(void) __UNUSED;
102 static bool nrf51_errata_61(void) __UNUSED;
103 static bool nrf51_errata_62(void) __UNUSED;
104 static bool nrf51_errata_63(void) __UNUSED;
105 static bool nrf51_errata_64(void) __UNUSED;
106 static bool nrf51_errata_65(void) __UNUSED;
107 static bool nrf51_errata_66(void) __UNUSED;
108 static bool nrf51_errata_67(void) __UNUSED;
109 static bool nrf51_errata_68(void) __UNUSED;
110 static bool nrf51_errata_69(void) __UNUSED;
111 static bool nrf51_errata_70(void) __UNUSED;
112 static bool nrf51_errata_71(void) __UNUSED;
113 static bool nrf51_errata_72(void) __UNUSED;
114 static bool nrf51_errata_73(void) __UNUSED;
115 static bool nrf51_errata_74(void) __UNUSED;
116 static bool nrf51_errata_75(void) __UNUSED;
117 static bool nrf51_errata_76(void) __UNUSED;
118 static bool nrf51_errata_77(void) __UNUSED;
119 static bool nrf51_errata_78(void) __UNUSED;
120
121 /* ========= Errata 1 ========= */
122 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
123 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
124 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
125 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
126 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
127 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
128 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
129 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
130 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
131 #define NRF51_ERRATA_1_PRESENT 1
132 #else
133 #define NRF51_ERRATA_1_PRESENT 0
134 #endif
135
136 #ifndef NRF51_ERRATA_1_ENABLE_WORKAROUND
137 #define NRF51_ERRATA_1_ENABLE_WORKAROUND NRF51_ERRATA_1_PRESENT
138 #endif
139
nrf51_errata_1(void)140 static bool nrf51_errata_1(void)
141 {
142 #ifndef NRF51_SERIES
143 return false;
144 #else
145 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
146 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
147 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
148 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
149 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
150 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
151 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
152 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
153 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
154 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
155 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
156 #endif
157 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
158 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
159 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
160 if (var1 == 0x01)
161 {
162 switch(var2)
163 {
164 case 0x00ul:
165 return true;
166 case 0x01ul:
167 return true;
168 case 0x02ul:
169 return false;
170 case 0x03ul:
171 return true;
172 case 0x04ul:
173 return false;
174 case 0x07ul:
175 return false;
176 case 0x08ul:
177 return false;
178 case 0x09ul:
179 return false;
180 case 0x0Aul:
181 return false;
182 case 0x0Bul:
183 return false;
184 case 0x0Cul:
185 return false;
186 case 0x0Dul:
187 return false;
188 default:
189 return false;
190 }
191 }
192 #endif
193 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
194 if (var1 == 0x01)
195 {
196 switch(var2)
197 {
198 case 0x00ul:
199 return true;
200 case 0x01ul:
201 return true;
202 case 0x02ul:
203 return false;
204 case 0x03ul:
205 return true;
206 case 0x04ul:
207 return false;
208 case 0x07ul:
209 return false;
210 case 0x08ul:
211 return false;
212 case 0x09ul:
213 return false;
214 case 0x0Aul:
215 return false;
216 case 0x0Bul:
217 return false;
218 case 0x0Cul:
219 return false;
220 case 0x0Dul:
221 return false;
222 default:
223 return false;
224 }
225 }
226 #endif
227 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
228 if (var1 == 0x01)
229 {
230 switch(var2)
231 {
232 case 0x00ul:
233 return true;
234 case 0x01ul:
235 return true;
236 case 0x02ul:
237 return false;
238 case 0x03ul:
239 return true;
240 case 0x04ul:
241 return false;
242 case 0x07ul:
243 return false;
244 case 0x08ul:
245 return false;
246 case 0x09ul:
247 return false;
248 case 0x0Aul:
249 return false;
250 case 0x0Bul:
251 return false;
252 case 0x0Cul:
253 return false;
254 case 0x0Dul:
255 return false;
256 default:
257 return false;
258 }
259 }
260 #endif
261 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
262 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
263 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
264 if (var1 == 0x01)
265 {
266 switch(var2)
267 {
268 case 0x00ul:
269 return true;
270 case 0x01ul:
271 return true;
272 case 0x02ul:
273 return false;
274 case 0x03ul:
275 return true;
276 case 0x04ul:
277 return false;
278 case 0x07ul:
279 return false;
280 case 0x08ul:
281 return false;
282 case 0x09ul:
283 return false;
284 case 0x0Aul:
285 return false;
286 case 0x0Bul:
287 return false;
288 case 0x0Cul:
289 return false;
290 case 0x0Dul:
291 return false;
292 default:
293 return false;
294 }
295 }
296 #endif
297 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
298 if (var1 == 0x01)
299 {
300 switch(var2)
301 {
302 case 0x00ul:
303 return true;
304 case 0x01ul:
305 return true;
306 case 0x02ul:
307 return false;
308 case 0x03ul:
309 return true;
310 case 0x04ul:
311 return false;
312 case 0x07ul:
313 return false;
314 case 0x08ul:
315 return false;
316 case 0x09ul:
317 return false;
318 case 0x0Aul:
319 return false;
320 case 0x0Bul:
321 return false;
322 case 0x0Cul:
323 return false;
324 case 0x0Dul:
325 return false;
326 default:
327 return false;
328 }
329 }
330 #endif
331 return false;
332 #endif
333 }
334
335 /* ========= Errata 2 ========= */
336 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
337 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
338 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
339 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
340 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
341 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
342 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
343 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
344 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
345 #define NRF51_ERRATA_2_PRESENT 1
346 #else
347 #define NRF51_ERRATA_2_PRESENT 0
348 #endif
349
350 #ifndef NRF51_ERRATA_2_ENABLE_WORKAROUND
351 #define NRF51_ERRATA_2_ENABLE_WORKAROUND NRF51_ERRATA_2_PRESENT
352 #endif
353
nrf51_errata_2(void)354 static bool nrf51_errata_2(void)
355 {
356 #ifndef NRF51_SERIES
357 return false;
358 #else
359 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
360 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
361 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
362 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
363 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
364 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
365 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
366 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
367 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
368 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
369 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
370 #endif
371 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
372 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
373 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
374 if (var1 == 0x01)
375 {
376 switch(var2)
377 {
378 case 0x00ul:
379 return true;
380 case 0x01ul:
381 return true;
382 case 0x02ul:
383 return false;
384 case 0x03ul:
385 return true;
386 case 0x04ul:
387 return false;
388 case 0x07ul:
389 return false;
390 case 0x08ul:
391 return false;
392 case 0x09ul:
393 return false;
394 case 0x0Aul:
395 return false;
396 case 0x0Bul:
397 return false;
398 case 0x0Cul:
399 return false;
400 case 0x0Dul:
401 return false;
402 default:
403 return false;
404 }
405 }
406 #endif
407 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
408 if (var1 == 0x01)
409 {
410 switch(var2)
411 {
412 case 0x00ul:
413 return true;
414 case 0x01ul:
415 return true;
416 case 0x02ul:
417 return false;
418 case 0x03ul:
419 return true;
420 case 0x04ul:
421 return false;
422 case 0x07ul:
423 return false;
424 case 0x08ul:
425 return false;
426 case 0x09ul:
427 return false;
428 case 0x0Aul:
429 return false;
430 case 0x0Bul:
431 return false;
432 case 0x0Cul:
433 return false;
434 case 0x0Dul:
435 return false;
436 default:
437 return false;
438 }
439 }
440 #endif
441 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
442 if (var1 == 0x01)
443 {
444 switch(var2)
445 {
446 case 0x00ul:
447 return true;
448 case 0x01ul:
449 return true;
450 case 0x02ul:
451 return false;
452 case 0x03ul:
453 return true;
454 case 0x04ul:
455 return false;
456 case 0x07ul:
457 return false;
458 case 0x08ul:
459 return false;
460 case 0x09ul:
461 return false;
462 case 0x0Aul:
463 return false;
464 case 0x0Bul:
465 return false;
466 case 0x0Cul:
467 return false;
468 case 0x0Dul:
469 return false;
470 default:
471 return false;
472 }
473 }
474 #endif
475 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
476 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
477 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
478 if (var1 == 0x01)
479 {
480 switch(var2)
481 {
482 case 0x00ul:
483 return true;
484 case 0x01ul:
485 return true;
486 case 0x02ul:
487 return false;
488 case 0x03ul:
489 return true;
490 case 0x04ul:
491 return false;
492 case 0x07ul:
493 return false;
494 case 0x08ul:
495 return false;
496 case 0x09ul:
497 return false;
498 case 0x0Aul:
499 return false;
500 case 0x0Bul:
501 return false;
502 case 0x0Cul:
503 return false;
504 case 0x0Dul:
505 return false;
506 default:
507 return false;
508 }
509 }
510 #endif
511 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
512 if (var1 == 0x01)
513 {
514 switch(var2)
515 {
516 case 0x00ul:
517 return true;
518 case 0x01ul:
519 return true;
520 case 0x02ul:
521 return false;
522 case 0x03ul:
523 return true;
524 case 0x04ul:
525 return false;
526 case 0x07ul:
527 return false;
528 case 0x08ul:
529 return false;
530 case 0x09ul:
531 return false;
532 case 0x0Aul:
533 return false;
534 case 0x0Bul:
535 return false;
536 case 0x0Cul:
537 return false;
538 case 0x0Dul:
539 return false;
540 default:
541 return false;
542 }
543 }
544 #endif
545 return false;
546 #endif
547 }
548
549 /* ========= Errata 3 ========= */
550 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
551 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
552 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
553 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
554 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
555 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
556 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
557 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
558 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
559 #define NRF51_ERRATA_3_PRESENT 1
560 #else
561 #define NRF51_ERRATA_3_PRESENT 0
562 #endif
563
564 #ifndef NRF51_ERRATA_3_ENABLE_WORKAROUND
565 #define NRF51_ERRATA_3_ENABLE_WORKAROUND NRF51_ERRATA_3_PRESENT
566 #endif
567
nrf51_errata_3(void)568 static bool nrf51_errata_3(void)
569 {
570 #ifndef NRF51_SERIES
571 return false;
572 #else
573 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
574 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
575 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
576 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
577 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
578 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
579 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
580 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
581 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
582 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
583 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
584 #endif
585 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
586 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
587 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
588 if (var1 == 0x01)
589 {
590 switch(var2)
591 {
592 case 0x00ul:
593 return true;
594 case 0x01ul:
595 return true;
596 case 0x02ul:
597 return false;
598 case 0x03ul:
599 return true;
600 case 0x04ul:
601 return false;
602 case 0x07ul:
603 return false;
604 case 0x08ul:
605 return false;
606 case 0x09ul:
607 return false;
608 case 0x0Aul:
609 return false;
610 case 0x0Bul:
611 return false;
612 case 0x0Cul:
613 return false;
614 case 0x0Dul:
615 return false;
616 default:
617 return false;
618 }
619 }
620 #endif
621 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
622 if (var1 == 0x01)
623 {
624 switch(var2)
625 {
626 case 0x00ul:
627 return true;
628 case 0x01ul:
629 return true;
630 case 0x02ul:
631 return false;
632 case 0x03ul:
633 return true;
634 case 0x04ul:
635 return false;
636 case 0x07ul:
637 return false;
638 case 0x08ul:
639 return false;
640 case 0x09ul:
641 return false;
642 case 0x0Aul:
643 return false;
644 case 0x0Bul:
645 return false;
646 case 0x0Cul:
647 return false;
648 case 0x0Dul:
649 return false;
650 default:
651 return false;
652 }
653 }
654 #endif
655 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
656 if (var1 == 0x01)
657 {
658 switch(var2)
659 {
660 case 0x00ul:
661 return true;
662 case 0x01ul:
663 return true;
664 case 0x02ul:
665 return false;
666 case 0x03ul:
667 return true;
668 case 0x04ul:
669 return false;
670 case 0x07ul:
671 return false;
672 case 0x08ul:
673 return false;
674 case 0x09ul:
675 return false;
676 case 0x0Aul:
677 return false;
678 case 0x0Bul:
679 return false;
680 case 0x0Cul:
681 return false;
682 case 0x0Dul:
683 return false;
684 default:
685 return false;
686 }
687 }
688 #endif
689 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
690 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
691 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
692 if (var1 == 0x01)
693 {
694 switch(var2)
695 {
696 case 0x00ul:
697 return true;
698 case 0x01ul:
699 return true;
700 case 0x02ul:
701 return false;
702 case 0x03ul:
703 return true;
704 case 0x04ul:
705 return false;
706 case 0x07ul:
707 return false;
708 case 0x08ul:
709 return false;
710 case 0x09ul:
711 return false;
712 case 0x0Aul:
713 return false;
714 case 0x0Bul:
715 return false;
716 case 0x0Cul:
717 return false;
718 case 0x0Dul:
719 return false;
720 default:
721 return false;
722 }
723 }
724 #endif
725 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
726 if (var1 == 0x01)
727 {
728 switch(var2)
729 {
730 case 0x00ul:
731 return true;
732 case 0x01ul:
733 return true;
734 case 0x02ul:
735 return false;
736 case 0x03ul:
737 return true;
738 case 0x04ul:
739 return false;
740 case 0x07ul:
741 return false;
742 case 0x08ul:
743 return false;
744 case 0x09ul:
745 return false;
746 case 0x0Aul:
747 return false;
748 case 0x0Bul:
749 return false;
750 case 0x0Cul:
751 return false;
752 case 0x0Dul:
753 return false;
754 default:
755 return false;
756 }
757 }
758 #endif
759 return false;
760 #endif
761 }
762
763 /* ========= Errata 4 ========= */
764 #define NRF51_ERRATA_4_PRESENT 0
765
766 #ifndef NRF51_ERRATA_4_ENABLE_WORKAROUND
767 #define NRF51_ERRATA_4_ENABLE_WORKAROUND NRF51_ERRATA_4_PRESENT
768 #endif
769
nrf51_errata_4(void)770 static bool nrf51_errata_4(void)
771 {
772 #ifndef NRF51_SERIES
773 return false;
774 #else
775 return false;
776 #endif
777 }
778
779 /* ========= Errata 5 ========= */
780 #define NRF51_ERRATA_5_PRESENT 0
781
782 #ifndef NRF51_ERRATA_5_ENABLE_WORKAROUND
783 #define NRF51_ERRATA_5_ENABLE_WORKAROUND NRF51_ERRATA_5_PRESENT
784 #endif
785
nrf51_errata_5(void)786 static bool nrf51_errata_5(void)
787 {
788 #ifndef NRF51_SERIES
789 return false;
790 #else
791 return false;
792 #endif
793 }
794
795 /* ========= Errata 6 ========= */
796 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
797 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
798 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
799 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
800 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
801 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
802 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
803 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
804 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
805 #define NRF51_ERRATA_6_PRESENT 1
806 #else
807 #define NRF51_ERRATA_6_PRESENT 0
808 #endif
809
810 #ifndef NRF51_ERRATA_6_ENABLE_WORKAROUND
811 #define NRF51_ERRATA_6_ENABLE_WORKAROUND NRF51_ERRATA_6_PRESENT
812 #endif
813
nrf51_errata_6(void)814 static bool nrf51_errata_6(void)
815 {
816 #ifndef NRF51_SERIES
817 return false;
818 #else
819 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
820 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
821 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
822 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
823 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
824 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
825 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
826 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
827 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
828 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
829 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
830 #endif
831 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
832 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
833 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
834 if (var1 == 0x01)
835 {
836 switch(var2)
837 {
838 case 0x00ul:
839 return true;
840 case 0x01ul:
841 return true;
842 case 0x02ul:
843 return false;
844 case 0x03ul:
845 return true;
846 case 0x04ul:
847 return false;
848 case 0x07ul:
849 return false;
850 case 0x08ul:
851 return false;
852 case 0x09ul:
853 return false;
854 case 0x0Aul:
855 return false;
856 case 0x0Bul:
857 return false;
858 case 0x0Cul:
859 return false;
860 case 0x0Dul:
861 return false;
862 default:
863 return false;
864 }
865 }
866 #endif
867 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
868 if (var1 == 0x01)
869 {
870 switch(var2)
871 {
872 case 0x00ul:
873 return true;
874 case 0x01ul:
875 return true;
876 case 0x02ul:
877 return false;
878 case 0x03ul:
879 return true;
880 case 0x04ul:
881 return false;
882 case 0x07ul:
883 return false;
884 case 0x08ul:
885 return false;
886 case 0x09ul:
887 return false;
888 case 0x0Aul:
889 return false;
890 case 0x0Bul:
891 return false;
892 case 0x0Cul:
893 return false;
894 case 0x0Dul:
895 return false;
896 default:
897 return false;
898 }
899 }
900 #endif
901 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
902 if (var1 == 0x01)
903 {
904 switch(var2)
905 {
906 case 0x00ul:
907 return true;
908 case 0x01ul:
909 return true;
910 case 0x02ul:
911 return false;
912 case 0x03ul:
913 return true;
914 case 0x04ul:
915 return false;
916 case 0x07ul:
917 return false;
918 case 0x08ul:
919 return false;
920 case 0x09ul:
921 return false;
922 case 0x0Aul:
923 return false;
924 case 0x0Bul:
925 return false;
926 case 0x0Cul:
927 return false;
928 case 0x0Dul:
929 return false;
930 default:
931 return false;
932 }
933 }
934 #endif
935 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
936 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
937 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
938 if (var1 == 0x01)
939 {
940 switch(var2)
941 {
942 case 0x00ul:
943 return true;
944 case 0x01ul:
945 return true;
946 case 0x02ul:
947 return false;
948 case 0x03ul:
949 return true;
950 case 0x04ul:
951 return false;
952 case 0x07ul:
953 return false;
954 case 0x08ul:
955 return false;
956 case 0x09ul:
957 return false;
958 case 0x0Aul:
959 return false;
960 case 0x0Bul:
961 return false;
962 case 0x0Cul:
963 return false;
964 case 0x0Dul:
965 return false;
966 default:
967 return false;
968 }
969 }
970 #endif
971 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
972 if (var1 == 0x01)
973 {
974 switch(var2)
975 {
976 case 0x00ul:
977 return true;
978 case 0x01ul:
979 return true;
980 case 0x02ul:
981 return false;
982 case 0x03ul:
983 return true;
984 case 0x04ul:
985 return false;
986 case 0x07ul:
987 return false;
988 case 0x08ul:
989 return false;
990 case 0x09ul:
991 return false;
992 case 0x0Aul:
993 return false;
994 case 0x0Bul:
995 return false;
996 case 0x0Cul:
997 return false;
998 case 0x0Dul:
999 return false;
1000 default:
1001 return false;
1002 }
1003 }
1004 #endif
1005 return false;
1006 #endif
1007 }
1008
1009 /* ========= Errata 7 ========= */
1010 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
1011 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
1012 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
1013 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
1014 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
1015 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
1016 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
1017 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
1018 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1019 #define NRF51_ERRATA_7_PRESENT 1
1020 #else
1021 #define NRF51_ERRATA_7_PRESENT 0
1022 #endif
1023
1024 #ifndef NRF51_ERRATA_7_ENABLE_WORKAROUND
1025 #define NRF51_ERRATA_7_ENABLE_WORKAROUND NRF51_ERRATA_7_PRESENT
1026 #endif
1027
nrf51_errata_7(void)1028 static bool nrf51_errata_7(void)
1029 {
1030 #ifndef NRF51_SERIES
1031 return false;
1032 #else
1033 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1034 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1035 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
1036 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
1037 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
1038 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1039 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1040 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
1041 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1042 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
1043 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
1044 #endif
1045 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1046 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1047 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
1048 if (var1 == 0x01)
1049 {
1050 switch(var2)
1051 {
1052 case 0x00ul:
1053 return true;
1054 case 0x01ul:
1055 return true;
1056 case 0x02ul:
1057 return false;
1058 case 0x03ul:
1059 return true;
1060 case 0x04ul:
1061 return false;
1062 case 0x07ul:
1063 return false;
1064 case 0x08ul:
1065 return false;
1066 case 0x09ul:
1067 return false;
1068 case 0x0Aul:
1069 return false;
1070 case 0x0Bul:
1071 return false;
1072 case 0x0Cul:
1073 return false;
1074 case 0x0Dul:
1075 return false;
1076 default:
1077 return false;
1078 }
1079 }
1080 #endif
1081 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
1082 if (var1 == 0x01)
1083 {
1084 switch(var2)
1085 {
1086 case 0x00ul:
1087 return true;
1088 case 0x01ul:
1089 return true;
1090 case 0x02ul:
1091 return false;
1092 case 0x03ul:
1093 return true;
1094 case 0x04ul:
1095 return false;
1096 case 0x07ul:
1097 return false;
1098 case 0x08ul:
1099 return false;
1100 case 0x09ul:
1101 return false;
1102 case 0x0Aul:
1103 return false;
1104 case 0x0Bul:
1105 return false;
1106 case 0x0Cul:
1107 return false;
1108 case 0x0Dul:
1109 return false;
1110 default:
1111 return false;
1112 }
1113 }
1114 #endif
1115 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
1116 if (var1 == 0x01)
1117 {
1118 switch(var2)
1119 {
1120 case 0x00ul:
1121 return true;
1122 case 0x01ul:
1123 return true;
1124 case 0x02ul:
1125 return false;
1126 case 0x03ul:
1127 return true;
1128 case 0x04ul:
1129 return false;
1130 case 0x07ul:
1131 return false;
1132 case 0x08ul:
1133 return false;
1134 case 0x09ul:
1135 return false;
1136 case 0x0Aul:
1137 return false;
1138 case 0x0Bul:
1139 return false;
1140 case 0x0Cul:
1141 return false;
1142 case 0x0Dul:
1143 return false;
1144 default:
1145 return false;
1146 }
1147 }
1148 #endif
1149 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1150 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1151 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
1152 if (var1 == 0x01)
1153 {
1154 switch(var2)
1155 {
1156 case 0x00ul:
1157 return true;
1158 case 0x01ul:
1159 return true;
1160 case 0x02ul:
1161 return false;
1162 case 0x03ul:
1163 return true;
1164 case 0x04ul:
1165 return false;
1166 case 0x07ul:
1167 return false;
1168 case 0x08ul:
1169 return false;
1170 case 0x09ul:
1171 return false;
1172 case 0x0Aul:
1173 return false;
1174 case 0x0Bul:
1175 return false;
1176 case 0x0Cul:
1177 return false;
1178 case 0x0Dul:
1179 return false;
1180 default:
1181 return false;
1182 }
1183 }
1184 #endif
1185 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1186 if (var1 == 0x01)
1187 {
1188 switch(var2)
1189 {
1190 case 0x00ul:
1191 return true;
1192 case 0x01ul:
1193 return true;
1194 case 0x02ul:
1195 return false;
1196 case 0x03ul:
1197 return true;
1198 case 0x04ul:
1199 return false;
1200 case 0x07ul:
1201 return false;
1202 case 0x08ul:
1203 return false;
1204 case 0x09ul:
1205 return false;
1206 case 0x0Aul:
1207 return false;
1208 case 0x0Bul:
1209 return false;
1210 case 0x0Cul:
1211 return false;
1212 case 0x0Dul:
1213 return false;
1214 default:
1215 return false;
1216 }
1217 }
1218 #endif
1219 return false;
1220 #endif
1221 }
1222
1223 /* ========= Errata 8 ========= */
1224 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
1225 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
1226 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
1227 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
1228 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
1229 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
1230 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
1231 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
1232 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1233 #define NRF51_ERRATA_8_PRESENT 1
1234 #else
1235 #define NRF51_ERRATA_8_PRESENT 0
1236 #endif
1237
1238 #ifndef NRF51_ERRATA_8_ENABLE_WORKAROUND
1239 #define NRF51_ERRATA_8_ENABLE_WORKAROUND NRF51_ERRATA_8_PRESENT
1240 #endif
1241
nrf51_errata_8(void)1242 static bool nrf51_errata_8(void)
1243 {
1244 #ifndef NRF51_SERIES
1245 return false;
1246 #else
1247 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1248 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1249 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
1250 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
1251 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
1252 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1253 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1254 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
1255 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1256 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
1257 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
1258 #endif
1259 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1260 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1261 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
1262 if (var1 == 0x01)
1263 {
1264 switch(var2)
1265 {
1266 case 0x00ul:
1267 return true;
1268 case 0x01ul:
1269 return true;
1270 case 0x02ul:
1271 return false;
1272 case 0x03ul:
1273 return true;
1274 case 0x04ul:
1275 return false;
1276 case 0x07ul:
1277 return false;
1278 case 0x08ul:
1279 return false;
1280 case 0x09ul:
1281 return false;
1282 case 0x0Aul:
1283 return false;
1284 case 0x0Bul:
1285 return false;
1286 case 0x0Cul:
1287 return false;
1288 case 0x0Dul:
1289 return false;
1290 default:
1291 return false;
1292 }
1293 }
1294 #endif
1295 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
1296 if (var1 == 0x01)
1297 {
1298 switch(var2)
1299 {
1300 case 0x00ul:
1301 return true;
1302 case 0x01ul:
1303 return true;
1304 case 0x02ul:
1305 return false;
1306 case 0x03ul:
1307 return true;
1308 case 0x04ul:
1309 return false;
1310 case 0x07ul:
1311 return false;
1312 case 0x08ul:
1313 return false;
1314 case 0x09ul:
1315 return false;
1316 case 0x0Aul:
1317 return false;
1318 case 0x0Bul:
1319 return false;
1320 case 0x0Cul:
1321 return false;
1322 case 0x0Dul:
1323 return false;
1324 default:
1325 return false;
1326 }
1327 }
1328 #endif
1329 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
1330 if (var1 == 0x01)
1331 {
1332 switch(var2)
1333 {
1334 case 0x00ul:
1335 return true;
1336 case 0x01ul:
1337 return true;
1338 case 0x02ul:
1339 return false;
1340 case 0x03ul:
1341 return true;
1342 case 0x04ul:
1343 return false;
1344 case 0x07ul:
1345 return false;
1346 case 0x08ul:
1347 return false;
1348 case 0x09ul:
1349 return false;
1350 case 0x0Aul:
1351 return false;
1352 case 0x0Bul:
1353 return false;
1354 case 0x0Cul:
1355 return false;
1356 case 0x0Dul:
1357 return false;
1358 default:
1359 return false;
1360 }
1361 }
1362 #endif
1363 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1364 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1365 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
1366 if (var1 == 0x01)
1367 {
1368 switch(var2)
1369 {
1370 case 0x00ul:
1371 return true;
1372 case 0x01ul:
1373 return true;
1374 case 0x02ul:
1375 return false;
1376 case 0x03ul:
1377 return true;
1378 case 0x04ul:
1379 return false;
1380 case 0x07ul:
1381 return false;
1382 case 0x08ul:
1383 return false;
1384 case 0x09ul:
1385 return false;
1386 case 0x0Aul:
1387 return false;
1388 case 0x0Bul:
1389 return false;
1390 case 0x0Cul:
1391 return false;
1392 case 0x0Dul:
1393 return false;
1394 default:
1395 return false;
1396 }
1397 }
1398 #endif
1399 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1400 if (var1 == 0x01)
1401 {
1402 switch(var2)
1403 {
1404 case 0x00ul:
1405 return true;
1406 case 0x01ul:
1407 return true;
1408 case 0x02ul:
1409 return false;
1410 case 0x03ul:
1411 return true;
1412 case 0x04ul:
1413 return false;
1414 case 0x07ul:
1415 return false;
1416 case 0x08ul:
1417 return false;
1418 case 0x09ul:
1419 return false;
1420 case 0x0Aul:
1421 return false;
1422 case 0x0Bul:
1423 return false;
1424 case 0x0Cul:
1425 return false;
1426 case 0x0Dul:
1427 return false;
1428 default:
1429 return false;
1430 }
1431 }
1432 #endif
1433 return false;
1434 #endif
1435 }
1436
1437 /* ========= Errata 9 ========= */
1438 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
1439 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
1440 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
1441 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
1442 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
1443 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
1444 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
1445 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
1446 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1447 #define NRF51_ERRATA_9_PRESENT 1
1448 #else
1449 #define NRF51_ERRATA_9_PRESENT 0
1450 #endif
1451
1452 #ifndef NRF51_ERRATA_9_ENABLE_WORKAROUND
1453 #define NRF51_ERRATA_9_ENABLE_WORKAROUND NRF51_ERRATA_9_PRESENT
1454 #endif
1455
nrf51_errata_9(void)1456 static bool nrf51_errata_9(void)
1457 {
1458 #ifndef NRF51_SERIES
1459 return false;
1460 #else
1461 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1462 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1463 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
1464 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
1465 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
1466 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1467 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1468 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
1469 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1470 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
1471 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
1472 #endif
1473 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1474 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1475 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
1476 if (var1 == 0x01)
1477 {
1478 switch(var2)
1479 {
1480 case 0x00ul:
1481 return true;
1482 case 0x01ul:
1483 return true;
1484 case 0x02ul:
1485 return false;
1486 case 0x03ul:
1487 return true;
1488 case 0x04ul:
1489 return false;
1490 case 0x07ul:
1491 return false;
1492 case 0x08ul:
1493 return false;
1494 case 0x09ul:
1495 return false;
1496 case 0x0Aul:
1497 return false;
1498 case 0x0Bul:
1499 return false;
1500 case 0x0Cul:
1501 return false;
1502 case 0x0Dul:
1503 return false;
1504 default:
1505 return false;
1506 }
1507 }
1508 #endif
1509 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
1510 if (var1 == 0x01)
1511 {
1512 switch(var2)
1513 {
1514 case 0x00ul:
1515 return true;
1516 case 0x01ul:
1517 return true;
1518 case 0x02ul:
1519 return false;
1520 case 0x03ul:
1521 return true;
1522 case 0x04ul:
1523 return false;
1524 case 0x07ul:
1525 return false;
1526 case 0x08ul:
1527 return false;
1528 case 0x09ul:
1529 return false;
1530 case 0x0Aul:
1531 return false;
1532 case 0x0Bul:
1533 return false;
1534 case 0x0Cul:
1535 return false;
1536 case 0x0Dul:
1537 return false;
1538 default:
1539 return false;
1540 }
1541 }
1542 #endif
1543 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
1544 if (var1 == 0x01)
1545 {
1546 switch(var2)
1547 {
1548 case 0x00ul:
1549 return true;
1550 case 0x01ul:
1551 return true;
1552 case 0x02ul:
1553 return false;
1554 case 0x03ul:
1555 return true;
1556 case 0x04ul:
1557 return false;
1558 case 0x07ul:
1559 return false;
1560 case 0x08ul:
1561 return false;
1562 case 0x09ul:
1563 return false;
1564 case 0x0Aul:
1565 return false;
1566 case 0x0Bul:
1567 return false;
1568 case 0x0Cul:
1569 return false;
1570 case 0x0Dul:
1571 return false;
1572 default:
1573 return false;
1574 }
1575 }
1576 #endif
1577 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1578 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1579 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
1580 if (var1 == 0x01)
1581 {
1582 switch(var2)
1583 {
1584 case 0x00ul:
1585 return true;
1586 case 0x01ul:
1587 return true;
1588 case 0x02ul:
1589 return false;
1590 case 0x03ul:
1591 return true;
1592 case 0x04ul:
1593 return false;
1594 case 0x07ul:
1595 return false;
1596 case 0x08ul:
1597 return false;
1598 case 0x09ul:
1599 return false;
1600 case 0x0Aul:
1601 return false;
1602 case 0x0Bul:
1603 return false;
1604 case 0x0Cul:
1605 return false;
1606 case 0x0Dul:
1607 return false;
1608 default:
1609 return false;
1610 }
1611 }
1612 #endif
1613 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1614 if (var1 == 0x01)
1615 {
1616 switch(var2)
1617 {
1618 case 0x00ul:
1619 return true;
1620 case 0x01ul:
1621 return true;
1622 case 0x02ul:
1623 return false;
1624 case 0x03ul:
1625 return true;
1626 case 0x04ul:
1627 return false;
1628 case 0x07ul:
1629 return false;
1630 case 0x08ul:
1631 return false;
1632 case 0x09ul:
1633 return false;
1634 case 0x0Aul:
1635 return false;
1636 case 0x0Bul:
1637 return false;
1638 case 0x0Cul:
1639 return false;
1640 case 0x0Dul:
1641 return false;
1642 default:
1643 return false;
1644 }
1645 }
1646 #endif
1647 return false;
1648 #endif
1649 }
1650
1651 /* ========= Errata 10 ========= */
1652 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
1653 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
1654 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
1655 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
1656 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
1657 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
1658 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
1659 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
1660 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1661 #define NRF51_ERRATA_10_PRESENT 1
1662 #else
1663 #define NRF51_ERRATA_10_PRESENT 0
1664 #endif
1665
1666 #ifndef NRF51_ERRATA_10_ENABLE_WORKAROUND
1667 #define NRF51_ERRATA_10_ENABLE_WORKAROUND NRF51_ERRATA_10_PRESENT
1668 #endif
1669
nrf51_errata_10(void)1670 static bool nrf51_errata_10(void)
1671 {
1672 #ifndef NRF51_SERIES
1673 return false;
1674 #else
1675 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1676 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1677 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
1678 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
1679 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
1680 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1681 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1682 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
1683 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1684 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
1685 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
1686 #endif
1687 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1688 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1689 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
1690 if (var1 == 0x01)
1691 {
1692 switch(var2)
1693 {
1694 case 0x00ul:
1695 return true;
1696 case 0x01ul:
1697 return true;
1698 case 0x02ul:
1699 return false;
1700 case 0x03ul:
1701 return true;
1702 case 0x04ul:
1703 return false;
1704 case 0x07ul:
1705 return false;
1706 case 0x08ul:
1707 return false;
1708 case 0x09ul:
1709 return false;
1710 case 0x0Aul:
1711 return false;
1712 case 0x0Bul:
1713 return false;
1714 case 0x0Cul:
1715 return false;
1716 case 0x0Dul:
1717 return false;
1718 default:
1719 return false;
1720 }
1721 }
1722 #endif
1723 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
1724 if (var1 == 0x01)
1725 {
1726 switch(var2)
1727 {
1728 case 0x00ul:
1729 return true;
1730 case 0x01ul:
1731 return true;
1732 case 0x02ul:
1733 return false;
1734 case 0x03ul:
1735 return true;
1736 case 0x04ul:
1737 return false;
1738 case 0x07ul:
1739 return false;
1740 case 0x08ul:
1741 return false;
1742 case 0x09ul:
1743 return false;
1744 case 0x0Aul:
1745 return false;
1746 case 0x0Bul:
1747 return false;
1748 case 0x0Cul:
1749 return false;
1750 case 0x0Dul:
1751 return false;
1752 default:
1753 return false;
1754 }
1755 }
1756 #endif
1757 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
1758 if (var1 == 0x01)
1759 {
1760 switch(var2)
1761 {
1762 case 0x00ul:
1763 return true;
1764 case 0x01ul:
1765 return true;
1766 case 0x02ul:
1767 return false;
1768 case 0x03ul:
1769 return true;
1770 case 0x04ul:
1771 return false;
1772 case 0x07ul:
1773 return false;
1774 case 0x08ul:
1775 return false;
1776 case 0x09ul:
1777 return false;
1778 case 0x0Aul:
1779 return false;
1780 case 0x0Bul:
1781 return false;
1782 case 0x0Cul:
1783 return false;
1784 case 0x0Dul:
1785 return false;
1786 default:
1787 return false;
1788 }
1789 }
1790 #endif
1791 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1792 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1793 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
1794 if (var1 == 0x01)
1795 {
1796 switch(var2)
1797 {
1798 case 0x00ul:
1799 return true;
1800 case 0x01ul:
1801 return true;
1802 case 0x02ul:
1803 return false;
1804 case 0x03ul:
1805 return true;
1806 case 0x04ul:
1807 return false;
1808 case 0x07ul:
1809 return false;
1810 case 0x08ul:
1811 return false;
1812 case 0x09ul:
1813 return false;
1814 case 0x0Aul:
1815 return false;
1816 case 0x0Bul:
1817 return false;
1818 case 0x0Cul:
1819 return false;
1820 case 0x0Dul:
1821 return false;
1822 default:
1823 return false;
1824 }
1825 }
1826 #endif
1827 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1828 if (var1 == 0x01)
1829 {
1830 switch(var2)
1831 {
1832 case 0x00ul:
1833 return true;
1834 case 0x01ul:
1835 return true;
1836 case 0x02ul:
1837 return false;
1838 case 0x03ul:
1839 return true;
1840 case 0x04ul:
1841 return false;
1842 case 0x07ul:
1843 return false;
1844 case 0x08ul:
1845 return false;
1846 case 0x09ul:
1847 return false;
1848 case 0x0Aul:
1849 return false;
1850 case 0x0Bul:
1851 return false;
1852 case 0x0Cul:
1853 return false;
1854 case 0x0Dul:
1855 return false;
1856 default:
1857 return false;
1858 }
1859 }
1860 #endif
1861 return false;
1862 #endif
1863 }
1864
1865 /* ========= Errata 11 ========= */
1866 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
1867 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
1868 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
1869 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
1870 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
1871 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
1872 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
1873 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
1874 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1875 #define NRF51_ERRATA_11_PRESENT 1
1876 #else
1877 #define NRF51_ERRATA_11_PRESENT 0
1878 #endif
1879
1880 #ifndef NRF51_ERRATA_11_ENABLE_WORKAROUND
1881 #define NRF51_ERRATA_11_ENABLE_WORKAROUND NRF51_ERRATA_11_PRESENT
1882 #endif
1883
nrf51_errata_11(void)1884 static bool nrf51_errata_11(void)
1885 {
1886 #ifndef NRF51_SERIES
1887 return false;
1888 #else
1889 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1890 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1891 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
1892 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
1893 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
1894 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
1895 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
1896 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
1897 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
1898 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
1899 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
1900 #endif
1901 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
1902 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
1903 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
1904 if (var1 == 0x01)
1905 {
1906 switch(var2)
1907 {
1908 case 0x00ul:
1909 return true;
1910 case 0x01ul:
1911 return true;
1912 case 0x02ul:
1913 return false;
1914 case 0x03ul:
1915 return true;
1916 case 0x04ul:
1917 return false;
1918 case 0x07ul:
1919 return false;
1920 case 0x08ul:
1921 return false;
1922 case 0x09ul:
1923 return false;
1924 case 0x0Aul:
1925 return false;
1926 case 0x0Bul:
1927 return false;
1928 case 0x0Cul:
1929 return false;
1930 case 0x0Dul:
1931 return false;
1932 default:
1933 return false;
1934 }
1935 }
1936 #endif
1937 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
1938 if (var1 == 0x01)
1939 {
1940 switch(var2)
1941 {
1942 case 0x00ul:
1943 return true;
1944 case 0x01ul:
1945 return true;
1946 case 0x02ul:
1947 return false;
1948 case 0x03ul:
1949 return true;
1950 case 0x04ul:
1951 return false;
1952 case 0x07ul:
1953 return false;
1954 case 0x08ul:
1955 return false;
1956 case 0x09ul:
1957 return false;
1958 case 0x0Aul:
1959 return false;
1960 case 0x0Bul:
1961 return false;
1962 case 0x0Cul:
1963 return false;
1964 case 0x0Dul:
1965 return false;
1966 default:
1967 return false;
1968 }
1969 }
1970 #endif
1971 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
1972 if (var1 == 0x01)
1973 {
1974 switch(var2)
1975 {
1976 case 0x00ul:
1977 return true;
1978 case 0x01ul:
1979 return true;
1980 case 0x02ul:
1981 return false;
1982 case 0x03ul:
1983 return true;
1984 case 0x04ul:
1985 return false;
1986 case 0x07ul:
1987 return false;
1988 case 0x08ul:
1989 return false;
1990 case 0x09ul:
1991 return false;
1992 case 0x0Aul:
1993 return false;
1994 case 0x0Bul:
1995 return false;
1996 case 0x0Cul:
1997 return false;
1998 case 0x0Dul:
1999 return false;
2000 default:
2001 return false;
2002 }
2003 }
2004 #endif
2005 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2006 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2007 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
2008 if (var1 == 0x01)
2009 {
2010 switch(var2)
2011 {
2012 case 0x00ul:
2013 return true;
2014 case 0x01ul:
2015 return true;
2016 case 0x02ul:
2017 return false;
2018 case 0x03ul:
2019 return true;
2020 case 0x04ul:
2021 return false;
2022 case 0x07ul:
2023 return false;
2024 case 0x08ul:
2025 return false;
2026 case 0x09ul:
2027 return false;
2028 case 0x0Aul:
2029 return false;
2030 case 0x0Bul:
2031 return false;
2032 case 0x0Cul:
2033 return false;
2034 case 0x0Dul:
2035 return false;
2036 default:
2037 return false;
2038 }
2039 }
2040 #endif
2041 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2042 if (var1 == 0x01)
2043 {
2044 switch(var2)
2045 {
2046 case 0x00ul:
2047 return true;
2048 case 0x01ul:
2049 return true;
2050 case 0x02ul:
2051 return false;
2052 case 0x03ul:
2053 return true;
2054 case 0x04ul:
2055 return false;
2056 case 0x07ul:
2057 return false;
2058 case 0x08ul:
2059 return false;
2060 case 0x09ul:
2061 return false;
2062 case 0x0Aul:
2063 return false;
2064 case 0x0Bul:
2065 return false;
2066 case 0x0Cul:
2067 return false;
2068 case 0x0Dul:
2069 return false;
2070 default:
2071 return false;
2072 }
2073 }
2074 #endif
2075 return false;
2076 #endif
2077 }
2078
2079 /* ========= Errata 12 ========= */
2080 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
2081 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
2082 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
2083 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
2084 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
2085 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
2086 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
2087 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
2088 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2089 #define NRF51_ERRATA_12_PRESENT 1
2090 #else
2091 #define NRF51_ERRATA_12_PRESENT 0
2092 #endif
2093
2094 #ifndef NRF51_ERRATA_12_ENABLE_WORKAROUND
2095 #define NRF51_ERRATA_12_ENABLE_WORKAROUND NRF51_ERRATA_12_PRESENT
2096 #endif
2097
nrf51_errata_12(void)2098 static bool nrf51_errata_12(void)
2099 {
2100 #ifndef NRF51_SERIES
2101 return false;
2102 #else
2103 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2104 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2105 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
2106 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
2107 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
2108 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2109 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2110 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
2111 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2112 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
2113 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
2114 #endif
2115 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2116 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2117 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
2118 if (var1 == 0x01)
2119 {
2120 switch(var2)
2121 {
2122 case 0x00ul:
2123 return true;
2124 case 0x01ul:
2125 return true;
2126 case 0x02ul:
2127 return false;
2128 case 0x03ul:
2129 return true;
2130 case 0x04ul:
2131 return false;
2132 case 0x07ul:
2133 return false;
2134 case 0x08ul:
2135 return false;
2136 case 0x09ul:
2137 return false;
2138 case 0x0Aul:
2139 return false;
2140 case 0x0Bul:
2141 return false;
2142 case 0x0Cul:
2143 return false;
2144 case 0x0Dul:
2145 return false;
2146 default:
2147 return false;
2148 }
2149 }
2150 #endif
2151 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
2152 if (var1 == 0x01)
2153 {
2154 switch(var2)
2155 {
2156 case 0x00ul:
2157 return true;
2158 case 0x01ul:
2159 return true;
2160 case 0x02ul:
2161 return false;
2162 case 0x03ul:
2163 return true;
2164 case 0x04ul:
2165 return false;
2166 case 0x07ul:
2167 return false;
2168 case 0x08ul:
2169 return false;
2170 case 0x09ul:
2171 return false;
2172 case 0x0Aul:
2173 return false;
2174 case 0x0Bul:
2175 return false;
2176 case 0x0Cul:
2177 return false;
2178 case 0x0Dul:
2179 return false;
2180 default:
2181 return false;
2182 }
2183 }
2184 #endif
2185 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
2186 if (var1 == 0x01)
2187 {
2188 switch(var2)
2189 {
2190 case 0x00ul:
2191 return true;
2192 case 0x01ul:
2193 return true;
2194 case 0x02ul:
2195 return false;
2196 case 0x03ul:
2197 return true;
2198 case 0x04ul:
2199 return false;
2200 case 0x07ul:
2201 return false;
2202 case 0x08ul:
2203 return false;
2204 case 0x09ul:
2205 return false;
2206 case 0x0Aul:
2207 return false;
2208 case 0x0Bul:
2209 return false;
2210 case 0x0Cul:
2211 return false;
2212 case 0x0Dul:
2213 return false;
2214 default:
2215 return false;
2216 }
2217 }
2218 #endif
2219 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2220 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2221 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
2222 if (var1 == 0x01)
2223 {
2224 switch(var2)
2225 {
2226 case 0x00ul:
2227 return true;
2228 case 0x01ul:
2229 return true;
2230 case 0x02ul:
2231 return false;
2232 case 0x03ul:
2233 return true;
2234 case 0x04ul:
2235 return false;
2236 case 0x07ul:
2237 return false;
2238 case 0x08ul:
2239 return false;
2240 case 0x09ul:
2241 return false;
2242 case 0x0Aul:
2243 return false;
2244 case 0x0Bul:
2245 return false;
2246 case 0x0Cul:
2247 return false;
2248 case 0x0Dul:
2249 return false;
2250 default:
2251 return false;
2252 }
2253 }
2254 #endif
2255 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2256 if (var1 == 0x01)
2257 {
2258 switch(var2)
2259 {
2260 case 0x00ul:
2261 return true;
2262 case 0x01ul:
2263 return true;
2264 case 0x02ul:
2265 return false;
2266 case 0x03ul:
2267 return true;
2268 case 0x04ul:
2269 return false;
2270 case 0x07ul:
2271 return false;
2272 case 0x08ul:
2273 return false;
2274 case 0x09ul:
2275 return false;
2276 case 0x0Aul:
2277 return false;
2278 case 0x0Bul:
2279 return false;
2280 case 0x0Cul:
2281 return false;
2282 case 0x0Dul:
2283 return false;
2284 default:
2285 return false;
2286 }
2287 }
2288 #endif
2289 return false;
2290 #endif
2291 }
2292
2293 /* ========= Errata 13 ========= */
2294 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
2295 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
2296 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
2297 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
2298 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
2299 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
2300 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
2301 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
2302 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2303 #define NRF51_ERRATA_13_PRESENT 1
2304 #else
2305 #define NRF51_ERRATA_13_PRESENT 0
2306 #endif
2307
2308 #ifndef NRF51_ERRATA_13_ENABLE_WORKAROUND
2309 #define NRF51_ERRATA_13_ENABLE_WORKAROUND NRF51_ERRATA_13_PRESENT
2310 #endif
2311
nrf51_errata_13(void)2312 static bool nrf51_errata_13(void)
2313 {
2314 #ifndef NRF51_SERIES
2315 return false;
2316 #else
2317 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2318 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2319 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
2320 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
2321 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
2322 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2323 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2324 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
2325 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2326 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
2327 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
2328 #endif
2329 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2330 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2331 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
2332 if (var1 == 0x01)
2333 {
2334 switch(var2)
2335 {
2336 case 0x00ul:
2337 return true;
2338 case 0x01ul:
2339 return true;
2340 case 0x02ul:
2341 return false;
2342 case 0x03ul:
2343 return true;
2344 case 0x04ul:
2345 return false;
2346 case 0x07ul:
2347 return false;
2348 case 0x08ul:
2349 return false;
2350 case 0x09ul:
2351 return false;
2352 case 0x0Aul:
2353 return false;
2354 case 0x0Bul:
2355 return false;
2356 case 0x0Cul:
2357 return false;
2358 case 0x0Dul:
2359 return false;
2360 default:
2361 return false;
2362 }
2363 }
2364 #endif
2365 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
2366 if (var1 == 0x01)
2367 {
2368 switch(var2)
2369 {
2370 case 0x00ul:
2371 return true;
2372 case 0x01ul:
2373 return true;
2374 case 0x02ul:
2375 return false;
2376 case 0x03ul:
2377 return true;
2378 case 0x04ul:
2379 return false;
2380 case 0x07ul:
2381 return false;
2382 case 0x08ul:
2383 return false;
2384 case 0x09ul:
2385 return false;
2386 case 0x0Aul:
2387 return false;
2388 case 0x0Bul:
2389 return false;
2390 case 0x0Cul:
2391 return false;
2392 case 0x0Dul:
2393 return false;
2394 default:
2395 return false;
2396 }
2397 }
2398 #endif
2399 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
2400 if (var1 == 0x01)
2401 {
2402 switch(var2)
2403 {
2404 case 0x00ul:
2405 return true;
2406 case 0x01ul:
2407 return true;
2408 case 0x02ul:
2409 return false;
2410 case 0x03ul:
2411 return true;
2412 case 0x04ul:
2413 return false;
2414 case 0x07ul:
2415 return false;
2416 case 0x08ul:
2417 return false;
2418 case 0x09ul:
2419 return false;
2420 case 0x0Aul:
2421 return false;
2422 case 0x0Bul:
2423 return false;
2424 case 0x0Cul:
2425 return false;
2426 case 0x0Dul:
2427 return false;
2428 default:
2429 return false;
2430 }
2431 }
2432 #endif
2433 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2434 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2435 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
2436 if (var1 == 0x01)
2437 {
2438 switch(var2)
2439 {
2440 case 0x00ul:
2441 return true;
2442 case 0x01ul:
2443 return true;
2444 case 0x02ul:
2445 return false;
2446 case 0x03ul:
2447 return true;
2448 case 0x04ul:
2449 return false;
2450 case 0x07ul:
2451 return false;
2452 case 0x08ul:
2453 return false;
2454 case 0x09ul:
2455 return false;
2456 case 0x0Aul:
2457 return false;
2458 case 0x0Bul:
2459 return false;
2460 case 0x0Cul:
2461 return false;
2462 case 0x0Dul:
2463 return false;
2464 default:
2465 return false;
2466 }
2467 }
2468 #endif
2469 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2470 if (var1 == 0x01)
2471 {
2472 switch(var2)
2473 {
2474 case 0x00ul:
2475 return true;
2476 case 0x01ul:
2477 return true;
2478 case 0x02ul:
2479 return false;
2480 case 0x03ul:
2481 return true;
2482 case 0x04ul:
2483 return false;
2484 case 0x07ul:
2485 return false;
2486 case 0x08ul:
2487 return false;
2488 case 0x09ul:
2489 return false;
2490 case 0x0Aul:
2491 return false;
2492 case 0x0Bul:
2493 return false;
2494 case 0x0Cul:
2495 return false;
2496 case 0x0Dul:
2497 return false;
2498 default:
2499 return false;
2500 }
2501 }
2502 #endif
2503 return false;
2504 #endif
2505 }
2506
2507 /* ========= Errata 14 ========= */
2508 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
2509 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
2510 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
2511 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
2512 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
2513 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
2514 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
2515 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
2516 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2517 #define NRF51_ERRATA_14_PRESENT 1
2518 #else
2519 #define NRF51_ERRATA_14_PRESENT 0
2520 #endif
2521
2522 #ifndef NRF51_ERRATA_14_ENABLE_WORKAROUND
2523 #define NRF51_ERRATA_14_ENABLE_WORKAROUND NRF51_ERRATA_14_PRESENT
2524 #endif
2525
nrf51_errata_14(void)2526 static bool nrf51_errata_14(void)
2527 {
2528 #ifndef NRF51_SERIES
2529 return false;
2530 #else
2531 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2532 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2533 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
2534 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
2535 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
2536 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2537 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2538 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
2539 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2540 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
2541 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
2542 #endif
2543 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2544 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2545 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
2546 if (var1 == 0x01)
2547 {
2548 switch(var2)
2549 {
2550 case 0x00ul:
2551 return true;
2552 case 0x01ul:
2553 return true;
2554 case 0x02ul:
2555 return false;
2556 case 0x03ul:
2557 return true;
2558 case 0x04ul:
2559 return false;
2560 case 0x07ul:
2561 return false;
2562 case 0x08ul:
2563 return false;
2564 case 0x09ul:
2565 return false;
2566 case 0x0Aul:
2567 return false;
2568 case 0x0Bul:
2569 return false;
2570 case 0x0Cul:
2571 return false;
2572 case 0x0Dul:
2573 return false;
2574 default:
2575 return false;
2576 }
2577 }
2578 #endif
2579 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
2580 if (var1 == 0x01)
2581 {
2582 switch(var2)
2583 {
2584 case 0x00ul:
2585 return true;
2586 case 0x01ul:
2587 return true;
2588 case 0x02ul:
2589 return false;
2590 case 0x03ul:
2591 return true;
2592 case 0x04ul:
2593 return false;
2594 case 0x07ul:
2595 return false;
2596 case 0x08ul:
2597 return false;
2598 case 0x09ul:
2599 return false;
2600 case 0x0Aul:
2601 return false;
2602 case 0x0Bul:
2603 return false;
2604 case 0x0Cul:
2605 return false;
2606 case 0x0Dul:
2607 return false;
2608 default:
2609 return false;
2610 }
2611 }
2612 #endif
2613 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
2614 if (var1 == 0x01)
2615 {
2616 switch(var2)
2617 {
2618 case 0x00ul:
2619 return true;
2620 case 0x01ul:
2621 return true;
2622 case 0x02ul:
2623 return false;
2624 case 0x03ul:
2625 return true;
2626 case 0x04ul:
2627 return false;
2628 case 0x07ul:
2629 return false;
2630 case 0x08ul:
2631 return false;
2632 case 0x09ul:
2633 return false;
2634 case 0x0Aul:
2635 return false;
2636 case 0x0Bul:
2637 return false;
2638 case 0x0Cul:
2639 return false;
2640 case 0x0Dul:
2641 return false;
2642 default:
2643 return false;
2644 }
2645 }
2646 #endif
2647 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2648 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2649 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
2650 if (var1 == 0x01)
2651 {
2652 switch(var2)
2653 {
2654 case 0x00ul:
2655 return true;
2656 case 0x01ul:
2657 return true;
2658 case 0x02ul:
2659 return false;
2660 case 0x03ul:
2661 return true;
2662 case 0x04ul:
2663 return false;
2664 case 0x07ul:
2665 return false;
2666 case 0x08ul:
2667 return false;
2668 case 0x09ul:
2669 return false;
2670 case 0x0Aul:
2671 return false;
2672 case 0x0Bul:
2673 return false;
2674 case 0x0Cul:
2675 return false;
2676 case 0x0Dul:
2677 return false;
2678 default:
2679 return false;
2680 }
2681 }
2682 #endif
2683 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2684 if (var1 == 0x01)
2685 {
2686 switch(var2)
2687 {
2688 case 0x00ul:
2689 return true;
2690 case 0x01ul:
2691 return true;
2692 case 0x02ul:
2693 return false;
2694 case 0x03ul:
2695 return true;
2696 case 0x04ul:
2697 return false;
2698 case 0x07ul:
2699 return false;
2700 case 0x08ul:
2701 return false;
2702 case 0x09ul:
2703 return false;
2704 case 0x0Aul:
2705 return false;
2706 case 0x0Bul:
2707 return false;
2708 case 0x0Cul:
2709 return false;
2710 case 0x0Dul:
2711 return false;
2712 default:
2713 return false;
2714 }
2715 }
2716 #endif
2717 return false;
2718 #endif
2719 }
2720
2721 /* ========= Errata 15 ========= */
2722 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
2723 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
2724 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
2725 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
2726 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
2727 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
2728 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
2729 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
2730 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2731 #define NRF51_ERRATA_15_PRESENT 1
2732 #else
2733 #define NRF51_ERRATA_15_PRESENT 0
2734 #endif
2735
2736 #ifndef NRF51_ERRATA_15_ENABLE_WORKAROUND
2737 #define NRF51_ERRATA_15_ENABLE_WORKAROUND NRF51_ERRATA_15_PRESENT
2738 #endif
2739
nrf51_errata_15(void)2740 static bool nrf51_errata_15(void)
2741 {
2742 #ifndef NRF51_SERIES
2743 return false;
2744 #else
2745 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2746 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2747 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
2748 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
2749 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
2750 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2751 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2752 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
2753 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2754 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
2755 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
2756 #endif
2757 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2758 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2759 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
2760 if (var1 == 0x01)
2761 {
2762 switch(var2)
2763 {
2764 case 0x00ul:
2765 return true;
2766 case 0x01ul:
2767 return true;
2768 case 0x02ul:
2769 return false;
2770 case 0x03ul:
2771 return true;
2772 case 0x04ul:
2773 return false;
2774 case 0x07ul:
2775 return false;
2776 case 0x08ul:
2777 return false;
2778 case 0x09ul:
2779 return false;
2780 case 0x0Aul:
2781 return false;
2782 case 0x0Bul:
2783 return false;
2784 case 0x0Cul:
2785 return false;
2786 case 0x0Dul:
2787 return false;
2788 default:
2789 return false;
2790 }
2791 }
2792 #endif
2793 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
2794 if (var1 == 0x01)
2795 {
2796 switch(var2)
2797 {
2798 case 0x00ul:
2799 return true;
2800 case 0x01ul:
2801 return true;
2802 case 0x02ul:
2803 return false;
2804 case 0x03ul:
2805 return true;
2806 case 0x04ul:
2807 return false;
2808 case 0x07ul:
2809 return false;
2810 case 0x08ul:
2811 return false;
2812 case 0x09ul:
2813 return false;
2814 case 0x0Aul:
2815 return false;
2816 case 0x0Bul:
2817 return false;
2818 case 0x0Cul:
2819 return false;
2820 case 0x0Dul:
2821 return false;
2822 default:
2823 return false;
2824 }
2825 }
2826 #endif
2827 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
2828 if (var1 == 0x01)
2829 {
2830 switch(var2)
2831 {
2832 case 0x00ul:
2833 return true;
2834 case 0x01ul:
2835 return true;
2836 case 0x02ul:
2837 return false;
2838 case 0x03ul:
2839 return true;
2840 case 0x04ul:
2841 return false;
2842 case 0x07ul:
2843 return false;
2844 case 0x08ul:
2845 return false;
2846 case 0x09ul:
2847 return false;
2848 case 0x0Aul:
2849 return false;
2850 case 0x0Bul:
2851 return false;
2852 case 0x0Cul:
2853 return false;
2854 case 0x0Dul:
2855 return false;
2856 default:
2857 return false;
2858 }
2859 }
2860 #endif
2861 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2862 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2863 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
2864 if (var1 == 0x01)
2865 {
2866 switch(var2)
2867 {
2868 case 0x00ul:
2869 return true;
2870 case 0x01ul:
2871 return true;
2872 case 0x02ul:
2873 return false;
2874 case 0x03ul:
2875 return true;
2876 case 0x04ul:
2877 return false;
2878 case 0x07ul:
2879 return false;
2880 case 0x08ul:
2881 return false;
2882 case 0x09ul:
2883 return false;
2884 case 0x0Aul:
2885 return false;
2886 case 0x0Bul:
2887 return false;
2888 case 0x0Cul:
2889 return false;
2890 case 0x0Dul:
2891 return false;
2892 default:
2893 return false;
2894 }
2895 }
2896 #endif
2897 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2898 if (var1 == 0x01)
2899 {
2900 switch(var2)
2901 {
2902 case 0x00ul:
2903 return true;
2904 case 0x01ul:
2905 return true;
2906 case 0x02ul:
2907 return false;
2908 case 0x03ul:
2909 return true;
2910 case 0x04ul:
2911 return false;
2912 case 0x07ul:
2913 return false;
2914 case 0x08ul:
2915 return false;
2916 case 0x09ul:
2917 return false;
2918 case 0x0Aul:
2919 return false;
2920 case 0x0Bul:
2921 return false;
2922 case 0x0Cul:
2923 return false;
2924 case 0x0Dul:
2925 return false;
2926 default:
2927 return false;
2928 }
2929 }
2930 #endif
2931 return false;
2932 #endif
2933 }
2934
2935 /* ========= Errata 16 ========= */
2936 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
2937 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
2938 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
2939 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
2940 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
2941 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
2942 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
2943 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
2944 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2945 #define NRF51_ERRATA_16_PRESENT 1
2946 #else
2947 #define NRF51_ERRATA_16_PRESENT 0
2948 #endif
2949
2950 #ifndef NRF51_ERRATA_16_ENABLE_WORKAROUND
2951 #define NRF51_ERRATA_16_ENABLE_WORKAROUND NRF51_ERRATA_16_PRESENT
2952 #endif
2953
nrf51_errata_16(void)2954 static bool nrf51_errata_16(void)
2955 {
2956 #ifndef NRF51_SERIES
2957 return false;
2958 #else
2959 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2960 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2961 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
2962 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
2963 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
2964 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
2965 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
2966 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
2967 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
2968 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
2969 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
2970 #endif
2971 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
2972 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
2973 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
2974 if (var1 == 0x01)
2975 {
2976 switch(var2)
2977 {
2978 case 0x00ul:
2979 return true;
2980 case 0x01ul:
2981 return true;
2982 case 0x02ul:
2983 return false;
2984 case 0x03ul:
2985 return true;
2986 case 0x04ul:
2987 return false;
2988 case 0x07ul:
2989 return false;
2990 case 0x08ul:
2991 return false;
2992 case 0x09ul:
2993 return false;
2994 case 0x0Aul:
2995 return false;
2996 case 0x0Bul:
2997 return false;
2998 case 0x0Cul:
2999 return false;
3000 case 0x0Dul:
3001 return false;
3002 default:
3003 return false;
3004 }
3005 }
3006 #endif
3007 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
3008 if (var1 == 0x01)
3009 {
3010 switch(var2)
3011 {
3012 case 0x00ul:
3013 return true;
3014 case 0x01ul:
3015 return true;
3016 case 0x02ul:
3017 return false;
3018 case 0x03ul:
3019 return true;
3020 case 0x04ul:
3021 return false;
3022 case 0x07ul:
3023 return false;
3024 case 0x08ul:
3025 return false;
3026 case 0x09ul:
3027 return false;
3028 case 0x0Aul:
3029 return false;
3030 case 0x0Bul:
3031 return false;
3032 case 0x0Cul:
3033 return false;
3034 case 0x0Dul:
3035 return false;
3036 default:
3037 return false;
3038 }
3039 }
3040 #endif
3041 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
3042 if (var1 == 0x01)
3043 {
3044 switch(var2)
3045 {
3046 case 0x00ul:
3047 return true;
3048 case 0x01ul:
3049 return true;
3050 case 0x02ul:
3051 return false;
3052 case 0x03ul:
3053 return true;
3054 case 0x04ul:
3055 return false;
3056 case 0x07ul:
3057 return false;
3058 case 0x08ul:
3059 return false;
3060 case 0x09ul:
3061 return false;
3062 case 0x0Aul:
3063 return false;
3064 case 0x0Bul:
3065 return false;
3066 case 0x0Cul:
3067 return false;
3068 case 0x0Dul:
3069 return false;
3070 default:
3071 return false;
3072 }
3073 }
3074 #endif
3075 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3076 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3077 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
3078 if (var1 == 0x01)
3079 {
3080 switch(var2)
3081 {
3082 case 0x00ul:
3083 return true;
3084 case 0x01ul:
3085 return true;
3086 case 0x02ul:
3087 return false;
3088 case 0x03ul:
3089 return true;
3090 case 0x04ul:
3091 return false;
3092 case 0x07ul:
3093 return false;
3094 case 0x08ul:
3095 return false;
3096 case 0x09ul:
3097 return false;
3098 case 0x0Aul:
3099 return false;
3100 case 0x0Bul:
3101 return false;
3102 case 0x0Cul:
3103 return false;
3104 case 0x0Dul:
3105 return false;
3106 default:
3107 return false;
3108 }
3109 }
3110 #endif
3111 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3112 if (var1 == 0x01)
3113 {
3114 switch(var2)
3115 {
3116 case 0x00ul:
3117 return true;
3118 case 0x01ul:
3119 return true;
3120 case 0x02ul:
3121 return false;
3122 case 0x03ul:
3123 return true;
3124 case 0x04ul:
3125 return false;
3126 case 0x07ul:
3127 return false;
3128 case 0x08ul:
3129 return false;
3130 case 0x09ul:
3131 return false;
3132 case 0x0Aul:
3133 return false;
3134 case 0x0Bul:
3135 return false;
3136 case 0x0Cul:
3137 return false;
3138 case 0x0Dul:
3139 return false;
3140 default:
3141 return false;
3142 }
3143 }
3144 #endif
3145 return false;
3146 #endif
3147 }
3148
3149 /* ========= Errata 17 ========= */
3150 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
3151 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
3152 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
3153 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
3154 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
3155 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
3156 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
3157 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
3158 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3159 #define NRF51_ERRATA_17_PRESENT 1
3160 #else
3161 #define NRF51_ERRATA_17_PRESENT 0
3162 #endif
3163
3164 #ifndef NRF51_ERRATA_17_ENABLE_WORKAROUND
3165 #define NRF51_ERRATA_17_ENABLE_WORKAROUND NRF51_ERRATA_17_PRESENT
3166 #endif
3167
nrf51_errata_17(void)3168 static bool nrf51_errata_17(void)
3169 {
3170 #ifndef NRF51_SERIES
3171 return false;
3172 #else
3173 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3174 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3175 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
3176 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
3177 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
3178 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3179 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3180 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
3181 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3182 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
3183 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
3184 #endif
3185 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3186 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3187 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
3188 if (var1 == 0x01)
3189 {
3190 switch(var2)
3191 {
3192 case 0x00ul:
3193 return true;
3194 case 0x01ul:
3195 return true;
3196 case 0x02ul:
3197 return false;
3198 case 0x03ul:
3199 return true;
3200 case 0x04ul:
3201 return false;
3202 case 0x07ul:
3203 return false;
3204 case 0x08ul:
3205 return false;
3206 case 0x09ul:
3207 return false;
3208 case 0x0Aul:
3209 return false;
3210 case 0x0Bul:
3211 return false;
3212 case 0x0Cul:
3213 return false;
3214 case 0x0Dul:
3215 return false;
3216 default:
3217 return false;
3218 }
3219 }
3220 #endif
3221 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
3222 if (var1 == 0x01)
3223 {
3224 switch(var2)
3225 {
3226 case 0x00ul:
3227 return true;
3228 case 0x01ul:
3229 return true;
3230 case 0x02ul:
3231 return false;
3232 case 0x03ul:
3233 return true;
3234 case 0x04ul:
3235 return false;
3236 case 0x07ul:
3237 return false;
3238 case 0x08ul:
3239 return false;
3240 case 0x09ul:
3241 return false;
3242 case 0x0Aul:
3243 return false;
3244 case 0x0Bul:
3245 return false;
3246 case 0x0Cul:
3247 return false;
3248 case 0x0Dul:
3249 return false;
3250 default:
3251 return false;
3252 }
3253 }
3254 #endif
3255 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
3256 if (var1 == 0x01)
3257 {
3258 switch(var2)
3259 {
3260 case 0x00ul:
3261 return true;
3262 case 0x01ul:
3263 return true;
3264 case 0x02ul:
3265 return false;
3266 case 0x03ul:
3267 return true;
3268 case 0x04ul:
3269 return false;
3270 case 0x07ul:
3271 return false;
3272 case 0x08ul:
3273 return false;
3274 case 0x09ul:
3275 return false;
3276 case 0x0Aul:
3277 return false;
3278 case 0x0Bul:
3279 return false;
3280 case 0x0Cul:
3281 return false;
3282 case 0x0Dul:
3283 return false;
3284 default:
3285 return false;
3286 }
3287 }
3288 #endif
3289 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3290 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3291 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
3292 if (var1 == 0x01)
3293 {
3294 switch(var2)
3295 {
3296 case 0x00ul:
3297 return true;
3298 case 0x01ul:
3299 return true;
3300 case 0x02ul:
3301 return false;
3302 case 0x03ul:
3303 return true;
3304 case 0x04ul:
3305 return false;
3306 case 0x07ul:
3307 return false;
3308 case 0x08ul:
3309 return false;
3310 case 0x09ul:
3311 return false;
3312 case 0x0Aul:
3313 return false;
3314 case 0x0Bul:
3315 return false;
3316 case 0x0Cul:
3317 return false;
3318 case 0x0Dul:
3319 return false;
3320 default:
3321 return false;
3322 }
3323 }
3324 #endif
3325 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3326 if (var1 == 0x01)
3327 {
3328 switch(var2)
3329 {
3330 case 0x00ul:
3331 return true;
3332 case 0x01ul:
3333 return true;
3334 case 0x02ul:
3335 return false;
3336 case 0x03ul:
3337 return true;
3338 case 0x04ul:
3339 return false;
3340 case 0x07ul:
3341 return false;
3342 case 0x08ul:
3343 return false;
3344 case 0x09ul:
3345 return false;
3346 case 0x0Aul:
3347 return false;
3348 case 0x0Bul:
3349 return false;
3350 case 0x0Cul:
3351 return false;
3352 case 0x0Dul:
3353 return false;
3354 default:
3355 return false;
3356 }
3357 }
3358 #endif
3359 return false;
3360 #endif
3361 }
3362
3363 /* ========= Errata 18 ========= */
3364 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
3365 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
3366 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
3367 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
3368 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
3369 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
3370 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
3371 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
3372 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3373 #define NRF51_ERRATA_18_PRESENT 1
3374 #else
3375 #define NRF51_ERRATA_18_PRESENT 0
3376 #endif
3377
3378 #ifndef NRF51_ERRATA_18_ENABLE_WORKAROUND
3379 #define NRF51_ERRATA_18_ENABLE_WORKAROUND NRF51_ERRATA_18_PRESENT
3380 #endif
3381
nrf51_errata_18(void)3382 static bool nrf51_errata_18(void)
3383 {
3384 #ifndef NRF51_SERIES
3385 return false;
3386 #else
3387 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3388 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3389 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
3390 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
3391 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
3392 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3393 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3394 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
3395 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3396 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
3397 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
3398 #endif
3399 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3400 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3401 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
3402 if (var1 == 0x01)
3403 {
3404 switch(var2)
3405 {
3406 case 0x00ul:
3407 return true;
3408 case 0x01ul:
3409 return true;
3410 case 0x02ul:
3411 return false;
3412 case 0x03ul:
3413 return true;
3414 case 0x04ul:
3415 return false;
3416 case 0x07ul:
3417 return false;
3418 case 0x08ul:
3419 return false;
3420 case 0x09ul:
3421 return false;
3422 case 0x0Aul:
3423 return false;
3424 case 0x0Bul:
3425 return false;
3426 case 0x0Cul:
3427 return false;
3428 case 0x0Dul:
3429 return false;
3430 default:
3431 return false;
3432 }
3433 }
3434 #endif
3435 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
3436 if (var1 == 0x01)
3437 {
3438 switch(var2)
3439 {
3440 case 0x00ul:
3441 return true;
3442 case 0x01ul:
3443 return true;
3444 case 0x02ul:
3445 return false;
3446 case 0x03ul:
3447 return true;
3448 case 0x04ul:
3449 return false;
3450 case 0x07ul:
3451 return false;
3452 case 0x08ul:
3453 return false;
3454 case 0x09ul:
3455 return false;
3456 case 0x0Aul:
3457 return false;
3458 case 0x0Bul:
3459 return false;
3460 case 0x0Cul:
3461 return false;
3462 case 0x0Dul:
3463 return false;
3464 default:
3465 return false;
3466 }
3467 }
3468 #endif
3469 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
3470 if (var1 == 0x01)
3471 {
3472 switch(var2)
3473 {
3474 case 0x00ul:
3475 return true;
3476 case 0x01ul:
3477 return true;
3478 case 0x02ul:
3479 return false;
3480 case 0x03ul:
3481 return true;
3482 case 0x04ul:
3483 return false;
3484 case 0x07ul:
3485 return false;
3486 case 0x08ul:
3487 return false;
3488 case 0x09ul:
3489 return false;
3490 case 0x0Aul:
3491 return false;
3492 case 0x0Bul:
3493 return false;
3494 case 0x0Cul:
3495 return false;
3496 case 0x0Dul:
3497 return false;
3498 default:
3499 return false;
3500 }
3501 }
3502 #endif
3503 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3504 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3505 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
3506 if (var1 == 0x01)
3507 {
3508 switch(var2)
3509 {
3510 case 0x00ul:
3511 return true;
3512 case 0x01ul:
3513 return true;
3514 case 0x02ul:
3515 return false;
3516 case 0x03ul:
3517 return true;
3518 case 0x04ul:
3519 return false;
3520 case 0x07ul:
3521 return false;
3522 case 0x08ul:
3523 return false;
3524 case 0x09ul:
3525 return false;
3526 case 0x0Aul:
3527 return false;
3528 case 0x0Bul:
3529 return false;
3530 case 0x0Cul:
3531 return false;
3532 case 0x0Dul:
3533 return false;
3534 default:
3535 return false;
3536 }
3537 }
3538 #endif
3539 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3540 if (var1 == 0x01)
3541 {
3542 switch(var2)
3543 {
3544 case 0x00ul:
3545 return true;
3546 case 0x01ul:
3547 return true;
3548 case 0x02ul:
3549 return false;
3550 case 0x03ul:
3551 return true;
3552 case 0x04ul:
3553 return false;
3554 case 0x07ul:
3555 return false;
3556 case 0x08ul:
3557 return false;
3558 case 0x09ul:
3559 return false;
3560 case 0x0Aul:
3561 return false;
3562 case 0x0Bul:
3563 return false;
3564 case 0x0Cul:
3565 return false;
3566 case 0x0Dul:
3567 return false;
3568 default:
3569 return false;
3570 }
3571 }
3572 #endif
3573 return false;
3574 #endif
3575 }
3576
3577 /* ========= Errata 19 ========= */
3578 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
3579 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
3580 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
3581 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
3582 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
3583 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
3584 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
3585 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
3586 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3587 #define NRF51_ERRATA_19_PRESENT 1
3588 #else
3589 #define NRF51_ERRATA_19_PRESENT 0
3590 #endif
3591
3592 #ifndef NRF51_ERRATA_19_ENABLE_WORKAROUND
3593 #define NRF51_ERRATA_19_ENABLE_WORKAROUND NRF51_ERRATA_19_PRESENT
3594 #endif
3595
nrf51_errata_19(void)3596 static bool nrf51_errata_19(void)
3597 {
3598 #ifndef NRF51_SERIES
3599 return false;
3600 #else
3601 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3602 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3603 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
3604 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
3605 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
3606 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3607 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3608 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
3609 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3610 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
3611 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
3612 #endif
3613 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3614 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3615 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
3616 if (var1 == 0x01)
3617 {
3618 switch(var2)
3619 {
3620 case 0x00ul:
3621 return true;
3622 case 0x01ul:
3623 return true;
3624 case 0x02ul:
3625 return false;
3626 case 0x03ul:
3627 return true;
3628 case 0x04ul:
3629 return false;
3630 case 0x07ul:
3631 return false;
3632 case 0x08ul:
3633 return false;
3634 case 0x09ul:
3635 return false;
3636 case 0x0Aul:
3637 return false;
3638 case 0x0Bul:
3639 return false;
3640 case 0x0Cul:
3641 return false;
3642 case 0x0Dul:
3643 return false;
3644 default:
3645 return false;
3646 }
3647 }
3648 #endif
3649 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
3650 if (var1 == 0x01)
3651 {
3652 switch(var2)
3653 {
3654 case 0x00ul:
3655 return true;
3656 case 0x01ul:
3657 return true;
3658 case 0x02ul:
3659 return false;
3660 case 0x03ul:
3661 return true;
3662 case 0x04ul:
3663 return false;
3664 case 0x07ul:
3665 return false;
3666 case 0x08ul:
3667 return false;
3668 case 0x09ul:
3669 return false;
3670 case 0x0Aul:
3671 return false;
3672 case 0x0Bul:
3673 return false;
3674 case 0x0Cul:
3675 return false;
3676 case 0x0Dul:
3677 return false;
3678 default:
3679 return false;
3680 }
3681 }
3682 #endif
3683 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
3684 if (var1 == 0x01)
3685 {
3686 switch(var2)
3687 {
3688 case 0x00ul:
3689 return true;
3690 case 0x01ul:
3691 return true;
3692 case 0x02ul:
3693 return false;
3694 case 0x03ul:
3695 return true;
3696 case 0x04ul:
3697 return false;
3698 case 0x07ul:
3699 return false;
3700 case 0x08ul:
3701 return false;
3702 case 0x09ul:
3703 return false;
3704 case 0x0Aul:
3705 return false;
3706 case 0x0Bul:
3707 return false;
3708 case 0x0Cul:
3709 return false;
3710 case 0x0Dul:
3711 return false;
3712 default:
3713 return false;
3714 }
3715 }
3716 #endif
3717 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3718 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3719 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
3720 if (var1 == 0x01)
3721 {
3722 switch(var2)
3723 {
3724 case 0x00ul:
3725 return true;
3726 case 0x01ul:
3727 return true;
3728 case 0x02ul:
3729 return false;
3730 case 0x03ul:
3731 return true;
3732 case 0x04ul:
3733 return false;
3734 case 0x07ul:
3735 return false;
3736 case 0x08ul:
3737 return false;
3738 case 0x09ul:
3739 return false;
3740 case 0x0Aul:
3741 return false;
3742 case 0x0Bul:
3743 return false;
3744 case 0x0Cul:
3745 return false;
3746 case 0x0Dul:
3747 return false;
3748 default:
3749 return false;
3750 }
3751 }
3752 #endif
3753 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3754 if (var1 == 0x01)
3755 {
3756 switch(var2)
3757 {
3758 case 0x00ul:
3759 return true;
3760 case 0x01ul:
3761 return true;
3762 case 0x02ul:
3763 return false;
3764 case 0x03ul:
3765 return true;
3766 case 0x04ul:
3767 return false;
3768 case 0x07ul:
3769 return false;
3770 case 0x08ul:
3771 return false;
3772 case 0x09ul:
3773 return false;
3774 case 0x0Aul:
3775 return false;
3776 case 0x0Bul:
3777 return false;
3778 case 0x0Cul:
3779 return false;
3780 case 0x0Dul:
3781 return false;
3782 default:
3783 return false;
3784 }
3785 }
3786 #endif
3787 return false;
3788 #endif
3789 }
3790
3791 /* ========= Errata 20 ========= */
3792 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
3793 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
3794 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
3795 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
3796 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
3797 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
3798 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
3799 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
3800 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3801 #define NRF51_ERRATA_20_PRESENT 1
3802 #else
3803 #define NRF51_ERRATA_20_PRESENT 0
3804 #endif
3805
3806 #ifndef NRF51_ERRATA_20_ENABLE_WORKAROUND
3807 #define NRF51_ERRATA_20_ENABLE_WORKAROUND NRF51_ERRATA_20_PRESENT
3808 #endif
3809
nrf51_errata_20(void)3810 static bool nrf51_errata_20(void)
3811 {
3812 #ifndef NRF51_SERIES
3813 return false;
3814 #else
3815 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3816 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3817 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
3818 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
3819 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
3820 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3821 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3822 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
3823 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3824 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
3825 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
3826 #endif
3827 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
3828 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
3829 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
3830 if (var1 == 0x01)
3831 {
3832 switch(var2)
3833 {
3834 case 0x00ul:
3835 return true;
3836 case 0x01ul:
3837 return true;
3838 case 0x02ul:
3839 return false;
3840 case 0x03ul:
3841 return true;
3842 case 0x04ul:
3843 return false;
3844 case 0x07ul:
3845 return false;
3846 case 0x08ul:
3847 return false;
3848 case 0x09ul:
3849 return false;
3850 case 0x0Aul:
3851 return false;
3852 case 0x0Bul:
3853 return false;
3854 case 0x0Cul:
3855 return false;
3856 case 0x0Dul:
3857 return false;
3858 default:
3859 return false;
3860 }
3861 }
3862 #endif
3863 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
3864 if (var1 == 0x01)
3865 {
3866 switch(var2)
3867 {
3868 case 0x00ul:
3869 return true;
3870 case 0x01ul:
3871 return true;
3872 case 0x02ul:
3873 return false;
3874 case 0x03ul:
3875 return true;
3876 case 0x04ul:
3877 return false;
3878 case 0x07ul:
3879 return false;
3880 case 0x08ul:
3881 return false;
3882 case 0x09ul:
3883 return false;
3884 case 0x0Aul:
3885 return false;
3886 case 0x0Bul:
3887 return false;
3888 case 0x0Cul:
3889 return false;
3890 case 0x0Dul:
3891 return false;
3892 default:
3893 return false;
3894 }
3895 }
3896 #endif
3897 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
3898 if (var1 == 0x01)
3899 {
3900 switch(var2)
3901 {
3902 case 0x00ul:
3903 return true;
3904 case 0x01ul:
3905 return true;
3906 case 0x02ul:
3907 return false;
3908 case 0x03ul:
3909 return true;
3910 case 0x04ul:
3911 return false;
3912 case 0x07ul:
3913 return false;
3914 case 0x08ul:
3915 return false;
3916 case 0x09ul:
3917 return false;
3918 case 0x0Aul:
3919 return false;
3920 case 0x0Bul:
3921 return false;
3922 case 0x0Cul:
3923 return false;
3924 case 0x0Dul:
3925 return false;
3926 default:
3927 return false;
3928 }
3929 }
3930 #endif
3931 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
3932 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
3933 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
3934 if (var1 == 0x01)
3935 {
3936 switch(var2)
3937 {
3938 case 0x00ul:
3939 return true;
3940 case 0x01ul:
3941 return true;
3942 case 0x02ul:
3943 return false;
3944 case 0x03ul:
3945 return true;
3946 case 0x04ul:
3947 return false;
3948 case 0x07ul:
3949 return false;
3950 case 0x08ul:
3951 return false;
3952 case 0x09ul:
3953 return false;
3954 case 0x0Aul:
3955 return false;
3956 case 0x0Bul:
3957 return false;
3958 case 0x0Cul:
3959 return false;
3960 case 0x0Dul:
3961 return false;
3962 default:
3963 return false;
3964 }
3965 }
3966 #endif
3967 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
3968 if (var1 == 0x01)
3969 {
3970 switch(var2)
3971 {
3972 case 0x00ul:
3973 return true;
3974 case 0x01ul:
3975 return true;
3976 case 0x02ul:
3977 return false;
3978 case 0x03ul:
3979 return true;
3980 case 0x04ul:
3981 return false;
3982 case 0x07ul:
3983 return false;
3984 case 0x08ul:
3985 return false;
3986 case 0x09ul:
3987 return false;
3988 case 0x0Aul:
3989 return false;
3990 case 0x0Bul:
3991 return false;
3992 case 0x0Cul:
3993 return false;
3994 case 0x0Dul:
3995 return false;
3996 default:
3997 return false;
3998 }
3999 }
4000 #endif
4001 return false;
4002 #endif
4003 }
4004
4005 /* ========= Errata 21 ========= */
4006 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
4007 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
4008 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
4009 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
4010 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
4011 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
4012 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
4013 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
4014 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4015 #define NRF51_ERRATA_21_PRESENT 1
4016 #else
4017 #define NRF51_ERRATA_21_PRESENT 0
4018 #endif
4019
4020 #ifndef NRF51_ERRATA_21_ENABLE_WORKAROUND
4021 #define NRF51_ERRATA_21_ENABLE_WORKAROUND NRF51_ERRATA_21_PRESENT
4022 #endif
4023
nrf51_errata_21(void)4024 static bool nrf51_errata_21(void)
4025 {
4026 #ifndef NRF51_SERIES
4027 return false;
4028 #else
4029 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4030 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4031 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
4032 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
4033 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
4034 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4035 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4036 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
4037 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4038 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
4039 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
4040 #endif
4041 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4042 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4043 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
4044 if (var1 == 0x01)
4045 {
4046 switch(var2)
4047 {
4048 case 0x00ul:
4049 return true;
4050 case 0x01ul:
4051 return true;
4052 case 0x02ul:
4053 return false;
4054 case 0x03ul:
4055 return true;
4056 case 0x04ul:
4057 return false;
4058 case 0x07ul:
4059 return false;
4060 case 0x08ul:
4061 return false;
4062 case 0x09ul:
4063 return false;
4064 case 0x0Aul:
4065 return false;
4066 case 0x0Bul:
4067 return false;
4068 case 0x0Cul:
4069 return false;
4070 case 0x0Dul:
4071 return false;
4072 default:
4073 return false;
4074 }
4075 }
4076 #endif
4077 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
4078 if (var1 == 0x01)
4079 {
4080 switch(var2)
4081 {
4082 case 0x00ul:
4083 return true;
4084 case 0x01ul:
4085 return true;
4086 case 0x02ul:
4087 return false;
4088 case 0x03ul:
4089 return true;
4090 case 0x04ul:
4091 return false;
4092 case 0x07ul:
4093 return false;
4094 case 0x08ul:
4095 return false;
4096 case 0x09ul:
4097 return false;
4098 case 0x0Aul:
4099 return false;
4100 case 0x0Bul:
4101 return false;
4102 case 0x0Cul:
4103 return false;
4104 case 0x0Dul:
4105 return false;
4106 default:
4107 return false;
4108 }
4109 }
4110 #endif
4111 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
4112 if (var1 == 0x01)
4113 {
4114 switch(var2)
4115 {
4116 case 0x00ul:
4117 return true;
4118 case 0x01ul:
4119 return true;
4120 case 0x02ul:
4121 return false;
4122 case 0x03ul:
4123 return true;
4124 case 0x04ul:
4125 return false;
4126 case 0x07ul:
4127 return false;
4128 case 0x08ul:
4129 return false;
4130 case 0x09ul:
4131 return false;
4132 case 0x0Aul:
4133 return false;
4134 case 0x0Bul:
4135 return false;
4136 case 0x0Cul:
4137 return false;
4138 case 0x0Dul:
4139 return false;
4140 default:
4141 return false;
4142 }
4143 }
4144 #endif
4145 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4146 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4147 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
4148 if (var1 == 0x01)
4149 {
4150 switch(var2)
4151 {
4152 case 0x00ul:
4153 return true;
4154 case 0x01ul:
4155 return true;
4156 case 0x02ul:
4157 return false;
4158 case 0x03ul:
4159 return true;
4160 case 0x04ul:
4161 return false;
4162 case 0x07ul:
4163 return false;
4164 case 0x08ul:
4165 return false;
4166 case 0x09ul:
4167 return false;
4168 case 0x0Aul:
4169 return false;
4170 case 0x0Bul:
4171 return false;
4172 case 0x0Cul:
4173 return false;
4174 case 0x0Dul:
4175 return false;
4176 default:
4177 return false;
4178 }
4179 }
4180 #endif
4181 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4182 if (var1 == 0x01)
4183 {
4184 switch(var2)
4185 {
4186 case 0x00ul:
4187 return true;
4188 case 0x01ul:
4189 return true;
4190 case 0x02ul:
4191 return false;
4192 case 0x03ul:
4193 return true;
4194 case 0x04ul:
4195 return false;
4196 case 0x07ul:
4197 return false;
4198 case 0x08ul:
4199 return false;
4200 case 0x09ul:
4201 return false;
4202 case 0x0Aul:
4203 return false;
4204 case 0x0Bul:
4205 return false;
4206 case 0x0Cul:
4207 return false;
4208 case 0x0Dul:
4209 return false;
4210 default:
4211 return false;
4212 }
4213 }
4214 #endif
4215 return false;
4216 #endif
4217 }
4218
4219 /* ========= Errata 22 ========= */
4220 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
4221 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
4222 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
4223 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
4224 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
4225 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
4226 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
4227 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
4228 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4229 #define NRF51_ERRATA_22_PRESENT 1
4230 #else
4231 #define NRF51_ERRATA_22_PRESENT 0
4232 #endif
4233
4234 #ifndef NRF51_ERRATA_22_ENABLE_WORKAROUND
4235 #define NRF51_ERRATA_22_ENABLE_WORKAROUND NRF51_ERRATA_22_PRESENT
4236 #endif
4237
nrf51_errata_22(void)4238 static bool nrf51_errata_22(void)
4239 {
4240 #ifndef NRF51_SERIES
4241 return false;
4242 #else
4243 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4244 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4245 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
4246 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
4247 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
4248 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4249 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4250 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
4251 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4252 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
4253 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
4254 #endif
4255 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4256 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4257 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
4258 if (var1 == 0x01)
4259 {
4260 switch(var2)
4261 {
4262 case 0x00ul:
4263 return true;
4264 case 0x01ul:
4265 return true;
4266 case 0x02ul:
4267 return false;
4268 case 0x03ul:
4269 return true;
4270 case 0x04ul:
4271 return false;
4272 case 0x07ul:
4273 return false;
4274 case 0x08ul:
4275 return false;
4276 case 0x09ul:
4277 return false;
4278 case 0x0Aul:
4279 return false;
4280 case 0x0Bul:
4281 return false;
4282 case 0x0Cul:
4283 return false;
4284 case 0x0Dul:
4285 return false;
4286 default:
4287 return false;
4288 }
4289 }
4290 #endif
4291 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
4292 if (var1 == 0x01)
4293 {
4294 switch(var2)
4295 {
4296 case 0x00ul:
4297 return true;
4298 case 0x01ul:
4299 return true;
4300 case 0x02ul:
4301 return false;
4302 case 0x03ul:
4303 return true;
4304 case 0x04ul:
4305 return false;
4306 case 0x07ul:
4307 return false;
4308 case 0x08ul:
4309 return false;
4310 case 0x09ul:
4311 return false;
4312 case 0x0Aul:
4313 return false;
4314 case 0x0Bul:
4315 return false;
4316 case 0x0Cul:
4317 return false;
4318 case 0x0Dul:
4319 return false;
4320 default:
4321 return false;
4322 }
4323 }
4324 #endif
4325 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
4326 if (var1 == 0x01)
4327 {
4328 switch(var2)
4329 {
4330 case 0x00ul:
4331 return true;
4332 case 0x01ul:
4333 return true;
4334 case 0x02ul:
4335 return false;
4336 case 0x03ul:
4337 return true;
4338 case 0x04ul:
4339 return false;
4340 case 0x07ul:
4341 return false;
4342 case 0x08ul:
4343 return false;
4344 case 0x09ul:
4345 return false;
4346 case 0x0Aul:
4347 return false;
4348 case 0x0Bul:
4349 return false;
4350 case 0x0Cul:
4351 return false;
4352 case 0x0Dul:
4353 return false;
4354 default:
4355 return false;
4356 }
4357 }
4358 #endif
4359 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4360 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4361 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
4362 if (var1 == 0x01)
4363 {
4364 switch(var2)
4365 {
4366 case 0x00ul:
4367 return true;
4368 case 0x01ul:
4369 return true;
4370 case 0x02ul:
4371 return false;
4372 case 0x03ul:
4373 return true;
4374 case 0x04ul:
4375 return false;
4376 case 0x07ul:
4377 return false;
4378 case 0x08ul:
4379 return false;
4380 case 0x09ul:
4381 return false;
4382 case 0x0Aul:
4383 return false;
4384 case 0x0Bul:
4385 return false;
4386 case 0x0Cul:
4387 return false;
4388 case 0x0Dul:
4389 return false;
4390 default:
4391 return false;
4392 }
4393 }
4394 #endif
4395 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4396 if (var1 == 0x01)
4397 {
4398 switch(var2)
4399 {
4400 case 0x00ul:
4401 return true;
4402 case 0x01ul:
4403 return true;
4404 case 0x02ul:
4405 return false;
4406 case 0x03ul:
4407 return true;
4408 case 0x04ul:
4409 return false;
4410 case 0x07ul:
4411 return false;
4412 case 0x08ul:
4413 return false;
4414 case 0x09ul:
4415 return false;
4416 case 0x0Aul:
4417 return false;
4418 case 0x0Bul:
4419 return false;
4420 case 0x0Cul:
4421 return false;
4422 case 0x0Dul:
4423 return false;
4424 default:
4425 return false;
4426 }
4427 }
4428 #endif
4429 return false;
4430 #endif
4431 }
4432
4433 /* ========= Errata 23 ========= */
4434 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
4435 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
4436 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
4437 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
4438 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
4439 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
4440 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
4441 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
4442 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4443 #define NRF51_ERRATA_23_PRESENT 1
4444 #else
4445 #define NRF51_ERRATA_23_PRESENT 0
4446 #endif
4447
4448 #ifndef NRF51_ERRATA_23_ENABLE_WORKAROUND
4449 #define NRF51_ERRATA_23_ENABLE_WORKAROUND NRF51_ERRATA_23_PRESENT
4450 #endif
4451
nrf51_errata_23(void)4452 static bool nrf51_errata_23(void)
4453 {
4454 #ifndef NRF51_SERIES
4455 return false;
4456 #else
4457 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4458 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4459 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
4460 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
4461 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
4462 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4463 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4464 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
4465 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4466 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
4467 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
4468 #endif
4469 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4470 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4471 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
4472 if (var1 == 0x01)
4473 {
4474 switch(var2)
4475 {
4476 case 0x00ul:
4477 return true;
4478 case 0x01ul:
4479 return true;
4480 case 0x02ul:
4481 return false;
4482 case 0x03ul:
4483 return true;
4484 case 0x04ul:
4485 return false;
4486 case 0x07ul:
4487 return false;
4488 case 0x08ul:
4489 return false;
4490 case 0x09ul:
4491 return false;
4492 case 0x0Aul:
4493 return false;
4494 case 0x0Bul:
4495 return false;
4496 case 0x0Cul:
4497 return false;
4498 case 0x0Dul:
4499 return false;
4500 default:
4501 return false;
4502 }
4503 }
4504 #endif
4505 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
4506 if (var1 == 0x01)
4507 {
4508 switch(var2)
4509 {
4510 case 0x00ul:
4511 return true;
4512 case 0x01ul:
4513 return true;
4514 case 0x02ul:
4515 return false;
4516 case 0x03ul:
4517 return true;
4518 case 0x04ul:
4519 return false;
4520 case 0x07ul:
4521 return false;
4522 case 0x08ul:
4523 return false;
4524 case 0x09ul:
4525 return false;
4526 case 0x0Aul:
4527 return false;
4528 case 0x0Bul:
4529 return false;
4530 case 0x0Cul:
4531 return false;
4532 case 0x0Dul:
4533 return false;
4534 default:
4535 return false;
4536 }
4537 }
4538 #endif
4539 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
4540 if (var1 == 0x01)
4541 {
4542 switch(var2)
4543 {
4544 case 0x00ul:
4545 return true;
4546 case 0x01ul:
4547 return true;
4548 case 0x02ul:
4549 return false;
4550 case 0x03ul:
4551 return true;
4552 case 0x04ul:
4553 return false;
4554 case 0x07ul:
4555 return false;
4556 case 0x08ul:
4557 return false;
4558 case 0x09ul:
4559 return false;
4560 case 0x0Aul:
4561 return false;
4562 case 0x0Bul:
4563 return false;
4564 case 0x0Cul:
4565 return false;
4566 case 0x0Dul:
4567 return false;
4568 default:
4569 return false;
4570 }
4571 }
4572 #endif
4573 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4574 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4575 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
4576 if (var1 == 0x01)
4577 {
4578 switch(var2)
4579 {
4580 case 0x00ul:
4581 return true;
4582 case 0x01ul:
4583 return true;
4584 case 0x02ul:
4585 return false;
4586 case 0x03ul:
4587 return true;
4588 case 0x04ul:
4589 return false;
4590 case 0x07ul:
4591 return false;
4592 case 0x08ul:
4593 return false;
4594 case 0x09ul:
4595 return false;
4596 case 0x0Aul:
4597 return false;
4598 case 0x0Bul:
4599 return false;
4600 case 0x0Cul:
4601 return false;
4602 case 0x0Dul:
4603 return false;
4604 default:
4605 return false;
4606 }
4607 }
4608 #endif
4609 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4610 if (var1 == 0x01)
4611 {
4612 switch(var2)
4613 {
4614 case 0x00ul:
4615 return true;
4616 case 0x01ul:
4617 return true;
4618 case 0x02ul:
4619 return false;
4620 case 0x03ul:
4621 return true;
4622 case 0x04ul:
4623 return false;
4624 case 0x07ul:
4625 return false;
4626 case 0x08ul:
4627 return false;
4628 case 0x09ul:
4629 return false;
4630 case 0x0Aul:
4631 return false;
4632 case 0x0Bul:
4633 return false;
4634 case 0x0Cul:
4635 return false;
4636 case 0x0Dul:
4637 return false;
4638 default:
4639 return false;
4640 }
4641 }
4642 #endif
4643 return false;
4644 #endif
4645 }
4646
4647 /* ========= Errata 24 ========= */
4648 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
4649 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
4650 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
4651 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
4652 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
4653 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
4654 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
4655 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
4656 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4657 #define NRF51_ERRATA_24_PRESENT 1
4658 #else
4659 #define NRF51_ERRATA_24_PRESENT 0
4660 #endif
4661
4662 #ifndef NRF51_ERRATA_24_ENABLE_WORKAROUND
4663 #define NRF51_ERRATA_24_ENABLE_WORKAROUND NRF51_ERRATA_24_PRESENT
4664 #endif
4665
nrf51_errata_24(void)4666 static bool nrf51_errata_24(void)
4667 {
4668 #ifndef NRF51_SERIES
4669 return false;
4670 #else
4671 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4672 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4673 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
4674 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
4675 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
4676 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4677 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4678 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
4679 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4680 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
4681 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
4682 #endif
4683 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4684 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4685 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
4686 if (var1 == 0x01)
4687 {
4688 switch(var2)
4689 {
4690 case 0x00ul:
4691 return true;
4692 case 0x01ul:
4693 return true;
4694 case 0x02ul:
4695 return false;
4696 case 0x03ul:
4697 return true;
4698 case 0x04ul:
4699 return false;
4700 case 0x07ul:
4701 return false;
4702 case 0x08ul:
4703 return false;
4704 case 0x09ul:
4705 return false;
4706 case 0x0Aul:
4707 return false;
4708 case 0x0Bul:
4709 return false;
4710 case 0x0Cul:
4711 return false;
4712 case 0x0Dul:
4713 return false;
4714 default:
4715 return false;
4716 }
4717 }
4718 #endif
4719 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
4720 if (var1 == 0x01)
4721 {
4722 switch(var2)
4723 {
4724 case 0x00ul:
4725 return true;
4726 case 0x01ul:
4727 return true;
4728 case 0x02ul:
4729 return false;
4730 case 0x03ul:
4731 return true;
4732 case 0x04ul:
4733 return false;
4734 case 0x07ul:
4735 return false;
4736 case 0x08ul:
4737 return false;
4738 case 0x09ul:
4739 return false;
4740 case 0x0Aul:
4741 return false;
4742 case 0x0Bul:
4743 return false;
4744 case 0x0Cul:
4745 return false;
4746 case 0x0Dul:
4747 return false;
4748 default:
4749 return false;
4750 }
4751 }
4752 #endif
4753 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
4754 if (var1 == 0x01)
4755 {
4756 switch(var2)
4757 {
4758 case 0x00ul:
4759 return true;
4760 case 0x01ul:
4761 return true;
4762 case 0x02ul:
4763 return false;
4764 case 0x03ul:
4765 return true;
4766 case 0x04ul:
4767 return false;
4768 case 0x07ul:
4769 return false;
4770 case 0x08ul:
4771 return false;
4772 case 0x09ul:
4773 return false;
4774 case 0x0Aul:
4775 return false;
4776 case 0x0Bul:
4777 return false;
4778 case 0x0Cul:
4779 return false;
4780 case 0x0Dul:
4781 return false;
4782 default:
4783 return false;
4784 }
4785 }
4786 #endif
4787 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4788 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4789 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
4790 if (var1 == 0x01)
4791 {
4792 switch(var2)
4793 {
4794 case 0x00ul:
4795 return true;
4796 case 0x01ul:
4797 return true;
4798 case 0x02ul:
4799 return false;
4800 case 0x03ul:
4801 return true;
4802 case 0x04ul:
4803 return false;
4804 case 0x07ul:
4805 return false;
4806 case 0x08ul:
4807 return false;
4808 case 0x09ul:
4809 return false;
4810 case 0x0Aul:
4811 return false;
4812 case 0x0Bul:
4813 return false;
4814 case 0x0Cul:
4815 return false;
4816 case 0x0Dul:
4817 return false;
4818 default:
4819 return false;
4820 }
4821 }
4822 #endif
4823 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4824 if (var1 == 0x01)
4825 {
4826 switch(var2)
4827 {
4828 case 0x00ul:
4829 return true;
4830 case 0x01ul:
4831 return true;
4832 case 0x02ul:
4833 return false;
4834 case 0x03ul:
4835 return true;
4836 case 0x04ul:
4837 return false;
4838 case 0x07ul:
4839 return false;
4840 case 0x08ul:
4841 return false;
4842 case 0x09ul:
4843 return false;
4844 case 0x0Aul:
4845 return false;
4846 case 0x0Bul:
4847 return false;
4848 case 0x0Cul:
4849 return false;
4850 case 0x0Dul:
4851 return false;
4852 default:
4853 return false;
4854 }
4855 }
4856 #endif
4857 return false;
4858 #endif
4859 }
4860
4861 /* ========= Errata 25 ========= */
4862 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
4863 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
4864 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
4865 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
4866 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
4867 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
4868 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
4869 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
4870 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4871 #define NRF51_ERRATA_25_PRESENT 1
4872 #else
4873 #define NRF51_ERRATA_25_PRESENT 0
4874 #endif
4875
4876 #ifndef NRF51_ERRATA_25_ENABLE_WORKAROUND
4877 #define NRF51_ERRATA_25_ENABLE_WORKAROUND NRF51_ERRATA_25_PRESENT
4878 #endif
4879
nrf51_errata_25(void)4880 static bool nrf51_errata_25(void)
4881 {
4882 #ifndef NRF51_SERIES
4883 return false;
4884 #else
4885 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4886 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4887 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
4888 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
4889 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
4890 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
4891 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
4892 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
4893 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
4894 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
4895 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
4896 #endif
4897 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
4898 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
4899 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
4900 if (var1 == 0x01)
4901 {
4902 switch(var2)
4903 {
4904 case 0x00ul:
4905 return true;
4906 case 0x01ul:
4907 return true;
4908 case 0x02ul:
4909 return false;
4910 case 0x03ul:
4911 return true;
4912 case 0x04ul:
4913 return false;
4914 case 0x07ul:
4915 return false;
4916 case 0x08ul:
4917 return false;
4918 case 0x09ul:
4919 return false;
4920 case 0x0Aul:
4921 return false;
4922 case 0x0Bul:
4923 return false;
4924 case 0x0Cul:
4925 return false;
4926 case 0x0Dul:
4927 return false;
4928 default:
4929 return false;
4930 }
4931 }
4932 #endif
4933 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
4934 if (var1 == 0x01)
4935 {
4936 switch(var2)
4937 {
4938 case 0x00ul:
4939 return true;
4940 case 0x01ul:
4941 return true;
4942 case 0x02ul:
4943 return false;
4944 case 0x03ul:
4945 return true;
4946 case 0x04ul:
4947 return false;
4948 case 0x07ul:
4949 return false;
4950 case 0x08ul:
4951 return false;
4952 case 0x09ul:
4953 return false;
4954 case 0x0Aul:
4955 return false;
4956 case 0x0Bul:
4957 return false;
4958 case 0x0Cul:
4959 return false;
4960 case 0x0Dul:
4961 return false;
4962 default:
4963 return false;
4964 }
4965 }
4966 #endif
4967 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
4968 if (var1 == 0x01)
4969 {
4970 switch(var2)
4971 {
4972 case 0x00ul:
4973 return true;
4974 case 0x01ul:
4975 return true;
4976 case 0x02ul:
4977 return false;
4978 case 0x03ul:
4979 return true;
4980 case 0x04ul:
4981 return false;
4982 case 0x07ul:
4983 return false;
4984 case 0x08ul:
4985 return false;
4986 case 0x09ul:
4987 return false;
4988 case 0x0Aul:
4989 return false;
4990 case 0x0Bul:
4991 return false;
4992 case 0x0Cul:
4993 return false;
4994 case 0x0Dul:
4995 return false;
4996 default:
4997 return false;
4998 }
4999 }
5000 #endif
5001 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5002 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5003 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
5004 if (var1 == 0x01)
5005 {
5006 switch(var2)
5007 {
5008 case 0x00ul:
5009 return true;
5010 case 0x01ul:
5011 return true;
5012 case 0x02ul:
5013 return false;
5014 case 0x03ul:
5015 return true;
5016 case 0x04ul:
5017 return false;
5018 case 0x07ul:
5019 return false;
5020 case 0x08ul:
5021 return false;
5022 case 0x09ul:
5023 return false;
5024 case 0x0Aul:
5025 return false;
5026 case 0x0Bul:
5027 return false;
5028 case 0x0Cul:
5029 return false;
5030 case 0x0Dul:
5031 return false;
5032 default:
5033 return false;
5034 }
5035 }
5036 #endif
5037 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5038 if (var1 == 0x01)
5039 {
5040 switch(var2)
5041 {
5042 case 0x00ul:
5043 return true;
5044 case 0x01ul:
5045 return true;
5046 case 0x02ul:
5047 return false;
5048 case 0x03ul:
5049 return true;
5050 case 0x04ul:
5051 return false;
5052 case 0x07ul:
5053 return false;
5054 case 0x08ul:
5055 return false;
5056 case 0x09ul:
5057 return false;
5058 case 0x0Aul:
5059 return false;
5060 case 0x0Bul:
5061 return false;
5062 case 0x0Cul:
5063 return false;
5064 case 0x0Dul:
5065 return false;
5066 default:
5067 return false;
5068 }
5069 }
5070 #endif
5071 return false;
5072 #endif
5073 }
5074
5075 /* ========= Errata 26 ========= */
5076 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
5077 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
5078 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
5079 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
5080 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
5081 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
5082 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
5083 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
5084 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5085 #define NRF51_ERRATA_26_PRESENT 1
5086 #else
5087 #define NRF51_ERRATA_26_PRESENT 0
5088 #endif
5089
5090 #ifndef NRF51_ERRATA_26_ENABLE_WORKAROUND
5091 #define NRF51_ERRATA_26_ENABLE_WORKAROUND NRF51_ERRATA_26_PRESENT
5092 #endif
5093
nrf51_errata_26(void)5094 static bool nrf51_errata_26(void)
5095 {
5096 #ifndef NRF51_SERIES
5097 return false;
5098 #else
5099 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5100 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5101 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
5102 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
5103 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
5104 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5105 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5106 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
5107 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5108 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
5109 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
5110 #endif
5111 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5112 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5113 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
5114 if (var1 == 0x01)
5115 {
5116 switch(var2)
5117 {
5118 case 0x00ul:
5119 return true;
5120 case 0x01ul:
5121 return true;
5122 case 0x02ul:
5123 return false;
5124 case 0x03ul:
5125 return true;
5126 case 0x04ul:
5127 return false;
5128 case 0x07ul:
5129 return false;
5130 case 0x08ul:
5131 return false;
5132 case 0x09ul:
5133 return false;
5134 case 0x0Aul:
5135 return false;
5136 case 0x0Bul:
5137 return false;
5138 case 0x0Cul:
5139 return false;
5140 case 0x0Dul:
5141 return false;
5142 default:
5143 return false;
5144 }
5145 }
5146 #endif
5147 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
5148 if (var1 == 0x01)
5149 {
5150 switch(var2)
5151 {
5152 case 0x00ul:
5153 return true;
5154 case 0x01ul:
5155 return true;
5156 case 0x02ul:
5157 return false;
5158 case 0x03ul:
5159 return true;
5160 case 0x04ul:
5161 return false;
5162 case 0x07ul:
5163 return false;
5164 case 0x08ul:
5165 return false;
5166 case 0x09ul:
5167 return false;
5168 case 0x0Aul:
5169 return false;
5170 case 0x0Bul:
5171 return false;
5172 case 0x0Cul:
5173 return false;
5174 case 0x0Dul:
5175 return false;
5176 default:
5177 return false;
5178 }
5179 }
5180 #endif
5181 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
5182 if (var1 == 0x01)
5183 {
5184 switch(var2)
5185 {
5186 case 0x00ul:
5187 return true;
5188 case 0x01ul:
5189 return true;
5190 case 0x02ul:
5191 return false;
5192 case 0x03ul:
5193 return true;
5194 case 0x04ul:
5195 return false;
5196 case 0x07ul:
5197 return false;
5198 case 0x08ul:
5199 return false;
5200 case 0x09ul:
5201 return false;
5202 case 0x0Aul:
5203 return false;
5204 case 0x0Bul:
5205 return false;
5206 case 0x0Cul:
5207 return false;
5208 case 0x0Dul:
5209 return false;
5210 default:
5211 return false;
5212 }
5213 }
5214 #endif
5215 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5216 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5217 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
5218 if (var1 == 0x01)
5219 {
5220 switch(var2)
5221 {
5222 case 0x00ul:
5223 return true;
5224 case 0x01ul:
5225 return true;
5226 case 0x02ul:
5227 return false;
5228 case 0x03ul:
5229 return true;
5230 case 0x04ul:
5231 return false;
5232 case 0x07ul:
5233 return false;
5234 case 0x08ul:
5235 return false;
5236 case 0x09ul:
5237 return false;
5238 case 0x0Aul:
5239 return false;
5240 case 0x0Bul:
5241 return false;
5242 case 0x0Cul:
5243 return false;
5244 case 0x0Dul:
5245 return false;
5246 default:
5247 return false;
5248 }
5249 }
5250 #endif
5251 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5252 if (var1 == 0x01)
5253 {
5254 switch(var2)
5255 {
5256 case 0x00ul:
5257 return true;
5258 case 0x01ul:
5259 return true;
5260 case 0x02ul:
5261 return false;
5262 case 0x03ul:
5263 return true;
5264 case 0x04ul:
5265 return false;
5266 case 0x07ul:
5267 return false;
5268 case 0x08ul:
5269 return false;
5270 case 0x09ul:
5271 return false;
5272 case 0x0Aul:
5273 return false;
5274 case 0x0Bul:
5275 return false;
5276 case 0x0Cul:
5277 return false;
5278 case 0x0Dul:
5279 return false;
5280 default:
5281 return false;
5282 }
5283 }
5284 #endif
5285 return false;
5286 #endif
5287 }
5288
5289 /* ========= Errata 27 ========= */
5290 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
5291 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
5292 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
5293 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
5294 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
5295 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
5296 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
5297 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
5298 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5299 #define NRF51_ERRATA_27_PRESENT 1
5300 #else
5301 #define NRF51_ERRATA_27_PRESENT 0
5302 #endif
5303
5304 #ifndef NRF51_ERRATA_27_ENABLE_WORKAROUND
5305 #define NRF51_ERRATA_27_ENABLE_WORKAROUND NRF51_ERRATA_27_PRESENT
5306 #endif
5307
nrf51_errata_27(void)5308 static bool nrf51_errata_27(void)
5309 {
5310 #ifndef NRF51_SERIES
5311 return false;
5312 #else
5313 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5314 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5315 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
5316 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
5317 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
5318 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5319 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5320 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
5321 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5322 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
5323 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
5324 #endif
5325 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5326 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5327 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
5328 if (var1 == 0x01)
5329 {
5330 switch(var2)
5331 {
5332 case 0x00ul:
5333 return true;
5334 case 0x01ul:
5335 return true;
5336 case 0x02ul:
5337 return false;
5338 case 0x03ul:
5339 return true;
5340 case 0x04ul:
5341 return false;
5342 case 0x07ul:
5343 return false;
5344 case 0x08ul:
5345 return false;
5346 case 0x09ul:
5347 return false;
5348 case 0x0Aul:
5349 return false;
5350 case 0x0Bul:
5351 return false;
5352 case 0x0Cul:
5353 return false;
5354 case 0x0Dul:
5355 return false;
5356 default:
5357 return false;
5358 }
5359 }
5360 #endif
5361 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
5362 if (var1 == 0x01)
5363 {
5364 switch(var2)
5365 {
5366 case 0x00ul:
5367 return true;
5368 case 0x01ul:
5369 return true;
5370 case 0x02ul:
5371 return false;
5372 case 0x03ul:
5373 return true;
5374 case 0x04ul:
5375 return false;
5376 case 0x07ul:
5377 return false;
5378 case 0x08ul:
5379 return false;
5380 case 0x09ul:
5381 return false;
5382 case 0x0Aul:
5383 return false;
5384 case 0x0Bul:
5385 return false;
5386 case 0x0Cul:
5387 return false;
5388 case 0x0Dul:
5389 return false;
5390 default:
5391 return false;
5392 }
5393 }
5394 #endif
5395 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
5396 if (var1 == 0x01)
5397 {
5398 switch(var2)
5399 {
5400 case 0x00ul:
5401 return true;
5402 case 0x01ul:
5403 return true;
5404 case 0x02ul:
5405 return false;
5406 case 0x03ul:
5407 return true;
5408 case 0x04ul:
5409 return false;
5410 case 0x07ul:
5411 return false;
5412 case 0x08ul:
5413 return false;
5414 case 0x09ul:
5415 return false;
5416 case 0x0Aul:
5417 return false;
5418 case 0x0Bul:
5419 return false;
5420 case 0x0Cul:
5421 return false;
5422 case 0x0Dul:
5423 return false;
5424 default:
5425 return false;
5426 }
5427 }
5428 #endif
5429 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5430 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5431 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
5432 if (var1 == 0x01)
5433 {
5434 switch(var2)
5435 {
5436 case 0x00ul:
5437 return true;
5438 case 0x01ul:
5439 return true;
5440 case 0x02ul:
5441 return false;
5442 case 0x03ul:
5443 return true;
5444 case 0x04ul:
5445 return false;
5446 case 0x07ul:
5447 return false;
5448 case 0x08ul:
5449 return false;
5450 case 0x09ul:
5451 return false;
5452 case 0x0Aul:
5453 return false;
5454 case 0x0Bul:
5455 return false;
5456 case 0x0Cul:
5457 return false;
5458 case 0x0Dul:
5459 return false;
5460 default:
5461 return false;
5462 }
5463 }
5464 #endif
5465 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5466 if (var1 == 0x01)
5467 {
5468 switch(var2)
5469 {
5470 case 0x00ul:
5471 return true;
5472 case 0x01ul:
5473 return true;
5474 case 0x02ul:
5475 return false;
5476 case 0x03ul:
5477 return true;
5478 case 0x04ul:
5479 return false;
5480 case 0x07ul:
5481 return false;
5482 case 0x08ul:
5483 return false;
5484 case 0x09ul:
5485 return false;
5486 case 0x0Aul:
5487 return false;
5488 case 0x0Bul:
5489 return false;
5490 case 0x0Cul:
5491 return false;
5492 case 0x0Dul:
5493 return false;
5494 default:
5495 return false;
5496 }
5497 }
5498 #endif
5499 return false;
5500 #endif
5501 }
5502
5503 /* ========= Errata 28 ========= */
5504 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
5505 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
5506 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
5507 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
5508 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
5509 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
5510 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
5511 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
5512 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5513 #define NRF51_ERRATA_28_PRESENT 1
5514 #else
5515 #define NRF51_ERRATA_28_PRESENT 0
5516 #endif
5517
5518 #ifndef NRF51_ERRATA_28_ENABLE_WORKAROUND
5519 #define NRF51_ERRATA_28_ENABLE_WORKAROUND NRF51_ERRATA_28_PRESENT
5520 #endif
5521
nrf51_errata_28(void)5522 static bool nrf51_errata_28(void)
5523 {
5524 #ifndef NRF51_SERIES
5525 return false;
5526 #else
5527 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5528 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5529 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
5530 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
5531 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
5532 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5533 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5534 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
5535 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5536 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
5537 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
5538 #endif
5539 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5540 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5541 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
5542 if (var1 == 0x01)
5543 {
5544 switch(var2)
5545 {
5546 case 0x00ul:
5547 return true;
5548 case 0x01ul:
5549 return true;
5550 case 0x02ul:
5551 return false;
5552 case 0x03ul:
5553 return true;
5554 case 0x04ul:
5555 return false;
5556 case 0x07ul:
5557 return false;
5558 case 0x08ul:
5559 return false;
5560 case 0x09ul:
5561 return false;
5562 case 0x0Aul:
5563 return false;
5564 case 0x0Bul:
5565 return false;
5566 case 0x0Cul:
5567 return false;
5568 case 0x0Dul:
5569 return false;
5570 default:
5571 return false;
5572 }
5573 }
5574 #endif
5575 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
5576 if (var1 == 0x01)
5577 {
5578 switch(var2)
5579 {
5580 case 0x00ul:
5581 return true;
5582 case 0x01ul:
5583 return true;
5584 case 0x02ul:
5585 return false;
5586 case 0x03ul:
5587 return true;
5588 case 0x04ul:
5589 return false;
5590 case 0x07ul:
5591 return false;
5592 case 0x08ul:
5593 return false;
5594 case 0x09ul:
5595 return false;
5596 case 0x0Aul:
5597 return false;
5598 case 0x0Bul:
5599 return false;
5600 case 0x0Cul:
5601 return false;
5602 case 0x0Dul:
5603 return false;
5604 default:
5605 return false;
5606 }
5607 }
5608 #endif
5609 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
5610 if (var1 == 0x01)
5611 {
5612 switch(var2)
5613 {
5614 case 0x00ul:
5615 return true;
5616 case 0x01ul:
5617 return true;
5618 case 0x02ul:
5619 return false;
5620 case 0x03ul:
5621 return true;
5622 case 0x04ul:
5623 return false;
5624 case 0x07ul:
5625 return false;
5626 case 0x08ul:
5627 return false;
5628 case 0x09ul:
5629 return false;
5630 case 0x0Aul:
5631 return false;
5632 case 0x0Bul:
5633 return false;
5634 case 0x0Cul:
5635 return false;
5636 case 0x0Dul:
5637 return false;
5638 default:
5639 return false;
5640 }
5641 }
5642 #endif
5643 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5644 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5645 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
5646 if (var1 == 0x01)
5647 {
5648 switch(var2)
5649 {
5650 case 0x00ul:
5651 return true;
5652 case 0x01ul:
5653 return true;
5654 case 0x02ul:
5655 return false;
5656 case 0x03ul:
5657 return true;
5658 case 0x04ul:
5659 return false;
5660 case 0x07ul:
5661 return false;
5662 case 0x08ul:
5663 return false;
5664 case 0x09ul:
5665 return false;
5666 case 0x0Aul:
5667 return false;
5668 case 0x0Bul:
5669 return false;
5670 case 0x0Cul:
5671 return false;
5672 case 0x0Dul:
5673 return false;
5674 default:
5675 return false;
5676 }
5677 }
5678 #endif
5679 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5680 if (var1 == 0x01)
5681 {
5682 switch(var2)
5683 {
5684 case 0x00ul:
5685 return true;
5686 case 0x01ul:
5687 return true;
5688 case 0x02ul:
5689 return false;
5690 case 0x03ul:
5691 return true;
5692 case 0x04ul:
5693 return false;
5694 case 0x07ul:
5695 return false;
5696 case 0x08ul:
5697 return false;
5698 case 0x09ul:
5699 return false;
5700 case 0x0Aul:
5701 return false;
5702 case 0x0Bul:
5703 return false;
5704 case 0x0Cul:
5705 return false;
5706 case 0x0Dul:
5707 return false;
5708 default:
5709 return false;
5710 }
5711 }
5712 #endif
5713 return false;
5714 #endif
5715 }
5716
5717 /* ========= Errata 29 ========= */
5718 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
5719 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
5720 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
5721 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
5722 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
5723 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
5724 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
5725 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
5726 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5727 #define NRF51_ERRATA_29_PRESENT 1
5728 #else
5729 #define NRF51_ERRATA_29_PRESENT 0
5730 #endif
5731
5732 #ifndef NRF51_ERRATA_29_ENABLE_WORKAROUND
5733 #define NRF51_ERRATA_29_ENABLE_WORKAROUND NRF51_ERRATA_29_PRESENT
5734 #endif
5735
nrf51_errata_29(void)5736 static bool nrf51_errata_29(void)
5737 {
5738 #ifndef NRF51_SERIES
5739 return false;
5740 #else
5741 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5742 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5743 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
5744 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
5745 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
5746 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5747 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5748 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
5749 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5750 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
5751 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
5752 #endif
5753 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5754 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5755 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
5756 if (var1 == 0x01)
5757 {
5758 switch(var2)
5759 {
5760 case 0x00ul:
5761 return true;
5762 case 0x01ul:
5763 return true;
5764 case 0x02ul:
5765 return false;
5766 case 0x03ul:
5767 return true;
5768 case 0x04ul:
5769 return false;
5770 case 0x07ul:
5771 return false;
5772 case 0x08ul:
5773 return false;
5774 case 0x09ul:
5775 return false;
5776 case 0x0Aul:
5777 return false;
5778 case 0x0Bul:
5779 return false;
5780 case 0x0Cul:
5781 return false;
5782 case 0x0Dul:
5783 return false;
5784 default:
5785 return false;
5786 }
5787 }
5788 #endif
5789 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
5790 if (var1 == 0x01)
5791 {
5792 switch(var2)
5793 {
5794 case 0x00ul:
5795 return true;
5796 case 0x01ul:
5797 return true;
5798 case 0x02ul:
5799 return false;
5800 case 0x03ul:
5801 return true;
5802 case 0x04ul:
5803 return false;
5804 case 0x07ul:
5805 return false;
5806 case 0x08ul:
5807 return false;
5808 case 0x09ul:
5809 return false;
5810 case 0x0Aul:
5811 return false;
5812 case 0x0Bul:
5813 return false;
5814 case 0x0Cul:
5815 return false;
5816 case 0x0Dul:
5817 return false;
5818 default:
5819 return false;
5820 }
5821 }
5822 #endif
5823 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
5824 if (var1 == 0x01)
5825 {
5826 switch(var2)
5827 {
5828 case 0x00ul:
5829 return true;
5830 case 0x01ul:
5831 return true;
5832 case 0x02ul:
5833 return false;
5834 case 0x03ul:
5835 return true;
5836 case 0x04ul:
5837 return false;
5838 case 0x07ul:
5839 return false;
5840 case 0x08ul:
5841 return false;
5842 case 0x09ul:
5843 return false;
5844 case 0x0Aul:
5845 return false;
5846 case 0x0Bul:
5847 return false;
5848 case 0x0Cul:
5849 return false;
5850 case 0x0Dul:
5851 return false;
5852 default:
5853 return false;
5854 }
5855 }
5856 #endif
5857 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5858 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5859 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
5860 if (var1 == 0x01)
5861 {
5862 switch(var2)
5863 {
5864 case 0x00ul:
5865 return true;
5866 case 0x01ul:
5867 return true;
5868 case 0x02ul:
5869 return false;
5870 case 0x03ul:
5871 return true;
5872 case 0x04ul:
5873 return false;
5874 case 0x07ul:
5875 return false;
5876 case 0x08ul:
5877 return false;
5878 case 0x09ul:
5879 return false;
5880 case 0x0Aul:
5881 return false;
5882 case 0x0Bul:
5883 return false;
5884 case 0x0Cul:
5885 return false;
5886 case 0x0Dul:
5887 return false;
5888 default:
5889 return false;
5890 }
5891 }
5892 #endif
5893 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5894 if (var1 == 0x01)
5895 {
5896 switch(var2)
5897 {
5898 case 0x00ul:
5899 return true;
5900 case 0x01ul:
5901 return true;
5902 case 0x02ul:
5903 return false;
5904 case 0x03ul:
5905 return true;
5906 case 0x04ul:
5907 return false;
5908 case 0x07ul:
5909 return false;
5910 case 0x08ul:
5911 return false;
5912 case 0x09ul:
5913 return false;
5914 case 0x0Aul:
5915 return false;
5916 case 0x0Bul:
5917 return false;
5918 case 0x0Cul:
5919 return false;
5920 case 0x0Dul:
5921 return false;
5922 default:
5923 return false;
5924 }
5925 }
5926 #endif
5927 return false;
5928 #endif
5929 }
5930
5931 /* ========= Errata 30 ========= */
5932 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
5933 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
5934 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
5935 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
5936 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
5937 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
5938 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
5939 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
5940 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5941 #define NRF51_ERRATA_30_PRESENT 1
5942 #else
5943 #define NRF51_ERRATA_30_PRESENT 0
5944 #endif
5945
5946 #ifndef NRF51_ERRATA_30_ENABLE_WORKAROUND
5947 #define NRF51_ERRATA_30_ENABLE_WORKAROUND NRF51_ERRATA_30_PRESENT
5948 #endif
5949
nrf51_errata_30(void)5950 static bool nrf51_errata_30(void)
5951 {
5952 #ifndef NRF51_SERIES
5953 return false;
5954 #else
5955 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5956 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5957 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
5958 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
5959 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
5960 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
5961 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
5962 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
5963 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
5964 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
5965 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
5966 #endif
5967 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
5968 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
5969 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
5970 if (var1 == 0x01)
5971 {
5972 switch(var2)
5973 {
5974 case 0x00ul:
5975 return true;
5976 case 0x01ul:
5977 return true;
5978 case 0x02ul:
5979 return false;
5980 case 0x03ul:
5981 return true;
5982 case 0x04ul:
5983 return false;
5984 case 0x07ul:
5985 return false;
5986 case 0x08ul:
5987 return false;
5988 case 0x09ul:
5989 return false;
5990 case 0x0Aul:
5991 return false;
5992 case 0x0Bul:
5993 return false;
5994 case 0x0Cul:
5995 return false;
5996 case 0x0Dul:
5997 return false;
5998 default:
5999 return false;
6000 }
6001 }
6002 #endif
6003 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
6004 if (var1 == 0x01)
6005 {
6006 switch(var2)
6007 {
6008 case 0x00ul:
6009 return true;
6010 case 0x01ul:
6011 return true;
6012 case 0x02ul:
6013 return false;
6014 case 0x03ul:
6015 return true;
6016 case 0x04ul:
6017 return false;
6018 case 0x07ul:
6019 return false;
6020 case 0x08ul:
6021 return false;
6022 case 0x09ul:
6023 return false;
6024 case 0x0Aul:
6025 return false;
6026 case 0x0Bul:
6027 return false;
6028 case 0x0Cul:
6029 return false;
6030 case 0x0Dul:
6031 return false;
6032 default:
6033 return false;
6034 }
6035 }
6036 #endif
6037 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
6038 if (var1 == 0x01)
6039 {
6040 switch(var2)
6041 {
6042 case 0x00ul:
6043 return true;
6044 case 0x01ul:
6045 return true;
6046 case 0x02ul:
6047 return false;
6048 case 0x03ul:
6049 return true;
6050 case 0x04ul:
6051 return false;
6052 case 0x07ul:
6053 return false;
6054 case 0x08ul:
6055 return false;
6056 case 0x09ul:
6057 return false;
6058 case 0x0Aul:
6059 return false;
6060 case 0x0Bul:
6061 return false;
6062 case 0x0Cul:
6063 return false;
6064 case 0x0Dul:
6065 return false;
6066 default:
6067 return false;
6068 }
6069 }
6070 #endif
6071 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6072 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6073 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
6074 if (var1 == 0x01)
6075 {
6076 switch(var2)
6077 {
6078 case 0x00ul:
6079 return true;
6080 case 0x01ul:
6081 return true;
6082 case 0x02ul:
6083 return false;
6084 case 0x03ul:
6085 return true;
6086 case 0x04ul:
6087 return false;
6088 case 0x07ul:
6089 return false;
6090 case 0x08ul:
6091 return false;
6092 case 0x09ul:
6093 return false;
6094 case 0x0Aul:
6095 return false;
6096 case 0x0Bul:
6097 return false;
6098 case 0x0Cul:
6099 return false;
6100 case 0x0Dul:
6101 return false;
6102 default:
6103 return false;
6104 }
6105 }
6106 #endif
6107 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6108 if (var1 == 0x01)
6109 {
6110 switch(var2)
6111 {
6112 case 0x00ul:
6113 return true;
6114 case 0x01ul:
6115 return true;
6116 case 0x02ul:
6117 return false;
6118 case 0x03ul:
6119 return true;
6120 case 0x04ul:
6121 return false;
6122 case 0x07ul:
6123 return false;
6124 case 0x08ul:
6125 return false;
6126 case 0x09ul:
6127 return false;
6128 case 0x0Aul:
6129 return false;
6130 case 0x0Bul:
6131 return false;
6132 case 0x0Cul:
6133 return false;
6134 case 0x0Dul:
6135 return false;
6136 default:
6137 return false;
6138 }
6139 }
6140 #endif
6141 return false;
6142 #endif
6143 }
6144
6145 /* ========= Errata 31 ========= */
6146 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
6147 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
6148 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
6149 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
6150 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
6151 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
6152 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
6153 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
6154 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6155 #define NRF51_ERRATA_31_PRESENT 1
6156 #else
6157 #define NRF51_ERRATA_31_PRESENT 0
6158 #endif
6159
6160 #ifndef NRF51_ERRATA_31_ENABLE_WORKAROUND
6161 #define NRF51_ERRATA_31_ENABLE_WORKAROUND NRF51_ERRATA_31_PRESENT
6162 #endif
6163
nrf51_errata_31(void)6164 static bool nrf51_errata_31(void)
6165 {
6166 #ifndef NRF51_SERIES
6167 return false;
6168 #else
6169 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6170 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6171 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
6172 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
6173 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
6174 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6175 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6176 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
6177 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6178 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
6179 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
6180 #endif
6181 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6182 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6183 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
6184 if (var1 == 0x01)
6185 {
6186 switch(var2)
6187 {
6188 case 0x00ul:
6189 return true;
6190 case 0x01ul:
6191 return true;
6192 case 0x02ul:
6193 return false;
6194 case 0x03ul:
6195 return true;
6196 case 0x04ul:
6197 return false;
6198 case 0x07ul:
6199 return false;
6200 case 0x08ul:
6201 return false;
6202 case 0x09ul:
6203 return false;
6204 case 0x0Aul:
6205 return false;
6206 case 0x0Bul:
6207 return false;
6208 case 0x0Cul:
6209 return false;
6210 case 0x0Dul:
6211 return false;
6212 default:
6213 return false;
6214 }
6215 }
6216 #endif
6217 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
6218 if (var1 == 0x01)
6219 {
6220 switch(var2)
6221 {
6222 case 0x00ul:
6223 return true;
6224 case 0x01ul:
6225 return true;
6226 case 0x02ul:
6227 return false;
6228 case 0x03ul:
6229 return true;
6230 case 0x04ul:
6231 return false;
6232 case 0x07ul:
6233 return false;
6234 case 0x08ul:
6235 return false;
6236 case 0x09ul:
6237 return false;
6238 case 0x0Aul:
6239 return false;
6240 case 0x0Bul:
6241 return false;
6242 case 0x0Cul:
6243 return false;
6244 case 0x0Dul:
6245 return false;
6246 default:
6247 return false;
6248 }
6249 }
6250 #endif
6251 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
6252 if (var1 == 0x01)
6253 {
6254 switch(var2)
6255 {
6256 case 0x00ul:
6257 return true;
6258 case 0x01ul:
6259 return true;
6260 case 0x02ul:
6261 return false;
6262 case 0x03ul:
6263 return true;
6264 case 0x04ul:
6265 return false;
6266 case 0x07ul:
6267 return false;
6268 case 0x08ul:
6269 return false;
6270 case 0x09ul:
6271 return false;
6272 case 0x0Aul:
6273 return false;
6274 case 0x0Bul:
6275 return false;
6276 case 0x0Cul:
6277 return false;
6278 case 0x0Dul:
6279 return false;
6280 default:
6281 return false;
6282 }
6283 }
6284 #endif
6285 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6286 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6287 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
6288 if (var1 == 0x01)
6289 {
6290 switch(var2)
6291 {
6292 case 0x00ul:
6293 return true;
6294 case 0x01ul:
6295 return true;
6296 case 0x02ul:
6297 return false;
6298 case 0x03ul:
6299 return true;
6300 case 0x04ul:
6301 return false;
6302 case 0x07ul:
6303 return false;
6304 case 0x08ul:
6305 return false;
6306 case 0x09ul:
6307 return false;
6308 case 0x0Aul:
6309 return false;
6310 case 0x0Bul:
6311 return false;
6312 case 0x0Cul:
6313 return false;
6314 case 0x0Dul:
6315 return false;
6316 default:
6317 return false;
6318 }
6319 }
6320 #endif
6321 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6322 if (var1 == 0x01)
6323 {
6324 switch(var2)
6325 {
6326 case 0x00ul:
6327 return true;
6328 case 0x01ul:
6329 return true;
6330 case 0x02ul:
6331 return false;
6332 case 0x03ul:
6333 return true;
6334 case 0x04ul:
6335 return false;
6336 case 0x07ul:
6337 return false;
6338 case 0x08ul:
6339 return false;
6340 case 0x09ul:
6341 return false;
6342 case 0x0Aul:
6343 return false;
6344 case 0x0Bul:
6345 return false;
6346 case 0x0Cul:
6347 return false;
6348 case 0x0Dul:
6349 return false;
6350 default:
6351 return false;
6352 }
6353 }
6354 #endif
6355 return false;
6356 #endif
6357 }
6358
6359 /* ========= Errata 32 ========= */
6360 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
6361 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
6362 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
6363 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
6364 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
6365 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
6366 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
6367 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
6368 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6369 #define NRF51_ERRATA_32_PRESENT 1
6370 #else
6371 #define NRF51_ERRATA_32_PRESENT 0
6372 #endif
6373
6374 #ifndef NRF51_ERRATA_32_ENABLE_WORKAROUND
6375 #define NRF51_ERRATA_32_ENABLE_WORKAROUND NRF51_ERRATA_32_PRESENT
6376 #endif
6377
nrf51_errata_32(void)6378 static bool nrf51_errata_32(void)
6379 {
6380 #ifndef NRF51_SERIES
6381 return false;
6382 #else
6383 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6384 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6385 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
6386 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
6387 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
6388 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6389 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6390 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
6391 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6392 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
6393 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
6394 #endif
6395 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6396 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6397 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
6398 if (var1 == 0x01)
6399 {
6400 switch(var2)
6401 {
6402 case 0x00ul:
6403 return true;
6404 case 0x01ul:
6405 return true;
6406 case 0x02ul:
6407 return false;
6408 case 0x03ul:
6409 return true;
6410 case 0x04ul:
6411 return false;
6412 case 0x07ul:
6413 return false;
6414 case 0x08ul:
6415 return false;
6416 case 0x09ul:
6417 return false;
6418 case 0x0Aul:
6419 return false;
6420 case 0x0Bul:
6421 return false;
6422 case 0x0Cul:
6423 return false;
6424 case 0x0Dul:
6425 return false;
6426 default:
6427 return false;
6428 }
6429 }
6430 #endif
6431 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
6432 if (var1 == 0x01)
6433 {
6434 switch(var2)
6435 {
6436 case 0x00ul:
6437 return true;
6438 case 0x01ul:
6439 return true;
6440 case 0x02ul:
6441 return false;
6442 case 0x03ul:
6443 return true;
6444 case 0x04ul:
6445 return false;
6446 case 0x07ul:
6447 return false;
6448 case 0x08ul:
6449 return false;
6450 case 0x09ul:
6451 return false;
6452 case 0x0Aul:
6453 return false;
6454 case 0x0Bul:
6455 return false;
6456 case 0x0Cul:
6457 return false;
6458 case 0x0Dul:
6459 return false;
6460 default:
6461 return false;
6462 }
6463 }
6464 #endif
6465 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
6466 if (var1 == 0x01)
6467 {
6468 switch(var2)
6469 {
6470 case 0x00ul:
6471 return true;
6472 case 0x01ul:
6473 return true;
6474 case 0x02ul:
6475 return false;
6476 case 0x03ul:
6477 return true;
6478 case 0x04ul:
6479 return false;
6480 case 0x07ul:
6481 return false;
6482 case 0x08ul:
6483 return false;
6484 case 0x09ul:
6485 return false;
6486 case 0x0Aul:
6487 return false;
6488 case 0x0Bul:
6489 return false;
6490 case 0x0Cul:
6491 return false;
6492 case 0x0Dul:
6493 return false;
6494 default:
6495 return false;
6496 }
6497 }
6498 #endif
6499 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6500 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6501 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
6502 if (var1 == 0x01)
6503 {
6504 switch(var2)
6505 {
6506 case 0x00ul:
6507 return true;
6508 case 0x01ul:
6509 return true;
6510 case 0x02ul:
6511 return false;
6512 case 0x03ul:
6513 return true;
6514 case 0x04ul:
6515 return false;
6516 case 0x07ul:
6517 return false;
6518 case 0x08ul:
6519 return false;
6520 case 0x09ul:
6521 return false;
6522 case 0x0Aul:
6523 return false;
6524 case 0x0Bul:
6525 return false;
6526 case 0x0Cul:
6527 return false;
6528 case 0x0Dul:
6529 return false;
6530 default:
6531 return false;
6532 }
6533 }
6534 #endif
6535 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6536 if (var1 == 0x01)
6537 {
6538 switch(var2)
6539 {
6540 case 0x00ul:
6541 return true;
6542 case 0x01ul:
6543 return true;
6544 case 0x02ul:
6545 return false;
6546 case 0x03ul:
6547 return true;
6548 case 0x04ul:
6549 return false;
6550 case 0x07ul:
6551 return false;
6552 case 0x08ul:
6553 return false;
6554 case 0x09ul:
6555 return false;
6556 case 0x0Aul:
6557 return false;
6558 case 0x0Bul:
6559 return false;
6560 case 0x0Cul:
6561 return false;
6562 case 0x0Dul:
6563 return false;
6564 default:
6565 return false;
6566 }
6567 }
6568 #endif
6569 return false;
6570 #endif
6571 }
6572
6573 /* ========= Errata 33 ========= */
6574 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
6575 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
6576 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
6577 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
6578 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
6579 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
6580 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
6581 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
6582 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6583 #define NRF51_ERRATA_33_PRESENT 1
6584 #else
6585 #define NRF51_ERRATA_33_PRESENT 0
6586 #endif
6587
6588 #ifndef NRF51_ERRATA_33_ENABLE_WORKAROUND
6589 #define NRF51_ERRATA_33_ENABLE_WORKAROUND NRF51_ERRATA_33_PRESENT
6590 #endif
6591
nrf51_errata_33(void)6592 static bool nrf51_errata_33(void)
6593 {
6594 #ifndef NRF51_SERIES
6595 return false;
6596 #else
6597 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6598 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6599 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
6600 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
6601 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
6602 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6603 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6604 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
6605 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6606 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
6607 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
6608 #endif
6609 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6610 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6611 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
6612 if (var1 == 0x01)
6613 {
6614 switch(var2)
6615 {
6616 case 0x00ul:
6617 return true;
6618 case 0x01ul:
6619 return true;
6620 case 0x02ul:
6621 return false;
6622 case 0x03ul:
6623 return true;
6624 case 0x04ul:
6625 return false;
6626 case 0x07ul:
6627 return false;
6628 case 0x08ul:
6629 return false;
6630 case 0x09ul:
6631 return false;
6632 case 0x0Aul:
6633 return false;
6634 case 0x0Bul:
6635 return false;
6636 case 0x0Cul:
6637 return false;
6638 case 0x0Dul:
6639 return false;
6640 default:
6641 return false;
6642 }
6643 }
6644 #endif
6645 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
6646 if (var1 == 0x01)
6647 {
6648 switch(var2)
6649 {
6650 case 0x00ul:
6651 return true;
6652 case 0x01ul:
6653 return true;
6654 case 0x02ul:
6655 return false;
6656 case 0x03ul:
6657 return true;
6658 case 0x04ul:
6659 return false;
6660 case 0x07ul:
6661 return false;
6662 case 0x08ul:
6663 return false;
6664 case 0x09ul:
6665 return false;
6666 case 0x0Aul:
6667 return false;
6668 case 0x0Bul:
6669 return false;
6670 case 0x0Cul:
6671 return false;
6672 case 0x0Dul:
6673 return false;
6674 default:
6675 return false;
6676 }
6677 }
6678 #endif
6679 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
6680 if (var1 == 0x01)
6681 {
6682 switch(var2)
6683 {
6684 case 0x00ul:
6685 return true;
6686 case 0x01ul:
6687 return true;
6688 case 0x02ul:
6689 return false;
6690 case 0x03ul:
6691 return true;
6692 case 0x04ul:
6693 return false;
6694 case 0x07ul:
6695 return false;
6696 case 0x08ul:
6697 return false;
6698 case 0x09ul:
6699 return false;
6700 case 0x0Aul:
6701 return false;
6702 case 0x0Bul:
6703 return false;
6704 case 0x0Cul:
6705 return false;
6706 case 0x0Dul:
6707 return false;
6708 default:
6709 return false;
6710 }
6711 }
6712 #endif
6713 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6714 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6715 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
6716 if (var1 == 0x01)
6717 {
6718 switch(var2)
6719 {
6720 case 0x00ul:
6721 return true;
6722 case 0x01ul:
6723 return true;
6724 case 0x02ul:
6725 return false;
6726 case 0x03ul:
6727 return true;
6728 case 0x04ul:
6729 return false;
6730 case 0x07ul:
6731 return false;
6732 case 0x08ul:
6733 return false;
6734 case 0x09ul:
6735 return false;
6736 case 0x0Aul:
6737 return false;
6738 case 0x0Bul:
6739 return false;
6740 case 0x0Cul:
6741 return false;
6742 case 0x0Dul:
6743 return false;
6744 default:
6745 return false;
6746 }
6747 }
6748 #endif
6749 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6750 if (var1 == 0x01)
6751 {
6752 switch(var2)
6753 {
6754 case 0x00ul:
6755 return true;
6756 case 0x01ul:
6757 return true;
6758 case 0x02ul:
6759 return false;
6760 case 0x03ul:
6761 return true;
6762 case 0x04ul:
6763 return false;
6764 case 0x07ul:
6765 return false;
6766 case 0x08ul:
6767 return false;
6768 case 0x09ul:
6769 return false;
6770 case 0x0Aul:
6771 return false;
6772 case 0x0Bul:
6773 return false;
6774 case 0x0Cul:
6775 return false;
6776 case 0x0Dul:
6777 return false;
6778 default:
6779 return false;
6780 }
6781 }
6782 #endif
6783 return false;
6784 #endif
6785 }
6786
6787 /* ========= Errata 34 ========= */
6788 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
6789 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
6790 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
6791 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
6792 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
6793 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
6794 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
6795 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
6796 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6797 #define NRF51_ERRATA_34_PRESENT 1
6798 #else
6799 #define NRF51_ERRATA_34_PRESENT 0
6800 #endif
6801
6802 #ifndef NRF51_ERRATA_34_ENABLE_WORKAROUND
6803 #define NRF51_ERRATA_34_ENABLE_WORKAROUND NRF51_ERRATA_34_PRESENT
6804 #endif
6805
nrf51_errata_34(void)6806 static bool nrf51_errata_34(void)
6807 {
6808 #ifndef NRF51_SERIES
6809 return false;
6810 #else
6811 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6812 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6813 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
6814 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
6815 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
6816 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6817 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6818 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
6819 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6820 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
6821 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
6822 #endif
6823 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
6824 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
6825 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
6826 if (var1 == 0x01)
6827 {
6828 switch(var2)
6829 {
6830 case 0x00ul:
6831 return true;
6832 case 0x01ul:
6833 return true;
6834 case 0x02ul:
6835 return false;
6836 case 0x03ul:
6837 return true;
6838 case 0x04ul:
6839 return false;
6840 case 0x07ul:
6841 return false;
6842 case 0x08ul:
6843 return false;
6844 case 0x09ul:
6845 return false;
6846 case 0x0Aul:
6847 return false;
6848 case 0x0Bul:
6849 return false;
6850 case 0x0Cul:
6851 return false;
6852 case 0x0Dul:
6853 return false;
6854 default:
6855 return false;
6856 }
6857 }
6858 #endif
6859 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
6860 if (var1 == 0x01)
6861 {
6862 switch(var2)
6863 {
6864 case 0x00ul:
6865 return true;
6866 case 0x01ul:
6867 return true;
6868 case 0x02ul:
6869 return false;
6870 case 0x03ul:
6871 return true;
6872 case 0x04ul:
6873 return false;
6874 case 0x07ul:
6875 return false;
6876 case 0x08ul:
6877 return false;
6878 case 0x09ul:
6879 return false;
6880 case 0x0Aul:
6881 return false;
6882 case 0x0Bul:
6883 return false;
6884 case 0x0Cul:
6885 return false;
6886 case 0x0Dul:
6887 return false;
6888 default:
6889 return false;
6890 }
6891 }
6892 #endif
6893 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
6894 if (var1 == 0x01)
6895 {
6896 switch(var2)
6897 {
6898 case 0x00ul:
6899 return true;
6900 case 0x01ul:
6901 return true;
6902 case 0x02ul:
6903 return false;
6904 case 0x03ul:
6905 return true;
6906 case 0x04ul:
6907 return false;
6908 case 0x07ul:
6909 return false;
6910 case 0x08ul:
6911 return false;
6912 case 0x09ul:
6913 return false;
6914 case 0x0Aul:
6915 return false;
6916 case 0x0Bul:
6917 return false;
6918 case 0x0Cul:
6919 return false;
6920 case 0x0Dul:
6921 return false;
6922 default:
6923 return false;
6924 }
6925 }
6926 #endif
6927 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
6928 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
6929 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
6930 if (var1 == 0x01)
6931 {
6932 switch(var2)
6933 {
6934 case 0x00ul:
6935 return true;
6936 case 0x01ul:
6937 return true;
6938 case 0x02ul:
6939 return false;
6940 case 0x03ul:
6941 return true;
6942 case 0x04ul:
6943 return false;
6944 case 0x07ul:
6945 return false;
6946 case 0x08ul:
6947 return false;
6948 case 0x09ul:
6949 return false;
6950 case 0x0Aul:
6951 return false;
6952 case 0x0Bul:
6953 return false;
6954 case 0x0Cul:
6955 return false;
6956 case 0x0Dul:
6957 return false;
6958 default:
6959 return false;
6960 }
6961 }
6962 #endif
6963 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
6964 if (var1 == 0x01)
6965 {
6966 switch(var2)
6967 {
6968 case 0x00ul:
6969 return true;
6970 case 0x01ul:
6971 return true;
6972 case 0x02ul:
6973 return false;
6974 case 0x03ul:
6975 return true;
6976 case 0x04ul:
6977 return false;
6978 case 0x07ul:
6979 return false;
6980 case 0x08ul:
6981 return false;
6982 case 0x09ul:
6983 return false;
6984 case 0x0Aul:
6985 return false;
6986 case 0x0Bul:
6987 return false;
6988 case 0x0Cul:
6989 return false;
6990 case 0x0Dul:
6991 return false;
6992 default:
6993 return false;
6994 }
6995 }
6996 #endif
6997 return false;
6998 #endif
6999 }
7000
7001 /* ========= Errata 35 ========= */
7002 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
7003 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
7004 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
7005 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
7006 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
7007 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
7008 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
7009 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
7010 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7011 #define NRF51_ERRATA_35_PRESENT 1
7012 #else
7013 #define NRF51_ERRATA_35_PRESENT 0
7014 #endif
7015
7016 #ifndef NRF51_ERRATA_35_ENABLE_WORKAROUND
7017 #define NRF51_ERRATA_35_ENABLE_WORKAROUND NRF51_ERRATA_35_PRESENT
7018 #endif
7019
nrf51_errata_35(void)7020 static bool nrf51_errata_35(void)
7021 {
7022 #ifndef NRF51_SERIES
7023 return false;
7024 #else
7025 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7026 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7027 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
7028 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
7029 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
7030 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7031 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7032 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
7033 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7034 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
7035 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
7036 #endif
7037 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7038 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7039 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
7040 if (var1 == 0x01)
7041 {
7042 switch(var2)
7043 {
7044 case 0x00ul:
7045 return true;
7046 case 0x01ul:
7047 return true;
7048 case 0x02ul:
7049 return true;
7050 case 0x03ul:
7051 return true;
7052 case 0x04ul:
7053 return true;
7054 case 0x07ul:
7055 return false;
7056 case 0x08ul:
7057 return false;
7058 case 0x09ul:
7059 return false;
7060 case 0x0Aul:
7061 return false;
7062 case 0x0Bul:
7063 return false;
7064 case 0x0Cul:
7065 return false;
7066 case 0x0Dul:
7067 return false;
7068 default:
7069 return false;
7070 }
7071 }
7072 #endif
7073 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
7074 if (var1 == 0x01)
7075 {
7076 switch(var2)
7077 {
7078 case 0x00ul:
7079 return true;
7080 case 0x01ul:
7081 return true;
7082 case 0x02ul:
7083 return true;
7084 case 0x03ul:
7085 return true;
7086 case 0x04ul:
7087 return true;
7088 case 0x07ul:
7089 return false;
7090 case 0x08ul:
7091 return false;
7092 case 0x09ul:
7093 return false;
7094 case 0x0Aul:
7095 return false;
7096 case 0x0Bul:
7097 return false;
7098 case 0x0Cul:
7099 return false;
7100 case 0x0Dul:
7101 return false;
7102 default:
7103 return false;
7104 }
7105 }
7106 #endif
7107 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
7108 if (var1 == 0x01)
7109 {
7110 switch(var2)
7111 {
7112 case 0x00ul:
7113 return true;
7114 case 0x01ul:
7115 return true;
7116 case 0x02ul:
7117 return true;
7118 case 0x03ul:
7119 return true;
7120 case 0x04ul:
7121 return true;
7122 case 0x07ul:
7123 return false;
7124 case 0x08ul:
7125 return false;
7126 case 0x09ul:
7127 return false;
7128 case 0x0Aul:
7129 return false;
7130 case 0x0Bul:
7131 return false;
7132 case 0x0Cul:
7133 return false;
7134 case 0x0Dul:
7135 return false;
7136 default:
7137 return false;
7138 }
7139 }
7140 #endif
7141 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7142 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7143 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
7144 if (var1 == 0x01)
7145 {
7146 switch(var2)
7147 {
7148 case 0x00ul:
7149 return true;
7150 case 0x01ul:
7151 return true;
7152 case 0x02ul:
7153 return true;
7154 case 0x03ul:
7155 return true;
7156 case 0x04ul:
7157 return true;
7158 case 0x07ul:
7159 return false;
7160 case 0x08ul:
7161 return false;
7162 case 0x09ul:
7163 return false;
7164 case 0x0Aul:
7165 return false;
7166 case 0x0Bul:
7167 return false;
7168 case 0x0Cul:
7169 return false;
7170 case 0x0Dul:
7171 return false;
7172 default:
7173 return false;
7174 }
7175 }
7176 #endif
7177 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7178 if (var1 == 0x01)
7179 {
7180 switch(var2)
7181 {
7182 case 0x00ul:
7183 return true;
7184 case 0x01ul:
7185 return true;
7186 case 0x02ul:
7187 return true;
7188 case 0x03ul:
7189 return true;
7190 case 0x04ul:
7191 return true;
7192 case 0x07ul:
7193 return false;
7194 case 0x08ul:
7195 return false;
7196 case 0x09ul:
7197 return false;
7198 case 0x0Aul:
7199 return false;
7200 case 0x0Bul:
7201 return false;
7202 case 0x0Cul:
7203 return false;
7204 case 0x0Dul:
7205 return false;
7206 default:
7207 return false;
7208 }
7209 }
7210 #endif
7211 return false;
7212 #endif
7213 }
7214
7215 /* ========= Errata 36 ========= */
7216 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
7217 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
7218 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
7219 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
7220 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
7221 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
7222 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
7223 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
7224 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7225 #define NRF51_ERRATA_36_PRESENT 1
7226 #else
7227 #define NRF51_ERRATA_36_PRESENT 0
7228 #endif
7229
7230 #ifndef NRF51_ERRATA_36_ENABLE_WORKAROUND
7231 #define NRF51_ERRATA_36_ENABLE_WORKAROUND NRF51_ERRATA_36_PRESENT
7232 #endif
7233
nrf51_errata_36(void)7234 static bool nrf51_errata_36(void)
7235 {
7236 #ifndef NRF51_SERIES
7237 return false;
7238 #else
7239 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7240 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7241 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
7242 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
7243 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
7244 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7245 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7246 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
7247 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7248 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
7249 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
7250 #endif
7251 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7252 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7253 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
7254 if (var1 == 0x01)
7255 {
7256 switch(var2)
7257 {
7258 case 0x00ul:
7259 return true;
7260 case 0x01ul:
7261 return true;
7262 case 0x02ul:
7263 return false;
7264 case 0x03ul:
7265 return true;
7266 case 0x04ul:
7267 return false;
7268 case 0x07ul:
7269 return false;
7270 case 0x08ul:
7271 return false;
7272 case 0x09ul:
7273 return false;
7274 case 0x0Aul:
7275 return false;
7276 case 0x0Bul:
7277 return false;
7278 case 0x0Cul:
7279 return false;
7280 case 0x0Dul:
7281 return false;
7282 default:
7283 return false;
7284 }
7285 }
7286 #endif
7287 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
7288 if (var1 == 0x01)
7289 {
7290 switch(var2)
7291 {
7292 case 0x00ul:
7293 return true;
7294 case 0x01ul:
7295 return true;
7296 case 0x02ul:
7297 return false;
7298 case 0x03ul:
7299 return true;
7300 case 0x04ul:
7301 return false;
7302 case 0x07ul:
7303 return false;
7304 case 0x08ul:
7305 return false;
7306 case 0x09ul:
7307 return false;
7308 case 0x0Aul:
7309 return false;
7310 case 0x0Bul:
7311 return false;
7312 case 0x0Cul:
7313 return false;
7314 case 0x0Dul:
7315 return false;
7316 default:
7317 return false;
7318 }
7319 }
7320 #endif
7321 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
7322 if (var1 == 0x01)
7323 {
7324 switch(var2)
7325 {
7326 case 0x00ul:
7327 return true;
7328 case 0x01ul:
7329 return true;
7330 case 0x02ul:
7331 return false;
7332 case 0x03ul:
7333 return true;
7334 case 0x04ul:
7335 return false;
7336 case 0x07ul:
7337 return false;
7338 case 0x08ul:
7339 return false;
7340 case 0x09ul:
7341 return false;
7342 case 0x0Aul:
7343 return false;
7344 case 0x0Bul:
7345 return false;
7346 case 0x0Cul:
7347 return false;
7348 case 0x0Dul:
7349 return false;
7350 default:
7351 return false;
7352 }
7353 }
7354 #endif
7355 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7356 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7357 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
7358 if (var1 == 0x01)
7359 {
7360 switch(var2)
7361 {
7362 case 0x00ul:
7363 return true;
7364 case 0x01ul:
7365 return true;
7366 case 0x02ul:
7367 return false;
7368 case 0x03ul:
7369 return true;
7370 case 0x04ul:
7371 return false;
7372 case 0x07ul:
7373 return false;
7374 case 0x08ul:
7375 return false;
7376 case 0x09ul:
7377 return false;
7378 case 0x0Aul:
7379 return false;
7380 case 0x0Bul:
7381 return false;
7382 case 0x0Cul:
7383 return false;
7384 case 0x0Dul:
7385 return false;
7386 default:
7387 return false;
7388 }
7389 }
7390 #endif
7391 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7392 if (var1 == 0x01)
7393 {
7394 switch(var2)
7395 {
7396 case 0x00ul:
7397 return true;
7398 case 0x01ul:
7399 return true;
7400 case 0x02ul:
7401 return false;
7402 case 0x03ul:
7403 return true;
7404 case 0x04ul:
7405 return false;
7406 case 0x07ul:
7407 return false;
7408 case 0x08ul:
7409 return false;
7410 case 0x09ul:
7411 return false;
7412 case 0x0Aul:
7413 return false;
7414 case 0x0Bul:
7415 return false;
7416 case 0x0Cul:
7417 return false;
7418 case 0x0Dul:
7419 return false;
7420 default:
7421 return false;
7422 }
7423 }
7424 #endif
7425 return false;
7426 #endif
7427 }
7428
7429 /* ========= Errata 37 ========= */
7430 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
7431 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
7432 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
7433 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
7434 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
7435 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
7436 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
7437 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
7438 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7439 #define NRF51_ERRATA_37_PRESENT 1
7440 #else
7441 #define NRF51_ERRATA_37_PRESENT 0
7442 #endif
7443
7444 #ifndef NRF51_ERRATA_37_ENABLE_WORKAROUND
7445 #define NRF51_ERRATA_37_ENABLE_WORKAROUND NRF51_ERRATA_37_PRESENT
7446 #endif
7447
nrf51_errata_37(void)7448 static bool nrf51_errata_37(void)
7449 {
7450 #ifndef NRF51_SERIES
7451 return false;
7452 #else
7453 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7454 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7455 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
7456 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
7457 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
7458 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7459 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7460 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
7461 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7462 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
7463 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
7464 #endif
7465 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7466 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7467 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
7468 if (var1 == 0x01)
7469 {
7470 switch(var2)
7471 {
7472 case 0x00ul:
7473 return true;
7474 case 0x01ul:
7475 return true;
7476 case 0x02ul:
7477 return false;
7478 case 0x03ul:
7479 return true;
7480 case 0x04ul:
7481 return false;
7482 case 0x07ul:
7483 return false;
7484 case 0x08ul:
7485 return false;
7486 case 0x09ul:
7487 return false;
7488 case 0x0Aul:
7489 return false;
7490 case 0x0Bul:
7491 return false;
7492 case 0x0Cul:
7493 return false;
7494 case 0x0Dul:
7495 return false;
7496 default:
7497 return false;
7498 }
7499 }
7500 #endif
7501 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
7502 if (var1 == 0x01)
7503 {
7504 switch(var2)
7505 {
7506 case 0x00ul:
7507 return true;
7508 case 0x01ul:
7509 return true;
7510 case 0x02ul:
7511 return false;
7512 case 0x03ul:
7513 return true;
7514 case 0x04ul:
7515 return false;
7516 case 0x07ul:
7517 return false;
7518 case 0x08ul:
7519 return false;
7520 case 0x09ul:
7521 return false;
7522 case 0x0Aul:
7523 return false;
7524 case 0x0Bul:
7525 return false;
7526 case 0x0Cul:
7527 return false;
7528 case 0x0Dul:
7529 return false;
7530 default:
7531 return false;
7532 }
7533 }
7534 #endif
7535 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
7536 if (var1 == 0x01)
7537 {
7538 switch(var2)
7539 {
7540 case 0x00ul:
7541 return true;
7542 case 0x01ul:
7543 return true;
7544 case 0x02ul:
7545 return false;
7546 case 0x03ul:
7547 return true;
7548 case 0x04ul:
7549 return false;
7550 case 0x07ul:
7551 return false;
7552 case 0x08ul:
7553 return false;
7554 case 0x09ul:
7555 return false;
7556 case 0x0Aul:
7557 return false;
7558 case 0x0Bul:
7559 return false;
7560 case 0x0Cul:
7561 return false;
7562 case 0x0Dul:
7563 return false;
7564 default:
7565 return false;
7566 }
7567 }
7568 #endif
7569 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7570 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7571 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
7572 if (var1 == 0x01)
7573 {
7574 switch(var2)
7575 {
7576 case 0x00ul:
7577 return true;
7578 case 0x01ul:
7579 return true;
7580 case 0x02ul:
7581 return false;
7582 case 0x03ul:
7583 return true;
7584 case 0x04ul:
7585 return false;
7586 case 0x07ul:
7587 return false;
7588 case 0x08ul:
7589 return false;
7590 case 0x09ul:
7591 return false;
7592 case 0x0Aul:
7593 return false;
7594 case 0x0Bul:
7595 return false;
7596 case 0x0Cul:
7597 return false;
7598 case 0x0Dul:
7599 return false;
7600 default:
7601 return false;
7602 }
7603 }
7604 #endif
7605 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7606 if (var1 == 0x01)
7607 {
7608 switch(var2)
7609 {
7610 case 0x00ul:
7611 return true;
7612 case 0x01ul:
7613 return true;
7614 case 0x02ul:
7615 return false;
7616 case 0x03ul:
7617 return true;
7618 case 0x04ul:
7619 return false;
7620 case 0x07ul:
7621 return false;
7622 case 0x08ul:
7623 return false;
7624 case 0x09ul:
7625 return false;
7626 case 0x0Aul:
7627 return false;
7628 case 0x0Bul:
7629 return false;
7630 case 0x0Cul:
7631 return false;
7632 case 0x0Dul:
7633 return false;
7634 default:
7635 return false;
7636 }
7637 }
7638 #endif
7639 return false;
7640 #endif
7641 }
7642
7643 /* ========= Errata 38 ========= */
7644 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
7645 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
7646 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
7647 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
7648 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
7649 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
7650 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
7651 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
7652 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7653 #define NRF51_ERRATA_38_PRESENT 1
7654 #else
7655 #define NRF51_ERRATA_38_PRESENT 0
7656 #endif
7657
7658 #ifndef NRF51_ERRATA_38_ENABLE_WORKAROUND
7659 #define NRF51_ERRATA_38_ENABLE_WORKAROUND NRF51_ERRATA_38_PRESENT
7660 #endif
7661
nrf51_errata_38(void)7662 static bool nrf51_errata_38(void)
7663 {
7664 #ifndef NRF51_SERIES
7665 return false;
7666 #else
7667 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7668 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7669 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
7670 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
7671 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
7672 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7673 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7674 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
7675 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7676 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
7677 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
7678 #endif
7679 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7680 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7681 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
7682 if (var1 == 0x01)
7683 {
7684 switch(var2)
7685 {
7686 case 0x00ul:
7687 return true;
7688 case 0x01ul:
7689 return true;
7690 case 0x02ul:
7691 return true;
7692 case 0x03ul:
7693 return true;
7694 case 0x04ul:
7695 return true;
7696 case 0x07ul:
7697 return true;
7698 case 0x08ul:
7699 return true;
7700 case 0x09ul:
7701 return true;
7702 case 0x0Aul:
7703 return true;
7704 case 0x0Bul:
7705 return true;
7706 case 0x0Cul:
7707 return true;
7708 case 0x0Dul:
7709 return true;
7710 default:
7711 return true;
7712 }
7713 }
7714 #endif
7715 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
7716 if (var1 == 0x01)
7717 {
7718 switch(var2)
7719 {
7720 case 0x00ul:
7721 return true;
7722 case 0x01ul:
7723 return true;
7724 case 0x02ul:
7725 return true;
7726 case 0x03ul:
7727 return true;
7728 case 0x04ul:
7729 return true;
7730 case 0x07ul:
7731 return true;
7732 case 0x08ul:
7733 return true;
7734 case 0x09ul:
7735 return true;
7736 case 0x0Aul:
7737 return true;
7738 case 0x0Bul:
7739 return true;
7740 case 0x0Cul:
7741 return true;
7742 case 0x0Dul:
7743 return true;
7744 default:
7745 return true;
7746 }
7747 }
7748 #endif
7749 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
7750 if (var1 == 0x01)
7751 {
7752 switch(var2)
7753 {
7754 case 0x00ul:
7755 return true;
7756 case 0x01ul:
7757 return true;
7758 case 0x02ul:
7759 return true;
7760 case 0x03ul:
7761 return true;
7762 case 0x04ul:
7763 return true;
7764 case 0x07ul:
7765 return true;
7766 case 0x08ul:
7767 return true;
7768 case 0x09ul:
7769 return true;
7770 case 0x0Aul:
7771 return true;
7772 case 0x0Bul:
7773 return true;
7774 case 0x0Cul:
7775 return true;
7776 case 0x0Dul:
7777 return true;
7778 default:
7779 return true;
7780 }
7781 }
7782 #endif
7783 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7784 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7785 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
7786 if (var1 == 0x01)
7787 {
7788 switch(var2)
7789 {
7790 case 0x00ul:
7791 return true;
7792 case 0x01ul:
7793 return true;
7794 case 0x02ul:
7795 return true;
7796 case 0x03ul:
7797 return true;
7798 case 0x04ul:
7799 return true;
7800 case 0x07ul:
7801 return true;
7802 case 0x08ul:
7803 return true;
7804 case 0x09ul:
7805 return true;
7806 case 0x0Aul:
7807 return true;
7808 case 0x0Bul:
7809 return true;
7810 case 0x0Cul:
7811 return true;
7812 case 0x0Dul:
7813 return true;
7814 default:
7815 return true;
7816 }
7817 }
7818 #endif
7819 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7820 if (var1 == 0x01)
7821 {
7822 switch(var2)
7823 {
7824 case 0x00ul:
7825 return true;
7826 case 0x01ul:
7827 return true;
7828 case 0x02ul:
7829 return true;
7830 case 0x03ul:
7831 return true;
7832 case 0x04ul:
7833 return true;
7834 case 0x07ul:
7835 return true;
7836 case 0x08ul:
7837 return true;
7838 case 0x09ul:
7839 return true;
7840 case 0x0Aul:
7841 return true;
7842 case 0x0Bul:
7843 return true;
7844 case 0x0Cul:
7845 return true;
7846 case 0x0Dul:
7847 return true;
7848 default:
7849 return true;
7850 }
7851 }
7852 #endif
7853 return false;
7854 #endif
7855 }
7856
7857 /* ========= Errata 39 ========= */
7858 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
7859 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
7860 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
7861 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
7862 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
7863 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
7864 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
7865 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
7866 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7867 #define NRF51_ERRATA_39_PRESENT 1
7868 #else
7869 #define NRF51_ERRATA_39_PRESENT 0
7870 #endif
7871
7872 #ifndef NRF51_ERRATA_39_ENABLE_WORKAROUND
7873 #define NRF51_ERRATA_39_ENABLE_WORKAROUND NRF51_ERRATA_39_PRESENT
7874 #endif
7875
nrf51_errata_39(void)7876 static bool nrf51_errata_39(void)
7877 {
7878 #ifndef NRF51_SERIES
7879 return false;
7880 #else
7881 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7882 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7883 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
7884 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
7885 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
7886 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7887 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7888 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
7889 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
7890 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
7891 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
7892 #endif
7893 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
7894 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
7895 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
7896 if (var1 == 0x01)
7897 {
7898 switch(var2)
7899 {
7900 case 0x00ul:
7901 return true;
7902 case 0x01ul:
7903 return true;
7904 case 0x02ul:
7905 return true;
7906 case 0x03ul:
7907 return true;
7908 case 0x04ul:
7909 return true;
7910 case 0x07ul:
7911 return false;
7912 case 0x08ul:
7913 return false;
7914 case 0x09ul:
7915 return false;
7916 case 0x0Aul:
7917 return false;
7918 case 0x0Bul:
7919 return false;
7920 case 0x0Cul:
7921 return false;
7922 case 0x0Dul:
7923 return false;
7924 default:
7925 return false;
7926 }
7927 }
7928 #endif
7929 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
7930 if (var1 == 0x01)
7931 {
7932 switch(var2)
7933 {
7934 case 0x00ul:
7935 return true;
7936 case 0x01ul:
7937 return true;
7938 case 0x02ul:
7939 return true;
7940 case 0x03ul:
7941 return true;
7942 case 0x04ul:
7943 return true;
7944 case 0x07ul:
7945 return false;
7946 case 0x08ul:
7947 return false;
7948 case 0x09ul:
7949 return false;
7950 case 0x0Aul:
7951 return false;
7952 case 0x0Bul:
7953 return false;
7954 case 0x0Cul:
7955 return false;
7956 case 0x0Dul:
7957 return false;
7958 default:
7959 return false;
7960 }
7961 }
7962 #endif
7963 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
7964 if (var1 == 0x01)
7965 {
7966 switch(var2)
7967 {
7968 case 0x00ul:
7969 return true;
7970 case 0x01ul:
7971 return true;
7972 case 0x02ul:
7973 return true;
7974 case 0x03ul:
7975 return true;
7976 case 0x04ul:
7977 return true;
7978 case 0x07ul:
7979 return false;
7980 case 0x08ul:
7981 return false;
7982 case 0x09ul:
7983 return false;
7984 case 0x0Aul:
7985 return false;
7986 case 0x0Bul:
7987 return false;
7988 case 0x0Cul:
7989 return false;
7990 case 0x0Dul:
7991 return false;
7992 default:
7993 return false;
7994 }
7995 }
7996 #endif
7997 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
7998 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
7999 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
8000 if (var1 == 0x01)
8001 {
8002 switch(var2)
8003 {
8004 case 0x00ul:
8005 return true;
8006 case 0x01ul:
8007 return true;
8008 case 0x02ul:
8009 return true;
8010 case 0x03ul:
8011 return true;
8012 case 0x04ul:
8013 return true;
8014 case 0x07ul:
8015 return false;
8016 case 0x08ul:
8017 return false;
8018 case 0x09ul:
8019 return false;
8020 case 0x0Aul:
8021 return false;
8022 case 0x0Bul:
8023 return false;
8024 case 0x0Cul:
8025 return false;
8026 case 0x0Dul:
8027 return false;
8028 default:
8029 return false;
8030 }
8031 }
8032 #endif
8033 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8034 if (var1 == 0x01)
8035 {
8036 switch(var2)
8037 {
8038 case 0x00ul:
8039 return true;
8040 case 0x01ul:
8041 return true;
8042 case 0x02ul:
8043 return true;
8044 case 0x03ul:
8045 return true;
8046 case 0x04ul:
8047 return true;
8048 case 0x07ul:
8049 return false;
8050 case 0x08ul:
8051 return false;
8052 case 0x09ul:
8053 return false;
8054 case 0x0Aul:
8055 return false;
8056 case 0x0Bul:
8057 return false;
8058 case 0x0Cul:
8059 return false;
8060 case 0x0Dul:
8061 return false;
8062 default:
8063 return false;
8064 }
8065 }
8066 #endif
8067 return false;
8068 #endif
8069 }
8070
8071 /* ========= Errata 40 ========= */
8072 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
8073 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
8074 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
8075 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
8076 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
8077 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
8078 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
8079 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
8080 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8081 #define NRF51_ERRATA_40_PRESENT 1
8082 #else
8083 #define NRF51_ERRATA_40_PRESENT 0
8084 #endif
8085
8086 #ifndef NRF51_ERRATA_40_ENABLE_WORKAROUND
8087 #define NRF51_ERRATA_40_ENABLE_WORKAROUND NRF51_ERRATA_40_PRESENT
8088 #endif
8089
nrf51_errata_40(void)8090 static bool nrf51_errata_40(void)
8091 {
8092 #ifndef NRF51_SERIES
8093 return false;
8094 #else
8095 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8096 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8097 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
8098 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
8099 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
8100 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8101 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8102 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
8103 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8104 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
8105 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
8106 #endif
8107 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8108 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8109 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
8110 if (var1 == 0x01)
8111 {
8112 switch(var2)
8113 {
8114 case 0x00ul:
8115 return true;
8116 case 0x01ul:
8117 return true;
8118 case 0x02ul:
8119 return true;
8120 case 0x03ul:
8121 return true;
8122 case 0x04ul:
8123 return true;
8124 case 0x07ul:
8125 return false;
8126 case 0x08ul:
8127 return false;
8128 case 0x09ul:
8129 return false;
8130 case 0x0Aul:
8131 return false;
8132 case 0x0Bul:
8133 return false;
8134 case 0x0Cul:
8135 return false;
8136 case 0x0Dul:
8137 return false;
8138 default:
8139 return false;
8140 }
8141 }
8142 #endif
8143 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
8144 if (var1 == 0x01)
8145 {
8146 switch(var2)
8147 {
8148 case 0x00ul:
8149 return true;
8150 case 0x01ul:
8151 return true;
8152 case 0x02ul:
8153 return true;
8154 case 0x03ul:
8155 return true;
8156 case 0x04ul:
8157 return true;
8158 case 0x07ul:
8159 return false;
8160 case 0x08ul:
8161 return false;
8162 case 0x09ul:
8163 return false;
8164 case 0x0Aul:
8165 return false;
8166 case 0x0Bul:
8167 return false;
8168 case 0x0Cul:
8169 return false;
8170 case 0x0Dul:
8171 return false;
8172 default:
8173 return false;
8174 }
8175 }
8176 #endif
8177 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
8178 if (var1 == 0x01)
8179 {
8180 switch(var2)
8181 {
8182 case 0x00ul:
8183 return true;
8184 case 0x01ul:
8185 return true;
8186 case 0x02ul:
8187 return true;
8188 case 0x03ul:
8189 return true;
8190 case 0x04ul:
8191 return true;
8192 case 0x07ul:
8193 return false;
8194 case 0x08ul:
8195 return false;
8196 case 0x09ul:
8197 return false;
8198 case 0x0Aul:
8199 return false;
8200 case 0x0Bul:
8201 return false;
8202 case 0x0Cul:
8203 return false;
8204 case 0x0Dul:
8205 return false;
8206 default:
8207 return false;
8208 }
8209 }
8210 #endif
8211 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8212 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8213 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
8214 if (var1 == 0x01)
8215 {
8216 switch(var2)
8217 {
8218 case 0x00ul:
8219 return true;
8220 case 0x01ul:
8221 return true;
8222 case 0x02ul:
8223 return true;
8224 case 0x03ul:
8225 return true;
8226 case 0x04ul:
8227 return true;
8228 case 0x07ul:
8229 return false;
8230 case 0x08ul:
8231 return false;
8232 case 0x09ul:
8233 return false;
8234 case 0x0Aul:
8235 return false;
8236 case 0x0Bul:
8237 return false;
8238 case 0x0Cul:
8239 return false;
8240 case 0x0Dul:
8241 return false;
8242 default:
8243 return false;
8244 }
8245 }
8246 #endif
8247 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8248 if (var1 == 0x01)
8249 {
8250 switch(var2)
8251 {
8252 case 0x00ul:
8253 return true;
8254 case 0x01ul:
8255 return true;
8256 case 0x02ul:
8257 return true;
8258 case 0x03ul:
8259 return true;
8260 case 0x04ul:
8261 return true;
8262 case 0x07ul:
8263 return false;
8264 case 0x08ul:
8265 return false;
8266 case 0x09ul:
8267 return false;
8268 case 0x0Aul:
8269 return false;
8270 case 0x0Bul:
8271 return false;
8272 case 0x0Cul:
8273 return false;
8274 case 0x0Dul:
8275 return false;
8276 default:
8277 return false;
8278 }
8279 }
8280 #endif
8281 return false;
8282 #endif
8283 }
8284
8285 /* ========= Errata 41 ========= */
8286 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
8287 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
8288 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
8289 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
8290 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
8291 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
8292 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
8293 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
8294 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8295 #define NRF51_ERRATA_41_PRESENT 1
8296 #else
8297 #define NRF51_ERRATA_41_PRESENT 0
8298 #endif
8299
8300 #ifndef NRF51_ERRATA_41_ENABLE_WORKAROUND
8301 #define NRF51_ERRATA_41_ENABLE_WORKAROUND NRF51_ERRATA_41_PRESENT
8302 #endif
8303
nrf51_errata_41(void)8304 static bool nrf51_errata_41(void)
8305 {
8306 #ifndef NRF51_SERIES
8307 return false;
8308 #else
8309 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8310 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8311 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
8312 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
8313 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
8314 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8315 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8316 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
8317 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8318 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
8319 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
8320 #endif
8321 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8322 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8323 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
8324 if (var1 == 0x01)
8325 {
8326 switch(var2)
8327 {
8328 case 0x00ul:
8329 return true;
8330 case 0x01ul:
8331 return true;
8332 case 0x02ul:
8333 return true;
8334 case 0x03ul:
8335 return true;
8336 case 0x04ul:
8337 return true;
8338 case 0x07ul:
8339 return false;
8340 case 0x08ul:
8341 return false;
8342 case 0x09ul:
8343 return false;
8344 case 0x0Aul:
8345 return false;
8346 case 0x0Bul:
8347 return false;
8348 case 0x0Cul:
8349 return false;
8350 case 0x0Dul:
8351 return false;
8352 default:
8353 return false;
8354 }
8355 }
8356 #endif
8357 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
8358 if (var1 == 0x01)
8359 {
8360 switch(var2)
8361 {
8362 case 0x00ul:
8363 return true;
8364 case 0x01ul:
8365 return true;
8366 case 0x02ul:
8367 return true;
8368 case 0x03ul:
8369 return true;
8370 case 0x04ul:
8371 return true;
8372 case 0x07ul:
8373 return false;
8374 case 0x08ul:
8375 return false;
8376 case 0x09ul:
8377 return false;
8378 case 0x0Aul:
8379 return false;
8380 case 0x0Bul:
8381 return false;
8382 case 0x0Cul:
8383 return false;
8384 case 0x0Dul:
8385 return false;
8386 default:
8387 return false;
8388 }
8389 }
8390 #endif
8391 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
8392 if (var1 == 0x01)
8393 {
8394 switch(var2)
8395 {
8396 case 0x00ul:
8397 return true;
8398 case 0x01ul:
8399 return true;
8400 case 0x02ul:
8401 return true;
8402 case 0x03ul:
8403 return true;
8404 case 0x04ul:
8405 return true;
8406 case 0x07ul:
8407 return false;
8408 case 0x08ul:
8409 return false;
8410 case 0x09ul:
8411 return false;
8412 case 0x0Aul:
8413 return false;
8414 case 0x0Bul:
8415 return false;
8416 case 0x0Cul:
8417 return false;
8418 case 0x0Dul:
8419 return false;
8420 default:
8421 return false;
8422 }
8423 }
8424 #endif
8425 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8426 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8427 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
8428 if (var1 == 0x01)
8429 {
8430 switch(var2)
8431 {
8432 case 0x00ul:
8433 return true;
8434 case 0x01ul:
8435 return true;
8436 case 0x02ul:
8437 return true;
8438 case 0x03ul:
8439 return true;
8440 case 0x04ul:
8441 return true;
8442 case 0x07ul:
8443 return false;
8444 case 0x08ul:
8445 return false;
8446 case 0x09ul:
8447 return false;
8448 case 0x0Aul:
8449 return false;
8450 case 0x0Bul:
8451 return false;
8452 case 0x0Cul:
8453 return false;
8454 case 0x0Dul:
8455 return false;
8456 default:
8457 return false;
8458 }
8459 }
8460 #endif
8461 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8462 if (var1 == 0x01)
8463 {
8464 switch(var2)
8465 {
8466 case 0x00ul:
8467 return true;
8468 case 0x01ul:
8469 return true;
8470 case 0x02ul:
8471 return true;
8472 case 0x03ul:
8473 return true;
8474 case 0x04ul:
8475 return true;
8476 case 0x07ul:
8477 return false;
8478 case 0x08ul:
8479 return false;
8480 case 0x09ul:
8481 return false;
8482 case 0x0Aul:
8483 return false;
8484 case 0x0Bul:
8485 return false;
8486 case 0x0Cul:
8487 return false;
8488 case 0x0Dul:
8489 return false;
8490 default:
8491 return false;
8492 }
8493 }
8494 #endif
8495 return false;
8496 #endif
8497 }
8498
8499 /* ========= Errata 42 ========= */
8500 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
8501 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
8502 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
8503 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
8504 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
8505 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
8506 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
8507 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
8508 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8509 #define NRF51_ERRATA_42_PRESENT 1
8510 #else
8511 #define NRF51_ERRATA_42_PRESENT 0
8512 #endif
8513
8514 #ifndef NRF51_ERRATA_42_ENABLE_WORKAROUND
8515 #define NRF51_ERRATA_42_ENABLE_WORKAROUND NRF51_ERRATA_42_PRESENT
8516 #endif
8517
nrf51_errata_42(void)8518 static bool nrf51_errata_42(void)
8519 {
8520 #ifndef NRF51_SERIES
8521 return false;
8522 #else
8523 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8524 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8525 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
8526 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
8527 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
8528 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8529 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8530 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
8531 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8532 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
8533 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
8534 #endif
8535 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8536 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8537 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
8538 if (var1 == 0x01)
8539 {
8540 switch(var2)
8541 {
8542 case 0x00ul:
8543 return true;
8544 case 0x01ul:
8545 return true;
8546 case 0x02ul:
8547 return true;
8548 case 0x03ul:
8549 return true;
8550 case 0x04ul:
8551 return true;
8552 case 0x07ul:
8553 return false;
8554 case 0x08ul:
8555 return false;
8556 case 0x09ul:
8557 return false;
8558 case 0x0Aul:
8559 return false;
8560 case 0x0Bul:
8561 return false;
8562 case 0x0Cul:
8563 return false;
8564 case 0x0Dul:
8565 return false;
8566 default:
8567 return false;
8568 }
8569 }
8570 #endif
8571 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
8572 if (var1 == 0x01)
8573 {
8574 switch(var2)
8575 {
8576 case 0x00ul:
8577 return true;
8578 case 0x01ul:
8579 return true;
8580 case 0x02ul:
8581 return true;
8582 case 0x03ul:
8583 return true;
8584 case 0x04ul:
8585 return true;
8586 case 0x07ul:
8587 return false;
8588 case 0x08ul:
8589 return false;
8590 case 0x09ul:
8591 return false;
8592 case 0x0Aul:
8593 return false;
8594 case 0x0Bul:
8595 return false;
8596 case 0x0Cul:
8597 return false;
8598 case 0x0Dul:
8599 return false;
8600 default:
8601 return false;
8602 }
8603 }
8604 #endif
8605 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
8606 if (var1 == 0x01)
8607 {
8608 switch(var2)
8609 {
8610 case 0x00ul:
8611 return true;
8612 case 0x01ul:
8613 return true;
8614 case 0x02ul:
8615 return true;
8616 case 0x03ul:
8617 return true;
8618 case 0x04ul:
8619 return true;
8620 case 0x07ul:
8621 return false;
8622 case 0x08ul:
8623 return false;
8624 case 0x09ul:
8625 return false;
8626 case 0x0Aul:
8627 return false;
8628 case 0x0Bul:
8629 return false;
8630 case 0x0Cul:
8631 return false;
8632 case 0x0Dul:
8633 return false;
8634 default:
8635 return false;
8636 }
8637 }
8638 #endif
8639 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8640 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8641 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
8642 if (var1 == 0x01)
8643 {
8644 switch(var2)
8645 {
8646 case 0x00ul:
8647 return true;
8648 case 0x01ul:
8649 return true;
8650 case 0x02ul:
8651 return true;
8652 case 0x03ul:
8653 return true;
8654 case 0x04ul:
8655 return true;
8656 case 0x07ul:
8657 return false;
8658 case 0x08ul:
8659 return false;
8660 case 0x09ul:
8661 return false;
8662 case 0x0Aul:
8663 return false;
8664 case 0x0Bul:
8665 return false;
8666 case 0x0Cul:
8667 return false;
8668 case 0x0Dul:
8669 return false;
8670 default:
8671 return false;
8672 }
8673 }
8674 #endif
8675 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8676 if (var1 == 0x01)
8677 {
8678 switch(var2)
8679 {
8680 case 0x00ul:
8681 return true;
8682 case 0x01ul:
8683 return true;
8684 case 0x02ul:
8685 return true;
8686 case 0x03ul:
8687 return true;
8688 case 0x04ul:
8689 return true;
8690 case 0x07ul:
8691 return false;
8692 case 0x08ul:
8693 return false;
8694 case 0x09ul:
8695 return false;
8696 case 0x0Aul:
8697 return false;
8698 case 0x0Bul:
8699 return false;
8700 case 0x0Cul:
8701 return false;
8702 case 0x0Dul:
8703 return false;
8704 default:
8705 return false;
8706 }
8707 }
8708 #endif
8709 return false;
8710 #endif
8711 }
8712
8713 /* ========= Errata 43 ========= */
8714 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
8715 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
8716 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
8717 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
8718 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
8719 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
8720 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
8721 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
8722 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8723 #define NRF51_ERRATA_43_PRESENT 1
8724 #else
8725 #define NRF51_ERRATA_43_PRESENT 0
8726 #endif
8727
8728 #ifndef NRF51_ERRATA_43_ENABLE_WORKAROUND
8729 #define NRF51_ERRATA_43_ENABLE_WORKAROUND NRF51_ERRATA_43_PRESENT
8730 #endif
8731
nrf51_errata_43(void)8732 static bool nrf51_errata_43(void)
8733 {
8734 #ifndef NRF51_SERIES
8735 return false;
8736 #else
8737 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8738 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8739 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
8740 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
8741 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
8742 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8743 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8744 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
8745 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8746 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
8747 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
8748 #endif
8749 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8750 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8751 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
8752 if (var1 == 0x01)
8753 {
8754 switch(var2)
8755 {
8756 case 0x00ul:
8757 return false;
8758 case 0x01ul:
8759 return false;
8760 case 0x02ul:
8761 return true;
8762 case 0x03ul:
8763 return false;
8764 case 0x04ul:
8765 return true;
8766 case 0x07ul:
8767 return false;
8768 case 0x08ul:
8769 return false;
8770 case 0x09ul:
8771 return false;
8772 case 0x0Aul:
8773 return false;
8774 case 0x0Bul:
8775 return false;
8776 case 0x0Cul:
8777 return false;
8778 case 0x0Dul:
8779 return false;
8780 default:
8781 return false;
8782 }
8783 }
8784 #endif
8785 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
8786 if (var1 == 0x01)
8787 {
8788 switch(var2)
8789 {
8790 case 0x00ul:
8791 return false;
8792 case 0x01ul:
8793 return false;
8794 case 0x02ul:
8795 return true;
8796 case 0x03ul:
8797 return false;
8798 case 0x04ul:
8799 return true;
8800 case 0x07ul:
8801 return false;
8802 case 0x08ul:
8803 return false;
8804 case 0x09ul:
8805 return false;
8806 case 0x0Aul:
8807 return false;
8808 case 0x0Bul:
8809 return false;
8810 case 0x0Cul:
8811 return false;
8812 case 0x0Dul:
8813 return false;
8814 default:
8815 return false;
8816 }
8817 }
8818 #endif
8819 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
8820 if (var1 == 0x01)
8821 {
8822 switch(var2)
8823 {
8824 case 0x00ul:
8825 return false;
8826 case 0x01ul:
8827 return false;
8828 case 0x02ul:
8829 return true;
8830 case 0x03ul:
8831 return false;
8832 case 0x04ul:
8833 return true;
8834 case 0x07ul:
8835 return false;
8836 case 0x08ul:
8837 return false;
8838 case 0x09ul:
8839 return false;
8840 case 0x0Aul:
8841 return false;
8842 case 0x0Bul:
8843 return false;
8844 case 0x0Cul:
8845 return false;
8846 case 0x0Dul:
8847 return false;
8848 default:
8849 return false;
8850 }
8851 }
8852 #endif
8853 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8854 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8855 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
8856 if (var1 == 0x01)
8857 {
8858 switch(var2)
8859 {
8860 case 0x00ul:
8861 return false;
8862 case 0x01ul:
8863 return false;
8864 case 0x02ul:
8865 return true;
8866 case 0x03ul:
8867 return false;
8868 case 0x04ul:
8869 return true;
8870 case 0x07ul:
8871 return false;
8872 case 0x08ul:
8873 return false;
8874 case 0x09ul:
8875 return false;
8876 case 0x0Aul:
8877 return false;
8878 case 0x0Bul:
8879 return false;
8880 case 0x0Cul:
8881 return false;
8882 case 0x0Dul:
8883 return false;
8884 default:
8885 return false;
8886 }
8887 }
8888 #endif
8889 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8890 if (var1 == 0x01)
8891 {
8892 switch(var2)
8893 {
8894 case 0x00ul:
8895 return false;
8896 case 0x01ul:
8897 return false;
8898 case 0x02ul:
8899 return true;
8900 case 0x03ul:
8901 return false;
8902 case 0x04ul:
8903 return true;
8904 case 0x07ul:
8905 return false;
8906 case 0x08ul:
8907 return false;
8908 case 0x09ul:
8909 return false;
8910 case 0x0Aul:
8911 return false;
8912 case 0x0Bul:
8913 return false;
8914 case 0x0Cul:
8915 return false;
8916 case 0x0Dul:
8917 return false;
8918 default:
8919 return false;
8920 }
8921 }
8922 #endif
8923 return false;
8924 #endif
8925 }
8926
8927 /* ========= Errata 44 ========= */
8928 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
8929 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
8930 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
8931 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
8932 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
8933 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
8934 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
8935 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
8936 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8937 #define NRF51_ERRATA_44_PRESENT 1
8938 #else
8939 #define NRF51_ERRATA_44_PRESENT 0
8940 #endif
8941
8942 #ifndef NRF51_ERRATA_44_ENABLE_WORKAROUND
8943 #define NRF51_ERRATA_44_ENABLE_WORKAROUND NRF51_ERRATA_44_PRESENT
8944 #endif
8945
nrf51_errata_44(void)8946 static bool nrf51_errata_44(void)
8947 {
8948 #ifndef NRF51_SERIES
8949 return false;
8950 #else
8951 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8952 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8953 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
8954 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
8955 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
8956 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
8957 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
8958 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
8959 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
8960 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
8961 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
8962 #endif
8963 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
8964 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
8965 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
8966 if (var1 == 0x01)
8967 {
8968 switch(var2)
8969 {
8970 case 0x00ul:
8971 return true;
8972 case 0x01ul:
8973 return true;
8974 case 0x02ul:
8975 return true;
8976 case 0x03ul:
8977 return true;
8978 case 0x04ul:
8979 return true;
8980 case 0x07ul:
8981 return false;
8982 case 0x08ul:
8983 return false;
8984 case 0x09ul:
8985 return false;
8986 case 0x0Aul:
8987 return false;
8988 case 0x0Bul:
8989 return false;
8990 case 0x0Cul:
8991 return false;
8992 case 0x0Dul:
8993 return false;
8994 default:
8995 return false;
8996 }
8997 }
8998 #endif
8999 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
9000 if (var1 == 0x01)
9001 {
9002 switch(var2)
9003 {
9004 case 0x00ul:
9005 return true;
9006 case 0x01ul:
9007 return true;
9008 case 0x02ul:
9009 return true;
9010 case 0x03ul:
9011 return true;
9012 case 0x04ul:
9013 return true;
9014 case 0x07ul:
9015 return false;
9016 case 0x08ul:
9017 return false;
9018 case 0x09ul:
9019 return false;
9020 case 0x0Aul:
9021 return false;
9022 case 0x0Bul:
9023 return false;
9024 case 0x0Cul:
9025 return false;
9026 case 0x0Dul:
9027 return false;
9028 default:
9029 return false;
9030 }
9031 }
9032 #endif
9033 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
9034 if (var1 == 0x01)
9035 {
9036 switch(var2)
9037 {
9038 case 0x00ul:
9039 return true;
9040 case 0x01ul:
9041 return true;
9042 case 0x02ul:
9043 return true;
9044 case 0x03ul:
9045 return true;
9046 case 0x04ul:
9047 return true;
9048 case 0x07ul:
9049 return false;
9050 case 0x08ul:
9051 return false;
9052 case 0x09ul:
9053 return false;
9054 case 0x0Aul:
9055 return false;
9056 case 0x0Bul:
9057 return false;
9058 case 0x0Cul:
9059 return false;
9060 case 0x0Dul:
9061 return false;
9062 default:
9063 return false;
9064 }
9065 }
9066 #endif
9067 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9068 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9069 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
9070 if (var1 == 0x01)
9071 {
9072 switch(var2)
9073 {
9074 case 0x00ul:
9075 return true;
9076 case 0x01ul:
9077 return true;
9078 case 0x02ul:
9079 return true;
9080 case 0x03ul:
9081 return true;
9082 case 0x04ul:
9083 return true;
9084 case 0x07ul:
9085 return false;
9086 case 0x08ul:
9087 return false;
9088 case 0x09ul:
9089 return false;
9090 case 0x0Aul:
9091 return false;
9092 case 0x0Bul:
9093 return false;
9094 case 0x0Cul:
9095 return false;
9096 case 0x0Dul:
9097 return false;
9098 default:
9099 return false;
9100 }
9101 }
9102 #endif
9103 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9104 if (var1 == 0x01)
9105 {
9106 switch(var2)
9107 {
9108 case 0x00ul:
9109 return true;
9110 case 0x01ul:
9111 return true;
9112 case 0x02ul:
9113 return true;
9114 case 0x03ul:
9115 return true;
9116 case 0x04ul:
9117 return true;
9118 case 0x07ul:
9119 return false;
9120 case 0x08ul:
9121 return false;
9122 case 0x09ul:
9123 return false;
9124 case 0x0Aul:
9125 return false;
9126 case 0x0Bul:
9127 return false;
9128 case 0x0Cul:
9129 return false;
9130 case 0x0Dul:
9131 return false;
9132 default:
9133 return false;
9134 }
9135 }
9136 #endif
9137 return false;
9138 #endif
9139 }
9140
9141 /* ========= Errata 45 ========= */
9142 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
9143 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
9144 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
9145 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
9146 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
9147 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
9148 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
9149 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
9150 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9151 #define NRF51_ERRATA_45_PRESENT 1
9152 #else
9153 #define NRF51_ERRATA_45_PRESENT 0
9154 #endif
9155
9156 #ifndef NRF51_ERRATA_45_ENABLE_WORKAROUND
9157 #define NRF51_ERRATA_45_ENABLE_WORKAROUND NRF51_ERRATA_45_PRESENT
9158 #endif
9159
nrf51_errata_45(void)9160 static bool nrf51_errata_45(void)
9161 {
9162 #ifndef NRF51_SERIES
9163 return false;
9164 #else
9165 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9166 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9167 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
9168 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
9169 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
9170 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9171 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9172 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
9173 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9174 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
9175 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
9176 #endif
9177 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9178 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9179 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
9180 if (var1 == 0x01)
9181 {
9182 switch(var2)
9183 {
9184 case 0x00ul:
9185 return true;
9186 case 0x01ul:
9187 return true;
9188 case 0x02ul:
9189 return true;
9190 case 0x03ul:
9191 return true;
9192 case 0x04ul:
9193 return true;
9194 case 0x07ul:
9195 return false;
9196 case 0x08ul:
9197 return false;
9198 case 0x09ul:
9199 return false;
9200 case 0x0Aul:
9201 return false;
9202 case 0x0Bul:
9203 return false;
9204 case 0x0Cul:
9205 return false;
9206 case 0x0Dul:
9207 return false;
9208 default:
9209 return false;
9210 }
9211 }
9212 #endif
9213 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
9214 if (var1 == 0x01)
9215 {
9216 switch(var2)
9217 {
9218 case 0x00ul:
9219 return true;
9220 case 0x01ul:
9221 return true;
9222 case 0x02ul:
9223 return true;
9224 case 0x03ul:
9225 return true;
9226 case 0x04ul:
9227 return true;
9228 case 0x07ul:
9229 return false;
9230 case 0x08ul:
9231 return false;
9232 case 0x09ul:
9233 return false;
9234 case 0x0Aul:
9235 return false;
9236 case 0x0Bul:
9237 return false;
9238 case 0x0Cul:
9239 return false;
9240 case 0x0Dul:
9241 return false;
9242 default:
9243 return false;
9244 }
9245 }
9246 #endif
9247 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
9248 if (var1 == 0x01)
9249 {
9250 switch(var2)
9251 {
9252 case 0x00ul:
9253 return true;
9254 case 0x01ul:
9255 return true;
9256 case 0x02ul:
9257 return true;
9258 case 0x03ul:
9259 return true;
9260 case 0x04ul:
9261 return true;
9262 case 0x07ul:
9263 return false;
9264 case 0x08ul:
9265 return false;
9266 case 0x09ul:
9267 return false;
9268 case 0x0Aul:
9269 return false;
9270 case 0x0Bul:
9271 return false;
9272 case 0x0Cul:
9273 return false;
9274 case 0x0Dul:
9275 return false;
9276 default:
9277 return false;
9278 }
9279 }
9280 #endif
9281 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9282 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9283 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
9284 if (var1 == 0x01)
9285 {
9286 switch(var2)
9287 {
9288 case 0x00ul:
9289 return true;
9290 case 0x01ul:
9291 return true;
9292 case 0x02ul:
9293 return true;
9294 case 0x03ul:
9295 return true;
9296 case 0x04ul:
9297 return true;
9298 case 0x07ul:
9299 return false;
9300 case 0x08ul:
9301 return false;
9302 case 0x09ul:
9303 return false;
9304 case 0x0Aul:
9305 return false;
9306 case 0x0Bul:
9307 return false;
9308 case 0x0Cul:
9309 return false;
9310 case 0x0Dul:
9311 return false;
9312 default:
9313 return false;
9314 }
9315 }
9316 #endif
9317 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9318 if (var1 == 0x01)
9319 {
9320 switch(var2)
9321 {
9322 case 0x00ul:
9323 return true;
9324 case 0x01ul:
9325 return true;
9326 case 0x02ul:
9327 return true;
9328 case 0x03ul:
9329 return true;
9330 case 0x04ul:
9331 return true;
9332 case 0x07ul:
9333 return false;
9334 case 0x08ul:
9335 return false;
9336 case 0x09ul:
9337 return false;
9338 case 0x0Aul:
9339 return false;
9340 case 0x0Bul:
9341 return false;
9342 case 0x0Cul:
9343 return false;
9344 case 0x0Dul:
9345 return false;
9346 default:
9347 return false;
9348 }
9349 }
9350 #endif
9351 return false;
9352 #endif
9353 }
9354
9355 /* ========= Errata 46 ========= */
9356 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
9357 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
9358 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
9359 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
9360 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
9361 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
9362 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
9363 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
9364 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9365 #define NRF51_ERRATA_46_PRESENT 1
9366 #else
9367 #define NRF51_ERRATA_46_PRESENT 0
9368 #endif
9369
9370 #ifndef NRF51_ERRATA_46_ENABLE_WORKAROUND
9371 #define NRF51_ERRATA_46_ENABLE_WORKAROUND NRF51_ERRATA_46_PRESENT
9372 #endif
9373
nrf51_errata_46(void)9374 static bool nrf51_errata_46(void)
9375 {
9376 #ifndef NRF51_SERIES
9377 return false;
9378 #else
9379 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9380 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9381 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
9382 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
9383 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
9384 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9385 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9386 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
9387 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9388 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
9389 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
9390 #endif
9391 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9392 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9393 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
9394 if (var1 == 0x01)
9395 {
9396 switch(var2)
9397 {
9398 case 0x00ul:
9399 return false;
9400 case 0x01ul:
9401 return false;
9402 case 0x02ul:
9403 return true;
9404 case 0x03ul:
9405 return false;
9406 case 0x04ul:
9407 return true;
9408 case 0x07ul:
9409 return true;
9410 case 0x08ul:
9411 return true;
9412 case 0x09ul:
9413 return true;
9414 case 0x0Aul:
9415 return false;
9416 case 0x0Bul:
9417 return true;
9418 case 0x0Cul:
9419 return true;
9420 case 0x0Dul:
9421 return false;
9422 default:
9423 return false;
9424 }
9425 }
9426 #endif
9427 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
9428 if (var1 == 0x01)
9429 {
9430 switch(var2)
9431 {
9432 case 0x00ul:
9433 return false;
9434 case 0x01ul:
9435 return false;
9436 case 0x02ul:
9437 return true;
9438 case 0x03ul:
9439 return false;
9440 case 0x04ul:
9441 return true;
9442 case 0x07ul:
9443 return true;
9444 case 0x08ul:
9445 return true;
9446 case 0x09ul:
9447 return true;
9448 case 0x0Aul:
9449 return false;
9450 case 0x0Bul:
9451 return true;
9452 case 0x0Cul:
9453 return true;
9454 case 0x0Dul:
9455 return false;
9456 default:
9457 return false;
9458 }
9459 }
9460 #endif
9461 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
9462 if (var1 == 0x01)
9463 {
9464 switch(var2)
9465 {
9466 case 0x00ul:
9467 return false;
9468 case 0x01ul:
9469 return false;
9470 case 0x02ul:
9471 return true;
9472 case 0x03ul:
9473 return false;
9474 case 0x04ul:
9475 return true;
9476 case 0x07ul:
9477 return true;
9478 case 0x08ul:
9479 return true;
9480 case 0x09ul:
9481 return true;
9482 case 0x0Aul:
9483 return false;
9484 case 0x0Bul:
9485 return true;
9486 case 0x0Cul:
9487 return true;
9488 case 0x0Dul:
9489 return false;
9490 default:
9491 return false;
9492 }
9493 }
9494 #endif
9495 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9496 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9497 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
9498 if (var1 == 0x01)
9499 {
9500 switch(var2)
9501 {
9502 case 0x00ul:
9503 return false;
9504 case 0x01ul:
9505 return false;
9506 case 0x02ul:
9507 return true;
9508 case 0x03ul:
9509 return false;
9510 case 0x04ul:
9511 return true;
9512 case 0x07ul:
9513 return true;
9514 case 0x08ul:
9515 return true;
9516 case 0x09ul:
9517 return true;
9518 case 0x0Aul:
9519 return false;
9520 case 0x0Bul:
9521 return true;
9522 case 0x0Cul:
9523 return true;
9524 case 0x0Dul:
9525 return false;
9526 default:
9527 return false;
9528 }
9529 }
9530 #endif
9531 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9532 if (var1 == 0x01)
9533 {
9534 switch(var2)
9535 {
9536 case 0x00ul:
9537 return false;
9538 case 0x01ul:
9539 return false;
9540 case 0x02ul:
9541 return true;
9542 case 0x03ul:
9543 return false;
9544 case 0x04ul:
9545 return true;
9546 case 0x07ul:
9547 return true;
9548 case 0x08ul:
9549 return true;
9550 case 0x09ul:
9551 return true;
9552 case 0x0Aul:
9553 return false;
9554 case 0x0Bul:
9555 return true;
9556 case 0x0Cul:
9557 return true;
9558 case 0x0Dul:
9559 return false;
9560 default:
9561 return false;
9562 }
9563 }
9564 #endif
9565 return false;
9566 #endif
9567 }
9568
9569 /* ========= Errata 47 ========= */
9570 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
9571 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
9572 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
9573 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
9574 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
9575 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
9576 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
9577 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
9578 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9579 #define NRF51_ERRATA_47_PRESENT 1
9580 #else
9581 #define NRF51_ERRATA_47_PRESENT 0
9582 #endif
9583
9584 #ifndef NRF51_ERRATA_47_ENABLE_WORKAROUND
9585 #define NRF51_ERRATA_47_ENABLE_WORKAROUND NRF51_ERRATA_47_PRESENT
9586 #endif
9587
nrf51_errata_47(void)9588 static bool nrf51_errata_47(void)
9589 {
9590 #ifndef NRF51_SERIES
9591 return false;
9592 #else
9593 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9594 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9595 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
9596 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
9597 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
9598 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9599 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9600 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
9601 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9602 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
9603 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
9604 #endif
9605 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9606 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9607 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
9608 if (var1 == 0x01)
9609 {
9610 switch(var2)
9611 {
9612 case 0x00ul:
9613 return true;
9614 case 0x01ul:
9615 return true;
9616 case 0x02ul:
9617 return true;
9618 case 0x03ul:
9619 return true;
9620 case 0x04ul:
9621 return true;
9622 case 0x07ul:
9623 return false;
9624 case 0x08ul:
9625 return false;
9626 case 0x09ul:
9627 return false;
9628 case 0x0Aul:
9629 return false;
9630 case 0x0Bul:
9631 return false;
9632 case 0x0Cul:
9633 return false;
9634 case 0x0Dul:
9635 return false;
9636 default:
9637 return false;
9638 }
9639 }
9640 #endif
9641 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
9642 if (var1 == 0x01)
9643 {
9644 switch(var2)
9645 {
9646 case 0x00ul:
9647 return true;
9648 case 0x01ul:
9649 return true;
9650 case 0x02ul:
9651 return true;
9652 case 0x03ul:
9653 return true;
9654 case 0x04ul:
9655 return true;
9656 case 0x07ul:
9657 return false;
9658 case 0x08ul:
9659 return false;
9660 case 0x09ul:
9661 return false;
9662 case 0x0Aul:
9663 return false;
9664 case 0x0Bul:
9665 return false;
9666 case 0x0Cul:
9667 return false;
9668 case 0x0Dul:
9669 return false;
9670 default:
9671 return false;
9672 }
9673 }
9674 #endif
9675 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
9676 if (var1 == 0x01)
9677 {
9678 switch(var2)
9679 {
9680 case 0x00ul:
9681 return true;
9682 case 0x01ul:
9683 return true;
9684 case 0x02ul:
9685 return true;
9686 case 0x03ul:
9687 return true;
9688 case 0x04ul:
9689 return true;
9690 case 0x07ul:
9691 return false;
9692 case 0x08ul:
9693 return false;
9694 case 0x09ul:
9695 return false;
9696 case 0x0Aul:
9697 return false;
9698 case 0x0Bul:
9699 return false;
9700 case 0x0Cul:
9701 return false;
9702 case 0x0Dul:
9703 return false;
9704 default:
9705 return false;
9706 }
9707 }
9708 #endif
9709 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9710 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9711 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
9712 if (var1 == 0x01)
9713 {
9714 switch(var2)
9715 {
9716 case 0x00ul:
9717 return true;
9718 case 0x01ul:
9719 return true;
9720 case 0x02ul:
9721 return true;
9722 case 0x03ul:
9723 return true;
9724 case 0x04ul:
9725 return true;
9726 case 0x07ul:
9727 return false;
9728 case 0x08ul:
9729 return false;
9730 case 0x09ul:
9731 return false;
9732 case 0x0Aul:
9733 return false;
9734 case 0x0Bul:
9735 return false;
9736 case 0x0Cul:
9737 return false;
9738 case 0x0Dul:
9739 return false;
9740 default:
9741 return false;
9742 }
9743 }
9744 #endif
9745 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9746 if (var1 == 0x01)
9747 {
9748 switch(var2)
9749 {
9750 case 0x00ul:
9751 return true;
9752 case 0x01ul:
9753 return true;
9754 case 0x02ul:
9755 return true;
9756 case 0x03ul:
9757 return true;
9758 case 0x04ul:
9759 return true;
9760 case 0x07ul:
9761 return false;
9762 case 0x08ul:
9763 return false;
9764 case 0x09ul:
9765 return false;
9766 case 0x0Aul:
9767 return false;
9768 case 0x0Bul:
9769 return false;
9770 case 0x0Cul:
9771 return false;
9772 case 0x0Dul:
9773 return false;
9774 default:
9775 return false;
9776 }
9777 }
9778 #endif
9779 return false;
9780 #endif
9781 }
9782
9783 /* ========= Errata 48 ========= */
9784 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
9785 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
9786 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
9787 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
9788 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
9789 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
9790 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
9791 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
9792 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9793 #define NRF51_ERRATA_48_PRESENT 1
9794 #else
9795 #define NRF51_ERRATA_48_PRESENT 0
9796 #endif
9797
9798 #ifndef NRF51_ERRATA_48_ENABLE_WORKAROUND
9799 #define NRF51_ERRATA_48_ENABLE_WORKAROUND NRF51_ERRATA_48_PRESENT
9800 #endif
9801
nrf51_errata_48(void)9802 static bool nrf51_errata_48(void)
9803 {
9804 #ifndef NRF51_SERIES
9805 return false;
9806 #else
9807 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9808 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9809 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
9810 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
9811 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
9812 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9813 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9814 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
9815 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9816 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
9817 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
9818 #endif
9819 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
9820 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
9821 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
9822 if (var1 == 0x01)
9823 {
9824 switch(var2)
9825 {
9826 case 0x00ul:
9827 return true;
9828 case 0x01ul:
9829 return true;
9830 case 0x02ul:
9831 return true;
9832 case 0x03ul:
9833 return true;
9834 case 0x04ul:
9835 return true;
9836 case 0x07ul:
9837 return false;
9838 case 0x08ul:
9839 return false;
9840 case 0x09ul:
9841 return false;
9842 case 0x0Aul:
9843 return false;
9844 case 0x0Bul:
9845 return false;
9846 case 0x0Cul:
9847 return false;
9848 case 0x0Dul:
9849 return false;
9850 default:
9851 return false;
9852 }
9853 }
9854 #endif
9855 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
9856 if (var1 == 0x01)
9857 {
9858 switch(var2)
9859 {
9860 case 0x00ul:
9861 return true;
9862 case 0x01ul:
9863 return true;
9864 case 0x02ul:
9865 return true;
9866 case 0x03ul:
9867 return true;
9868 case 0x04ul:
9869 return true;
9870 case 0x07ul:
9871 return false;
9872 case 0x08ul:
9873 return false;
9874 case 0x09ul:
9875 return false;
9876 case 0x0Aul:
9877 return false;
9878 case 0x0Bul:
9879 return false;
9880 case 0x0Cul:
9881 return false;
9882 case 0x0Dul:
9883 return false;
9884 default:
9885 return false;
9886 }
9887 }
9888 #endif
9889 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
9890 if (var1 == 0x01)
9891 {
9892 switch(var2)
9893 {
9894 case 0x00ul:
9895 return true;
9896 case 0x01ul:
9897 return true;
9898 case 0x02ul:
9899 return true;
9900 case 0x03ul:
9901 return true;
9902 case 0x04ul:
9903 return true;
9904 case 0x07ul:
9905 return false;
9906 case 0x08ul:
9907 return false;
9908 case 0x09ul:
9909 return false;
9910 case 0x0Aul:
9911 return false;
9912 case 0x0Bul:
9913 return false;
9914 case 0x0Cul:
9915 return false;
9916 case 0x0Dul:
9917 return false;
9918 default:
9919 return false;
9920 }
9921 }
9922 #endif
9923 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
9924 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
9925 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
9926 if (var1 == 0x01)
9927 {
9928 switch(var2)
9929 {
9930 case 0x00ul:
9931 return true;
9932 case 0x01ul:
9933 return true;
9934 case 0x02ul:
9935 return true;
9936 case 0x03ul:
9937 return true;
9938 case 0x04ul:
9939 return true;
9940 case 0x07ul:
9941 return false;
9942 case 0x08ul:
9943 return false;
9944 case 0x09ul:
9945 return false;
9946 case 0x0Aul:
9947 return false;
9948 case 0x0Bul:
9949 return false;
9950 case 0x0Cul:
9951 return false;
9952 case 0x0Dul:
9953 return false;
9954 default:
9955 return false;
9956 }
9957 }
9958 #endif
9959 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
9960 if (var1 == 0x01)
9961 {
9962 switch(var2)
9963 {
9964 case 0x00ul:
9965 return true;
9966 case 0x01ul:
9967 return true;
9968 case 0x02ul:
9969 return true;
9970 case 0x03ul:
9971 return true;
9972 case 0x04ul:
9973 return true;
9974 case 0x07ul:
9975 return false;
9976 case 0x08ul:
9977 return false;
9978 case 0x09ul:
9979 return false;
9980 case 0x0Aul:
9981 return false;
9982 case 0x0Bul:
9983 return false;
9984 case 0x0Cul:
9985 return false;
9986 case 0x0Dul:
9987 return false;
9988 default:
9989 return false;
9990 }
9991 }
9992 #endif
9993 return false;
9994 #endif
9995 }
9996
9997 /* ========= Errata 49 ========= */
9998 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
9999 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
10000 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
10001 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
10002 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
10003 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
10004 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
10005 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
10006 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10007 #define NRF51_ERRATA_49_PRESENT 1
10008 #else
10009 #define NRF51_ERRATA_49_PRESENT 0
10010 #endif
10011
10012 #ifndef NRF51_ERRATA_49_ENABLE_WORKAROUND
10013 #define NRF51_ERRATA_49_ENABLE_WORKAROUND NRF51_ERRATA_49_PRESENT
10014 #endif
10015
nrf51_errata_49(void)10016 static bool nrf51_errata_49(void)
10017 {
10018 #ifndef NRF51_SERIES
10019 return false;
10020 #else
10021 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10022 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10023 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
10024 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
10025 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
10026 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10027 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10028 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
10029 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10030 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
10031 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
10032 #endif
10033 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10034 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10035 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
10036 if (var1 == 0x01)
10037 {
10038 switch(var2)
10039 {
10040 case 0x00ul:
10041 return false;
10042 case 0x01ul:
10043 return false;
10044 case 0x02ul:
10045 return true;
10046 case 0x03ul:
10047 return false;
10048 case 0x04ul:
10049 return true;
10050 case 0x07ul:
10051 return false;
10052 case 0x08ul:
10053 return false;
10054 case 0x09ul:
10055 return false;
10056 case 0x0Aul:
10057 return false;
10058 case 0x0Bul:
10059 return false;
10060 case 0x0Cul:
10061 return false;
10062 case 0x0Dul:
10063 return false;
10064 default:
10065 return false;
10066 }
10067 }
10068 #endif
10069 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
10070 if (var1 == 0x01)
10071 {
10072 switch(var2)
10073 {
10074 case 0x00ul:
10075 return false;
10076 case 0x01ul:
10077 return false;
10078 case 0x02ul:
10079 return true;
10080 case 0x03ul:
10081 return false;
10082 case 0x04ul:
10083 return true;
10084 case 0x07ul:
10085 return false;
10086 case 0x08ul:
10087 return false;
10088 case 0x09ul:
10089 return false;
10090 case 0x0Aul:
10091 return false;
10092 case 0x0Bul:
10093 return false;
10094 case 0x0Cul:
10095 return false;
10096 case 0x0Dul:
10097 return false;
10098 default:
10099 return false;
10100 }
10101 }
10102 #endif
10103 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
10104 if (var1 == 0x01)
10105 {
10106 switch(var2)
10107 {
10108 case 0x00ul:
10109 return false;
10110 case 0x01ul:
10111 return false;
10112 case 0x02ul:
10113 return true;
10114 case 0x03ul:
10115 return false;
10116 case 0x04ul:
10117 return true;
10118 case 0x07ul:
10119 return false;
10120 case 0x08ul:
10121 return false;
10122 case 0x09ul:
10123 return false;
10124 case 0x0Aul:
10125 return false;
10126 case 0x0Bul:
10127 return false;
10128 case 0x0Cul:
10129 return false;
10130 case 0x0Dul:
10131 return false;
10132 default:
10133 return false;
10134 }
10135 }
10136 #endif
10137 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10138 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10139 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
10140 if (var1 == 0x01)
10141 {
10142 switch(var2)
10143 {
10144 case 0x00ul:
10145 return false;
10146 case 0x01ul:
10147 return false;
10148 case 0x02ul:
10149 return true;
10150 case 0x03ul:
10151 return false;
10152 case 0x04ul:
10153 return true;
10154 case 0x07ul:
10155 return false;
10156 case 0x08ul:
10157 return false;
10158 case 0x09ul:
10159 return false;
10160 case 0x0Aul:
10161 return false;
10162 case 0x0Bul:
10163 return false;
10164 case 0x0Cul:
10165 return false;
10166 case 0x0Dul:
10167 return false;
10168 default:
10169 return false;
10170 }
10171 }
10172 #endif
10173 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10174 if (var1 == 0x01)
10175 {
10176 switch(var2)
10177 {
10178 case 0x00ul:
10179 return false;
10180 case 0x01ul:
10181 return false;
10182 case 0x02ul:
10183 return true;
10184 case 0x03ul:
10185 return false;
10186 case 0x04ul:
10187 return true;
10188 case 0x07ul:
10189 return false;
10190 case 0x08ul:
10191 return false;
10192 case 0x09ul:
10193 return false;
10194 case 0x0Aul:
10195 return false;
10196 case 0x0Bul:
10197 return false;
10198 case 0x0Cul:
10199 return false;
10200 case 0x0Dul:
10201 return false;
10202 default:
10203 return false;
10204 }
10205 }
10206 #endif
10207 return false;
10208 #endif
10209 }
10210
10211 /* ========= Errata 50 ========= */
10212 #define NRF51_ERRATA_50_PRESENT 0
10213
10214 #ifndef NRF51_ERRATA_50_ENABLE_WORKAROUND
10215 #define NRF51_ERRATA_50_ENABLE_WORKAROUND NRF51_ERRATA_50_PRESENT
10216 #endif
10217
nrf51_errata_50(void)10218 static bool nrf51_errata_50(void)
10219 {
10220 #ifndef NRF51_SERIES
10221 return false;
10222 #else
10223 return false;
10224 #endif
10225 }
10226
10227 /* ========= Errata 51 ========= */
10228 #define NRF51_ERRATA_51_PRESENT 0
10229
10230 #ifndef NRF51_ERRATA_51_ENABLE_WORKAROUND
10231 #define NRF51_ERRATA_51_ENABLE_WORKAROUND NRF51_ERRATA_51_PRESENT
10232 #endif
10233
nrf51_errata_51(void)10234 static bool nrf51_errata_51(void)
10235 {
10236 #ifndef NRF51_SERIES
10237 return false;
10238 #else
10239 return false;
10240 #endif
10241 }
10242
10243 /* ========= Errata 52 ========= */
10244 #define NRF51_ERRATA_52_PRESENT 0
10245
10246 #ifndef NRF51_ERRATA_52_ENABLE_WORKAROUND
10247 #define NRF51_ERRATA_52_ENABLE_WORKAROUND NRF51_ERRATA_52_PRESENT
10248 #endif
10249
nrf51_errata_52(void)10250 static bool nrf51_errata_52(void)
10251 {
10252 #ifndef NRF51_SERIES
10253 return false;
10254 #else
10255 return false;
10256 #endif
10257 }
10258
10259 /* ========= Errata 53 ========= */
10260 #define NRF51_ERRATA_53_PRESENT 0
10261
10262 #ifndef NRF51_ERRATA_53_ENABLE_WORKAROUND
10263 #define NRF51_ERRATA_53_ENABLE_WORKAROUND NRF51_ERRATA_53_PRESENT
10264 #endif
10265
nrf51_errata_53(void)10266 static bool nrf51_errata_53(void)
10267 {
10268 #ifndef NRF51_SERIES
10269 return false;
10270 #else
10271 return false;
10272 #endif
10273 }
10274
10275 /* ========= Errata 54 ========= */
10276 #define NRF51_ERRATA_54_PRESENT 0
10277
10278 #ifndef NRF51_ERRATA_54_ENABLE_WORKAROUND
10279 #define NRF51_ERRATA_54_ENABLE_WORKAROUND NRF51_ERRATA_54_PRESENT
10280 #endif
10281
nrf51_errata_54(void)10282 static bool nrf51_errata_54(void)
10283 {
10284 #ifndef NRF51_SERIES
10285 return false;
10286 #else
10287 return false;
10288 #endif
10289 }
10290
10291 /* ========= Errata 55 ========= */
10292 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
10293 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
10294 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
10295 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
10296 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
10297 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
10298 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
10299 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
10300 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10301 #define NRF51_ERRATA_55_PRESENT 1
10302 #else
10303 #define NRF51_ERRATA_55_PRESENT 0
10304 #endif
10305
10306 #ifndef NRF51_ERRATA_55_ENABLE_WORKAROUND
10307 #define NRF51_ERRATA_55_ENABLE_WORKAROUND NRF51_ERRATA_55_PRESENT
10308 #endif
10309
nrf51_errata_55(void)10310 static bool nrf51_errata_55(void)
10311 {
10312 #ifndef NRF51_SERIES
10313 return false;
10314 #else
10315 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10316 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10317 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
10318 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
10319 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
10320 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10321 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10322 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
10323 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10324 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
10325 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
10326 #endif
10327 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10328 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10329 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
10330 if (var1 == 0x01)
10331 {
10332 switch(var2)
10333 {
10334 case 0x00ul:
10335 return true;
10336 case 0x01ul:
10337 return true;
10338 case 0x02ul:
10339 return false;
10340 case 0x03ul:
10341 return true;
10342 case 0x04ul:
10343 return false;
10344 case 0x07ul:
10345 return false;
10346 case 0x08ul:
10347 return false;
10348 case 0x09ul:
10349 return false;
10350 case 0x0Aul:
10351 return false;
10352 case 0x0Bul:
10353 return false;
10354 case 0x0Cul:
10355 return false;
10356 case 0x0Dul:
10357 return false;
10358 default:
10359 return false;
10360 }
10361 }
10362 #endif
10363 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
10364 if (var1 == 0x01)
10365 {
10366 switch(var2)
10367 {
10368 case 0x00ul:
10369 return true;
10370 case 0x01ul:
10371 return true;
10372 case 0x02ul:
10373 return false;
10374 case 0x03ul:
10375 return true;
10376 case 0x04ul:
10377 return false;
10378 case 0x07ul:
10379 return false;
10380 case 0x08ul:
10381 return false;
10382 case 0x09ul:
10383 return false;
10384 case 0x0Aul:
10385 return false;
10386 case 0x0Bul:
10387 return false;
10388 case 0x0Cul:
10389 return false;
10390 case 0x0Dul:
10391 return false;
10392 default:
10393 return false;
10394 }
10395 }
10396 #endif
10397 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
10398 if (var1 == 0x01)
10399 {
10400 switch(var2)
10401 {
10402 case 0x00ul:
10403 return true;
10404 case 0x01ul:
10405 return true;
10406 case 0x02ul:
10407 return false;
10408 case 0x03ul:
10409 return true;
10410 case 0x04ul:
10411 return false;
10412 case 0x07ul:
10413 return false;
10414 case 0x08ul:
10415 return false;
10416 case 0x09ul:
10417 return false;
10418 case 0x0Aul:
10419 return false;
10420 case 0x0Bul:
10421 return false;
10422 case 0x0Cul:
10423 return false;
10424 case 0x0Dul:
10425 return false;
10426 default:
10427 return false;
10428 }
10429 }
10430 #endif
10431 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10432 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10433 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
10434 if (var1 == 0x01)
10435 {
10436 switch(var2)
10437 {
10438 case 0x00ul:
10439 return true;
10440 case 0x01ul:
10441 return true;
10442 case 0x02ul:
10443 return false;
10444 case 0x03ul:
10445 return true;
10446 case 0x04ul:
10447 return false;
10448 case 0x07ul:
10449 return false;
10450 case 0x08ul:
10451 return false;
10452 case 0x09ul:
10453 return false;
10454 case 0x0Aul:
10455 return false;
10456 case 0x0Bul:
10457 return false;
10458 case 0x0Cul:
10459 return false;
10460 case 0x0Dul:
10461 return false;
10462 default:
10463 return false;
10464 }
10465 }
10466 #endif
10467 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10468 if (var1 == 0x01)
10469 {
10470 switch(var2)
10471 {
10472 case 0x00ul:
10473 return true;
10474 case 0x01ul:
10475 return true;
10476 case 0x02ul:
10477 return false;
10478 case 0x03ul:
10479 return true;
10480 case 0x04ul:
10481 return false;
10482 case 0x07ul:
10483 return false;
10484 case 0x08ul:
10485 return false;
10486 case 0x09ul:
10487 return false;
10488 case 0x0Aul:
10489 return false;
10490 case 0x0Bul:
10491 return false;
10492 case 0x0Cul:
10493 return false;
10494 case 0x0Dul:
10495 return false;
10496 default:
10497 return false;
10498 }
10499 }
10500 #endif
10501 return false;
10502 #endif
10503 }
10504
10505 /* ========= Errata 56 ========= */
10506 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
10507 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
10508 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
10509 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
10510 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
10511 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
10512 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
10513 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
10514 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10515 #define NRF51_ERRATA_56_PRESENT 1
10516 #else
10517 #define NRF51_ERRATA_56_PRESENT 0
10518 #endif
10519
10520 #ifndef NRF51_ERRATA_56_ENABLE_WORKAROUND
10521 #define NRF51_ERRATA_56_ENABLE_WORKAROUND NRF51_ERRATA_56_PRESENT
10522 #endif
10523
nrf51_errata_56(void)10524 static bool nrf51_errata_56(void)
10525 {
10526 #ifndef NRF51_SERIES
10527 return false;
10528 #else
10529 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10530 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10531 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
10532 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
10533 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
10534 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10535 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10536 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
10537 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10538 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
10539 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
10540 #endif
10541 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10542 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10543 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
10544 if (var1 == 0x01)
10545 {
10546 switch(var2)
10547 {
10548 case 0x00ul:
10549 return true;
10550 case 0x01ul:
10551 return true;
10552 case 0x02ul:
10553 return true;
10554 case 0x03ul:
10555 return true;
10556 case 0x04ul:
10557 return true;
10558 case 0x07ul:
10559 return false;
10560 case 0x08ul:
10561 return false;
10562 case 0x09ul:
10563 return false;
10564 case 0x0Aul:
10565 return false;
10566 case 0x0Bul:
10567 return false;
10568 case 0x0Cul:
10569 return false;
10570 case 0x0Dul:
10571 return false;
10572 default:
10573 return false;
10574 }
10575 }
10576 #endif
10577 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
10578 if (var1 == 0x01)
10579 {
10580 switch(var2)
10581 {
10582 case 0x00ul:
10583 return true;
10584 case 0x01ul:
10585 return true;
10586 case 0x02ul:
10587 return true;
10588 case 0x03ul:
10589 return true;
10590 case 0x04ul:
10591 return true;
10592 case 0x07ul:
10593 return false;
10594 case 0x08ul:
10595 return false;
10596 case 0x09ul:
10597 return false;
10598 case 0x0Aul:
10599 return false;
10600 case 0x0Bul:
10601 return false;
10602 case 0x0Cul:
10603 return false;
10604 case 0x0Dul:
10605 return false;
10606 default:
10607 return false;
10608 }
10609 }
10610 #endif
10611 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
10612 if (var1 == 0x01)
10613 {
10614 switch(var2)
10615 {
10616 case 0x00ul:
10617 return true;
10618 case 0x01ul:
10619 return true;
10620 case 0x02ul:
10621 return true;
10622 case 0x03ul:
10623 return true;
10624 case 0x04ul:
10625 return true;
10626 case 0x07ul:
10627 return false;
10628 case 0x08ul:
10629 return false;
10630 case 0x09ul:
10631 return false;
10632 case 0x0Aul:
10633 return false;
10634 case 0x0Bul:
10635 return false;
10636 case 0x0Cul:
10637 return false;
10638 case 0x0Dul:
10639 return false;
10640 default:
10641 return false;
10642 }
10643 }
10644 #endif
10645 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10646 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10647 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
10648 if (var1 == 0x01)
10649 {
10650 switch(var2)
10651 {
10652 case 0x00ul:
10653 return true;
10654 case 0x01ul:
10655 return true;
10656 case 0x02ul:
10657 return true;
10658 case 0x03ul:
10659 return true;
10660 case 0x04ul:
10661 return true;
10662 case 0x07ul:
10663 return false;
10664 case 0x08ul:
10665 return false;
10666 case 0x09ul:
10667 return false;
10668 case 0x0Aul:
10669 return false;
10670 case 0x0Bul:
10671 return false;
10672 case 0x0Cul:
10673 return false;
10674 case 0x0Dul:
10675 return false;
10676 default:
10677 return false;
10678 }
10679 }
10680 #endif
10681 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10682 if (var1 == 0x01)
10683 {
10684 switch(var2)
10685 {
10686 case 0x00ul:
10687 return true;
10688 case 0x01ul:
10689 return true;
10690 case 0x02ul:
10691 return true;
10692 case 0x03ul:
10693 return true;
10694 case 0x04ul:
10695 return true;
10696 case 0x07ul:
10697 return false;
10698 case 0x08ul:
10699 return false;
10700 case 0x09ul:
10701 return false;
10702 case 0x0Aul:
10703 return false;
10704 case 0x0Bul:
10705 return false;
10706 case 0x0Cul:
10707 return false;
10708 case 0x0Dul:
10709 return false;
10710 default:
10711 return false;
10712 }
10713 }
10714 #endif
10715 return false;
10716 #endif
10717 }
10718
10719 /* ========= Errata 57 ========= */
10720 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
10721 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
10722 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
10723 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
10724 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
10725 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
10726 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
10727 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
10728 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10729 #define NRF51_ERRATA_57_PRESENT 1
10730 #else
10731 #define NRF51_ERRATA_57_PRESENT 0
10732 #endif
10733
10734 #ifndef NRF51_ERRATA_57_ENABLE_WORKAROUND
10735 #define NRF51_ERRATA_57_ENABLE_WORKAROUND NRF51_ERRATA_57_PRESENT
10736 #endif
10737
nrf51_errata_57(void)10738 static bool nrf51_errata_57(void)
10739 {
10740 #ifndef NRF51_SERIES
10741 return false;
10742 #else
10743 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10744 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10745 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
10746 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
10747 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
10748 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10749 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10750 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
10751 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10752 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
10753 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
10754 #endif
10755 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10756 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10757 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
10758 if (var1 == 0x01)
10759 {
10760 switch(var2)
10761 {
10762 case 0x00ul:
10763 return true;
10764 case 0x01ul:
10765 return true;
10766 case 0x02ul:
10767 return true;
10768 case 0x03ul:
10769 return true;
10770 case 0x04ul:
10771 return true;
10772 case 0x07ul:
10773 return false;
10774 case 0x08ul:
10775 return false;
10776 case 0x09ul:
10777 return false;
10778 case 0x0Aul:
10779 return false;
10780 case 0x0Bul:
10781 return false;
10782 case 0x0Cul:
10783 return false;
10784 case 0x0Dul:
10785 return false;
10786 default:
10787 return false;
10788 }
10789 }
10790 #endif
10791 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
10792 if (var1 == 0x01)
10793 {
10794 switch(var2)
10795 {
10796 case 0x00ul:
10797 return true;
10798 case 0x01ul:
10799 return true;
10800 case 0x02ul:
10801 return true;
10802 case 0x03ul:
10803 return true;
10804 case 0x04ul:
10805 return true;
10806 case 0x07ul:
10807 return false;
10808 case 0x08ul:
10809 return false;
10810 case 0x09ul:
10811 return false;
10812 case 0x0Aul:
10813 return false;
10814 case 0x0Bul:
10815 return false;
10816 case 0x0Cul:
10817 return false;
10818 case 0x0Dul:
10819 return false;
10820 default:
10821 return false;
10822 }
10823 }
10824 #endif
10825 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
10826 if (var1 == 0x01)
10827 {
10828 switch(var2)
10829 {
10830 case 0x00ul:
10831 return true;
10832 case 0x01ul:
10833 return true;
10834 case 0x02ul:
10835 return true;
10836 case 0x03ul:
10837 return true;
10838 case 0x04ul:
10839 return true;
10840 case 0x07ul:
10841 return false;
10842 case 0x08ul:
10843 return false;
10844 case 0x09ul:
10845 return false;
10846 case 0x0Aul:
10847 return false;
10848 case 0x0Bul:
10849 return false;
10850 case 0x0Cul:
10851 return false;
10852 case 0x0Dul:
10853 return false;
10854 default:
10855 return false;
10856 }
10857 }
10858 #endif
10859 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10860 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10861 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
10862 if (var1 == 0x01)
10863 {
10864 switch(var2)
10865 {
10866 case 0x00ul:
10867 return true;
10868 case 0x01ul:
10869 return true;
10870 case 0x02ul:
10871 return true;
10872 case 0x03ul:
10873 return true;
10874 case 0x04ul:
10875 return true;
10876 case 0x07ul:
10877 return false;
10878 case 0x08ul:
10879 return false;
10880 case 0x09ul:
10881 return false;
10882 case 0x0Aul:
10883 return false;
10884 case 0x0Bul:
10885 return false;
10886 case 0x0Cul:
10887 return false;
10888 case 0x0Dul:
10889 return false;
10890 default:
10891 return false;
10892 }
10893 }
10894 #endif
10895 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10896 if (var1 == 0x01)
10897 {
10898 switch(var2)
10899 {
10900 case 0x00ul:
10901 return true;
10902 case 0x01ul:
10903 return true;
10904 case 0x02ul:
10905 return true;
10906 case 0x03ul:
10907 return true;
10908 case 0x04ul:
10909 return true;
10910 case 0x07ul:
10911 return false;
10912 case 0x08ul:
10913 return false;
10914 case 0x09ul:
10915 return false;
10916 case 0x0Aul:
10917 return false;
10918 case 0x0Bul:
10919 return false;
10920 case 0x0Cul:
10921 return false;
10922 case 0x0Dul:
10923 return false;
10924 default:
10925 return false;
10926 }
10927 }
10928 #endif
10929 return false;
10930 #endif
10931 }
10932
10933 /* ========= Errata 58 ========= */
10934 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
10935 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
10936 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
10937 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
10938 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
10939 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
10940 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
10941 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
10942 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10943 #define NRF51_ERRATA_58_PRESENT 1
10944 #else
10945 #define NRF51_ERRATA_58_PRESENT 0
10946 #endif
10947
10948 #ifndef NRF51_ERRATA_58_ENABLE_WORKAROUND
10949 #define NRF51_ERRATA_58_ENABLE_WORKAROUND NRF51_ERRATA_58_PRESENT
10950 #endif
10951
nrf51_errata_58(void)10952 static bool nrf51_errata_58(void)
10953 {
10954 #ifndef NRF51_SERIES
10955 return false;
10956 #else
10957 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10958 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10959 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
10960 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
10961 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
10962 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
10963 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
10964 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
10965 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
10966 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
10967 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
10968 #endif
10969 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
10970 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
10971 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
10972 if (var1 == 0x01)
10973 {
10974 switch(var2)
10975 {
10976 case 0x00ul:
10977 return false;
10978 case 0x01ul:
10979 return false;
10980 case 0x02ul:
10981 return true;
10982 case 0x03ul:
10983 return false;
10984 case 0x04ul:
10985 return true;
10986 case 0x07ul:
10987 return false;
10988 case 0x08ul:
10989 return false;
10990 case 0x09ul:
10991 return false;
10992 case 0x0Aul:
10993 return false;
10994 case 0x0Bul:
10995 return false;
10996 case 0x0Cul:
10997 return false;
10998 case 0x0Dul:
10999 return false;
11000 default:
11001 return false;
11002 }
11003 }
11004 #endif
11005 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
11006 if (var1 == 0x01)
11007 {
11008 switch(var2)
11009 {
11010 case 0x00ul:
11011 return false;
11012 case 0x01ul:
11013 return false;
11014 case 0x02ul:
11015 return true;
11016 case 0x03ul:
11017 return false;
11018 case 0x04ul:
11019 return true;
11020 case 0x07ul:
11021 return false;
11022 case 0x08ul:
11023 return false;
11024 case 0x09ul:
11025 return false;
11026 case 0x0Aul:
11027 return false;
11028 case 0x0Bul:
11029 return false;
11030 case 0x0Cul:
11031 return false;
11032 case 0x0Dul:
11033 return false;
11034 default:
11035 return false;
11036 }
11037 }
11038 #endif
11039 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
11040 if (var1 == 0x01)
11041 {
11042 switch(var2)
11043 {
11044 case 0x00ul:
11045 return false;
11046 case 0x01ul:
11047 return false;
11048 case 0x02ul:
11049 return true;
11050 case 0x03ul:
11051 return false;
11052 case 0x04ul:
11053 return true;
11054 case 0x07ul:
11055 return false;
11056 case 0x08ul:
11057 return false;
11058 case 0x09ul:
11059 return false;
11060 case 0x0Aul:
11061 return false;
11062 case 0x0Bul:
11063 return false;
11064 case 0x0Cul:
11065 return false;
11066 case 0x0Dul:
11067 return false;
11068 default:
11069 return false;
11070 }
11071 }
11072 #endif
11073 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11074 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11075 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
11076 if (var1 == 0x01)
11077 {
11078 switch(var2)
11079 {
11080 case 0x00ul:
11081 return false;
11082 case 0x01ul:
11083 return false;
11084 case 0x02ul:
11085 return true;
11086 case 0x03ul:
11087 return false;
11088 case 0x04ul:
11089 return true;
11090 case 0x07ul:
11091 return false;
11092 case 0x08ul:
11093 return false;
11094 case 0x09ul:
11095 return false;
11096 case 0x0Aul:
11097 return false;
11098 case 0x0Bul:
11099 return false;
11100 case 0x0Cul:
11101 return false;
11102 case 0x0Dul:
11103 return false;
11104 default:
11105 return false;
11106 }
11107 }
11108 #endif
11109 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11110 if (var1 == 0x01)
11111 {
11112 switch(var2)
11113 {
11114 case 0x00ul:
11115 return false;
11116 case 0x01ul:
11117 return false;
11118 case 0x02ul:
11119 return true;
11120 case 0x03ul:
11121 return false;
11122 case 0x04ul:
11123 return true;
11124 case 0x07ul:
11125 return false;
11126 case 0x08ul:
11127 return false;
11128 case 0x09ul:
11129 return false;
11130 case 0x0Aul:
11131 return false;
11132 case 0x0Bul:
11133 return false;
11134 case 0x0Cul:
11135 return false;
11136 case 0x0Dul:
11137 return false;
11138 default:
11139 return false;
11140 }
11141 }
11142 #endif
11143 return false;
11144 #endif
11145 }
11146
11147 /* ========= Errata 59 ========= */
11148 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
11149 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
11150 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
11151 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
11152 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
11153 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
11154 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
11155 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
11156 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11157 #define NRF51_ERRATA_59_PRESENT 1
11158 #else
11159 #define NRF51_ERRATA_59_PRESENT 0
11160 #endif
11161
11162 #ifndef NRF51_ERRATA_59_ENABLE_WORKAROUND
11163 #define NRF51_ERRATA_59_ENABLE_WORKAROUND NRF51_ERRATA_59_PRESENT
11164 #endif
11165
nrf51_errata_59(void)11166 static bool nrf51_errata_59(void)
11167 {
11168 #ifndef NRF51_SERIES
11169 return false;
11170 #else
11171 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11172 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11173 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
11174 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
11175 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
11176 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11177 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11178 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
11179 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11180 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
11181 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
11182 #endif
11183 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11184 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11185 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
11186 if (var1 == 0x01)
11187 {
11188 switch(var2)
11189 {
11190 case 0x00ul:
11191 return false;
11192 case 0x01ul:
11193 return false;
11194 case 0x02ul:
11195 return true;
11196 case 0x03ul:
11197 return false;
11198 case 0x04ul:
11199 return true;
11200 case 0x07ul:
11201 return false;
11202 case 0x08ul:
11203 return false;
11204 case 0x09ul:
11205 return false;
11206 case 0x0Aul:
11207 return false;
11208 case 0x0Bul:
11209 return false;
11210 case 0x0Cul:
11211 return false;
11212 case 0x0Dul:
11213 return false;
11214 default:
11215 return false;
11216 }
11217 }
11218 #endif
11219 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
11220 if (var1 == 0x01)
11221 {
11222 switch(var2)
11223 {
11224 case 0x00ul:
11225 return false;
11226 case 0x01ul:
11227 return false;
11228 case 0x02ul:
11229 return true;
11230 case 0x03ul:
11231 return false;
11232 case 0x04ul:
11233 return true;
11234 case 0x07ul:
11235 return false;
11236 case 0x08ul:
11237 return false;
11238 case 0x09ul:
11239 return false;
11240 case 0x0Aul:
11241 return false;
11242 case 0x0Bul:
11243 return false;
11244 case 0x0Cul:
11245 return false;
11246 case 0x0Dul:
11247 return false;
11248 default:
11249 return false;
11250 }
11251 }
11252 #endif
11253 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
11254 if (var1 == 0x01)
11255 {
11256 switch(var2)
11257 {
11258 case 0x00ul:
11259 return false;
11260 case 0x01ul:
11261 return false;
11262 case 0x02ul:
11263 return true;
11264 case 0x03ul:
11265 return false;
11266 case 0x04ul:
11267 return true;
11268 case 0x07ul:
11269 return false;
11270 case 0x08ul:
11271 return false;
11272 case 0x09ul:
11273 return false;
11274 case 0x0Aul:
11275 return false;
11276 case 0x0Bul:
11277 return false;
11278 case 0x0Cul:
11279 return false;
11280 case 0x0Dul:
11281 return false;
11282 default:
11283 return false;
11284 }
11285 }
11286 #endif
11287 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11288 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11289 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
11290 if (var1 == 0x01)
11291 {
11292 switch(var2)
11293 {
11294 case 0x00ul:
11295 return false;
11296 case 0x01ul:
11297 return false;
11298 case 0x02ul:
11299 return true;
11300 case 0x03ul:
11301 return false;
11302 case 0x04ul:
11303 return true;
11304 case 0x07ul:
11305 return false;
11306 case 0x08ul:
11307 return false;
11308 case 0x09ul:
11309 return false;
11310 case 0x0Aul:
11311 return false;
11312 case 0x0Bul:
11313 return false;
11314 case 0x0Cul:
11315 return false;
11316 case 0x0Dul:
11317 return false;
11318 default:
11319 return false;
11320 }
11321 }
11322 #endif
11323 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11324 if (var1 == 0x01)
11325 {
11326 switch(var2)
11327 {
11328 case 0x00ul:
11329 return false;
11330 case 0x01ul:
11331 return false;
11332 case 0x02ul:
11333 return true;
11334 case 0x03ul:
11335 return false;
11336 case 0x04ul:
11337 return true;
11338 case 0x07ul:
11339 return false;
11340 case 0x08ul:
11341 return false;
11342 case 0x09ul:
11343 return false;
11344 case 0x0Aul:
11345 return false;
11346 case 0x0Bul:
11347 return false;
11348 case 0x0Cul:
11349 return false;
11350 case 0x0Dul:
11351 return false;
11352 default:
11353 return false;
11354 }
11355 }
11356 #endif
11357 return false;
11358 #endif
11359 }
11360
11361 /* ========= Errata 60 ========= */
11362 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
11363 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
11364 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
11365 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
11366 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
11367 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
11368 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
11369 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
11370 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11371 #define NRF51_ERRATA_60_PRESENT 1
11372 #else
11373 #define NRF51_ERRATA_60_PRESENT 0
11374 #endif
11375
11376 #ifndef NRF51_ERRATA_60_ENABLE_WORKAROUND
11377 #define NRF51_ERRATA_60_ENABLE_WORKAROUND NRF51_ERRATA_60_PRESENT
11378 #endif
11379
nrf51_errata_60(void)11380 static bool nrf51_errata_60(void)
11381 {
11382 #ifndef NRF51_SERIES
11383 return false;
11384 #else
11385 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11386 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11387 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
11388 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
11389 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
11390 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11391 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11392 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
11393 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11394 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
11395 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
11396 #endif
11397 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11398 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11399 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
11400 if (var1 == 0x01)
11401 {
11402 switch(var2)
11403 {
11404 case 0x00ul:
11405 return false;
11406 case 0x01ul:
11407 return false;
11408 case 0x02ul:
11409 return true;
11410 case 0x03ul:
11411 return false;
11412 case 0x04ul:
11413 return true;
11414 case 0x07ul:
11415 return false;
11416 case 0x08ul:
11417 return false;
11418 case 0x09ul:
11419 return false;
11420 case 0x0Aul:
11421 return false;
11422 case 0x0Bul:
11423 return false;
11424 case 0x0Cul:
11425 return false;
11426 case 0x0Dul:
11427 return false;
11428 default:
11429 return false;
11430 }
11431 }
11432 #endif
11433 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
11434 if (var1 == 0x01)
11435 {
11436 switch(var2)
11437 {
11438 case 0x00ul:
11439 return false;
11440 case 0x01ul:
11441 return false;
11442 case 0x02ul:
11443 return true;
11444 case 0x03ul:
11445 return false;
11446 case 0x04ul:
11447 return true;
11448 case 0x07ul:
11449 return false;
11450 case 0x08ul:
11451 return false;
11452 case 0x09ul:
11453 return false;
11454 case 0x0Aul:
11455 return false;
11456 case 0x0Bul:
11457 return false;
11458 case 0x0Cul:
11459 return false;
11460 case 0x0Dul:
11461 return false;
11462 default:
11463 return false;
11464 }
11465 }
11466 #endif
11467 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
11468 if (var1 == 0x01)
11469 {
11470 switch(var2)
11471 {
11472 case 0x00ul:
11473 return false;
11474 case 0x01ul:
11475 return false;
11476 case 0x02ul:
11477 return true;
11478 case 0x03ul:
11479 return false;
11480 case 0x04ul:
11481 return true;
11482 case 0x07ul:
11483 return false;
11484 case 0x08ul:
11485 return false;
11486 case 0x09ul:
11487 return false;
11488 case 0x0Aul:
11489 return false;
11490 case 0x0Bul:
11491 return false;
11492 case 0x0Cul:
11493 return false;
11494 case 0x0Dul:
11495 return false;
11496 default:
11497 return false;
11498 }
11499 }
11500 #endif
11501 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11502 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11503 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
11504 if (var1 == 0x01)
11505 {
11506 switch(var2)
11507 {
11508 case 0x00ul:
11509 return false;
11510 case 0x01ul:
11511 return false;
11512 case 0x02ul:
11513 return true;
11514 case 0x03ul:
11515 return false;
11516 case 0x04ul:
11517 return true;
11518 case 0x07ul:
11519 return false;
11520 case 0x08ul:
11521 return false;
11522 case 0x09ul:
11523 return false;
11524 case 0x0Aul:
11525 return false;
11526 case 0x0Bul:
11527 return false;
11528 case 0x0Cul:
11529 return false;
11530 case 0x0Dul:
11531 return false;
11532 default:
11533 return false;
11534 }
11535 }
11536 #endif
11537 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11538 if (var1 == 0x01)
11539 {
11540 switch(var2)
11541 {
11542 case 0x00ul:
11543 return false;
11544 case 0x01ul:
11545 return false;
11546 case 0x02ul:
11547 return true;
11548 case 0x03ul:
11549 return false;
11550 case 0x04ul:
11551 return true;
11552 case 0x07ul:
11553 return false;
11554 case 0x08ul:
11555 return false;
11556 case 0x09ul:
11557 return false;
11558 case 0x0Aul:
11559 return false;
11560 case 0x0Bul:
11561 return false;
11562 case 0x0Cul:
11563 return false;
11564 case 0x0Dul:
11565 return false;
11566 default:
11567 return false;
11568 }
11569 }
11570 #endif
11571 return false;
11572 #endif
11573 }
11574
11575 /* ========= Errata 61 ========= */
11576 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
11577 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
11578 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
11579 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
11580 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
11581 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
11582 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
11583 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
11584 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11585 #define NRF51_ERRATA_61_PRESENT 1
11586 #else
11587 #define NRF51_ERRATA_61_PRESENT 0
11588 #endif
11589
11590 #ifndef NRF51_ERRATA_61_ENABLE_WORKAROUND
11591 #define NRF51_ERRATA_61_ENABLE_WORKAROUND NRF51_ERRATA_61_PRESENT
11592 #endif
11593
nrf51_errata_61(void)11594 static bool nrf51_errata_61(void)
11595 {
11596 #ifndef NRF51_SERIES
11597 return false;
11598 #else
11599 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11600 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11601 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
11602 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
11603 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
11604 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11605 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11606 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
11607 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11608 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
11609 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
11610 #endif
11611 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11612 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11613 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
11614 if (var1 == 0x01)
11615 {
11616 switch(var2)
11617 {
11618 case 0x00ul:
11619 return false;
11620 case 0x01ul:
11621 return false;
11622 case 0x02ul:
11623 return true;
11624 case 0x03ul:
11625 return false;
11626 case 0x04ul:
11627 return true;
11628 case 0x07ul:
11629 return true;
11630 case 0x08ul:
11631 return true;
11632 case 0x09ul:
11633 return true;
11634 case 0x0Aul:
11635 return true;
11636 case 0x0Bul:
11637 return true;
11638 case 0x0Cul:
11639 return true;
11640 case 0x0Dul:
11641 return true;
11642 default:
11643 return true;
11644 }
11645 }
11646 #endif
11647 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
11648 if (var1 == 0x01)
11649 {
11650 switch(var2)
11651 {
11652 case 0x00ul:
11653 return false;
11654 case 0x01ul:
11655 return false;
11656 case 0x02ul:
11657 return true;
11658 case 0x03ul:
11659 return false;
11660 case 0x04ul:
11661 return true;
11662 case 0x07ul:
11663 return true;
11664 case 0x08ul:
11665 return true;
11666 case 0x09ul:
11667 return true;
11668 case 0x0Aul:
11669 return true;
11670 case 0x0Bul:
11671 return true;
11672 case 0x0Cul:
11673 return true;
11674 case 0x0Dul:
11675 return true;
11676 default:
11677 return true;
11678 }
11679 }
11680 #endif
11681 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
11682 if (var1 == 0x01)
11683 {
11684 switch(var2)
11685 {
11686 case 0x00ul:
11687 return false;
11688 case 0x01ul:
11689 return false;
11690 case 0x02ul:
11691 return true;
11692 case 0x03ul:
11693 return false;
11694 case 0x04ul:
11695 return true;
11696 case 0x07ul:
11697 return true;
11698 case 0x08ul:
11699 return true;
11700 case 0x09ul:
11701 return true;
11702 case 0x0Aul:
11703 return true;
11704 case 0x0Bul:
11705 return true;
11706 case 0x0Cul:
11707 return true;
11708 case 0x0Dul:
11709 return true;
11710 default:
11711 return true;
11712 }
11713 }
11714 #endif
11715 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11716 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11717 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
11718 if (var1 == 0x01)
11719 {
11720 switch(var2)
11721 {
11722 case 0x00ul:
11723 return false;
11724 case 0x01ul:
11725 return false;
11726 case 0x02ul:
11727 return true;
11728 case 0x03ul:
11729 return false;
11730 case 0x04ul:
11731 return true;
11732 case 0x07ul:
11733 return true;
11734 case 0x08ul:
11735 return true;
11736 case 0x09ul:
11737 return true;
11738 case 0x0Aul:
11739 return true;
11740 case 0x0Bul:
11741 return true;
11742 case 0x0Cul:
11743 return true;
11744 case 0x0Dul:
11745 return true;
11746 default:
11747 return true;
11748 }
11749 }
11750 #endif
11751 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11752 if (var1 == 0x01)
11753 {
11754 switch(var2)
11755 {
11756 case 0x00ul:
11757 return false;
11758 case 0x01ul:
11759 return false;
11760 case 0x02ul:
11761 return true;
11762 case 0x03ul:
11763 return false;
11764 case 0x04ul:
11765 return true;
11766 case 0x07ul:
11767 return true;
11768 case 0x08ul:
11769 return true;
11770 case 0x09ul:
11771 return true;
11772 case 0x0Aul:
11773 return true;
11774 case 0x0Bul:
11775 return true;
11776 case 0x0Cul:
11777 return true;
11778 case 0x0Dul:
11779 return true;
11780 default:
11781 return true;
11782 }
11783 }
11784 #endif
11785 return false;
11786 #endif
11787 }
11788
11789 /* ========= Errata 62 ========= */
11790 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
11791 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
11792 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
11793 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
11794 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
11795 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
11796 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
11797 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
11798 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11799 #define NRF51_ERRATA_62_PRESENT 1
11800 #else
11801 #define NRF51_ERRATA_62_PRESENT 0
11802 #endif
11803
11804 #ifndef NRF51_ERRATA_62_ENABLE_WORKAROUND
11805 #define NRF51_ERRATA_62_ENABLE_WORKAROUND NRF51_ERRATA_62_PRESENT
11806 #endif
11807
nrf51_errata_62(void)11808 static bool nrf51_errata_62(void)
11809 {
11810 #ifndef NRF51_SERIES
11811 return false;
11812 #else
11813 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11814 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11815 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
11816 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
11817 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
11818 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11819 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11820 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
11821 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11822 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
11823 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
11824 #endif
11825 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
11826 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
11827 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
11828 if (var1 == 0x01)
11829 {
11830 switch(var2)
11831 {
11832 case 0x00ul:
11833 return false;
11834 case 0x01ul:
11835 return false;
11836 case 0x02ul:
11837 return true;
11838 case 0x03ul:
11839 return false;
11840 case 0x04ul:
11841 return true;
11842 case 0x07ul:
11843 return false;
11844 case 0x08ul:
11845 return false;
11846 case 0x09ul:
11847 return false;
11848 case 0x0Aul:
11849 return false;
11850 case 0x0Bul:
11851 return false;
11852 case 0x0Cul:
11853 return false;
11854 case 0x0Dul:
11855 return false;
11856 default:
11857 return false;
11858 }
11859 }
11860 #endif
11861 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
11862 if (var1 == 0x01)
11863 {
11864 switch(var2)
11865 {
11866 case 0x00ul:
11867 return false;
11868 case 0x01ul:
11869 return false;
11870 case 0x02ul:
11871 return true;
11872 case 0x03ul:
11873 return false;
11874 case 0x04ul:
11875 return true;
11876 case 0x07ul:
11877 return false;
11878 case 0x08ul:
11879 return false;
11880 case 0x09ul:
11881 return false;
11882 case 0x0Aul:
11883 return false;
11884 case 0x0Bul:
11885 return false;
11886 case 0x0Cul:
11887 return false;
11888 case 0x0Dul:
11889 return false;
11890 default:
11891 return false;
11892 }
11893 }
11894 #endif
11895 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
11896 if (var1 == 0x01)
11897 {
11898 switch(var2)
11899 {
11900 case 0x00ul:
11901 return false;
11902 case 0x01ul:
11903 return false;
11904 case 0x02ul:
11905 return true;
11906 case 0x03ul:
11907 return false;
11908 case 0x04ul:
11909 return true;
11910 case 0x07ul:
11911 return false;
11912 case 0x08ul:
11913 return false;
11914 case 0x09ul:
11915 return false;
11916 case 0x0Aul:
11917 return false;
11918 case 0x0Bul:
11919 return false;
11920 case 0x0Cul:
11921 return false;
11922 case 0x0Dul:
11923 return false;
11924 default:
11925 return false;
11926 }
11927 }
11928 #endif
11929 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
11930 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
11931 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
11932 if (var1 == 0x01)
11933 {
11934 switch(var2)
11935 {
11936 case 0x00ul:
11937 return false;
11938 case 0x01ul:
11939 return false;
11940 case 0x02ul:
11941 return true;
11942 case 0x03ul:
11943 return false;
11944 case 0x04ul:
11945 return true;
11946 case 0x07ul:
11947 return false;
11948 case 0x08ul:
11949 return false;
11950 case 0x09ul:
11951 return false;
11952 case 0x0Aul:
11953 return false;
11954 case 0x0Bul:
11955 return false;
11956 case 0x0Cul:
11957 return false;
11958 case 0x0Dul:
11959 return false;
11960 default:
11961 return false;
11962 }
11963 }
11964 #endif
11965 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
11966 if (var1 == 0x01)
11967 {
11968 switch(var2)
11969 {
11970 case 0x00ul:
11971 return false;
11972 case 0x01ul:
11973 return false;
11974 case 0x02ul:
11975 return true;
11976 case 0x03ul:
11977 return false;
11978 case 0x04ul:
11979 return true;
11980 case 0x07ul:
11981 return false;
11982 case 0x08ul:
11983 return false;
11984 case 0x09ul:
11985 return false;
11986 case 0x0Aul:
11987 return false;
11988 case 0x0Bul:
11989 return false;
11990 case 0x0Cul:
11991 return false;
11992 case 0x0Dul:
11993 return false;
11994 default:
11995 return false;
11996 }
11997 }
11998 #endif
11999 return false;
12000 #endif
12001 }
12002
12003 /* ========= Errata 63 ========= */
12004 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
12005 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
12006 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
12007 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
12008 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
12009 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
12010 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
12011 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
12012 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12013 #define NRF51_ERRATA_63_PRESENT 1
12014 #else
12015 #define NRF51_ERRATA_63_PRESENT 0
12016 #endif
12017
12018 #ifndef NRF51_ERRATA_63_ENABLE_WORKAROUND
12019 #define NRF51_ERRATA_63_ENABLE_WORKAROUND NRF51_ERRATA_63_PRESENT
12020 #endif
12021
nrf51_errata_63(void)12022 static bool nrf51_errata_63(void)
12023 {
12024 #ifndef NRF51_SERIES
12025 return false;
12026 #else
12027 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12028 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12029 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
12030 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
12031 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
12032 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12033 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12034 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
12035 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12036 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
12037 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
12038 #endif
12039 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12040 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12041 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
12042 if (var1 == 0x01)
12043 {
12044 switch(var2)
12045 {
12046 case 0x00ul:
12047 return true;
12048 case 0x01ul:
12049 return true;
12050 case 0x02ul:
12051 return true;
12052 case 0x03ul:
12053 return true;
12054 case 0x04ul:
12055 return true;
12056 case 0x07ul:
12057 return false;
12058 case 0x08ul:
12059 return false;
12060 case 0x09ul:
12061 return false;
12062 case 0x0Aul:
12063 return false;
12064 case 0x0Bul:
12065 return false;
12066 case 0x0Cul:
12067 return false;
12068 case 0x0Dul:
12069 return false;
12070 default:
12071 return false;
12072 }
12073 }
12074 #endif
12075 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
12076 if (var1 == 0x01)
12077 {
12078 switch(var2)
12079 {
12080 case 0x00ul:
12081 return true;
12082 case 0x01ul:
12083 return true;
12084 case 0x02ul:
12085 return true;
12086 case 0x03ul:
12087 return true;
12088 case 0x04ul:
12089 return true;
12090 case 0x07ul:
12091 return false;
12092 case 0x08ul:
12093 return false;
12094 case 0x09ul:
12095 return false;
12096 case 0x0Aul:
12097 return false;
12098 case 0x0Bul:
12099 return false;
12100 case 0x0Cul:
12101 return false;
12102 case 0x0Dul:
12103 return false;
12104 default:
12105 return false;
12106 }
12107 }
12108 #endif
12109 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
12110 if (var1 == 0x01)
12111 {
12112 switch(var2)
12113 {
12114 case 0x00ul:
12115 return true;
12116 case 0x01ul:
12117 return true;
12118 case 0x02ul:
12119 return true;
12120 case 0x03ul:
12121 return true;
12122 case 0x04ul:
12123 return true;
12124 case 0x07ul:
12125 return false;
12126 case 0x08ul:
12127 return false;
12128 case 0x09ul:
12129 return false;
12130 case 0x0Aul:
12131 return false;
12132 case 0x0Bul:
12133 return false;
12134 case 0x0Cul:
12135 return false;
12136 case 0x0Dul:
12137 return false;
12138 default:
12139 return false;
12140 }
12141 }
12142 #endif
12143 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12144 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12145 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
12146 if (var1 == 0x01)
12147 {
12148 switch(var2)
12149 {
12150 case 0x00ul:
12151 return true;
12152 case 0x01ul:
12153 return true;
12154 case 0x02ul:
12155 return true;
12156 case 0x03ul:
12157 return true;
12158 case 0x04ul:
12159 return true;
12160 case 0x07ul:
12161 return false;
12162 case 0x08ul:
12163 return false;
12164 case 0x09ul:
12165 return false;
12166 case 0x0Aul:
12167 return false;
12168 case 0x0Bul:
12169 return false;
12170 case 0x0Cul:
12171 return false;
12172 case 0x0Dul:
12173 return false;
12174 default:
12175 return false;
12176 }
12177 }
12178 #endif
12179 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12180 if (var1 == 0x01)
12181 {
12182 switch(var2)
12183 {
12184 case 0x00ul:
12185 return true;
12186 case 0x01ul:
12187 return true;
12188 case 0x02ul:
12189 return true;
12190 case 0x03ul:
12191 return true;
12192 case 0x04ul:
12193 return true;
12194 case 0x07ul:
12195 return false;
12196 case 0x08ul:
12197 return false;
12198 case 0x09ul:
12199 return false;
12200 case 0x0Aul:
12201 return false;
12202 case 0x0Bul:
12203 return false;
12204 case 0x0Cul:
12205 return false;
12206 case 0x0Dul:
12207 return false;
12208 default:
12209 return false;
12210 }
12211 }
12212 #endif
12213 return false;
12214 #endif
12215 }
12216
12217 /* ========= Errata 64 ========= */
12218 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
12219 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
12220 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
12221 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
12222 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
12223 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
12224 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
12225 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
12226 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12227 #define NRF51_ERRATA_64_PRESENT 1
12228 #else
12229 #define NRF51_ERRATA_64_PRESENT 0
12230 #endif
12231
12232 #ifndef NRF51_ERRATA_64_ENABLE_WORKAROUND
12233 #define NRF51_ERRATA_64_ENABLE_WORKAROUND NRF51_ERRATA_64_PRESENT
12234 #endif
12235
nrf51_errata_64(void)12236 static bool nrf51_errata_64(void)
12237 {
12238 #ifndef NRF51_SERIES
12239 return false;
12240 #else
12241 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12242 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12243 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
12244 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
12245 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
12246 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12247 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12248 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
12249 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12250 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
12251 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
12252 #endif
12253 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12254 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12255 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
12256 if (var1 == 0x01)
12257 {
12258 switch(var2)
12259 {
12260 case 0x00ul:
12261 return true;
12262 case 0x01ul:
12263 return true;
12264 case 0x02ul:
12265 return true;
12266 case 0x03ul:
12267 return true;
12268 case 0x04ul:
12269 return true;
12270 case 0x07ul:
12271 return false;
12272 case 0x08ul:
12273 return false;
12274 case 0x09ul:
12275 return false;
12276 case 0x0Aul:
12277 return false;
12278 case 0x0Bul:
12279 return false;
12280 case 0x0Cul:
12281 return false;
12282 case 0x0Dul:
12283 return false;
12284 default:
12285 return false;
12286 }
12287 }
12288 #endif
12289 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
12290 if (var1 == 0x01)
12291 {
12292 switch(var2)
12293 {
12294 case 0x00ul:
12295 return true;
12296 case 0x01ul:
12297 return true;
12298 case 0x02ul:
12299 return true;
12300 case 0x03ul:
12301 return true;
12302 case 0x04ul:
12303 return true;
12304 case 0x07ul:
12305 return false;
12306 case 0x08ul:
12307 return false;
12308 case 0x09ul:
12309 return false;
12310 case 0x0Aul:
12311 return false;
12312 case 0x0Bul:
12313 return false;
12314 case 0x0Cul:
12315 return false;
12316 case 0x0Dul:
12317 return false;
12318 default:
12319 return false;
12320 }
12321 }
12322 #endif
12323 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
12324 if (var1 == 0x01)
12325 {
12326 switch(var2)
12327 {
12328 case 0x00ul:
12329 return true;
12330 case 0x01ul:
12331 return true;
12332 case 0x02ul:
12333 return true;
12334 case 0x03ul:
12335 return true;
12336 case 0x04ul:
12337 return true;
12338 case 0x07ul:
12339 return false;
12340 case 0x08ul:
12341 return false;
12342 case 0x09ul:
12343 return false;
12344 case 0x0Aul:
12345 return false;
12346 case 0x0Bul:
12347 return false;
12348 case 0x0Cul:
12349 return false;
12350 case 0x0Dul:
12351 return false;
12352 default:
12353 return false;
12354 }
12355 }
12356 #endif
12357 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12358 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12359 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
12360 if (var1 == 0x01)
12361 {
12362 switch(var2)
12363 {
12364 case 0x00ul:
12365 return true;
12366 case 0x01ul:
12367 return true;
12368 case 0x02ul:
12369 return true;
12370 case 0x03ul:
12371 return true;
12372 case 0x04ul:
12373 return true;
12374 case 0x07ul:
12375 return false;
12376 case 0x08ul:
12377 return false;
12378 case 0x09ul:
12379 return false;
12380 case 0x0Aul:
12381 return false;
12382 case 0x0Bul:
12383 return false;
12384 case 0x0Cul:
12385 return false;
12386 case 0x0Dul:
12387 return false;
12388 default:
12389 return false;
12390 }
12391 }
12392 #endif
12393 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12394 if (var1 == 0x01)
12395 {
12396 switch(var2)
12397 {
12398 case 0x00ul:
12399 return true;
12400 case 0x01ul:
12401 return true;
12402 case 0x02ul:
12403 return true;
12404 case 0x03ul:
12405 return true;
12406 case 0x04ul:
12407 return true;
12408 case 0x07ul:
12409 return false;
12410 case 0x08ul:
12411 return false;
12412 case 0x09ul:
12413 return false;
12414 case 0x0Aul:
12415 return false;
12416 case 0x0Bul:
12417 return false;
12418 case 0x0Cul:
12419 return false;
12420 case 0x0Dul:
12421 return false;
12422 default:
12423 return false;
12424 }
12425 }
12426 #endif
12427 return false;
12428 #endif
12429 }
12430
12431 /* ========= Errata 65 ========= */
12432 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
12433 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
12434 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
12435 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
12436 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
12437 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
12438 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
12439 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
12440 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12441 #define NRF51_ERRATA_65_PRESENT 1
12442 #else
12443 #define NRF51_ERRATA_65_PRESENT 0
12444 #endif
12445
12446 #ifndef NRF51_ERRATA_65_ENABLE_WORKAROUND
12447 #define NRF51_ERRATA_65_ENABLE_WORKAROUND NRF51_ERRATA_65_PRESENT
12448 #endif
12449
nrf51_errata_65(void)12450 static bool nrf51_errata_65(void)
12451 {
12452 #ifndef NRF51_SERIES
12453 return false;
12454 #else
12455 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12456 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12457 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
12458 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
12459 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
12460 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12461 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12462 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
12463 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12464 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
12465 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
12466 #endif
12467 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12468 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12469 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
12470 if (var1 == 0x01)
12471 {
12472 switch(var2)
12473 {
12474 case 0x00ul:
12475 return true;
12476 case 0x01ul:
12477 return true;
12478 case 0x02ul:
12479 return true;
12480 case 0x03ul:
12481 return true;
12482 case 0x04ul:
12483 return true;
12484 case 0x07ul:
12485 return false;
12486 case 0x08ul:
12487 return false;
12488 case 0x09ul:
12489 return false;
12490 case 0x0Aul:
12491 return false;
12492 case 0x0Bul:
12493 return false;
12494 case 0x0Cul:
12495 return false;
12496 case 0x0Dul:
12497 return false;
12498 default:
12499 return false;
12500 }
12501 }
12502 #endif
12503 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
12504 if (var1 == 0x01)
12505 {
12506 switch(var2)
12507 {
12508 case 0x00ul:
12509 return true;
12510 case 0x01ul:
12511 return true;
12512 case 0x02ul:
12513 return true;
12514 case 0x03ul:
12515 return true;
12516 case 0x04ul:
12517 return true;
12518 case 0x07ul:
12519 return false;
12520 case 0x08ul:
12521 return false;
12522 case 0x09ul:
12523 return false;
12524 case 0x0Aul:
12525 return false;
12526 case 0x0Bul:
12527 return false;
12528 case 0x0Cul:
12529 return false;
12530 case 0x0Dul:
12531 return false;
12532 default:
12533 return false;
12534 }
12535 }
12536 #endif
12537 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
12538 if (var1 == 0x01)
12539 {
12540 switch(var2)
12541 {
12542 case 0x00ul:
12543 return true;
12544 case 0x01ul:
12545 return true;
12546 case 0x02ul:
12547 return true;
12548 case 0x03ul:
12549 return true;
12550 case 0x04ul:
12551 return true;
12552 case 0x07ul:
12553 return false;
12554 case 0x08ul:
12555 return false;
12556 case 0x09ul:
12557 return false;
12558 case 0x0Aul:
12559 return false;
12560 case 0x0Bul:
12561 return false;
12562 case 0x0Cul:
12563 return false;
12564 case 0x0Dul:
12565 return false;
12566 default:
12567 return false;
12568 }
12569 }
12570 #endif
12571 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12572 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12573 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
12574 if (var1 == 0x01)
12575 {
12576 switch(var2)
12577 {
12578 case 0x00ul:
12579 return true;
12580 case 0x01ul:
12581 return true;
12582 case 0x02ul:
12583 return true;
12584 case 0x03ul:
12585 return true;
12586 case 0x04ul:
12587 return true;
12588 case 0x07ul:
12589 return false;
12590 case 0x08ul:
12591 return false;
12592 case 0x09ul:
12593 return false;
12594 case 0x0Aul:
12595 return false;
12596 case 0x0Bul:
12597 return false;
12598 case 0x0Cul:
12599 return false;
12600 case 0x0Dul:
12601 return false;
12602 default:
12603 return false;
12604 }
12605 }
12606 #endif
12607 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12608 if (var1 == 0x01)
12609 {
12610 switch(var2)
12611 {
12612 case 0x00ul:
12613 return true;
12614 case 0x01ul:
12615 return true;
12616 case 0x02ul:
12617 return true;
12618 case 0x03ul:
12619 return true;
12620 case 0x04ul:
12621 return true;
12622 case 0x07ul:
12623 return false;
12624 case 0x08ul:
12625 return false;
12626 case 0x09ul:
12627 return false;
12628 case 0x0Aul:
12629 return false;
12630 case 0x0Bul:
12631 return false;
12632 case 0x0Cul:
12633 return false;
12634 case 0x0Dul:
12635 return false;
12636 default:
12637 return false;
12638 }
12639 }
12640 #endif
12641 return false;
12642 #endif
12643 }
12644
12645 /* ========= Errata 66 ========= */
12646 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
12647 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
12648 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
12649 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
12650 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
12651 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
12652 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
12653 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
12654 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12655 #define NRF51_ERRATA_66_PRESENT 1
12656 #else
12657 #define NRF51_ERRATA_66_PRESENT 0
12658 #endif
12659
12660 #ifndef NRF51_ERRATA_66_ENABLE_WORKAROUND
12661 #define NRF51_ERRATA_66_ENABLE_WORKAROUND NRF51_ERRATA_66_PRESENT
12662 #endif
12663
nrf51_errata_66(void)12664 static bool nrf51_errata_66(void)
12665 {
12666 #ifndef NRF51_SERIES
12667 return false;
12668 #else
12669 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12670 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12671 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
12672 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
12673 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
12674 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12675 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12676 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
12677 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12678 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
12679 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
12680 #endif
12681 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12682 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12683 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
12684 if (var1 == 0x01)
12685 {
12686 switch(var2)
12687 {
12688 case 0x00ul:
12689 return false;
12690 case 0x01ul:
12691 return false;
12692 case 0x02ul:
12693 return true;
12694 case 0x03ul:
12695 return false;
12696 case 0x04ul:
12697 return true;
12698 case 0x07ul:
12699 return true;
12700 case 0x08ul:
12701 return true;
12702 case 0x09ul:
12703 return true;
12704 case 0x0Aul:
12705 return false;
12706 case 0x0Bul:
12707 return true;
12708 case 0x0Cul:
12709 return true;
12710 case 0x0Dul:
12711 return false;
12712 default:
12713 return false;
12714 }
12715 }
12716 #endif
12717 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
12718 if (var1 == 0x01)
12719 {
12720 switch(var2)
12721 {
12722 case 0x00ul:
12723 return false;
12724 case 0x01ul:
12725 return false;
12726 case 0x02ul:
12727 return true;
12728 case 0x03ul:
12729 return false;
12730 case 0x04ul:
12731 return true;
12732 case 0x07ul:
12733 return true;
12734 case 0x08ul:
12735 return true;
12736 case 0x09ul:
12737 return true;
12738 case 0x0Aul:
12739 return false;
12740 case 0x0Bul:
12741 return true;
12742 case 0x0Cul:
12743 return true;
12744 case 0x0Dul:
12745 return false;
12746 default:
12747 return false;
12748 }
12749 }
12750 #endif
12751 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
12752 if (var1 == 0x01)
12753 {
12754 switch(var2)
12755 {
12756 case 0x00ul:
12757 return false;
12758 case 0x01ul:
12759 return false;
12760 case 0x02ul:
12761 return true;
12762 case 0x03ul:
12763 return false;
12764 case 0x04ul:
12765 return true;
12766 case 0x07ul:
12767 return true;
12768 case 0x08ul:
12769 return true;
12770 case 0x09ul:
12771 return true;
12772 case 0x0Aul:
12773 return false;
12774 case 0x0Bul:
12775 return true;
12776 case 0x0Cul:
12777 return true;
12778 case 0x0Dul:
12779 return false;
12780 default:
12781 return false;
12782 }
12783 }
12784 #endif
12785 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12786 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12787 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
12788 if (var1 == 0x01)
12789 {
12790 switch(var2)
12791 {
12792 case 0x00ul:
12793 return false;
12794 case 0x01ul:
12795 return false;
12796 case 0x02ul:
12797 return true;
12798 case 0x03ul:
12799 return false;
12800 case 0x04ul:
12801 return true;
12802 case 0x07ul:
12803 return true;
12804 case 0x08ul:
12805 return true;
12806 case 0x09ul:
12807 return true;
12808 case 0x0Aul:
12809 return false;
12810 case 0x0Bul:
12811 return true;
12812 case 0x0Cul:
12813 return true;
12814 case 0x0Dul:
12815 return false;
12816 default:
12817 return false;
12818 }
12819 }
12820 #endif
12821 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12822 if (var1 == 0x01)
12823 {
12824 switch(var2)
12825 {
12826 case 0x00ul:
12827 return false;
12828 case 0x01ul:
12829 return false;
12830 case 0x02ul:
12831 return true;
12832 case 0x03ul:
12833 return false;
12834 case 0x04ul:
12835 return true;
12836 case 0x07ul:
12837 return true;
12838 case 0x08ul:
12839 return true;
12840 case 0x09ul:
12841 return true;
12842 case 0x0Aul:
12843 return false;
12844 case 0x0Bul:
12845 return true;
12846 case 0x0Cul:
12847 return true;
12848 case 0x0Dul:
12849 return false;
12850 default:
12851 return false;
12852 }
12853 }
12854 #endif
12855 return false;
12856 #endif
12857 }
12858
12859 /* ========= Errata 67 ========= */
12860 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
12861 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
12862 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
12863 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
12864 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
12865 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
12866 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
12867 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
12868 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12869 #define NRF51_ERRATA_67_PRESENT 1
12870 #else
12871 #define NRF51_ERRATA_67_PRESENT 0
12872 #endif
12873
12874 #ifndef NRF51_ERRATA_67_ENABLE_WORKAROUND
12875 #define NRF51_ERRATA_67_ENABLE_WORKAROUND NRF51_ERRATA_67_PRESENT
12876 #endif
12877
nrf51_errata_67(void)12878 static bool nrf51_errata_67(void)
12879 {
12880 #ifndef NRF51_SERIES
12881 return false;
12882 #else
12883 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12884 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12885 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
12886 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
12887 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
12888 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
12889 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
12890 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
12891 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
12892 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
12893 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
12894 #endif
12895 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
12896 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
12897 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
12898 if (var1 == 0x01)
12899 {
12900 switch(var2)
12901 {
12902 case 0x00ul:
12903 return false;
12904 case 0x01ul:
12905 return false;
12906 case 0x02ul:
12907 return true;
12908 case 0x03ul:
12909 return false;
12910 case 0x04ul:
12911 return true;
12912 case 0x07ul:
12913 return true;
12914 case 0x08ul:
12915 return true;
12916 case 0x09ul:
12917 return true;
12918 case 0x0Aul:
12919 return true;
12920 case 0x0Bul:
12921 return true;
12922 case 0x0Cul:
12923 return true;
12924 case 0x0Dul:
12925 return true;
12926 default:
12927 return true;
12928 }
12929 }
12930 #endif
12931 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
12932 if (var1 == 0x01)
12933 {
12934 switch(var2)
12935 {
12936 case 0x00ul:
12937 return false;
12938 case 0x01ul:
12939 return false;
12940 case 0x02ul:
12941 return true;
12942 case 0x03ul:
12943 return false;
12944 case 0x04ul:
12945 return true;
12946 case 0x07ul:
12947 return true;
12948 case 0x08ul:
12949 return true;
12950 case 0x09ul:
12951 return true;
12952 case 0x0Aul:
12953 return true;
12954 case 0x0Bul:
12955 return true;
12956 case 0x0Cul:
12957 return true;
12958 case 0x0Dul:
12959 return true;
12960 default:
12961 return true;
12962 }
12963 }
12964 #endif
12965 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
12966 if (var1 == 0x01)
12967 {
12968 switch(var2)
12969 {
12970 case 0x00ul:
12971 return false;
12972 case 0x01ul:
12973 return false;
12974 case 0x02ul:
12975 return true;
12976 case 0x03ul:
12977 return false;
12978 case 0x04ul:
12979 return true;
12980 case 0x07ul:
12981 return true;
12982 case 0x08ul:
12983 return true;
12984 case 0x09ul:
12985 return true;
12986 case 0x0Aul:
12987 return true;
12988 case 0x0Bul:
12989 return true;
12990 case 0x0Cul:
12991 return true;
12992 case 0x0Dul:
12993 return true;
12994 default:
12995 return true;
12996 }
12997 }
12998 #endif
12999 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13000 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13001 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
13002 if (var1 == 0x01)
13003 {
13004 switch(var2)
13005 {
13006 case 0x00ul:
13007 return false;
13008 case 0x01ul:
13009 return false;
13010 case 0x02ul:
13011 return true;
13012 case 0x03ul:
13013 return false;
13014 case 0x04ul:
13015 return true;
13016 case 0x07ul:
13017 return true;
13018 case 0x08ul:
13019 return true;
13020 case 0x09ul:
13021 return true;
13022 case 0x0Aul:
13023 return true;
13024 case 0x0Bul:
13025 return true;
13026 case 0x0Cul:
13027 return true;
13028 case 0x0Dul:
13029 return true;
13030 default:
13031 return true;
13032 }
13033 }
13034 #endif
13035 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13036 if (var1 == 0x01)
13037 {
13038 switch(var2)
13039 {
13040 case 0x00ul:
13041 return false;
13042 case 0x01ul:
13043 return false;
13044 case 0x02ul:
13045 return true;
13046 case 0x03ul:
13047 return false;
13048 case 0x04ul:
13049 return true;
13050 case 0x07ul:
13051 return true;
13052 case 0x08ul:
13053 return true;
13054 case 0x09ul:
13055 return true;
13056 case 0x0Aul:
13057 return true;
13058 case 0x0Bul:
13059 return true;
13060 case 0x0Cul:
13061 return true;
13062 case 0x0Dul:
13063 return true;
13064 default:
13065 return true;
13066 }
13067 }
13068 #endif
13069 return false;
13070 #endif
13071 }
13072
13073 /* ========= Errata 68 ========= */
13074 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
13075 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
13076 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
13077 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
13078 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
13079 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
13080 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
13081 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
13082 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13083 #define NRF51_ERRATA_68_PRESENT 1
13084 #else
13085 #define NRF51_ERRATA_68_PRESENT 0
13086 #endif
13087
13088 #ifndef NRF51_ERRATA_68_ENABLE_WORKAROUND
13089 #define NRF51_ERRATA_68_ENABLE_WORKAROUND NRF51_ERRATA_68_PRESENT
13090 #endif
13091
nrf51_errata_68(void)13092 static bool nrf51_errata_68(void)
13093 {
13094 #ifndef NRF51_SERIES
13095 return false;
13096 #else
13097 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13098 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13099 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
13100 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
13101 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
13102 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13103 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13104 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
13105 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13106 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
13107 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
13108 #endif
13109 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13110 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13111 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
13112 if (var1 == 0x01)
13113 {
13114 switch(var2)
13115 {
13116 case 0x00ul:
13117 return false;
13118 case 0x01ul:
13119 return false;
13120 case 0x02ul:
13121 return true;
13122 case 0x03ul:
13123 return false;
13124 case 0x04ul:
13125 return true;
13126 case 0x07ul:
13127 return false;
13128 case 0x08ul:
13129 return false;
13130 case 0x09ul:
13131 return false;
13132 case 0x0Aul:
13133 return false;
13134 case 0x0Bul:
13135 return false;
13136 case 0x0Cul:
13137 return false;
13138 case 0x0Dul:
13139 return false;
13140 default:
13141 return false;
13142 }
13143 }
13144 #endif
13145 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
13146 if (var1 == 0x01)
13147 {
13148 switch(var2)
13149 {
13150 case 0x00ul:
13151 return false;
13152 case 0x01ul:
13153 return false;
13154 case 0x02ul:
13155 return true;
13156 case 0x03ul:
13157 return false;
13158 case 0x04ul:
13159 return true;
13160 case 0x07ul:
13161 return false;
13162 case 0x08ul:
13163 return false;
13164 case 0x09ul:
13165 return false;
13166 case 0x0Aul:
13167 return false;
13168 case 0x0Bul:
13169 return false;
13170 case 0x0Cul:
13171 return false;
13172 case 0x0Dul:
13173 return false;
13174 default:
13175 return false;
13176 }
13177 }
13178 #endif
13179 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
13180 if (var1 == 0x01)
13181 {
13182 switch(var2)
13183 {
13184 case 0x00ul:
13185 return false;
13186 case 0x01ul:
13187 return false;
13188 case 0x02ul:
13189 return true;
13190 case 0x03ul:
13191 return false;
13192 case 0x04ul:
13193 return true;
13194 case 0x07ul:
13195 return false;
13196 case 0x08ul:
13197 return false;
13198 case 0x09ul:
13199 return false;
13200 case 0x0Aul:
13201 return false;
13202 case 0x0Bul:
13203 return false;
13204 case 0x0Cul:
13205 return false;
13206 case 0x0Dul:
13207 return false;
13208 default:
13209 return false;
13210 }
13211 }
13212 #endif
13213 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13214 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13215 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
13216 if (var1 == 0x01)
13217 {
13218 switch(var2)
13219 {
13220 case 0x00ul:
13221 return false;
13222 case 0x01ul:
13223 return false;
13224 case 0x02ul:
13225 return true;
13226 case 0x03ul:
13227 return false;
13228 case 0x04ul:
13229 return true;
13230 case 0x07ul:
13231 return false;
13232 case 0x08ul:
13233 return false;
13234 case 0x09ul:
13235 return false;
13236 case 0x0Aul:
13237 return false;
13238 case 0x0Bul:
13239 return false;
13240 case 0x0Cul:
13241 return false;
13242 case 0x0Dul:
13243 return false;
13244 default:
13245 return false;
13246 }
13247 }
13248 #endif
13249 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13250 if (var1 == 0x01)
13251 {
13252 switch(var2)
13253 {
13254 case 0x00ul:
13255 return false;
13256 case 0x01ul:
13257 return false;
13258 case 0x02ul:
13259 return true;
13260 case 0x03ul:
13261 return false;
13262 case 0x04ul:
13263 return true;
13264 case 0x07ul:
13265 return false;
13266 case 0x08ul:
13267 return false;
13268 case 0x09ul:
13269 return false;
13270 case 0x0Aul:
13271 return false;
13272 case 0x0Bul:
13273 return false;
13274 case 0x0Cul:
13275 return false;
13276 case 0x0Dul:
13277 return false;
13278 default:
13279 return false;
13280 }
13281 }
13282 #endif
13283 return false;
13284 #endif
13285 }
13286
13287 /* ========= Errata 69 ========= */
13288 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
13289 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
13290 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
13291 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
13292 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
13293 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
13294 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
13295 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
13296 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13297 #define NRF51_ERRATA_69_PRESENT 1
13298 #else
13299 #define NRF51_ERRATA_69_PRESENT 0
13300 #endif
13301
13302 #ifndef NRF51_ERRATA_69_ENABLE_WORKAROUND
13303 #define NRF51_ERRATA_69_ENABLE_WORKAROUND NRF51_ERRATA_69_PRESENT
13304 #endif
13305
nrf51_errata_69(void)13306 static bool nrf51_errata_69(void)
13307 {
13308 #ifndef NRF51_SERIES
13309 return false;
13310 #else
13311 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13312 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13313 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
13314 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
13315 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
13316 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13317 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13318 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
13319 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13320 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
13321 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
13322 #endif
13323 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13324 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13325 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
13326 if (var1 == 0x01)
13327 {
13328 switch(var2)
13329 {
13330 case 0x00ul:
13331 return false;
13332 case 0x01ul:
13333 return false;
13334 case 0x02ul:
13335 return false;
13336 case 0x03ul:
13337 return false;
13338 case 0x04ul:
13339 return false;
13340 case 0x07ul:
13341 return true;
13342 case 0x08ul:
13343 return true;
13344 case 0x09ul:
13345 return false;
13346 case 0x0Aul:
13347 return false;
13348 case 0x0Bul:
13349 return true;
13350 case 0x0Cul:
13351 return true;
13352 case 0x0Dul:
13353 return false;
13354 default:
13355 return false;
13356 }
13357 }
13358 #endif
13359 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
13360 if (var1 == 0x01)
13361 {
13362 switch(var2)
13363 {
13364 case 0x00ul:
13365 return false;
13366 case 0x01ul:
13367 return false;
13368 case 0x02ul:
13369 return false;
13370 case 0x03ul:
13371 return false;
13372 case 0x04ul:
13373 return false;
13374 case 0x07ul:
13375 return true;
13376 case 0x08ul:
13377 return true;
13378 case 0x09ul:
13379 return false;
13380 case 0x0Aul:
13381 return false;
13382 case 0x0Bul:
13383 return true;
13384 case 0x0Cul:
13385 return true;
13386 case 0x0Dul:
13387 return false;
13388 default:
13389 return false;
13390 }
13391 }
13392 #endif
13393 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
13394 if (var1 == 0x01)
13395 {
13396 switch(var2)
13397 {
13398 case 0x00ul:
13399 return false;
13400 case 0x01ul:
13401 return false;
13402 case 0x02ul:
13403 return false;
13404 case 0x03ul:
13405 return false;
13406 case 0x04ul:
13407 return false;
13408 case 0x07ul:
13409 return true;
13410 case 0x08ul:
13411 return true;
13412 case 0x09ul:
13413 return false;
13414 case 0x0Aul:
13415 return false;
13416 case 0x0Bul:
13417 return true;
13418 case 0x0Cul:
13419 return true;
13420 case 0x0Dul:
13421 return false;
13422 default:
13423 return false;
13424 }
13425 }
13426 #endif
13427 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13428 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13429 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
13430 if (var1 == 0x01)
13431 {
13432 switch(var2)
13433 {
13434 case 0x00ul:
13435 return false;
13436 case 0x01ul:
13437 return false;
13438 case 0x02ul:
13439 return false;
13440 case 0x03ul:
13441 return false;
13442 case 0x04ul:
13443 return false;
13444 case 0x07ul:
13445 return true;
13446 case 0x08ul:
13447 return true;
13448 case 0x09ul:
13449 return false;
13450 case 0x0Aul:
13451 return false;
13452 case 0x0Bul:
13453 return true;
13454 case 0x0Cul:
13455 return true;
13456 case 0x0Dul:
13457 return false;
13458 default:
13459 return false;
13460 }
13461 }
13462 #endif
13463 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13464 if (var1 == 0x01)
13465 {
13466 switch(var2)
13467 {
13468 case 0x00ul:
13469 return false;
13470 case 0x01ul:
13471 return false;
13472 case 0x02ul:
13473 return false;
13474 case 0x03ul:
13475 return false;
13476 case 0x04ul:
13477 return false;
13478 case 0x07ul:
13479 return true;
13480 case 0x08ul:
13481 return true;
13482 case 0x09ul:
13483 return false;
13484 case 0x0Aul:
13485 return false;
13486 case 0x0Bul:
13487 return true;
13488 case 0x0Cul:
13489 return true;
13490 case 0x0Dul:
13491 return false;
13492 default:
13493 return false;
13494 }
13495 }
13496 #endif
13497 return false;
13498 #endif
13499 }
13500
13501 /* ========= Errata 70 ========= */
13502 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
13503 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
13504 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
13505 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
13506 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
13507 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
13508 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
13509 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
13510 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13511 #define NRF51_ERRATA_70_PRESENT 1
13512 #else
13513 #define NRF51_ERRATA_70_PRESENT 0
13514 #endif
13515
13516 #ifndef NRF51_ERRATA_70_ENABLE_WORKAROUND
13517 #define NRF51_ERRATA_70_ENABLE_WORKAROUND NRF51_ERRATA_70_PRESENT
13518 #endif
13519
nrf51_errata_70(void)13520 static bool nrf51_errata_70(void)
13521 {
13522 #ifndef NRF51_SERIES
13523 return false;
13524 #else
13525 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13526 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13527 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
13528 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
13529 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
13530 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13531 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13532 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
13533 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13534 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
13535 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
13536 #endif
13537 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13538 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13539 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
13540 if (var1 == 0x01)
13541 {
13542 switch(var2)
13543 {
13544 case 0x00ul:
13545 return false;
13546 case 0x01ul:
13547 return false;
13548 case 0x02ul:
13549 return true;
13550 case 0x03ul:
13551 return false;
13552 case 0x04ul:
13553 return true;
13554 case 0x07ul:
13555 return true;
13556 case 0x08ul:
13557 return true;
13558 case 0x09ul:
13559 return true;
13560 case 0x0Aul:
13561 return true;
13562 case 0x0Bul:
13563 return true;
13564 case 0x0Cul:
13565 return true;
13566 case 0x0Dul:
13567 return true;
13568 default:
13569 return true;
13570 }
13571 }
13572 #endif
13573 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
13574 if (var1 == 0x01)
13575 {
13576 switch(var2)
13577 {
13578 case 0x00ul:
13579 return false;
13580 case 0x01ul:
13581 return false;
13582 case 0x02ul:
13583 return true;
13584 case 0x03ul:
13585 return false;
13586 case 0x04ul:
13587 return true;
13588 case 0x07ul:
13589 return true;
13590 case 0x08ul:
13591 return true;
13592 case 0x09ul:
13593 return true;
13594 case 0x0Aul:
13595 return true;
13596 case 0x0Bul:
13597 return true;
13598 case 0x0Cul:
13599 return true;
13600 case 0x0Dul:
13601 return true;
13602 default:
13603 return true;
13604 }
13605 }
13606 #endif
13607 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
13608 if (var1 == 0x01)
13609 {
13610 switch(var2)
13611 {
13612 case 0x00ul:
13613 return false;
13614 case 0x01ul:
13615 return false;
13616 case 0x02ul:
13617 return true;
13618 case 0x03ul:
13619 return false;
13620 case 0x04ul:
13621 return true;
13622 case 0x07ul:
13623 return true;
13624 case 0x08ul:
13625 return true;
13626 case 0x09ul:
13627 return true;
13628 case 0x0Aul:
13629 return true;
13630 case 0x0Bul:
13631 return true;
13632 case 0x0Cul:
13633 return true;
13634 case 0x0Dul:
13635 return true;
13636 default:
13637 return true;
13638 }
13639 }
13640 #endif
13641 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13642 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13643 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
13644 if (var1 == 0x01)
13645 {
13646 switch(var2)
13647 {
13648 case 0x00ul:
13649 return false;
13650 case 0x01ul:
13651 return false;
13652 case 0x02ul:
13653 return true;
13654 case 0x03ul:
13655 return false;
13656 case 0x04ul:
13657 return true;
13658 case 0x07ul:
13659 return true;
13660 case 0x08ul:
13661 return true;
13662 case 0x09ul:
13663 return true;
13664 case 0x0Aul:
13665 return true;
13666 case 0x0Bul:
13667 return true;
13668 case 0x0Cul:
13669 return true;
13670 case 0x0Dul:
13671 return true;
13672 default:
13673 return true;
13674 }
13675 }
13676 #endif
13677 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13678 if (var1 == 0x01)
13679 {
13680 switch(var2)
13681 {
13682 case 0x00ul:
13683 return false;
13684 case 0x01ul:
13685 return false;
13686 case 0x02ul:
13687 return true;
13688 case 0x03ul:
13689 return false;
13690 case 0x04ul:
13691 return true;
13692 case 0x07ul:
13693 return true;
13694 case 0x08ul:
13695 return true;
13696 case 0x09ul:
13697 return true;
13698 case 0x0Aul:
13699 return true;
13700 case 0x0Bul:
13701 return true;
13702 case 0x0Cul:
13703 return true;
13704 case 0x0Dul:
13705 return true;
13706 default:
13707 return true;
13708 }
13709 }
13710 #endif
13711 return false;
13712 #endif
13713 }
13714
13715 /* ========= Errata 71 ========= */
13716 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
13717 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
13718 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
13719 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
13720 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
13721 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
13722 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
13723 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
13724 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13725 #define NRF51_ERRATA_71_PRESENT 1
13726 #else
13727 #define NRF51_ERRATA_71_PRESENT 0
13728 #endif
13729
13730 #ifndef NRF51_ERRATA_71_ENABLE_WORKAROUND
13731 #define NRF51_ERRATA_71_ENABLE_WORKAROUND NRF51_ERRATA_71_PRESENT
13732 #endif
13733
nrf51_errata_71(void)13734 static bool nrf51_errata_71(void)
13735 {
13736 #ifndef NRF51_SERIES
13737 return false;
13738 #else
13739 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13740 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13741 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
13742 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
13743 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
13744 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13745 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13746 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
13747 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13748 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
13749 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
13750 #endif
13751 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13752 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13753 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
13754 if (var1 == 0x01)
13755 {
13756 switch(var2)
13757 {
13758 case 0x00ul:
13759 return false;
13760 case 0x01ul:
13761 return false;
13762 case 0x02ul:
13763 return false;
13764 case 0x03ul:
13765 return false;
13766 case 0x04ul:
13767 return false;
13768 case 0x07ul:
13769 return true;
13770 case 0x08ul:
13771 return true;
13772 case 0x09ul:
13773 return false;
13774 case 0x0Aul:
13775 return false;
13776 case 0x0Bul:
13777 return true;
13778 case 0x0Cul:
13779 return true;
13780 case 0x0Dul:
13781 return false;
13782 default:
13783 return false;
13784 }
13785 }
13786 #endif
13787 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
13788 if (var1 == 0x01)
13789 {
13790 switch(var2)
13791 {
13792 case 0x00ul:
13793 return false;
13794 case 0x01ul:
13795 return false;
13796 case 0x02ul:
13797 return false;
13798 case 0x03ul:
13799 return false;
13800 case 0x04ul:
13801 return false;
13802 case 0x07ul:
13803 return true;
13804 case 0x08ul:
13805 return true;
13806 case 0x09ul:
13807 return false;
13808 case 0x0Aul:
13809 return false;
13810 case 0x0Bul:
13811 return true;
13812 case 0x0Cul:
13813 return true;
13814 case 0x0Dul:
13815 return false;
13816 default:
13817 return false;
13818 }
13819 }
13820 #endif
13821 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
13822 if (var1 == 0x01)
13823 {
13824 switch(var2)
13825 {
13826 case 0x00ul:
13827 return false;
13828 case 0x01ul:
13829 return false;
13830 case 0x02ul:
13831 return false;
13832 case 0x03ul:
13833 return false;
13834 case 0x04ul:
13835 return false;
13836 case 0x07ul:
13837 return true;
13838 case 0x08ul:
13839 return true;
13840 case 0x09ul:
13841 return false;
13842 case 0x0Aul:
13843 return false;
13844 case 0x0Bul:
13845 return true;
13846 case 0x0Cul:
13847 return true;
13848 case 0x0Dul:
13849 return false;
13850 default:
13851 return false;
13852 }
13853 }
13854 #endif
13855 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13856 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13857 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
13858 if (var1 == 0x01)
13859 {
13860 switch(var2)
13861 {
13862 case 0x00ul:
13863 return false;
13864 case 0x01ul:
13865 return false;
13866 case 0x02ul:
13867 return false;
13868 case 0x03ul:
13869 return false;
13870 case 0x04ul:
13871 return false;
13872 case 0x07ul:
13873 return true;
13874 case 0x08ul:
13875 return true;
13876 case 0x09ul:
13877 return false;
13878 case 0x0Aul:
13879 return false;
13880 case 0x0Bul:
13881 return true;
13882 case 0x0Cul:
13883 return true;
13884 case 0x0Dul:
13885 return false;
13886 default:
13887 return false;
13888 }
13889 }
13890 #endif
13891 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13892 if (var1 == 0x01)
13893 {
13894 switch(var2)
13895 {
13896 case 0x00ul:
13897 return false;
13898 case 0x01ul:
13899 return false;
13900 case 0x02ul:
13901 return false;
13902 case 0x03ul:
13903 return false;
13904 case 0x04ul:
13905 return false;
13906 case 0x07ul:
13907 return true;
13908 case 0x08ul:
13909 return true;
13910 case 0x09ul:
13911 return false;
13912 case 0x0Aul:
13913 return false;
13914 case 0x0Bul:
13915 return true;
13916 case 0x0Cul:
13917 return true;
13918 case 0x0Dul:
13919 return false;
13920 default:
13921 return false;
13922 }
13923 }
13924 #endif
13925 return false;
13926 #endif
13927 }
13928
13929 /* ========= Errata 72 ========= */
13930 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
13931 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
13932 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
13933 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
13934 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
13935 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
13936 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
13937 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
13938 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13939 #define NRF51_ERRATA_72_PRESENT 1
13940 #else
13941 #define NRF51_ERRATA_72_PRESENT 0
13942 #endif
13943
13944 #ifndef NRF51_ERRATA_72_ENABLE_WORKAROUND
13945 #define NRF51_ERRATA_72_ENABLE_WORKAROUND NRF51_ERRATA_72_PRESENT
13946 #endif
13947
nrf51_errata_72(void)13948 static bool nrf51_errata_72(void)
13949 {
13950 #ifndef NRF51_SERIES
13951 return false;
13952 #else
13953 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13954 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13955 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
13956 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
13957 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
13958 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
13959 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
13960 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
13961 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
13962 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
13963 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
13964 #endif
13965 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
13966 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
13967 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
13968 if (var1 == 0x01)
13969 {
13970 switch(var2)
13971 {
13972 case 0x00ul:
13973 return true;
13974 case 0x01ul:
13975 return true;
13976 case 0x02ul:
13977 return true;
13978 case 0x03ul:
13979 return true;
13980 case 0x04ul:
13981 return true;
13982 case 0x07ul:
13983 return true;
13984 case 0x08ul:
13985 return true;
13986 case 0x09ul:
13987 return true;
13988 case 0x0Aul:
13989 return true;
13990 case 0x0Bul:
13991 return true;
13992 case 0x0Cul:
13993 return true;
13994 case 0x0Dul:
13995 return true;
13996 default:
13997 return true;
13998 }
13999 }
14000 #endif
14001 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
14002 if (var1 == 0x01)
14003 {
14004 switch(var2)
14005 {
14006 case 0x00ul:
14007 return true;
14008 case 0x01ul:
14009 return true;
14010 case 0x02ul:
14011 return true;
14012 case 0x03ul:
14013 return true;
14014 case 0x04ul:
14015 return true;
14016 case 0x07ul:
14017 return true;
14018 case 0x08ul:
14019 return true;
14020 case 0x09ul:
14021 return true;
14022 case 0x0Aul:
14023 return true;
14024 case 0x0Bul:
14025 return true;
14026 case 0x0Cul:
14027 return true;
14028 case 0x0Dul:
14029 return true;
14030 default:
14031 return true;
14032 }
14033 }
14034 #endif
14035 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
14036 if (var1 == 0x01)
14037 {
14038 switch(var2)
14039 {
14040 case 0x00ul:
14041 return true;
14042 case 0x01ul:
14043 return true;
14044 case 0x02ul:
14045 return true;
14046 case 0x03ul:
14047 return true;
14048 case 0x04ul:
14049 return true;
14050 case 0x07ul:
14051 return true;
14052 case 0x08ul:
14053 return true;
14054 case 0x09ul:
14055 return true;
14056 case 0x0Aul:
14057 return true;
14058 case 0x0Bul:
14059 return true;
14060 case 0x0Cul:
14061 return true;
14062 case 0x0Dul:
14063 return true;
14064 default:
14065 return true;
14066 }
14067 }
14068 #endif
14069 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14070 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14071 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
14072 if (var1 == 0x01)
14073 {
14074 switch(var2)
14075 {
14076 case 0x00ul:
14077 return true;
14078 case 0x01ul:
14079 return true;
14080 case 0x02ul:
14081 return true;
14082 case 0x03ul:
14083 return true;
14084 case 0x04ul:
14085 return true;
14086 case 0x07ul:
14087 return true;
14088 case 0x08ul:
14089 return true;
14090 case 0x09ul:
14091 return true;
14092 case 0x0Aul:
14093 return true;
14094 case 0x0Bul:
14095 return true;
14096 case 0x0Cul:
14097 return true;
14098 case 0x0Dul:
14099 return true;
14100 default:
14101 return true;
14102 }
14103 }
14104 #endif
14105 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14106 if (var1 == 0x01)
14107 {
14108 switch(var2)
14109 {
14110 case 0x00ul:
14111 return true;
14112 case 0x01ul:
14113 return true;
14114 case 0x02ul:
14115 return true;
14116 case 0x03ul:
14117 return true;
14118 case 0x04ul:
14119 return true;
14120 case 0x07ul:
14121 return true;
14122 case 0x08ul:
14123 return true;
14124 case 0x09ul:
14125 return true;
14126 case 0x0Aul:
14127 return true;
14128 case 0x0Bul:
14129 return true;
14130 case 0x0Cul:
14131 return true;
14132 case 0x0Dul:
14133 return true;
14134 default:
14135 return true;
14136 }
14137 }
14138 #endif
14139 return false;
14140 #endif
14141 }
14142
14143 /* ========= Errata 73 ========= */
14144 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
14145 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
14146 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
14147 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
14148 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
14149 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
14150 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
14151 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
14152 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14153 #define NRF51_ERRATA_73_PRESENT 1
14154 #else
14155 #define NRF51_ERRATA_73_PRESENT 0
14156 #endif
14157
14158 #ifndef NRF51_ERRATA_73_ENABLE_WORKAROUND
14159 #define NRF51_ERRATA_73_ENABLE_WORKAROUND NRF51_ERRATA_73_PRESENT
14160 #endif
14161
nrf51_errata_73(void)14162 static bool nrf51_errata_73(void)
14163 {
14164 #ifndef NRF51_SERIES
14165 return false;
14166 #else
14167 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14168 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14169 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
14170 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
14171 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
14172 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14173 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14174 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
14175 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14176 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
14177 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
14178 #endif
14179 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14180 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14181 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
14182 if (var1 == 0x01)
14183 {
14184 switch(var2)
14185 {
14186 case 0x00ul:
14187 return false;
14188 case 0x01ul:
14189 return false;
14190 case 0x02ul:
14191 return false;
14192 case 0x03ul:
14193 return false;
14194 case 0x04ul:
14195 return false;
14196 case 0x07ul:
14197 return true;
14198 case 0x08ul:
14199 return true;
14200 case 0x09ul:
14201 return true;
14202 case 0x0Aul:
14203 return false;
14204 case 0x0Bul:
14205 return true;
14206 case 0x0Cul:
14207 return true;
14208 case 0x0Dul:
14209 return false;
14210 default:
14211 return false;
14212 }
14213 }
14214 #endif
14215 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
14216 if (var1 == 0x01)
14217 {
14218 switch(var2)
14219 {
14220 case 0x00ul:
14221 return false;
14222 case 0x01ul:
14223 return false;
14224 case 0x02ul:
14225 return false;
14226 case 0x03ul:
14227 return false;
14228 case 0x04ul:
14229 return false;
14230 case 0x07ul:
14231 return true;
14232 case 0x08ul:
14233 return true;
14234 case 0x09ul:
14235 return true;
14236 case 0x0Aul:
14237 return false;
14238 case 0x0Bul:
14239 return true;
14240 case 0x0Cul:
14241 return true;
14242 case 0x0Dul:
14243 return false;
14244 default:
14245 return false;
14246 }
14247 }
14248 #endif
14249 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
14250 if (var1 == 0x01)
14251 {
14252 switch(var2)
14253 {
14254 case 0x00ul:
14255 return false;
14256 case 0x01ul:
14257 return false;
14258 case 0x02ul:
14259 return false;
14260 case 0x03ul:
14261 return false;
14262 case 0x04ul:
14263 return false;
14264 case 0x07ul:
14265 return true;
14266 case 0x08ul:
14267 return true;
14268 case 0x09ul:
14269 return true;
14270 case 0x0Aul:
14271 return false;
14272 case 0x0Bul:
14273 return true;
14274 case 0x0Cul:
14275 return true;
14276 case 0x0Dul:
14277 return false;
14278 default:
14279 return false;
14280 }
14281 }
14282 #endif
14283 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14284 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14285 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
14286 if (var1 == 0x01)
14287 {
14288 switch(var2)
14289 {
14290 case 0x00ul:
14291 return false;
14292 case 0x01ul:
14293 return false;
14294 case 0x02ul:
14295 return false;
14296 case 0x03ul:
14297 return false;
14298 case 0x04ul:
14299 return false;
14300 case 0x07ul:
14301 return true;
14302 case 0x08ul:
14303 return true;
14304 case 0x09ul:
14305 return true;
14306 case 0x0Aul:
14307 return false;
14308 case 0x0Bul:
14309 return true;
14310 case 0x0Cul:
14311 return true;
14312 case 0x0Dul:
14313 return false;
14314 default:
14315 return false;
14316 }
14317 }
14318 #endif
14319 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14320 if (var1 == 0x01)
14321 {
14322 switch(var2)
14323 {
14324 case 0x00ul:
14325 return false;
14326 case 0x01ul:
14327 return false;
14328 case 0x02ul:
14329 return false;
14330 case 0x03ul:
14331 return false;
14332 case 0x04ul:
14333 return false;
14334 case 0x07ul:
14335 return true;
14336 case 0x08ul:
14337 return true;
14338 case 0x09ul:
14339 return true;
14340 case 0x0Aul:
14341 return false;
14342 case 0x0Bul:
14343 return true;
14344 case 0x0Cul:
14345 return true;
14346 case 0x0Dul:
14347 return false;
14348 default:
14349 return false;
14350 }
14351 }
14352 #endif
14353 return false;
14354 #endif
14355 }
14356
14357 /* ========= Errata 74 ========= */
14358 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
14359 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
14360 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
14361 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
14362 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
14363 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
14364 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
14365 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
14366 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14367 #define NRF51_ERRATA_74_PRESENT 1
14368 #else
14369 #define NRF51_ERRATA_74_PRESENT 0
14370 #endif
14371
14372 #ifndef NRF51_ERRATA_74_ENABLE_WORKAROUND
14373 #define NRF51_ERRATA_74_ENABLE_WORKAROUND NRF51_ERRATA_74_PRESENT
14374 #endif
14375
nrf51_errata_74(void)14376 static bool nrf51_errata_74(void)
14377 {
14378 #ifndef NRF51_SERIES
14379 return false;
14380 #else
14381 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14382 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14383 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
14384 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
14385 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
14386 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14387 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14388 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
14389 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14390 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
14391 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
14392 #endif
14393 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14394 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14395 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
14396 if (var1 == 0x01)
14397 {
14398 switch(var2)
14399 {
14400 case 0x00ul:
14401 return false;
14402 case 0x01ul:
14403 return false;
14404 case 0x02ul:
14405 return true;
14406 case 0x03ul:
14407 return false;
14408 case 0x04ul:
14409 return true;
14410 case 0x07ul:
14411 return true;
14412 case 0x08ul:
14413 return true;
14414 case 0x09ul:
14415 return true;
14416 case 0x0Aul:
14417 return false;
14418 case 0x0Bul:
14419 return true;
14420 case 0x0Cul:
14421 return true;
14422 case 0x0Dul:
14423 return false;
14424 default:
14425 return false;
14426 }
14427 }
14428 #endif
14429 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
14430 if (var1 == 0x01)
14431 {
14432 switch(var2)
14433 {
14434 case 0x00ul:
14435 return false;
14436 case 0x01ul:
14437 return false;
14438 case 0x02ul:
14439 return true;
14440 case 0x03ul:
14441 return false;
14442 case 0x04ul:
14443 return true;
14444 case 0x07ul:
14445 return true;
14446 case 0x08ul:
14447 return true;
14448 case 0x09ul:
14449 return true;
14450 case 0x0Aul:
14451 return false;
14452 case 0x0Bul:
14453 return true;
14454 case 0x0Cul:
14455 return true;
14456 case 0x0Dul:
14457 return false;
14458 default:
14459 return false;
14460 }
14461 }
14462 #endif
14463 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
14464 if (var1 == 0x01)
14465 {
14466 switch(var2)
14467 {
14468 case 0x00ul:
14469 return false;
14470 case 0x01ul:
14471 return false;
14472 case 0x02ul:
14473 return true;
14474 case 0x03ul:
14475 return false;
14476 case 0x04ul:
14477 return true;
14478 case 0x07ul:
14479 return true;
14480 case 0x08ul:
14481 return true;
14482 case 0x09ul:
14483 return true;
14484 case 0x0Aul:
14485 return false;
14486 case 0x0Bul:
14487 return true;
14488 case 0x0Cul:
14489 return true;
14490 case 0x0Dul:
14491 return false;
14492 default:
14493 return false;
14494 }
14495 }
14496 #endif
14497 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14498 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14499 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
14500 if (var1 == 0x01)
14501 {
14502 switch(var2)
14503 {
14504 case 0x00ul:
14505 return false;
14506 case 0x01ul:
14507 return false;
14508 case 0x02ul:
14509 return true;
14510 case 0x03ul:
14511 return false;
14512 case 0x04ul:
14513 return true;
14514 case 0x07ul:
14515 return true;
14516 case 0x08ul:
14517 return true;
14518 case 0x09ul:
14519 return true;
14520 case 0x0Aul:
14521 return false;
14522 case 0x0Bul:
14523 return true;
14524 case 0x0Cul:
14525 return true;
14526 case 0x0Dul:
14527 return false;
14528 default:
14529 return false;
14530 }
14531 }
14532 #endif
14533 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14534 if (var1 == 0x01)
14535 {
14536 switch(var2)
14537 {
14538 case 0x00ul:
14539 return false;
14540 case 0x01ul:
14541 return false;
14542 case 0x02ul:
14543 return true;
14544 case 0x03ul:
14545 return false;
14546 case 0x04ul:
14547 return true;
14548 case 0x07ul:
14549 return true;
14550 case 0x08ul:
14551 return true;
14552 case 0x09ul:
14553 return true;
14554 case 0x0Aul:
14555 return false;
14556 case 0x0Bul:
14557 return true;
14558 case 0x0Cul:
14559 return true;
14560 case 0x0Dul:
14561 return false;
14562 default:
14563 return false;
14564 }
14565 }
14566 #endif
14567 return false;
14568 #endif
14569 }
14570
14571 /* ========= Errata 75 ========= */
14572 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
14573 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
14574 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
14575 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
14576 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
14577 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
14578 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
14579 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
14580 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14581 #define NRF51_ERRATA_75_PRESENT 1
14582 #else
14583 #define NRF51_ERRATA_75_PRESENT 0
14584 #endif
14585
14586 #ifndef NRF51_ERRATA_75_ENABLE_WORKAROUND
14587 #define NRF51_ERRATA_75_ENABLE_WORKAROUND NRF51_ERRATA_75_PRESENT
14588 #endif
14589
nrf51_errata_75(void)14590 static bool nrf51_errata_75(void)
14591 {
14592 #ifndef NRF51_SERIES
14593 return false;
14594 #else
14595 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14596 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14597 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
14598 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
14599 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
14600 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14601 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14602 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
14603 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14604 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
14605 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
14606 #endif
14607 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14608 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14609 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
14610 if (var1 == 0x01)
14611 {
14612 switch(var2)
14613 {
14614 case 0x00ul:
14615 return false;
14616 case 0x01ul:
14617 return false;
14618 case 0x02ul:
14619 return true;
14620 case 0x03ul:
14621 return false;
14622 case 0x04ul:
14623 return true;
14624 case 0x07ul:
14625 return true;
14626 case 0x08ul:
14627 return true;
14628 case 0x09ul:
14629 return true;
14630 case 0x0Aul:
14631 return true;
14632 case 0x0Bul:
14633 return true;
14634 case 0x0Cul:
14635 return true;
14636 case 0x0Dul:
14637 return true;
14638 default:
14639 return true;
14640 }
14641 }
14642 #endif
14643 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
14644 if (var1 == 0x01)
14645 {
14646 switch(var2)
14647 {
14648 case 0x00ul:
14649 return false;
14650 case 0x01ul:
14651 return false;
14652 case 0x02ul:
14653 return true;
14654 case 0x03ul:
14655 return false;
14656 case 0x04ul:
14657 return true;
14658 case 0x07ul:
14659 return true;
14660 case 0x08ul:
14661 return true;
14662 case 0x09ul:
14663 return true;
14664 case 0x0Aul:
14665 return true;
14666 case 0x0Bul:
14667 return true;
14668 case 0x0Cul:
14669 return true;
14670 case 0x0Dul:
14671 return true;
14672 default:
14673 return true;
14674 }
14675 }
14676 #endif
14677 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
14678 if (var1 == 0x01)
14679 {
14680 switch(var2)
14681 {
14682 case 0x00ul:
14683 return false;
14684 case 0x01ul:
14685 return false;
14686 case 0x02ul:
14687 return true;
14688 case 0x03ul:
14689 return false;
14690 case 0x04ul:
14691 return true;
14692 case 0x07ul:
14693 return true;
14694 case 0x08ul:
14695 return true;
14696 case 0x09ul:
14697 return true;
14698 case 0x0Aul:
14699 return true;
14700 case 0x0Bul:
14701 return true;
14702 case 0x0Cul:
14703 return true;
14704 case 0x0Dul:
14705 return true;
14706 default:
14707 return true;
14708 }
14709 }
14710 #endif
14711 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14712 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14713 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
14714 if (var1 == 0x01)
14715 {
14716 switch(var2)
14717 {
14718 case 0x00ul:
14719 return false;
14720 case 0x01ul:
14721 return false;
14722 case 0x02ul:
14723 return true;
14724 case 0x03ul:
14725 return false;
14726 case 0x04ul:
14727 return true;
14728 case 0x07ul:
14729 return true;
14730 case 0x08ul:
14731 return true;
14732 case 0x09ul:
14733 return true;
14734 case 0x0Aul:
14735 return true;
14736 case 0x0Bul:
14737 return true;
14738 case 0x0Cul:
14739 return true;
14740 case 0x0Dul:
14741 return true;
14742 default:
14743 return true;
14744 }
14745 }
14746 #endif
14747 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14748 if (var1 == 0x01)
14749 {
14750 switch(var2)
14751 {
14752 case 0x00ul:
14753 return false;
14754 case 0x01ul:
14755 return false;
14756 case 0x02ul:
14757 return true;
14758 case 0x03ul:
14759 return false;
14760 case 0x04ul:
14761 return true;
14762 case 0x07ul:
14763 return true;
14764 case 0x08ul:
14765 return true;
14766 case 0x09ul:
14767 return true;
14768 case 0x0Aul:
14769 return true;
14770 case 0x0Bul:
14771 return true;
14772 case 0x0Cul:
14773 return true;
14774 case 0x0Dul:
14775 return true;
14776 default:
14777 return true;
14778 }
14779 }
14780 #endif
14781 return false;
14782 #endif
14783 }
14784
14785 /* ========= Errata 76 ========= */
14786 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
14787 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
14788 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
14789 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
14790 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
14791 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
14792 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
14793 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
14794 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14795 #define NRF51_ERRATA_76_PRESENT 1
14796 #else
14797 #define NRF51_ERRATA_76_PRESENT 0
14798 #endif
14799
14800 #ifndef NRF51_ERRATA_76_ENABLE_WORKAROUND
14801 #define NRF51_ERRATA_76_ENABLE_WORKAROUND NRF51_ERRATA_76_PRESENT
14802 #endif
14803
nrf51_errata_76(void)14804 static bool nrf51_errata_76(void)
14805 {
14806 #ifndef NRF51_SERIES
14807 return false;
14808 #else
14809 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14810 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14811 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
14812 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
14813 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
14814 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14815 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14816 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
14817 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14818 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
14819 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
14820 #endif
14821 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
14822 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
14823 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
14824 if (var1 == 0x01)
14825 {
14826 switch(var2)
14827 {
14828 case 0x00ul:
14829 return false;
14830 case 0x01ul:
14831 return false;
14832 case 0x02ul:
14833 return false;
14834 case 0x03ul:
14835 return false;
14836 case 0x04ul:
14837 return false;
14838 case 0x07ul:
14839 return false;
14840 case 0x08ul:
14841 return false;
14842 case 0x09ul:
14843 return false;
14844 case 0x0Aul:
14845 return true;
14846 case 0x0Bul:
14847 return false;
14848 case 0x0Cul:
14849 return false;
14850 case 0x0Dul:
14851 return true;
14852 default:
14853 return true;
14854 }
14855 }
14856 #endif
14857 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
14858 if (var1 == 0x01)
14859 {
14860 switch(var2)
14861 {
14862 case 0x00ul:
14863 return false;
14864 case 0x01ul:
14865 return false;
14866 case 0x02ul:
14867 return false;
14868 case 0x03ul:
14869 return false;
14870 case 0x04ul:
14871 return false;
14872 case 0x07ul:
14873 return false;
14874 case 0x08ul:
14875 return false;
14876 case 0x09ul:
14877 return false;
14878 case 0x0Aul:
14879 return true;
14880 case 0x0Bul:
14881 return false;
14882 case 0x0Cul:
14883 return false;
14884 case 0x0Dul:
14885 return true;
14886 default:
14887 return true;
14888 }
14889 }
14890 #endif
14891 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
14892 if (var1 == 0x01)
14893 {
14894 switch(var2)
14895 {
14896 case 0x00ul:
14897 return false;
14898 case 0x01ul:
14899 return false;
14900 case 0x02ul:
14901 return false;
14902 case 0x03ul:
14903 return false;
14904 case 0x04ul:
14905 return false;
14906 case 0x07ul:
14907 return false;
14908 case 0x08ul:
14909 return false;
14910 case 0x09ul:
14911 return false;
14912 case 0x0Aul:
14913 return true;
14914 case 0x0Bul:
14915 return false;
14916 case 0x0Cul:
14917 return false;
14918 case 0x0Dul:
14919 return true;
14920 default:
14921 return true;
14922 }
14923 }
14924 #endif
14925 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
14926 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
14927 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
14928 if (var1 == 0x01)
14929 {
14930 switch(var2)
14931 {
14932 case 0x00ul:
14933 return false;
14934 case 0x01ul:
14935 return false;
14936 case 0x02ul:
14937 return false;
14938 case 0x03ul:
14939 return false;
14940 case 0x04ul:
14941 return false;
14942 case 0x07ul:
14943 return false;
14944 case 0x08ul:
14945 return false;
14946 case 0x09ul:
14947 return false;
14948 case 0x0Aul:
14949 return true;
14950 case 0x0Bul:
14951 return false;
14952 case 0x0Cul:
14953 return false;
14954 case 0x0Dul:
14955 return true;
14956 default:
14957 return true;
14958 }
14959 }
14960 #endif
14961 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
14962 if (var1 == 0x01)
14963 {
14964 switch(var2)
14965 {
14966 case 0x00ul:
14967 return false;
14968 case 0x01ul:
14969 return false;
14970 case 0x02ul:
14971 return false;
14972 case 0x03ul:
14973 return false;
14974 case 0x04ul:
14975 return false;
14976 case 0x07ul:
14977 return false;
14978 case 0x08ul:
14979 return false;
14980 case 0x09ul:
14981 return false;
14982 case 0x0Aul:
14983 return true;
14984 case 0x0Bul:
14985 return false;
14986 case 0x0Cul:
14987 return false;
14988 case 0x0Dul:
14989 return true;
14990 default:
14991 return true;
14992 }
14993 }
14994 #endif
14995 return false;
14996 #endif
14997 }
14998
14999 /* ========= Errata 77 ========= */
15000 #define NRF51_ERRATA_77_PRESENT 0
15001
15002 #ifndef NRF51_ERRATA_77_ENABLE_WORKAROUND
15003 #define NRF51_ERRATA_77_ENABLE_WORKAROUND NRF51_ERRATA_77_PRESENT
15004 #endif
15005
nrf51_errata_77(void)15006 static bool nrf51_errata_77(void)
15007 {
15008 #ifndef NRF51_SERIES
15009 return false;
15010 #else
15011 return false;
15012 #endif
15013 }
15014
15015 /* ========= Errata 78 ========= */
15016 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422) \
15017 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422) \
15018 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422) \
15019 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801) \
15020 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802) \
15021 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822) \
15022 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822) \
15023 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822) \
15024 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
15025 #define NRF51_ERRATA_78_PRESENT 1
15026 #else
15027 #define NRF51_ERRATA_78_PRESENT 0
15028 #endif
15029
15030 #ifndef NRF51_ERRATA_78_ENABLE_WORKAROUND
15031 #define NRF51_ERRATA_78_ENABLE_WORKAROUND NRF51_ERRATA_78_PRESENT
15032 #endif
15033
nrf51_errata_78(void)15034 static bool nrf51_errata_78(void)
15035 {
15036 #ifndef NRF51_SERIES
15037 return false;
15038 #else
15039 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
15040 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
15041 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)\
15042 || defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)\
15043 || defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)\
15044 || defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
15045 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
15046 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)\
15047 || defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
15048 uint32_t var1 = ((*(uint32_t *)0xF0000FE0ul) & 0x000000FFul);
15049 uint32_t var2 = ((*(uint32_t *)0xF0000FE8ul) & 0x000000F0ul) >> 4;
15050 #endif
15051 #if defined (NRF51422_XXAA) || defined (DEVELOP_IN_NRF51422)\
15052 || defined (NRF51422_XXAB) || defined (DEVELOP_IN_NRF51422)\
15053 || defined (NRF51422_XXAC) || defined (DEVELOP_IN_NRF51422)
15054 if (var1 == 0x01)
15055 {
15056 switch(var2)
15057 {
15058 case 0x00ul:
15059 return false;
15060 case 0x01ul:
15061 return false;
15062 case 0x02ul:
15063 return true;
15064 case 0x03ul:
15065 return false;
15066 case 0x04ul:
15067 return true;
15068 case 0x07ul:
15069 return true;
15070 case 0x08ul:
15071 return true;
15072 case 0x09ul:
15073 return true;
15074 case 0x0Aul:
15075 return false;
15076 case 0x0Bul:
15077 return true;
15078 case 0x0Cul:
15079 return true;
15080 case 0x0Dul:
15081 return false;
15082 default:
15083 return false;
15084 }
15085 }
15086 #endif
15087 #if defined (NRF51801_XXAB) || defined (DEVELOP_IN_NRF51801)
15088 if (var1 == 0x01)
15089 {
15090 switch(var2)
15091 {
15092 case 0x00ul:
15093 return false;
15094 case 0x01ul:
15095 return false;
15096 case 0x02ul:
15097 return true;
15098 case 0x03ul:
15099 return false;
15100 case 0x04ul:
15101 return true;
15102 case 0x07ul:
15103 return true;
15104 case 0x08ul:
15105 return true;
15106 case 0x09ul:
15107 return true;
15108 case 0x0Aul:
15109 return false;
15110 case 0x0Bul:
15111 return true;
15112 case 0x0Cul:
15113 return true;
15114 case 0x0Dul:
15115 return false;
15116 default:
15117 return false;
15118 }
15119 }
15120 #endif
15121 #if defined (NRF51802_XXAA) || defined (DEVELOP_IN_NRF51802)
15122 if (var1 == 0x01)
15123 {
15124 switch(var2)
15125 {
15126 case 0x00ul:
15127 return false;
15128 case 0x01ul:
15129 return false;
15130 case 0x02ul:
15131 return true;
15132 case 0x03ul:
15133 return false;
15134 case 0x04ul:
15135 return true;
15136 case 0x07ul:
15137 return true;
15138 case 0x08ul:
15139 return true;
15140 case 0x09ul:
15141 return true;
15142 case 0x0Aul:
15143 return false;
15144 case 0x0Bul:
15145 return true;
15146 case 0x0Cul:
15147 return true;
15148 case 0x0Dul:
15149 return false;
15150 default:
15151 return false;
15152 }
15153 }
15154 #endif
15155 #if defined (NRF51822_XXAA) || defined (DEVELOP_IN_NRF51822)\
15156 || defined (NRF51822_XXAB) || defined (DEVELOP_IN_NRF51822)\
15157 || defined (NRF51822_XXAC) || defined (DEVELOP_IN_NRF51822)
15158 if (var1 == 0x01)
15159 {
15160 switch(var2)
15161 {
15162 case 0x00ul:
15163 return false;
15164 case 0x01ul:
15165 return false;
15166 case 0x02ul:
15167 return true;
15168 case 0x03ul:
15169 return false;
15170 case 0x04ul:
15171 return true;
15172 case 0x07ul:
15173 return true;
15174 case 0x08ul:
15175 return true;
15176 case 0x09ul:
15177 return true;
15178 case 0x0Aul:
15179 return false;
15180 case 0x0Bul:
15181 return true;
15182 case 0x0Cul:
15183 return true;
15184 case 0x0Dul:
15185 return false;
15186 default:
15187 return false;
15188 }
15189 }
15190 #endif
15191 #if defined (NRF51824_XXAA) || defined (DEVELOP_IN_NRF51824)
15192 if (var1 == 0x01)
15193 {
15194 switch(var2)
15195 {
15196 case 0x00ul:
15197 return false;
15198 case 0x01ul:
15199 return false;
15200 case 0x02ul:
15201 return true;
15202 case 0x03ul:
15203 return false;
15204 case 0x04ul:
15205 return true;
15206 case 0x07ul:
15207 return true;
15208 case 0x08ul:
15209 return true;
15210 case 0x09ul:
15211 return true;
15212 case 0x0Aul:
15213 return false;
15214 case 0x0Bul:
15215 return true;
15216 case 0x0Cul:
15217 return true;
15218 case 0x0Dul:
15219 return false;
15220 default:
15221 return false;
15222 }
15223 }
15224 #endif
15225 return false;
15226 #endif
15227 }
15228
15229 #endif /* NRF51_ERRATAS_H */
15230