Loading...
Searching...
No Matches
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#pragma once
12
13#include "vendor/lpc23xx.h"
14#include "arm7_common.h"
15#include "bitarithm.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#define F_CCO 288000000
22#define CL_CPU_DIV 4
23#define F_RC_OSCILLATOR 4000000
24#define F_RTC_OSCILLATOR 32767
25
26#define VIC_SIZE 32
27
28#define PLLCFG_N(n) ((n - 1) << 16)
29#define PLLCFG_M(m) (m - 1)
30
31#define GPIO_INT 17
32#define IRQP_GPIO 4
33
34#define _XTAL (72000)
35
40#define IMSEC 0x00000001
41#define IMMIN 0x00000002
42#define IMHOUR 0x00000004
43#define IMDOM 0x00000008
44#define IMDOW 0x00000010
45#define IMDOY 0x00000020
46#define IMMON 0x00000040
47#define IMYEAR 0x00000080
48
49#define AMRSEC 0x00000001 /* Alarm mask for Seconds */
50#define AMRMIN 0x00000002 /* Alarm mask for Minutes */
51#define AMRHOUR 0x00000004 /* Alarm mask for Hours */
52#define AMRDOM 0x00000008 /* Alarm mask for Day of Month */
53#define AMRDOW 0x00000010 /* Alarm mask for Day of Week */
54#define AMRDOY 0x00000020 /* Alarm mask for Day of Year */
55#define AMRMON 0x00000040 /* Alarm mask for Month */
56#define AMRYEAR 0x00000080 /* Alarm mask for Year */
57
58#define ILR_RTCCIF BIT0
59#define ILR_RTCALF BIT1
60#define ILR_RTSSF BIT2
61
62#define CCR_CLKEN 0x01
63#define CCR_CTCRST 0x02
64#define CCR_CLKSRC 0x10
66
71#define WDEN BIT0
72#define WDRESET BIT1
73#define WDTOF BIT2
74#define WDINT BIT3
76
81#define EXTWAKE0 BIT0
82#define EXTWAKE1 BIT1
83#define EXTWAKE2 BIT2
84#define EXTWAKE3 BIT3
85#define ETHWAKE BIT4
86#define USBWAKE BIT5
87#define CANWAKE BIT6
88#define GPIO0WAKE BIT7
89#define GPIO2WAKE BIT8
90#define BODWAKE BIT14
91#define RTCWAKE BIT15
93
98#define ULSR_RDR BIT0
99#define ULSR_OE BIT1
100#define ULSR_PE BIT2
101#define ULSR_FE BIT3
102#define ULSR_BI BIT4
103#define ULSR_THRE BIT5
104#define ULSR_TEMT BIT6
105#define ULSR_RXFE BIT7
106
107#define UIIR_INT_STATUS (BIT0)
108#define UIIR_THRE_INT (BIT1)
109#define UIIR_RDA_INT (BIT2)
110#define UIIR_RLS_INT (BIT1 | BIT2)
111#define UIIR_CTI_INT (BIT2 | BIT3)
112#define UIIR_ID_MASK (BIT1 | BIT2 | BIT3)
113#define UIIR_ABEO_INT BIT8
114#define UIIR_ABTO_INT BIT9
116
121#define SSPSR_TFE BIT0
122#define SSPSR_TNF BIT1
123#define SSPSR_RNE BIT2
124#define SSPSR_RFF BIT3
125#define SSPSR_BSY BIT4
127
132#define TXIR 0x00
133#define TXTCR 0x04
134#define TXTC 0x08
135#define TXPR 0x0C
136#define TXPC 0x10
137#define TXMCR 0x14
138#define TXMR0 0x18
139#define TXMR1 0x1C
140#define TXMR2 0x20
141#define TXMR3 0x24
142#define TXCCR 0x28
143#define TXCR0 0x2C
144#define TXCR1 0x30
145#define TXCR2 0x34
146#define TXCR3 0x38
147#define TXEMR 0x3C
148#define TXCTCR 0x70
150
151#ifdef __cplusplus
152}
153#endif
ARM7 CPU common declarations.
Helper functions for bit arithmetic.