-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathlpc111x.h
More file actions
3268 lines (2913 loc) · 229 KB
/
lpc111x.h
File metadata and controls
3268 lines (2913 loc) · 229 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**************************************************************************/
/*!
@file lpc111x.h
@author K. Townsend (microBuilder.eu)
@version 1.1
LPC1114 header file
Added muliplexing for LPC1115FBD48/303 as of version 1.1. Some new
registers for the LPC1100XL series may still be missing since these
additions haven't been thoroughly vetted and tested.
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2012 K. Townsend
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/
#ifndef _LPC111X_H_
#define _LPC111X_H_
#include "sysdefs.h"
#include "projectconfig.h"
/*##############################################################################
## System Control Block
##############################################################################*/
#define SCB_BASE_ADDRESS (*(pREG32 (0x40048000))) // System control block base address
/* SCB_MEMREMAP (System memory remap register)
The system memory remap register selects whether the ARM interrupt vectors are read
from the boot ROM, the flash, or the SRAM. */
#define SCB_MEMREMAP (*(pREG32 (0x40048000))) // System memory remap
#define SCB_MEMREMAP_MODE_BOOTLOADER ((unsigned int) 0x00000000) // Interrupt vectors are remapped to Boot ROM
#define SCB_MEMREMAP_MODE_RAM ((unsigned int) 0x00000001) // Interrupt vectors are remapped to Static ROM
#define SCB_MEMREMAP_MODE_FLASH ((unsigned int) 0x00000002) // Interrupt vectors are not remapped and reside in Flash
#define SCB_MEMREMAP_MASK ((unsigned int) 0x00000003)
/* PRESETCTRL (Peripheral reset control register) */
#define SCB_PRESETCTRL (*(pREG32 (0x40048004))) // Peripheral reset control
#define SCB_PRESETCTRL_SSP0_RESETENABLED ((unsigned int) 0x00000000)
#define SCB_PRESETCTRL_SSP0_RESETDISABLED ((unsigned int) 0x00000001)
#define SCB_PRESETCTRL_SSP0_MASK ((unsigned int) 0x00000001)
#define SCB_PRESETCTRL_I2C_RESETENABLED ((unsigned int) 0x00000000)
#define SCB_PRESETCTRL_I2C_RESETDISABLED ((unsigned int) 0x00000002)
#define SCB_PRESETCTRL_I2C_MASK ((unsigned int) 0x00000002)
#define SCB_PRESETCTRL_SSP1_RESETENABLED ((unsigned int) 0x00000000)
#define SCB_PRESETCTRL_SSP1_RESETDISABLED ((unsigned int) 0x00000004)
#define SCB_PRESETCTRL_SSP1_MASK ((unsigned int) 0x00000004)
#define SCB_PRESETCTRL_CAN_RESETENABLED ((unsigned int) 0x00000000)
#define SCB_PRESETCTRL_CAN_RESETDISABLED ((unsigned int) 0x00000008)
#define SCB_PRESETCTRL_CAN_MASK ((unsigned int) 0x00000008)
/* SYSPLLCTRL (System PLL control register)
This register connects and enables the system PLL and configures the PLL multiplier and
divider values. The PLL accepts an input frequency from 10 MHz to 25 MHz from various
clock sources. The input frequency is multiplied up to a high frequency, then divided down
to provide the actual clock used by the CPU, peripherals, and optionally the USB
subsystem. Note that the USB subsystem has its own dedicated PLL. The PLL can
produce a clock up to the maximum allowed for the CPU, which is 50 MHz. */
#define SCB_PLLCTRL (*(pREG32 (0x40048008))) // System PLL control
#define SCB_PLLCTRL_MSEL_1 ((unsigned int) 0x00000000)
#define SCB_PLLCTRL_MSEL_2 ((unsigned int) 0x00000001)
#define SCB_PLLCTRL_MSEL_3 ((unsigned int) 0x00000002)
#define SCB_PLLCTRL_MSEL_4 ((unsigned int) 0x00000003)
#define SCB_PLLCTRL_MSEL_5 ((unsigned int) 0x00000004)
#define SCB_PLLCTRL_MSEL_6 ((unsigned int) 0x00000005)
#define SCB_PLLCTRL_MSEL_7 ((unsigned int) 0x00000006)
#define SCB_PLLCTRL_MSEL_8 ((unsigned int) 0x00000007)
#define SCB_PLLCTRL_MSEL_9 ((unsigned int) 0x00000008)
#define SCB_PLLCTRL_MSEL_10 ((unsigned int) 0x00000009)
#define SCB_PLLCTRL_MSEL_11 ((unsigned int) 0x0000000A)
#define SCB_PLLCTRL_MSEL_12 ((unsigned int) 0x0000000B)
#define SCB_PLLCTRL_MSEL_13 ((unsigned int) 0x0000000C)
#define SCB_PLLCTRL_MSEL_14 ((unsigned int) 0x0000000D)
#define SCB_PLLCTRL_MSEL_15 ((unsigned int) 0x0000000E)
#define SCB_PLLCTRL_MSEL_16 ((unsigned int) 0x0000000F)
#define SCB_PLLCTRL_MSEL_17 ((unsigned int) 0x00000010)
#define SCB_PLLCTRL_MSEL_18 ((unsigned int) 0x00000011)
#define SCB_PLLCTRL_MSEL_19 ((unsigned int) 0x00000012)
#define SCB_PLLCTRL_MSEL_20 ((unsigned int) 0x00000013)
#define SCB_PLLCTRL_MSEL_21 ((unsigned int) 0x00000014)
#define SCB_PLLCTRL_MSEL_22 ((unsigned int) 0x00000015)
#define SCB_PLLCTRL_MSEL_23 ((unsigned int) 0x00000016)
#define SCB_PLLCTRL_MSEL_24 ((unsigned int) 0x00000017)
#define SCB_PLLCTRL_MSEL_25 ((unsigned int) 0x00000018)
#define SCB_PLLCTRL_MSEL_26 ((unsigned int) 0x00000019)
#define SCB_PLLCTRL_MSEL_27 ((unsigned int) 0x0000001A)
#define SCB_PLLCTRL_MSEL_28 ((unsigned int) 0x0000001B)
#define SCB_PLLCTRL_MSEL_29 ((unsigned int) 0x0000001C)
#define SCB_PLLCTRL_MSEL_30 ((unsigned int) 0x0000001D)
#define SCB_PLLCTRL_MSEL_31 ((unsigned int) 0x0000001E)
#define SCB_PLLCTRL_MSEL_32 ((unsigned int) 0x0000001F)
#define SCB_PLLCTRL_MSEL_MASK ((unsigned int) 0x0000001F)
#define SCB_PLLCTRL_PSEL_2 ((unsigned int) 0x00000000)
#define SCB_PLLCTRL_PSEL_4 ((unsigned int) 0x00000020)
#define SCB_PLLCTRL_PSEL_8 ((unsigned int) 0x00000040)
#define SCB_PLLCTRL_PSEL_16 ((unsigned int) 0x00000060)
#define SCB_PLLCTRL_PSEL_BIT (5)
#define SCB_PLLCTRL_PSEL_MASK ((unsigned int) 0x00000060)
#define SCB_PLLCTRL_MASK ((unsigned int) 0x0000007F)
/* SYSPLLSTAT (System PLL status register)
This register is a Read-only register and supplies the PLL lock status */
#define SCB_PLLSTAT (*(pREG32 (0x4004800C))) // System PLL status
#define SCB_PLLSTAT_LOCK ((unsigned int) 0x00000001) // 0 = PLL not locked, 1 = PLL locked
#define SCB_PLLSTAT_LOCK_MASK ((unsigned int) 0x00000001)
/* SYSOSCCTRL (System oscillator control register)
This register configures the frequency range for the system oscillator. */
#define SCB_SYSOSCCTRL (*(pREG32 (0x40048020))) // System oscillator control
#define SCB_SYSOSCCTRL_BYPASS_DISABLED ((unsigned int) 0x00000000) // Oscillator is not bypassed.
#define SCB_SYSOSCCTRL_BYPASS_ENABLED ((unsigned int) 0x00000001) // Bypass enabled
#define SCB_SYSOSCCTRL_BYPASS_MASK ((unsigned int) 0x00000001)
#define SCB_SYSOSCCTRL_FREQRANGE_1TO20MHZ ((unsigned int) 0x00000000) // 1-20 MHz frequency range
#define SCB_SYSOSCCTRL_FREQRANGE_15TO25MHZ ((unsigned int) 0x00000002) // 15-25 MHz frequency range
#define SCB_SYSOSCCTRL_FREQRANGE_MASK ((unsigned int) 0x00000002)
/* WDTOSCTRL (Watchdog oscillator control register)
This register configures the watchdog oscillator. The oscillator consists of an analog and a
digital part. The analog part contains the oscillator function and generates an analog clock
(Fclkana). With the digital part, the analog output clock (Fclkana) can be divided to the
required output clock frequency wdt_osc_clk. The analog output frequency (Fclkana) can
be adjusted with the FREQSEL bits between 500 kHz and 3.7 MHz. With the digital part
Fclkana will be divided (divider ratios = 2, 4,...,64) to wdt_osc_clk using the DIVSEL bits.*/
#define SCB_WDTOSCCTRL (*(pREG32 (0x40048024))) // Watchdog oscillator control
#define SCB_WDTOSCCTRL_DIVSEL_DIV2 ((unsigned int) 0x00000000) // Reset value
#define SCB_WDTOSCCTRL_DIVSEL_DIV4 ((unsigned int) 0x00000001)
#define SCB_WDTOSCCTRL_DIVSEL_DIV6 ((unsigned int) 0x00000002)
#define SCB_WDTOSCCTRL_DIVSEL_DIV8 ((unsigned int) 0x00000003)
#define SCB_WDTOSCCTRL_DIVSEL_DIV10 ((unsigned int) 0x00000004)
#define SCB_WDTOSCCTRL_DIVSEL_DIV12 ((unsigned int) 0x00000005)
#define SCB_WDTOSCCTRL_DIVSEL_DIV14 ((unsigned int) 0x00000006)
#define SCB_WDTOSCCTRL_DIVSEL_DIV16 ((unsigned int) 0x00000007)
#define SCB_WDTOSCCTRL_DIVSEL_DIV18 ((unsigned int) 0x00000008)
#define SCB_WDTOSCCTRL_DIVSEL_DIV20 ((unsigned int) 0x00000009)
#define SCB_WDTOSCCTRL_DIVSEL_DIV22 ((unsigned int) 0x0000000A)
#define SCB_WDTOSCCTRL_DIVSEL_DIV24 ((unsigned int) 0x0000000B)
#define SCB_WDTOSCCTRL_DIVSEL_DIV26 ((unsigned int) 0x0000000C)
#define SCB_WDTOSCCTRL_DIVSEL_DIV28 ((unsigned int) 0x0000000D)
#define SCB_WDTOSCCTRL_DIVSEL_DIV30 ((unsigned int) 0x0000000E)
#define SCB_WDTOSCCTRL_DIVSEL_DIV32 ((unsigned int) 0x0000000F)
#define SCB_WDTOSCCTRL_DIVSEL_DIV34 ((unsigned int) 0x00000010)
#define SCB_WDTOSCCTRL_DIVSEL_DIV36 ((unsigned int) 0x00000011)
#define SCB_WDTOSCCTRL_DIVSEL_DIV38 ((unsigned int) 0x00000012)
#define SCB_WDTOSCCTRL_DIVSEL_DIV40 ((unsigned int) 0x00000013)
#define SCB_WDTOSCCTRL_DIVSEL_DIV42 ((unsigned int) 0x00000014)
#define SCB_WDTOSCCTRL_DIVSEL_DIV44 ((unsigned int) 0x00000015)
#define SCB_WDTOSCCTRL_DIVSEL_DIV46 ((unsigned int) 0x00000016)
#define SCB_WDTOSCCTRL_DIVSEL_DIV48 ((unsigned int) 0x00000017)
#define SCB_WDTOSCCTRL_DIVSEL_DIV50 ((unsigned int) 0x00000018)
#define SCB_WDTOSCCTRL_DIVSEL_DIV52 ((unsigned int) 0x00000019)
#define SCB_WDTOSCCTRL_DIVSEL_DIV54 ((unsigned int) 0x0000001A)
#define SCB_WDTOSCCTRL_DIVSEL_DIV56 ((unsigned int) 0x0000001B)
#define SCB_WDTOSCCTRL_DIVSEL_DIV58 ((unsigned int) 0x0000001C)
#define SCB_WDTOSCCTRL_DIVSEL_DIV60 ((unsigned int) 0x0000001D)
#define SCB_WDTOSCCTRL_DIVSEL_DIV62 ((unsigned int) 0x0000001E)
#define SCB_WDTOSCCTRL_DIVSEL_DIV64 ((unsigned int) 0x0000001F)
#define SCB_WDTOSCCTRL_DIVSEL_MASK ((unsigned int) 0x0000001F)
#define SCB_WDTOSCCTRL_FREQSEL_0_5MHZ ((unsigned int) 0x00000020)
#define SCB_WDTOSCCTRL_FREQSEL_0_8MHZ ((unsigned int) 0x00000040)
#define SCB_WDTOSCCTRL_FREQSEL_1_1MHZ ((unsigned int) 0x00000060)
#define SCB_WDTOSCCTRL_FREQSEL_1_4MHZ ((unsigned int) 0x00000080)
#define SCB_WDTOSCCTRL_FREQSEL_1_6MHZ ((unsigned int) 0x000000A0) // Reset value
#define SCB_WDTOSCCTRL_FREQSEL_1_8MHZ ((unsigned int) 0x000000C0)
#define SCB_WDTOSCCTRL_FREQSEL_2_0MHZ ((unsigned int) 0x000000E0)
#define SCB_WDTOSCCTRL_FREQSEL_2_2MHZ ((unsigned int) 0x00000100)
#define SCB_WDTOSCCTRL_FREQSEL_2_4MHZ ((unsigned int) 0x00000120)
#define SCB_WDTOSCCTRL_FREQSEL_2_6MHZ ((unsigned int) 0x00000140)
#define SCB_WDTOSCCTRL_FREQSEL_2_7MHZ ((unsigned int) 0x00000160)
#define SCB_WDTOSCCTRL_FREQSEL_2_9MHZ ((unsigned int) 0x00000180)
#define SCB_WDTOSCCTRL_FREQSEL_3_1MHZ ((unsigned int) 0x000001A0)
#define SCB_WDTOSCCTRL_FREQSEL_3_2MHZ ((unsigned int) 0x000001C0)
#define SCB_WDTOSCCTRL_FREQSEL_3_4MHZ ((unsigned int) 0x000001E0)
#define SCB_WDTOSCCTRL_FREQSEL_MASK ((unsigned int) 0x000001E0)
/* IRCCTRL (Internal resonant crystal control register)
This register is used to trim the on-chip 12 MHz oscillator. The trim value is factory-preset
and written by the boot code on start-up. */
#define SCB_IRCCTRL (*(pREG32 (0x40048028))) // IRC control
#define SCB_IRCCTRL_MASK ((unsigned int) 0x000000FF)
/* SYSRSTSTAT (System reset status register)
The SYSRSTSTAT register shows the source of the latest reset event. The bits are
cleared by writing a one to any of the bits. The POR event clears all other bits in this
register, but if another reset signal (e.g., EXTRST) remains asserted after the POR signal
is negated, then its bit is set to detected. */
#define SCB_RESETSTAT (*(pREG32 (0x40048030))) // System reset status register
#define SCB_RESETSTAT_POR_MASK ((unsigned int) 0x00000001) // POR reset status
#define SCB_RESETSTAT_EXTRST_MASK ((unsigned int) 0x00000002) // Status of the external reset pin
#define SCB_RESETSTAT_WDT_MASK ((unsigned int) 0x00000004) // Status of the watchdog reset
#define SCB_RESETSTAT_BOD_MASK ((unsigned int) 0x00000008) // Status of the brown-out detect reset
#define SCB_RESETSTAT_SYSRST_MASK ((unsigned int) 0x00000010) // Status of the software system reset
#define SCB_RESETSTAT_MASK ((unsigned int) 0x00000010)
/* SYSPLLCLKSEL (System PLL clock source select register)
This register selects the clock source for the system PLL. The SYSPLLCLKUEN register
must be toggled from LOW to HIGH for the update to take effect.
*/
#define SCB_PLLCLKSEL (*(pREG32 (0x40048040))) // System PLL clock source select
#define SCB_CLKSEL_SOURCE_INTERNALOSC ((unsigned int) 0x00000000)
#define SCB_CLKSEL_SOURCE_MAINOSC ((unsigned int) 0x00000001)
#define SCB_CLKSEL_SOURCE_MASK ((unsigned int) 0x00000002)
/* SYSPLLUEN (System PLL clock source update enable register)
This register updates the clock source of the system PLL with the new input clock after the
SYSPLLCLKSEL register has been written to. In order for the update to take effect, first
write a zero to the SYSPLLUEN register and then write a one to SYSPLLUEN. */
#define SCB_PLLCLKUEN (*(pREG32 (0x40048044))) // System PLL clock source update enable
#define SCB_PLLCLKUEN_DISABLE ((unsigned int) 0x00000000)
#define SCB_PLLCLKUEN_UPDATE ((unsigned int) 0x00000001)
#define SCB_PLLCLKUEN_MASK ((unsigned int) 0x00000001)
/* MAINCLKSEL (Main clock source select register)
This register selects the main system clock which can be either the output from the
system PLL or the IRC, system, or Watchdog oscillators directly. The main system clock
clocks the core, the peripherals, and optionally the USB block.
The MAINCLKUEN register must be toggled from LOW to HIGH for the update to take effect.*/
#define SCB_MAINCLKSEL (*(pREG32 (0x40048070))) // Main clock source select
#define SCB_MAINCLKSEL_SOURCE_INTERNALOSC ((unsigned int) 0x00000000) // Use IRC oscillator for main clock source
#define SCB_MAINCLKSEL_SOURCE_INPUTCLOCK ((unsigned int) 0x00000001) // Use Input clock to system PLL for main clock source
#define SCB_MAINCLKSEL_SOURCE_WDTOSC ((unsigned int) 0x00000002) // Use watchdog oscillator for main clock source
#define SCB_MAINCLKSEL_SOURCE_SYSPLLCLKOUT ((unsigned int) 0x00000003) // Use system PLL clock out for main clock source
#define SCB_MAINCLKSEL_MASK ((unsigned int) 0x00000003)
/* MAINCLKUEN (Main clock source update enable register)
This register updates the clock source of the main clock with the new input clock after the
MAINCLKSEL register has been written to. In order for the update to take effect, first write
a zero to the MAINUEN register and then write a one to MAINCLKUEN. */
#define SCB_MAINCLKUEN (*(pREG32 (0x40048074))) // Main clock source update enable
#define SCB_MAINCLKUEN_DISABLE ((unsigned int) 0x00000000)
#define SCB_MAINCLKUEN_UPDATE ((unsigned int) 0x00000001)
#define SCB_MAINCLKUEN_MASK ((unsigned int) 0x00000001)
/* SYSAHBCLKDIV (System AHB clock divider register)
This register divides the main clock to provide the system clock to the core, memories,
and the peripherals. The system clock can be shut down completely by setting the DIV
bits to 0x0. */
#define SCB_SYSAHBCLKDIV (*(pREG32 (0x40048078))) // System AHB clock divider
#define SCB_SYSAHBCLKDIV_DISABLE ((unsigned int) 0x00000000) // 0 will shut the system clock down completely
#define SCB_SYSAHBCLKDIV_DIV1 ((unsigned int) 0x00000001) // 1, 2 or 4 are the most common values
#define SCB_SYSAHBCLKDIV_DIV2 ((unsigned int) 0x00000002)
#define SCB_SYSAHBCLKDIV_DIV4 ((unsigned int) 0x00000004)
#define SCB_SYSAHBCLKDIV_MASK ((unsigned int) 0x000000FF) // AHB clock divider can be from 0 to 255
/* AHBCLKCTRL (System AHB clock control register)
The AHBCLKCTRL register enables the clocks to individual system and peripheral blocks.
The system clock (sys_ahb_clk[0], bit 0 in the AHBCLKCTRL register) provides the clock
for the AHB to APB bridge, the AHB matrix, the ARM Cortex-M0, the Syscon block, and
the PMU. This clock cannot be disabled. */
#define SCB_SYSAHBCLKCTRL (*(pREG32 (0x40048080))) // System AHB clock control
#define SCB_SYSAHBCLKCTRL_SYS ((unsigned int) 0x00000001) // Enables clock for AHB and APB bridges, FCLK, HCLK, SysCon and PMU
#define SCB_SYSAHBCLKCTRL_SYS_MASK ((unsigned int) 0x00000001)
#define SCB_SYSAHBCLKCTRL_ROM ((unsigned int) 0x00000002) // Enables clock for ROM
#define SCB_SYSAHBCLKCTRL_ROM_MASK ((unsigned int) 0x00000002)
#define SCB_SYSAHBCLKCTRL_RAM ((unsigned int) 0x00000004) // Enables clock for SRAM
#define SCB_SYSAHBCLKCTRL_RAM_MASK ((unsigned int) 0x00000004)
#define SCB_SYSAHBCLKCTRL_FLASHREG ((unsigned int) 0x00000008) // Enables clock for flash register interface
#define SCB_SYSAHBCLKCTRL_FLASHREG_MASK ((unsigned int) 0x00000008)
#define SCB_SYSAHBCLKCTRL_FLASHARRAY ((unsigned int) 0x00000010) // Enables clock for flash array interface
#define SCB_SYSAHBCLKCTRL_FLASHARRAY_MASK ((unsigned int) 0x00000010)
#define SCB_SYSAHBCLKCTRL_I2C ((unsigned int) 0x00000020) // Enables clock for I2C
#define SCB_SYSAHBCLKCTRL_I2C_MASK ((unsigned int) 0x00000020)
#define SCB_SYSAHBCLKCTRL_GPIO ((unsigned int) 0x00000040) // Enables clock for GPIO
#define SCB_SYSAHBCLKCTRL_GPIO_MASK ((unsigned int) 0x00000040)
#define SCB_SYSAHBCLKCTRL_CT16B0 ((unsigned int) 0x00000080) // Enables clock for 16-bit counter/timer 0
#define SCB_SYSAHBCLKCTRL_CT16B0_MASK ((unsigned int) 0x00000080)
#define SCB_SYSAHBCLKCTRL_CT16B1 ((unsigned int) 0x00000100) // Enables clock for 16-bit counter/timer 1
#define SCB_SYSAHBCLKCTRL_CT16B1_MASK ((unsigned int) 0x00000100)
#define SCB_SYSAHBCLKCTRL_CT32B0 ((unsigned int) 0x00000200) // Enables clock for 32-bit counter/timer 0
#define SCB_SYSAHBCLKCTRL_CT32B0_MASK ((unsigned int) 0x00000200)
#define SCB_SYSAHBCLKCTRL_CT32B1 ((unsigned int) 0x00000400) // Enables clock for 32-bit counter/timer 1
#define SCB_SYSAHBCLKCTRL_CT32B1_MASK ((unsigned int) 0x00000400)
#define SCB_SYSAHBCLKCTRL_SSP0 ((unsigned int) 0x00000800) // Enables clock for SSP0
#define SCB_SYSAHBCLKCTRL_SSP0_MASK ((unsigned int) 0x00000800)
#define SCB_SYSAHBCLKCTRL_UART ((unsigned int) 0x00001000) // Enables clock for UART. UART pins must be configured
#define SCB_SYSAHBCLKCTRL_UART_MASK ((unsigned int) 0x00001000) // in the IOCON block before the UART clock can be enabled.
#define SCB_SYSAHBCLKCTRL_ADC ((unsigned int) 0x00002000) // Enables clock for ADC
#define SCB_SYSAHBCLKCTRL_ADC_MASK ((unsigned int) 0x00002000)
#define SCB_SYSAHBCLKCTRL_WDT ((unsigned int) 0x00008000) // Enables clock for watchdog timer
#define SCB_SYSAHBCLKCTRL_WDT_MASK ((unsigned int) 0x00008000)
#define SCB_SYSAHBCLKCTRL_IOCON ((unsigned int) 0x00010000) // Enables clock for IO configuration block
#define SCB_SYSAHBCLKCTRL_IOCON_MASK ((unsigned int) 0x00010000)
#define SCB_SYSAHBCLKCTRL_CAN ((unsigned int) 0x00020000) // Enables clock for CAN
#define SCB_SYSAHBCLKCTRL_CAN_MASK ((unsigned int) 0x00020000)
#define SCB_SYSAHBCLKCTRL_SSP1 ((unsigned int) 0x00040000) // Enables clock for SSP1
#define SCB_SYSAHBCLKCTRL_SSP1_MASK ((unsigned int) 0x00040000)
#define SCB_SYSAHBCLKCTRL_ALL_MASK ((unsigned int) 0x0007FFFF)
/* SSP0CLKDIV (SSP0 clock divider register)
This register configures the SSP0 peripheral clock SSP0_PCLK. The SSP0_PCLK can be
shut down by setting the DIV bits to 0x0. It can be set from 1..255. */
#define SCB_SSP0CLKDIV (*(pREG32 (0x40048094))) // SSP0 clock divider
#define SCB_SSP0CLKDIV_DISABLE ((unsigned int) 0x00000000)
#define SCB_SSP0CLKDIV_DIV1 ((unsigned int) 0x00000001) // Divide SSP0 clock by 1 (can be set from 1..255)
#define SCB_SSP0CLKDIV_DIV2 ((unsigned int) 0x00000002)
#define SCB_SSP0CLKDIV_DIV3 ((unsigned int) 0x00000003)
#define SCB_SSP0CLKDIV_DIV4 ((unsigned int) 0x00000004)
#define SCB_SSP0CLKDIV_DIV5 ((unsigned int) 0x00000005)
#define SCB_SSP0CLKDIV_DIV6 ((unsigned int) 0x00000006)
#define SCB_SSP0CLKDIV_DIV10 ((unsigned int) 0x0000000A)
#define SCB_SSP0CLKDIV_MASK ((unsigned int) 0x000000FF)
/* UARTCLKDIV (UART clock divider register)
This register configures the UART peripheral. The UART_PCLK can be shut down by
setting the DIV bits to 0x0.
Remark: Note that the UART pins must be configured in the IOCON block before the
UART clock can be enabled. */
#define SCB_UARTCLKDIV (*(pREG32 (0x40048098))) // UART clock divider
#define SCB_UARTCLKDIV_DISABLE ((unsigned int) 0x00000000)
#define SCB_UARTCLKDIV_DIV1 ((unsigned int) 0x00000001) // Divide UART clock by 1 (can be set from 1..255)
#define SCB_UARTCLKDIV_DIV2 ((unsigned int) 0x00000002)
#define SCB_UARTCLKDIV_DIV4 ((unsigned int) 0x00000004)
#define SCB_UARTCLKDIV_MASK ((unsigned int) 0x000000FF)
/* SSP1CLKDIV (SSP1 clock divider register)
This register configures the SSP1 peripheral clock SSP1_PCLK. The SSP1_PCLK can be
shut down by setting the DIV bits to 0x0. It can be set from 1..255. */
#define SCB_SSP1CLKDIV (*(pREG32 (0x4004809C))) // SSP1 clock divider
#define SCB_SSP1CLKDIV_DISABLE ((unsigned int) 0x00000000)
#define SCB_SSP1CLKDIV_DIV1 ((unsigned int) 0x00000001) // Divide SSP1 clock by 1 (can be set from 1..255)
#define SCB_SSP1CLKDIV_DIV2 ((unsigned int) 0x00000002)
#define SCB_SSP1CLKDIV_DIV3 ((unsigned int) 0x00000003)
#define SCB_SSP1CLKDIV_DIV4 ((unsigned int) 0x00000004)
#define SCB_SSP1CLKDIV_DIV5 ((unsigned int) 0x00000005)
#define SCB_SSP1CLKDIV_DIV6 ((unsigned int) 0x00000006)
#define SCB_SSP1CLKDIV_DIV10 ((unsigned int) 0x0000000A)
#define SCB_SSP1CLKDIV_MASK ((unsigned int) 0x000000FF)
/* WDTCLKSEL (WDT clock source select register)
This register selects the clock source for the watchdog timer. The WDTCLKUEN register
must be toggled from LOW to HIGH for the update to take effect. */
#define SCB_WDTCLKSEL (*(pREG32 (0x400480D0))) // Watchdog clock source select
#define SCB_WDTCLKSEL_SOURCE_INTERNALOSC ((unsigned int) 0x00000000) // Use the internal oscillator
#define SCB_WDTCLKSEL_SOURCE_INPUTCLOCK ((unsigned int) 0x00000001) // Use the main clock
#define SCB_WDTCLKSEL_SOURCE_WATCHDOGOSC ((unsigned int) 0x00000002) // Use the watchdog oscillator
#define SCB_WDTCLKSEL_MASK ((unsigned int) 0x00000003)
/* WDTCLKUEN (WDT clock source update enable register)
This register updates the clock source of the watchdog timer with the new input clock after
the WDTCLKSEL register has been written to. In order for the update to take effect at the
input of the watchdog timer, first write a zero to the WDTCLKUEN register and then write
a one to WDTCLKUEN. */
#define SCB_WDTCLKUEN (*(pREG32 (0x400480D4))) // Watchdog clock source update enable
#define SCB_WDTCLKUEN_DISABLE ((unsigned int) 0x00000000)
#define SCB_WDTCLKUEN_UPDATE ((unsigned int) 0x00000001)
#define SCB_WDTCLKUEN_MASK ((unsigned int) 0x00000001)
/* WDTCLKDIV (WDT clock divider register)
This register determines the divider values for the watchdog clock wdt_clk. */
#define SCB_WDTCLKDIV (*(pREG32 (0x400480D8))) // Watchdog clock divider
#define SCB_WDTCLKDIV_DISABLE ((unsigned int) 0x00000000)
#define SCB_WDTCLKDIV_DIV1 ((unsigned int) 0x00000001) // Divide clock by 1 (can be set from 1..255)
#define SCB_WDTCLKDIV_MASK ((unsigned int) 0x000000FF)
/* CLKOUTCLKSEL (CLKOUT clock source select register)
This register configures the clkout_clk signal to be output on the CLKOUT pin. All three
oscillators and the main clock can be selected for the clkout_clk clock.
The CLKOUTCLKUEN register must be toggled from LOW to HIGH for the update to take effect. */
#define SCB_CLKOUTCLKSEL (*(pREG32 (0x400480E0))) // CLKOUT clock source select
#define SCB_CLKOUTCLKSEL_SOURCE_USBPLLOUT ((unsigned int) 0x00000000) // USB PLL output
#define SCB_CLKOUTCLKSEL_SOURCE_INPUTCLOCK ((unsigned int) 0x00000001) // Use the main clock
#define SCB_CLKOUTCLKSEL_SOURCE_WATCHDOGOSC ((unsigned int) 0x00000002) // Use the watchdog oscillator
#define SCB_CLKOUTCLKSEL_MASK ((unsigned int) 0x00000003)
/* CLKOUTUEN (CLKOUT clock source update enable register)
This register updates the clock source of the CLKOUT pin with the new clock after the
CLKOUTCLKSEL register has been written to. In order for the update to take effect at the
input of the CLKOUT pin, first write a zero to the CLKCLKUEN register and then write a
one to CLKCLKUEN. */
#define SCB_CLKOUTCLKUEN (*(pREG32 (0x400480E4))) // CLKOUT clock source update enable
#define SCB_CLKOUTCLKUEN_DISABLE ((unsigned int) 0x00000000)
#define SCB_CLKOUTCLKUEN_UPDATE ((unsigned int) 0x00000001)
#define SCB_CLKOUTCLKUEN_MASK ((unsigned int) 0x00000001)
/* CLKOUTCLKDIV (CLKOUT clock divider register)
This register determines the divider value for the clkout_clk signal on the CLKOUT pin. */
#define SCB_CLKOUTCLKDIV (*(pREG32 (0x400480E8))) // CLKOUT clock divider
#define SCB_CLKOUTCLKDIV_DISABLE ((unsigned int) 0x00000000)
#define SCB_CLKOUTCLKDIV_DIV1 ((unsigned int) 0x00000001) // Divide clock by 1 (can be set from 1..255)
#define SCB_CLKOUTCLKDIV_MASK ((unsigned int) 0x000000FF)
/* PIOPORCAP0 (POR captured PIO status register 0)
The PIOPORCAP0 register captures the state (HIGH or LOW) of the PIO pins of ports 0,1,
and 2 (pins PIO2_0 to PIO2_7) at power-on-reset. Each bit represents the reset state of
one GPIO pin. This register is a read-only status register. */
#define SCB_PIOPORCAP0 (*(pREG32 (0x40048100))) // POR captured PIO status 0
#define SCB_PIOPORCAP0_PIO0_0 ((unsigned int) 0x00000001)
#define SCB_PIOPORCAP0_PIO0_0_MASK ((unsigned int) 0x00000001)
#define SCB_PIOPORCAP0_PIO0_1 ((unsigned int) 0x00000002)
#define SCB_PIOPORCAP0_PIO0_1_MASK ((unsigned int) 0x00000002)
#define SCB_PIOPORCAP0_PIO0_2 ((unsigned int) 0x00000004)
#define SCB_PIOPORCAP0_PIO0_2_MASK ((unsigned int) 0x00000004)
#define SCB_PIOPORCAP0_PIO0_3 ((unsigned int) 0x00000008)
#define SCB_PIOPORCAP0_PIO0_3_MASK ((unsigned int) 0x00000008)
#define SCB_PIOPORCAP0_PIO0_4 ((unsigned int) 0x00000010)
#define SCB_PIOPORCAP0_PIO0_4_MASK ((unsigned int) 0x00000010)
#define SCB_PIOPORCAP0_PIO0_5 ((unsigned int) 0x00000020)
#define SCB_PIOPORCAP0_PIO0_5_MASK ((unsigned int) 0x00000020)
#define SCB_PIOPORCAP0_PIO0_6 ((unsigned int) 0x00000040)
#define SCB_PIOPORCAP0_PIO0_6_MASK ((unsigned int) 0x00000040)
#define SCB_PIOPORCAP0_PIO0_7 ((unsigned int) 0x00000080)
#define SCB_PIOPORCAP0_PIO0_7_MASK ((unsigned int) 0x00000080)
#define SCB_PIOPORCAP0_PIO0_8 ((unsigned int) 0x00000100)
#define SCB_PIOPORCAP0_PIO0_8_MASK ((unsigned int) 0x00000100)
#define SCB_PIOPORCAP0_PIO0_9 ((unsigned int) 0x00000200)
#define SCB_PIOPORCAP0_PIO0_9_MASK ((unsigned int) 0x00000200)
#define SCB_PIOPORCAP0_PIO0_10 ((unsigned int) 0x00000400)
#define SCB_PIOPORCAP0_PIO0_10_MASK ((unsigned int) 0x00000400)
#define SCB_PIOPORCAP0_PIO0_11 ((unsigned int) 0x00000800)
#define SCB_PIOPORCAP0_PIO0_11_MASK ((unsigned int) 0x00000800)
#define SCB_PIOPORCAP0_PIO1_0 ((unsigned int) 0x00001000)
#define SCB_PIOPORCAP0_PIO1_0_MASK ((unsigned int) 0x00001000)
#define SCB_PIOPORCAP0_PIO1_1 ((unsigned int) 0x00002000)
#define SCB_PIOPORCAP0_PIO1_1_MASK ((unsigned int) 0x00002000)
#define SCB_PIOPORCAP0_PIO1_2 ((unsigned int) 0x00004000)
#define SCB_PIOPORCAP0_PIO1_2_MASK ((unsigned int) 0x00004000)
#define SCB_PIOPORCAP0_PIO1_3 ((unsigned int) 0x00008000)
#define SCB_PIOPORCAP0_PIO1_3_MASK ((unsigned int) 0x00008000)
#define SCB_PIOPORCAP0_PIO1_4 ((unsigned int) 0x00010000)
#define SCB_PIOPORCAP0_PIO1_4_MASK ((unsigned int) 0x00010000)
#define SCB_PIOPORCAP0_PIO1_5 ((unsigned int) 0x00020000)
#define SCB_PIOPORCAP0_PIO1_5_MASK ((unsigned int) 0x00020000)
#define SCB_PIOPORCAP0_PIO1_6 ((unsigned int) 0x00040000)
#define SCB_PIOPORCAP0_PIO1_6_MASK ((unsigned int) 0x00040000)
#define SCB_PIOPORCAP0_PIO1_7 ((unsigned int) 0x00080000)
#define SCB_PIOPORCAP0_PIO1_7_MASK ((unsigned int) 0x00080000)
#define SCB_PIOPORCAP0_PIO1_8 ((unsigned int) 0x00100000)
#define SCB_PIOPORCAP0_PIO1_8_MASK ((unsigned int) 0x00100000)
#define SCB_PIOPORCAP0_PIO1_9 ((unsigned int) 0x00200000)
#define SCB_PIOPORCAP0_PIO1_9_MASK ((unsigned int) 0x00200000)
#define SCB_PIOPORCAP0_PIO1_10 ((unsigned int) 0x00400000)
#define SCB_PIOPORCAP0_PIO1_10_MASK ((unsigned int) 0x00400000)
#define SCB_PIOPORCAP0_PIO1_11 ((unsigned int) 0x00800000)
#define SCB_PIOPORCAP0_PIO1_11_MASK ((unsigned int) 0x00800000)
#define SCB_PIOPORCAP0_PIO2_0 ((unsigned int) 0x01000000)
#define SCB_PIOPORCAP0_PIO2_0_MASK ((unsigned int) 0x01000000)
#define SCB_PIOPORCAP0_PIO2_1 ((unsigned int) 0x02000000)
#define SCB_PIOPORCAP0_PIO2_1_MASK ((unsigned int) 0x02000000)
#define SCB_PIOPORCAP0_PIO2_2 ((unsigned int) 0x04000000)
#define SCB_PIOPORCAP0_PIO2_2_MASK ((unsigned int) 0x04000000)
#define SCB_PIOPORCAP0_PIO2_3 ((unsigned int) 0x08000000)
#define SCB_PIOPORCAP0_PIO2_3_MASK ((unsigned int) 0x08000000)
#define SCB_PIOPORCAP0_PIO2_4 ((unsigned int) 0x10000000)
#define SCB_PIOPORCAP0_PIO2_4_MASK ((unsigned int) 0x10000000)
#define SCB_PIOPORCAP0_PIO2_5 ((unsigned int) 0x20000000)
#define SCB_PIOPORCAP0_PIO2_5_MASK ((unsigned int) 0x20000000)
#define SCB_PIOPORCAP0_PIO2_6 ((unsigned int) 0x40000000)
#define SCB_PIOPORCAP0_PIO2_6_MASK ((unsigned int) 0x40000000)
#define SCB_PIOPORCAP0_PIO2_7 ((unsigned int) 0x80000000)
#define SCB_PIOPORCAP0_PIO2_7_MASK ((unsigned int) 0x80000000)
/* PIOPORCAP1 (POR captured PIO status register 1)
The PIOPORCAP1 register captures the state (HIGH or LOW) of the PIO pins of port 2
(PIO2_8 to PIO2_11) and port 3 at power-on-reset. Each bit represents the reset state of
one PIO pin. This register is a read-only status register. */
#define SCB_PIOPORCAP1 (*(pREG32 (0x40048104))) // POR captured PIO status 1
#define SCB_PIOPORCAP1_PIO2_8 ((unsigned int) 0x00000001)
#define SCB_PIOPORCAP1_PIO2_8_MASK ((unsigned int) 0x00000001)
#define SCB_PIOPORCAP1_PIO2_9 ((unsigned int) 0x00000002)
#define SCB_PIOPORCAP1_PIO2_9_MASK ((unsigned int) 0x00000002)
#define SCB_PIOPORCAP1_PIO2_10 ((unsigned int) 0x00000004)
#define SCB_PIOPORCAP1_PIO2_10_MASK ((unsigned int) 0x00000004)
#define SCB_PIOPORCAP1_PIO2_11 ((unsigned int) 0x00000008)
#define SCB_PIOPORCAP1_PIO2_11_MASK ((unsigned int) 0x00000008)
#define SCB_PIOPORCAP1_PIO3_0 ((unsigned int) 0x00000010)
#define SCB_PIOPORCAP1_PIO3_0_MASK ((unsigned int) 0x00000010)
#define SCB_PIOPORCAP1_PIO3_1 ((unsigned int) 0x00000020)
#define SCB_PIOPORCAP1_PIO3_1_MASK ((unsigned int) 0x00000020)
#define SCB_PIOPORCAP1_PIO3_2 ((unsigned int) 0x00000040)
#define SCB_PIOPORCAP1_PIO3_2_MASK ((unsigned int) 0x00000040)
#define SCB_PIOPORCAP1_PIO3_3 ((unsigned int) 0x00000080)
#define SCB_PIOPORCAP1_PIO3_3_MASK ((unsigned int) 0x00000080)
#define SCB_PIOPORCAP1_PIO3_4 ((unsigned int) 0x00000100)
#define SCB_PIOPORCAP1_PIO3_4_MASK ((unsigned int) 0x00000100)
#define SCB_PIOPORCAP1_PIO3_5 ((unsigned int) 0x00000200)
#define SCB_PIOPORCAP1_PIO3_5_MASK ((unsigned int) 0x00000200)
/* BODCTRL (Brown-out detection control register)
The BOD control register selects four separate threshold values for sending a BOD
interrupt to the NVIC. Only one level is allowed for forced reset. */
#define SCB_BODCTRL (*(pREG32 (0x40048150))) // Brown-out detector control
#define SCB_BODCTRL_RSTLEVEL_1_46V_1_63V ((unsigned int) 0x00000000)
#define SCB_BODCTRL_RSTLEVEL_2_06V_2_15V ((unsigned int) 0x00000001)
#define SCB_BODCTRL_RSTLEVEL_2_35V_2_43V ((unsigned int) 0x00000002)
#define SCB_BODCTRL_RSTLEVEL_2_63V_2_71V ((unsigned int) 0x00000003)
#define SCB_BODCTRL_RSTLEVEL_MASK ((unsigned int) 0x00000003)
#define SCB_BODCTRL_INTLEVEL_1_65V_1_80V ((unsigned int) 0x00000000)
#define SCB_BODCTRL_INTLEVEL_2_22V_2_35V ((unsigned int) 0x00000004)
#define SCB_BODCTRL_INTLEVEL_2_52V_2_66V ((unsigned int) 0x00000008)
#define SCB_BODCTRL_INTLEVEL_2_80V_2_90V ((unsigned int) 0x0000000C)
#define SCB_BODCTRL_INTLEVEL_MASK ((unsigned int) 0x0000000C)
#define SCB_BODCTRL_RSTENABLE_DISABLE ((unsigned int) 0x00000000)
#define SCB_BODCTRL_RSTENABLE_ENABLE ((unsigned int) 0x00000010)
#define SCB_BODCTRL_RSTENABLE_MASK ((unsigned int) 0x00000010)
/* SYSTCKCAL (System tick counter calibration register) */
#define SCB_SYSTICKCCAL (*(pREG32 (0x40048158))) // System tick counter calibration
#define SCB_SYSTICKCCAL_MASK ((unsigned int) 0x03FFFFFF) // Undefined as of v0.10 of the LPC1114 User Manual
/* STARTAPRP0 (Start logic edge control register 0)
The STARTAPRP0 register controls the start logic inputs of ports 0 (PIO0_0 to PIO0_11)
and 1 (PIO1_0). This register selects a falling or rising edge on the corresponding PIO
input to produce a falling or rising clock edge, respectively, for the start logic (see
Section 38.3).
Every bit in the STARTAPRP0 register controls one port input and is connected to one
wake-up interrupt in the NVIC. Bit 0 in the STARTAPRP0 register corresponds to interrupt
0, bit 1 to interrupt 1, etc. (see Table 549), up to a total of 13 interrupts.
Remark: Each interrupt connected to a start logic input must be enabled in the NVIC if the
corresponding PIO pin is used to wake up the chip from Deep-sleep mode. */
#define SCB_STARTAPRP0 (*(pREG32 (0x40048200))) // Start logic edge control register 0; bottom 32 interrupts
#define SCB_STARTAPRP0_APRPIO0_0 ((unsigned int) 0x00000001)
#define SCB_STARTAPRP0_APRPIO0_0_MASK ((unsigned int) 0x00000001)
#define SCB_STARTAPRP0_APRPIO0_1 ((unsigned int) 0x00000002)
#define SCB_STARTAPRP0_APRPIO0_1_MASK ((unsigned int) 0x00000002)
#define SCB_STARTAPRP0_APRPIO0_2 ((unsigned int) 0x00000004)
#define SCB_STARTAPRP0_APRPIO0_2_MASK ((unsigned int) 0x00000004)
#define SCB_STARTAPRP0_APRPIO0_3 ((unsigned int) 0x00000008)
#define SCB_STARTAPRP0_APRPIO0_3_MASK ((unsigned int) 0x00000008)
#define SCB_STARTAPRP0_APRPIO0_4 ((unsigned int) 0x00000010)
#define SCB_STARTAPRP0_APRPIO0_4_MASK ((unsigned int) 0x00000010)
#define SCB_STARTAPRP0_APRPIO0_5 ((unsigned int) 0x00000020)
#define SCB_STARTAPRP0_APRPIO0_5_MASK ((unsigned int) 0x00000020)
#define SCB_STARTAPRP0_APRPIO0_6 ((unsigned int) 0x00000040)
#define SCB_STARTAPRP0_APRPIO0_6_MASK ((unsigned int) 0x00000040)
#define SCB_STARTAPRP0_APRPIO0_7 ((unsigned int) 0x00000080)
#define SCB_STARTAPRP0_APRPIO0_7_MASK ((unsigned int) 0x00000080)
#define SCB_STARTAPRP0_APRPIO0_8 ((unsigned int) 0x00000100)
#define SCB_STARTAPRP0_APRPIO0_8_MASK ((unsigned int) 0x00000100)
#define SCB_STARTAPRP0_APRPIO0_9 ((unsigned int) 0x00000200)
#define SCB_STARTAPRP0_APRPIO0_9_MASK ((unsigned int) 0x00000200)
#define SCB_STARTAPRP0_APRPIO0_10 ((unsigned int) 0x00000400)
#define SCB_STARTAPRP0_APRPIO0_10_MASK ((unsigned int) 0x00000400)
#define SCB_STARTAPRP0_APRPIO0_11 ((unsigned int) 0x00000800)
#define SCB_STARTAPRP0_APRPIO0_11_MASK ((unsigned int) 0x00000800)
#define SCB_STARTAPRP0_APRPIO1_0 ((unsigned int) 0x00001000)
#define SCB_STARTAPRP0_APRPIO1_0_MASK ((unsigned int) 0x00001000)
#define SCB_STARTAPRP0_MASK ((unsigned int) 0xFFFFFFFF)
/* STARTERP0 (Start logic signal enable register 0)
This STARTERP0 register enables or disables the start signal bits in the start logic. */
#define SCB_STARTERP0 (*(pREG32 (0x40048204))) // Start logic signal enable register 0; bottom 32 interrupts
#define SCB_STARTERP0_ERPIO0_0 ((unsigned int) 0x00000001)
#define SCB_STARTERP0_ERPIO0_0_MASK ((unsigned int) 0x00000001)
#define SCB_STARTERP0_ERPIO0_1 ((unsigned int) 0x00000002)
#define SCB_STARTERP0_ERPIO0_1_MASK ((unsigned int) 0x00000002)
#define SCB_STARTERP0_ERPIO0_2 ((unsigned int) 0x00000004)
#define SCB_STARTERP0_ERPIO0_2_MASK ((unsigned int) 0x00000004)
#define SCB_STARTERP0_ERPIO0_3 ((unsigned int) 0x00000008)
#define SCB_STARTERP0_ERPIO0_3_MASK ((unsigned int) 0x00000008)
#define SCB_STARTERP0_ERPIO0_4 ((unsigned int) 0x00000010)
#define SCB_STARTERP0_ERPIO0_4_MASK ((unsigned int) 0x00000010)
#define SCB_STARTERP0_ERPIO0_5 ((unsigned int) 0x00000020)
#define SCB_STARTERP0_ERPIO0_5_MASK ((unsigned int) 0x00000020)
#define SCB_STARTERP0_ERPIO0_6 ((unsigned int) 0x00000040)
#define SCB_STARTERP0_ERPIO0_6_MASK ((unsigned int) 0x00000040)
#define SCB_STARTERP0_ERPIO0_7 ((unsigned int) 0x00000080)
#define SCB_STARTERP0_ERPIO0_7_MASK ((unsigned int) 0x00000080)
#define SCB_STARTERP0_ERPIO0_8 ((unsigned int) 0x00000100)
#define SCB_STARTERP0_ERPIO0_8_MASK ((unsigned int) 0x00000100)
#define SCB_STARTERP0_ERPIO0_9 ((unsigned int) 0x00000200)
#define SCB_STARTERP0_ERPIO0_9_MASK ((unsigned int) 0x00000200)
#define SCB_STARTERP0_ERPIO0_10 ((unsigned int) 0x00000400)
#define SCB_STARTERP0_ERPIO0_10_MASK ((unsigned int) 0x00000400)
#define SCB_STARTERP0_ERPIO0_11 ((unsigned int) 0x00000800)
#define SCB_STARTERP0_ERPIO0_11_MASK ((unsigned int) 0x00000800)
#define SCB_STARTERP0_ERPIO1_0 ((unsigned int) 0x00001000)
#define SCB_STARTERP0_ERPIO1_0_MASK ((unsigned int) 0x00001000)
#define SCB_STARTERP0_MASK ((unsigned int) 0xFFFFFFFF)
/* STARTRSRP0CLR (Start logic reset register 0)
Writing a one to a bit in the STARTRSRP0CLR register resets the start logic state. The
start-up logic uses the input signals to generate a clock edge for registering a start
signal. This clock edge (falling or rising) sets the interrupt for waking up from
Deep-sleep mode. Therefore, the start-up logic states must be cleared before being used. */
#define SCB_STARTRSRP0CLR (*(pREG32 (0x40048208))) // Start logic reset register 0; bottom 32 interrupts
#define SCB_STARTRSRP0CLR_RSRPIO0_0 ((unsigned int) 0x00000001)
#define SCB_STARTRSRP0CLR_RSRPIO0_0_MASK ((unsigned int) 0x00000001)
#define SCB_STARTRSRP0CLR_RSRPIO0_1 ((unsigned int) 0x00000002)
#define SCB_STARTRSRP0CLR_RSRPIO0_1_MASK ((unsigned int) 0x00000002)
#define SCB_STARTRSRP0CLR_RSRPIO0_2 ((unsigned int) 0x00000004)
#define SCB_STARTRSRP0CLR_RSRPIO0_2_MASK ((unsigned int) 0x00000004)
#define SCB_STARTRSRP0CLR_RSRPIO0_3 ((unsigned int) 0x00000008)
#define SCB_STARTRSRP0CLR_RSRPIO0_3_MASK ((unsigned int) 0x00000008)
#define SCB_STARTRSRP0CLR_RSRPIO0_4 ((unsigned int) 0x00000010)
#define SCB_STARTRSRP0CLR_RSRPIO0_4_MASK ((unsigned int) 0x00000010)
#define SCB_STARTRSRP0CLR_RSRPIO0_5 ((unsigned int) 0x00000020)
#define SCB_STARTRSRP0CLR_RSRPIO0_5_MASK ((unsigned int) 0x00000020)
#define SCB_STARTRSRP0CLR_RSRPIO0_6 ((unsigned int) 0x00000040)
#define SCB_STARTRSRP0CLR_RSRPIO0_6_MASK ((unsigned int) 0x00000040)
#define SCB_STARTRSRP0CLR_RSRPIO0_7 ((unsigned int) 0x00000080)
#define SCB_STARTRSRP0CLR_RSRPIO0_7_MASK ((unsigned int) 0x00000080)
#define SCB_STARTRSRP0CLR_RSRPIO0_8 ((unsigned int) 0x00000100)
#define SCB_STARTRSRP0CLR_RSRPIO0_8_MASK ((unsigned int) 0x00000100)
#define SCB_STARTRSRP0CLR_RSRPIO0_9 ((unsigned int) 0x00000200)
#define SCB_STARTRSRP0CLR_RSRPIO0_9_MASK ((unsigned int) 0x00000200)
#define SCB_STARTRSRP0CLR_RSRPIO0_10 ((unsigned int) 0x00000400)
#define SCB_STARTRSRP0CLR_RSRPIO0_10_MASK ((unsigned int) 0x00000400)
#define SCB_STARTRSRP0CLR_RSRPIO0_11 ((unsigned int) 0x00000800)
#define SCB_STARTRSRP0CLR_RSRPIO0_11_MASK ((unsigned int) 0x00000800)
#define SCB_STARTRSRP0CLR_RSRPIO1_0 ((unsigned int) 0x00001000)
#define SCB_STARTRSRP0CLR_RSRPIO1_0_MASK ((unsigned int) 0x00001000)
#define SCB_STARTRSRP0CLR_MASK ((unsigned int) 0xFFFFFFFF)
/* (Start logic status register 0)
This register reflects the status of the enabled start signal bits. Each bit
(if enabled) reflects the state of the start logic, i.e. whether or not a
wake-up signal has been received for a given pin. */
#define SCB_STARTSRP0 (*(pREG32 (0x4004820C))) // Start logic status register 0; bottom 32 interrupts
#define SCB_STARTSRP0_SRPIO0_0 ((unsigned int) 0x00000001)
#define SCB_STARTSRP0_SRPIO0_0_MASK ((unsigned int) 0x00000001)
#define SCB_STARTSRP0_SRPIO0_1 ((unsigned int) 0x00000002)
#define SCB_STARTSRP0_SRPIO0_1_MASK ((unsigned int) 0x00000002)
#define SCB_STARTSRP0_SRPIO0_2 ((unsigned int) 0x00000004)
#define SCB_STARTSRP0_SRPIO0_2_MASK ((unsigned int) 0x00000004)
#define SCB_STARTSRP0_SRPIO0_3 ((unsigned int) 0x00000008)
#define SCB_STARTSRP0_SRPIO0_3_MASK ((unsigned int) 0x00000008)
#define SCB_STARTSRP0_SRPIO0_4 ((unsigned int) 0x00000010)
#define SCB_STARTSRP0_SRPIO0_4_MASK ((unsigned int) 0x00000010)
#define SCB_STARTSRP0_SRPIO0_5 ((unsigned int) 0x00000020)
#define SCB_STARTSRP0_SRPIO0_5_MASK ((unsigned int) 0x00000020)
#define SCB_STARTSRP0_SRPIO0_6 ((unsigned int) 0x00000040)
#define SCB_STARTSRP0_SRPIO0_6_MASK ((unsigned int) 0x00000040)
#define SCB_STARTSRP0_SRPIO0_7 ((unsigned int) 0x00000080)
#define SCB_STARTSRP0_SRPIO0_7_MASK ((unsigned int) 0x00000080)
#define SCB_STARTSRP0_SRPIO0_8 ((unsigned int) 0x00000100)
#define SCB_STARTSRP0_SRPIO0_8_MASK ((unsigned int) 0x00000100)
#define SCB_STARTSRP0_SRPIO0_9 ((unsigned int) 0x00000200)
#define SCB_STARTSRP0_SRPIO0_9_MASK ((unsigned int) 0x00000200)
#define SCB_STARTSRP0_SRPIO0_10 ((unsigned int) 0x00000400)
#define SCB_STARTSRP0_SRPIO0_10_MASK ((unsigned int) 0x00000400)
#define SCB_STARTSRP0_SRPIO0_11 ((unsigned int) 0x00000800)
#define SCB_STARTSRP0_SRPIO0_11_MASK ((unsigned int) 0x00000800)
#define SCB_STARTSRP0_SRPIO1_0 ((unsigned int) 0x00001000)
#define SCB_STARTSRP0_SRPIO1_0_MASK ((unsigned int) 0x00001000)
#define SCB_STARTSRP0_MASK ((unsigned int) 0xFFFFFFFF)
/* PDSLEEPCFG (Deep-sleep mode configuration register)
The bits in this register can be programmed to indicate the state the chip must enter when
the Deep-sleep mode is asserted by the ARM. The value of the PDSLEEPCFG register
will be automatically loaded into the PDRUNCFG register when the Sleep mode is
entered. */
/* Note: The latest version of the UM (10 March 2011) indicates that only four
values can be assigned to the PDSLEEPCFG register. This differs from early
versions of the UM which contained seperate values, but values have been
added for the four 'valid' values included in the latest UM. */
#define SCB_PDSLEEPCFG (*(pREG32 (0x40048230))) // Power-down states in Deep-sleep mode
#define SCB_PDSLEEPCFG_BOD_ON_WDOSC_ON ((unsigned int) 0x000018B7)
#define SCB_PDSLEEPCFG_BOD_ON_WDOSC_OFF ((unsigned int) 0x000018F7)
#define SCB_PDSLEEPCFG_BOD_OFF_WDOSC_ON ((unsigned int) 0x000018BF)
#define SCB_PDSLEEPCFG_BOD_OFF_WDOSC_OFF ((unsigned int) 0x000018FF)
//#define SCB_PDSLEEPCFG_IRCOUT_PD ((unsigned int) 0x00000001)
//#define SCB_PDSLEEPCFG_IRCOUT_PD_MASK ((unsigned int) 0x00000001)
//#define SCB_PDSLEEPCFG_IRC_PD ((unsigned int) 0x00000002)
//#define SCB_PDSLEEPCFG_IRC_PD_MASK ((unsigned int) 0x00000002)
//#define SCB_PDSLEEPCFG_FLASH_PD ((unsigned int) 0x00000004)
//#define SCB_PDSLEEPCFG_FLASH_PD_MASK ((unsigned int) 0x00000004)
//#define SCB_PDSLEEPCFG_BOD_PD ((unsigned int) 0x00000008)
//#define SCB_PDSLEEPCFG_BOD_PD_MASK ((unsigned int) 0x00000008)
//#define SCB_PDSLEEPCFG_ADC_PD ((unsigned int) 0x00000010)
//#define SCB_PDSLEEPCFG_ADC_PD_MASK ((unsigned int) 0x00000010)
//#define SCB_PDSLEEPCFG_SYSOSC_PD ((unsigned int) 0x00000020)
//#define SCB_PDSLEEPCFG_SYSOSC_PD_MASK ((unsigned int) 0x00000020)
//#define SCB_PDSLEEPCFG_WDTOSC_PD ((unsigned int) 0x00000040)
//#define SCB_PDSLEEPCFG_WDTOSC_PD_MASK ((unsigned int) 0x00000040)
//#define SCB_PDSLEEPCFG_SYSPLL_PD ((unsigned int) 0x00000080)
//#define SCB_PDSLEEPCFG_SYSPLL_PD_MASK ((unsigned int) 0x00000080)
/* PDAWAKECFG (Wake-up configuration register)
The bits in this register can be programmed to indicate the state the chip must enter when
it is waking up from Deep-sleep mode. */
#define SCB_PDAWAKECFG (*(pREG32 (0x40048234))) // Power-down states after wake-up from Deep-sleep mode
#define SCB_PDAWAKECFG_IRCOUT_PD ((unsigned int) 0x00000001)
#define SCB_PDAWAKECFG_IRCOUT_PD_MASK ((unsigned int) 0x00000001)
#define SCB_PDAWAKECFG_IRC_PD ((unsigned int) 0x00000002)
#define SCB_PDAWAKECFG_IRC_PD_MASK ((unsigned int) 0x00000002)
#define SCB_PDAWAKECFG_FLASH_PD ((unsigned int) 0x00000004)
#define SCB_PDAWAKECFG_FLASH_PD_MASK ((unsigned int) 0x00000004)
#define SCB_PDAWAKECFG_BOD_PD ((unsigned int) 0x00000008)
#define SCB_PDAWAKECFG_BOD_PD_MASK ((unsigned int) 0x00000008)
#define SCB_PDAWAKECFG_ADC_PD ((unsigned int) 0x00000010)
#define SCB_PDAWAKECFG_ADC_PD_MASK ((unsigned int) 0x00000010)
#define SCB_PDAWAKECFG_SYSOSC_PD ((unsigned int) 0x00000020)
#define SCB_PDAWAKECFG_SYSOSC_PD_MASK ((unsigned int) 0x00000020)
#define SCB_PDAWAKECFG_WDTOSC_PD ((unsigned int) 0x00000040)
#define SCB_PDAWAKECFG_WDTOSC_PD_MASK ((unsigned int) 0x00000040)
#define SCB_PDAWAKECFG_SYSPLL_PD ((unsigned int) 0x00000080)
#define SCB_PDAWAKECFG_SYSPLL_PD_MASK ((unsigned int) 0x00000080)
/* PDRUNCFG (Power-down configuration register)
The bits in the PDRUNCFG register control the power to the various analog blocks. This
register can be written to at any time while the chip is running, and a write will take effect
immediately with the exception of the power-down signal to the IRC. Setting a 1 powers-down
a peripheral and 0 enables it. */
#define SCB_PDRUNCFG (*(pREG32 (0x40048238))) // Power-down configuration register
#define SCB_PDRUNCFG_IRCOUT ((unsigned int) 0x00000001) // IRC oscillator output power-down
#define SCB_PDRUNCFG_IRCOUT_MASK ((unsigned int) 0x00000001)
#define SCB_PDRUNCFG_IRC ((unsigned int) 0x00000002) // IRC oscillator power-down
#define SCB_PDRUNCFG_IRC_MASK ((unsigned int) 0x00000002)
#define SCB_PDRUNCFG_FLASH ((unsigned int) 0x00000004) // Flash power-down
#define SCB_PDRUNCFG_FLASH_MASK ((unsigned int) 0x00000004)
#define SCB_PDRUNCFG_BOD ((unsigned int) 0x00000008) // Brown-out detector power-down
#define SCB_PDRUNCFG_BOD_MASK ((unsigned int) 0x00000008)
#define SCB_PDRUNCFG_ADC ((unsigned int) 0x00000010) // ADC power-down
#define SCB_PDRUNCFG_ADC_MASK ((unsigned int) 0x00000010)
#define SCB_PDRUNCFG_SYSOSC ((unsigned int) 0x00000020) // System oscillator power-down
#define SCB_PDRUNCFG_SYSOSC_MASK ((unsigned int) 0x00000020)
#define SCB_PDRUNCFG_WDTOSC ((unsigned int) 0x00000040) // Watchdog oscillator power-down
#define SCB_PDRUNCFG_WDTOSC_MASK ((unsigned int) 0x00000040)
#define SCB_PDRUNCFG_SYSPLL ((unsigned int) 0x00000080) // System PLL power-down
#define SCB_PDRUNCFG_SYSPLL_MASK ((unsigned int) 0x00000080)
/* DEVICE_ID (Device ID Register)
This device ID register is a read-only register and contains the device ID for each
LPC111x part. This register is also read by the ISP/IAP commands. */
#define SCB_DEVICEID (*(pREG32 (0x400483F4))) // Device ID
#define SCB_DEVICEID_LPC1111_101 ((unsigned int) 0x041E502B)
#define SCB_DEVICEID_LPC1111_102 ((unsigned int) 0x2516902B)
#define SCB_DEVICEID_LPC1111_201 ((unsigned int) 0x0416502B)
#define SCB_DEVICEID_LPC1111_202 ((unsigned int) 0x2516D02B)
#define SCB_DEVICEID_LPC1112_101 ((unsigned int) 0x042D502B)
#define SCB_DEVICEID_LPC1112_102 ((unsigned int) 0x2524D02B)
#define SCB_DEVICEID_LPC1112_201 ((unsigned int) 0x0425502B)
#define SCB_DEVICEID_LPC1112_202 ((unsigned int) 0x2524902B)
#define SCB_DEVICEID_LPC1113_201 ((unsigned int) 0x0434502B)
#define SCB_DEVICEID_LPC1113_202 ((unsigned int) 0x2532902B)
#define SCB_DEVICEID_LPC1113_301 ((unsigned int) 0x0434102B)
#define SCB_DEVICEID_LPC1113_302 ((unsigned int) 0x2532102B)
#define SCB_DEVICEID_LPC1114_201 ((unsigned int) 0x0444502B)
#define SCB_DEVICEID_LPC1114_202 ((unsigned int) 0x2540902B)
#define SCB_DEVICEID_LPC1114_301 ((unsigned int) 0x0444102B)
#define SCB_DEVICEID_LPC1114_302 ((unsigned int) 0x2540102B)
#define SCB_DEVICEID_LPC11C12_301 ((unsigned int) 0x1421102B)
#define SCB_DEVICEID_LPC11C14_301 ((unsigned int) 0x1440102B)
#define SCB_DEVICEID_LPC11C22_301 ((unsigned int) 0x1431102B)
#define SCB_DEVICEID_LPC11C24_301 ((unsigned int) 0X1430102B)
/* CPU ID Base Register */
#define SCB_CPUID (*(pREG32 (0xE000ED00)))
#define SCB_CPUID_REVISION_MASK ((unsigned int) 0x0000000F) // Revision Code
#define SCB_CPUID_PARTNO_MASK ((unsigned int) 0x0000FFF0) // Part Number
#define SCB_CPUID_CONSTANT_MASK ((unsigned int) 0x000F0000) // Constant
#define SCB_CPUID_VARIANT_MASK ((unsigned int) 0x00F00000) // Variant
#define SCB_CPUID_IMPLEMENTER_MASK ((unsigned int) 0xFF000000) // Implementer
#define SCB_ICSR (*(pREG32 (0xE000ED04)))
#define SCB_ICSR_NMIPENDSET_MASK ((unsigned int) 0x80000000)
#define SCB_ICSR_NMIPENDSET ((unsigned int) 0x80000000)
#define SCB_ICSR_PENDSVSET_MASK ((unsigned int) 0x10000000)
#define SCB_ICSR_PENDSVSET ((unsigned int) 0x10000000)
#define SCB_ICSR_PENDSVCLR_MASK ((unsigned int) 0x08000000)
#define SCB_ICSR_PENDSVCLR ((unsigned int) 0x08000000)
#define SCB_ICSR_PENDSTSET_MASK ((unsigned int) 0x04000000)
#define SCB_ICSR_PENDSTSET ((unsigned int) 0x04000000)
#define SCB_ICSR_PENDSTCLR_MASK ((unsigned int) 0x02000000)
#define SCB_ICSR_PENDSTCLR ((unsigned int) 0x02000000)
#define SCB_ICSR_ISRPREEMPT_MASK ((unsigned int) 0x00800000)
#define SCB_ICSR_ISRPREEMPT ((unsigned int) 0x00800000)
#define SCB_ICSR_ISRPENDING_MASK ((unsigned int) 0x00400000)
#define SCB_ICSR_ISRPENDING ((unsigned int) 0x00400000)
#define SCB_ICSR_VECTPENDING_MASK ((unsigned int) 0x001FF000)
#define SCB_ICSR_VECTACTIVE_MASK ((unsigned int) 0x000001FF)
/* Application Interrupt and Reset Control Register */
#define SCB_AIRCR (*(pREG32 (0xE000ED0C)))
#define SCB_AIRCR_VECTKEY_VALUE ((unsigned int) 0x05FA0000) // Vect key needs to be set to 05FA for reset to work
#define SCB_AIRCR_VECTKEY_MASK ((unsigned int) 0xFFFF0000)
#define SCB_AIRCR_ENDIANESS ((unsigned int) 0x00008000) // Read Endianness (1=Big, 0=Little)
#define SCB_AIRCR_ENDIANESS_MASK ((unsigned int) 0x00008000)
#define SCB_AIRCR_SYSRESETREQ ((unsigned int) 0x00000004) // Request system reset
#define SCB_AIRCR_SYSRESETREQ_MASK ((unsigned int) 0x00000004)
#define SCB_AIRCR_VECTCLRACTIVE ((unsigned int) 0x00000002) // Used to prevent accidental reset
#define SCB_AIRCR_VECTCLRACTIVE_MASK ((unsigned int) 0x00000002)
/* System Control Register */
#define SCB_SCR (*(pREG32 (0xE000ED10)))
#define SCB_SCR_SLEEPONEXIT_MASK ((unsigned int) 0x00000002) // Enable sleep on exit
#define SCB_SCR_SLEEPONEXIT ((unsigned int) 0x00000002)
#define SCB_SCR_SLEEPDEEP_MASK ((unsigned int) 0x00000004)
#define SCB_SCR_SLEEPDEEP ((unsigned int) 0x00000004) // Enable deep sleep
#define SCB_SCR_SEVONPEND_MASK ((unsigned int) 0x00000010) // Wake up from WFE is new int is pended regardless of priority
#define SCB_SCR_SEVONPEND ((unsigned int) 0x00000010)
/*##############################################################################
## Power Management Unit (PMU)
##############################################################################*/
#define PMU_BASE_ADDRESS (0x40038000)
#define PMU_PMUCTRL (*(pREG32 (0x40038000))) // Power control register
#define PMU_PMUCTRL_DPDEN_MASK ((unsigned int) 0x00000002) // Deep power-down enable
#define PMU_PMUCTRL_DPDEN_DEEPPOWERDOWN ((unsigned int) 0x00000002) // WFI will enter deep power-down mode
#define PMU_PMUCTRL_DPDEN_SLEEP ((unsigned int) 0x00000000) // WFI will enter sleep mode
#define PMU_PMUCTRL_SLEEPFLAG_MASK ((unsigned int) 0x00000100) // Read-only ... indicates if the device is in active or sleep/deep-sleep/deep-power-down mode
#define PMU_PMUCTRL_SLEEPFLAG ((unsigned int) 0x00000100)
#define PMU_PMUCTRL_DPDFLAG_MASK ((unsigned int) 0x00000800) // Deep power-down flag
#define PMU_PMUCTRL_DPDFLAG ((unsigned int) 0x00000800)
/* GPREG0..3 (General purpose registers 0 to 3)
The general purpose registers retain data through the Deep power-down mode when
power is still applied to the VDD(3V3) pin but the chip has entered Deep power-down mode.
Only a cold boot when all power has been completely removed from the chip will reset
the general purpose registers. */
#define PMU_GPREG0 (*(pREG32 (0x40038004))) // General purpose register 0
#define PMU_GPREG0_GPDATA_MASK ((unsigned int) 0xFFFFFFFF)
#define PMU_GPREG1 (*(pREG32 (0x40038008))) // General purpose register 1
#define PMU_GPREG1_GPDATA_MASK ((unsigned int) 0xFFFFFFFF)
#define PMU_GPREG2 (*(pREG32 (0x4003800C))) // General purpose register 2
#define PMU_GPREG2_GPDATA_MASK ((unsigned int) 0xFFFFFFFF)
#define PMU_GPREG3 (*(pREG32 (0x40038010))) // General purpose register 3
#define PMU_GPREG3_GPDATA_MASK ((unsigned int) 0xFFFFFFFF)
/* GPREG4 (General purpose register 4)
The general purpose register 4 retains data through the Deep power-down mode when
power is still applied to the VDD(3V3) pin but the chip has entered Deep power-down mode.
Only a cold boot, when all power has been completely removed from the chip, will reset
the general purpose registers.
Remark: If the external voltage applied on pin VDD(3V3) drops below 2.2V, the
hysteresis of the WAKEUP input pin has to be disabled in order for the chip to wake up
from Deep power-down mode. */
#define PMU_GPREG4 (*(pREG32 (0x40038014))) // General purpose register 4
#define PMU_GPREG4_GPDATA_MASK ((unsigned int) 0xFFFFF800)
#define PMU_GPREG4_WAKEUPHYS_MASK ((unsigned int) 0x00000400)
#define PMU_GPREG4_WAKEUPHYS_HYSTERESISENABLED ((unsigned int) 0x00000400)
#define PMU_GPREG4_WAKEUPHYS_HYSTERESISDISABLED ((unsigned int) 0x00000000)
#define PMU_GPREG4_GPDATA_MASK ((unsigned int) 0xFFFFF800)
/*##############################################################################
## I/O Control (IOCON)
##############################################################################*/
#define IOCON_BASE_ADDRESS (0x40044000)
#define IOCON_COMMON_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_COMMON_MODE_MASK ((unsigned int) 0x00000018)
#define IOCON_COMMON_MODE_INACTIVE ((unsigned int) 0x00000000)
#define IOCON_COMMON_MODE_PULLDOWN ((unsigned int) 0x00000008)
#define IOCON_COMMON_MODE_PULLUP ((unsigned int) 0x00000010)
#define IOCON_COMMON_MODE_REPEATER ((unsigned int) 0x00000018)
#define IOCON_COMMON_HYS_MASK ((unsigned int) 0x00000020)
#define IOCON_COMMON_HYS_DISABLE ((unsigned int) 0x00000000)
#define IOCON_COMMON_HYS_ENABLE ((unsigned int) 0x00000020)
#define IOCON_nRESET_PIO0_0 (*(pREG32 (0x4004400C)))
#define IOCON_nRESET_PIO0_0_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_nRESET_PIO0_0_FUNC_RESET ((unsigned int) 0x00000000)
#define IOCON_nRESET_PIO0_0_FUNC_GPIO ((unsigned int) 0x00000001)
#define IOCON_nRESET_PIO0_0_MODE_MASK ((unsigned int) 0x00000018)
#define IOCON_nRESET_PIO0_0_MODE_INACTIVE ((unsigned int) 0x00000000)
#define IOCON_nRESET_PIO0_0_MODE_PULLDOWN ((unsigned int) 0x00000008)
#define IOCON_nRESET_PIO0_0_MODE_PULLUP ((unsigned int) 0x00000010)
#define IOCON_nRESET_PIO0_0_MODE_REPEATER ((unsigned int) 0x00000018)
#define IOCON_nRESET_PIO0_0_HYS_MASK ((unsigned int) 0x00000020)
#define IOCON_nRESET_PIO0_0_HYS_DISABLE ((unsigned int) 0x00000000)
#define IOCON_nRESET_PIO0_0_HYS_ENABLE ((unsigned int) 0x00000020)
#define IOCON_PIO0_1 (*(pREG32 (0x40044010)))
#define IOCON_PIO0_1_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_PIO0_1_FUNC_GPIO ((unsigned int) 0x00000000)
#define IOCON_PIO0_1_FUNC_CLKOUT ((unsigned int) 0x00000001)
#define IOCON_PIO0_1_FUNC_CT32B0_MAT2 ((unsigned int) 0x00000002)
#define IOCON_PIO0_1_MODE_MASK ((unsigned int) 0x00000018)
#define IOCON_PIO0_1_MODE_INACTIVE ((unsigned int) 0x00000000)
#define IOCON_PIO0_1_MODE_PULLDOWN ((unsigned int) 0x00000008)
#define IOCON_PIO0_1_MODE_PULLUP ((unsigned int) 0x00000010)
#define IOCON_PIO0_1_MODE_REPEATER ((unsigned int) 0x00000018)
#define IOCON_PIO0_1_HYS_MASK ((unsigned int) 0x00000020)
#define IOCON_PIO0_1_HYS_DISABLE ((unsigned int) 0x00000000)
#define IOCON_PIO0_1_HYS_ENABLE ((unsigned int) 0x00000020)
#define IOCON_PIO0_2 (*(pREG32 (0x4004401C)))
#define IOCON_PIO0_2_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_PIO0_2_FUNC_GPIO ((unsigned int) 0x00000000)
#define IOCON_PIO0_2_FUNC_SSEL ((unsigned int) 0x00000001)
#define IOCON_PIO0_2_FUNC_CT16B0_CAP0 ((unsigned int) 0x00000002)
#define IOCON_PIO0_2_MODE_MASK ((unsigned int) 0x00000018)
#define IOCON_PIO0_2_MODE_INACTIVE ((unsigned int) 0x00000000)
#define IOCON_PIO0_2_MODE_PULLDOWN ((unsigned int) 0x00000008)
#define IOCON_PIO0_2_MODE_PULLUP ((unsigned int) 0x00000010)
#define IOCON_PIO0_2_MODE_REPEATER ((unsigned int) 0x00000018)
#define IOCON_PIO0_2_HYS_MASK ((unsigned int) 0x00000020)
#define IOCON_PIO0_2_HYS_DISABLE ((unsigned int) 0x00000000)
#define IOCON_PIO0_2_HYS_ENABLE ((unsigned int) 0x00000020)
#define IOCON_PIO0_3 (*(pREG32 (0x4004402C)))
#define IOCON_PIO0_3_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_PIO0_3_FUNC_GPIO ((unsigned int) 0x00000000)
#define IOCON_PIO0_3_MODE_MASK ((unsigned int) 0x00000018)
#define IOCON_PIO0_3_MODE_INACTIVE ((unsigned int) 0x00000000)
#define IOCON_PIO0_3_MODE_PULLDOWN ((unsigned int) 0x00000008)
#define IOCON_PIO0_3_MODE_PULLUP ((unsigned int) 0x00000010)
#define IOCON_PIO0_3_MODE_REPEATER ((unsigned int) 0x00000018)
#define IOCON_PIO0_3_HYS_MASK ((unsigned int) 0x00000020)
#define IOCON_PIO0_3_HYS_DISABLE ((unsigned int) 0x00000000)
#define IOCON_PIO0_3_HYS_ENABLE ((unsigned int) 0x00000020)
#define IOCON_PIO0_4 (*(pREG32 (0x40044030)))
#define IOCON_PIO0_4_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_PIO0_4_FUNC_GPIO ((unsigned int) 0x00000000)
#define IOCON_PIO0_4_FUNC_I2CSCL ((unsigned int) 0x00000001)
#define IOCON_PIO0_4_I2CMODE_MASK ((unsigned int) 0x00000300)
#define IOCON_PIO0_4_I2CMODE_STANDARDI2C ((unsigned int) 0x00000000)
#define IOCON_PIO0_4_I2CMODE_STANDARDIO ((unsigned int) 0x00000100)
#define IOCON_PIO0_4_I2CMODE_FASTPLUSI2C ((unsigned int) 0x00000200)
#define IOCON_PIO0_5 (*(pREG32 (0x40044034)))
#define IOCON_PIO0_5_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_PIO0_5_FUNC_GPIO ((unsigned int) 0x00000000)
#define IOCON_PIO0_5_FUNC_I2CSDA ((unsigned int) 0x00000001)
#define IOCON_PIO0_5_I2CMODE_MASK ((unsigned int) 0x00000300)
#define IOCON_PIO0_5_I2CMODE_STANDARDI2C ((unsigned int) 0x00000000)
#define IOCON_PIO0_5_I2CMODE_STANDARDIO ((unsigned int) 0x00000100)
#define IOCON_PIO0_5_I2CMODE_FASTPLUSI2C ((unsigned int) 0x00000200)
#define IOCON_PIO0_6 (*(pREG32 (0x4004404C)))
#define IOCON_PIO0_6_FUNC_MASK ((unsigned int) 0x00000007)
#define IOCON_PIO0_6_FUNC_GPIO ((unsigned int) 0x00000000)
#define IOCON_PIO0_6_FUNC_SCK ((unsigned int) 0x00000002)
#define IOCON_PIO0_6_MODE_MASK ((unsigned int) 0x00000018)
#define IOCON_PIO0_6_MODE_INACTIVE ((unsigned int) 0x00000000)
#define IOCON_PIO0_6_MODE_PULLDOWN ((unsigned int) 0x00000008)
#define IOCON_PIO0_6_MODE_PULLUP ((unsigned int) 0x00000010)
#define IOCON_PIO0_6_MODE_REPEATER ((unsigned int) 0x00000018)
#define IOCON_PIO0_6_HYS_MASK ((unsigned int) 0x00000020)
#define IOCON_PIO0_6_HYS_DISABLE ((unsigned int) 0x00000000)
#define IOCON_PIO0_6_HYS_ENABLE ((unsigned int) 0x00000020)
#define IOCON_PIO0_7 (*(pREG32 (0x40044050)))
#define IOCON_PIO0_7_FUNC_MASK ((unsigned int) 0x00000007)