The friendly Operating System for the Internet of Things
lpc2387.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 LPC2387_H
12 #define LPC2387_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 GPIO_INT 17
30 #define IRQP_GPIO 4
31 
32 #define _XTAL (72000)
33 
38 #define IMSEC 0x00000001
39 #define IMMIN 0x00000002
40 #define IMHOUR 0x00000004
41 #define IMDOM 0x00000008
42 #define IMDOW 0x00000010
43 #define IMDOY 0x00000020
44 #define IMMON 0x00000040
45 #define IMYEAR 0x00000080
46 
47 #define AMRSEC 0x00000001 /* Alarm mask for Seconds */
48 #define AMRMIN 0x00000002 /* Alarm mask for Minutes */
49 #define AMRHOUR 0x00000004 /* Alarm mask for Hours */
50 #define AMRDOM 0x00000008 /* Alarm mask for Day of Month */
51 #define AMRDOW 0x00000010 /* Alarm mask for Day of Week */
52 #define AMRDOY 0x00000020 /* Alarm mask for Day of Year */
53 #define AMRMON 0x00000040 /* Alarm mask for Month */
54 #define AMRYEAR 0x00000080 /* Alarm mask for Year */
55 
56 #define ILR_RTCCIF BIT0
57 #define ILR_RTCALF BIT1
58 #define ILR_RTSSF BIT2
59 
60 #define CCR_CLKEN 0x01
61 #define CCR_CTCRST 0x02
62 #define CCR_CLKSRC 0x10
63 
69 #define WDEN BIT0
70 #define WDRESET BIT1
71 #define WDTOF BIT2
72 #define WDINT BIT3
73 
79 #define EXTWAKE0 BIT0
80 #define EXTWAKE1 BIT1
81 #define EXTWAKE2 BIT2
82 #define EXTWAKE3 BIT3
83 #define ETHWAKE BIT4
84 #define USBWAKE BIT5
85 #define CANWAKE BIT6
86 #define GPIO0WAKE BIT7
87 #define GPIO2WAKE BIT8
88 #define BODWAKE BIT14
89 #define RTCWAKE BIT15
90 
96 #define ULSR_RDR BIT0
97 #define ULSR_OE BIT1
98 #define ULSR_PE BIT2
99 #define ULSR_FE BIT3
100 #define ULSR_BI BIT4
101 #define ULSR_THRE BIT5
102 #define ULSR_TEMT BIT6
103 #define ULSR_RXFE BIT7
104 
105 #define UIIR_INT_STATUS (BIT0)
106 #define UIIR_THRE_INT (BIT1)
107 #define UIIR_RDA_INT (BIT2)
108 #define UIIR_RLS_INT (BIT1 | BIT2)
109 #define UIIR_CTI_INT (BIT2 | BIT3)
110 #define UIIR_ID_MASK (BIT1 | BIT2 | BIT3)
111 #define UIIR_ABEO_INT BIT8
112 #define UIIR_ABTO_INT BIT9
113 
119 #define SSPSR_TFE BIT0
120 #define SSPSR_TNF BIT1
121 #define SSPSR_RNE BIT2
122 #define SSPSR_RFF BIT3
123 #define SSPSR_BSY BIT4
124 
130 #define TXIR 0x00
131 #define TXTCR 0x04
132 #define TXTC 0x08
133 #define TXPR 0x0C
134 #define TXPC 0x10
135 #define TXMCR 0x14
136 #define TXMR0 0x18
137 #define TXMR1 0x1C
138 #define TXMR2 0x20
139 #define TXMR3 0x24
140 #define TXCCR 0x28
141 #define TXCR0 0x2C
142 #define TXCR1 0x30
143 #define TXCR2 0x34
144 #define TXCR3 0x38
145 #define TXEMR 0x3C
146 #define TXCTCR 0x70
147 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif /* LPC2387_H */
ARM7 CPU common declarations.
Helper functions for bit arithmetic.