lpc23xx.h
1 /*
2  * Copyright (C) 2009 Kaspar Schleiser <kaspar@schleiser.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  *
8  * Parts taken from FeuerWhere-Project, lpc2387.h.
9  */
10 
11 #ifndef LPC23XX_H
12 #define LPC23XX_H
13 
14 #include "vendor/lpc23xx.h"
15 #include "arm7_common.h"
16 #include "bitarithm.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #define F_CCO 288000000
23 #define CL_CPU_DIV 4
24 #define F_RC_OSCILLATOR 4000000
25 #define F_RTC_OSCILLATOR 32767
26 
27 #define VIC_SIZE 32
28 
29 #define PLLCFG_N(n) ((n - 1) << 16)
30 #define PLLCFG_M(m) (m - 1)
31 
32 #define GPIO_INT 17
33 #define IRQP_GPIO 4
34 
35 #define _XTAL (72000)
36 
41 #define IMSEC 0x00000001
42 #define IMMIN 0x00000002
43 #define IMHOUR 0x00000004
44 #define IMDOM 0x00000008
45 #define IMDOW 0x00000010
46 #define IMDOY 0x00000020
47 #define IMMON 0x00000040
48 #define IMYEAR 0x00000080
49 
50 #define AMRSEC 0x00000001 /* Alarm mask for Seconds */
51 #define AMRMIN 0x00000002 /* Alarm mask for Minutes */
52 #define AMRHOUR 0x00000004 /* Alarm mask for Hours */
53 #define AMRDOM 0x00000008 /* Alarm mask for Day of Month */
54 #define AMRDOW 0x00000010 /* Alarm mask for Day of Week */
55 #define AMRDOY 0x00000020 /* Alarm mask for Day of Year */
56 #define AMRMON 0x00000040 /* Alarm mask for Month */
57 #define AMRYEAR 0x00000080 /* Alarm mask for Year */
58 
59 #define ILR_RTCCIF BIT0
60 #define ILR_RTCALF BIT1
61 #define ILR_RTSSF BIT2
62 
63 #define CCR_CLKEN 0x01
64 #define CCR_CTCRST 0x02
65 #define CCR_CLKSRC 0x10
72 #define WDEN BIT0
73 #define WDRESET BIT1
74 #define WDTOF BIT2
75 #define WDINT BIT3
82 #define EXTWAKE0 BIT0
83 #define EXTWAKE1 BIT1
84 #define EXTWAKE2 BIT2
85 #define EXTWAKE3 BIT3
86 #define ETHWAKE BIT4
87 #define USBWAKE BIT5
88 #define CANWAKE BIT6
89 #define GPIO0WAKE BIT7
90 #define GPIO2WAKE BIT8
91 #define BODWAKE BIT14
92 #define RTCWAKE BIT15
99 #define ULSR_RDR BIT0
100 #define ULSR_OE BIT1
101 #define ULSR_PE BIT2
102 #define ULSR_FE BIT3
103 #define ULSR_BI BIT4
104 #define ULSR_THRE BIT5
105 #define ULSR_TEMT BIT6
106 #define ULSR_RXFE BIT7
107 
108 #define UIIR_INT_STATUS (BIT0)
109 #define UIIR_THRE_INT (BIT1)
110 #define UIIR_RDA_INT (BIT2)
111 #define UIIR_RLS_INT (BIT1 | BIT2)
112 #define UIIR_CTI_INT (BIT2 | BIT3)
113 #define UIIR_ID_MASK (BIT1 | BIT2 | BIT3)
114 #define UIIR_ABEO_INT BIT8
115 #define UIIR_ABTO_INT BIT9
122 #define SSPSR_TFE BIT0
123 #define SSPSR_TNF BIT1
124 #define SSPSR_RNE BIT2
125 #define SSPSR_RFF BIT3
126 #define SSPSR_BSY BIT4
133 #define TXIR 0x00
134 #define TXTCR 0x04
135 #define TXTC 0x08
136 #define TXPR 0x0C
137 #define TXPC 0x10
138 #define TXMCR 0x14
139 #define TXMR0 0x18
140 #define TXMR1 0x1C
141 #define TXMR2 0x20
142 #define TXMR3 0x24
143 #define TXCCR 0x28
144 #define TXCR0 0x2C
145 #define TXCR1 0x30
146 #define TXCR2 0x34
147 #define TXCR3 0x38
148 #define TXEMR 0x3C
149 #define TXCTCR 0x70
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif /* LPC23XX_H */
ARM7 CPU common declarations.
Helper functions for bit arithmetic.