1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_VAR_IO_H
|
2 |
|
|
#define CYGONCE_HAL_VAR_IO_H
|
3 |
|
|
//=============================================================================
|
4 |
|
|
//
|
5 |
|
|
// var_io.h
|
6 |
|
|
//
|
7 |
|
|
// Variant specific registers
|
8 |
|
|
//
|
9 |
|
|
//=============================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//=============================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): ilijak
|
45 |
|
|
// Original data: Uwe Kindler ( LPC24XX port )
|
46 |
|
|
// Date: 2010-12-22
|
47 |
|
|
// Purpose: LPC17XX variant specific registers
|
48 |
|
|
// Description:
|
49 |
|
|
// Usage: #include <cyg/hal/var_io.h>
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//
|
53 |
|
|
//=============================================================================
|
54 |
|
|
|
55 |
|
|
#include <pkgconf/hal_cortexm_lpc17xx.h>
|
56 |
|
|
|
57 |
|
|
#include <cyg/hal/plf_io.h>
|
58 |
|
|
|
59 |
|
|
//=============================================================================
|
60 |
|
|
// Peripherals
|
61 |
|
|
|
62 |
|
|
//=============================================================================
|
63 |
|
|
// Cortex-M architecture register
|
64 |
|
|
|
65 |
|
|
// VTOR setting
|
66 |
|
|
#ifndef CYGARC_REG_NVIC_VTOR_TBLBASE_SRAM
|
67 |
|
|
#define CYGARC_REG_NVIC_VTOR_TBLBASE_SRAM BIT_(28)
|
68 |
|
|
#endif
|
69 |
|
|
|
70 |
|
|
//---------------------------------------------------------------------------
|
71 |
|
|
// Utilize LPC17xx flash between startup vectors and 0x2fc
|
72 |
|
|
// for misc funtions.
|
73 |
|
|
#ifdef CYGOPT_HAL_LPC17XX_MISC_FLASH_SECTION
|
74 |
|
|
# define CYGOPT_HAL_LPC17XX_MISC_FLASH_SECTION_ATTR \
|
75 |
|
|
CYGBLD_ATTRIB_SECTION(".lpc17xx_misc")
|
76 |
|
|
#else
|
77 |
|
|
# define CYGOPT_HAL_LPC17XX_MISC_FLASH_SECTION_ATTR
|
78 |
|
|
#endif
|
79 |
|
|
|
80 |
|
|
__externC const cyg_uint32* hal_lpc17xx_crp_p(void);
|
81 |
|
|
|
82 |
|
|
// LPC System Control Block
|
83 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_SCB_BASE 0x400FC000
|
84 |
|
|
|
85 |
|
|
// Flash accelerator
|
86 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLASHCFG 0x0000
|
87 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTSET(__tim) (__tim << 12)
|
88 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIM20MHZ 0x0
|
89 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIM40MHZ 0x1
|
90 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIM60MHZ 0x2
|
91 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIM80MHZ 0x3
|
92 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIM100MHZ 0x4
|
93 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIM120MHZ 0x4
|
94 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIMSAFE 0x5
|
95 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_FLTIM_MASK CYGHWR_HAL_LPC17XX_REG_FLTSET(0x0f)
|
96 |
|
|
|
97 |
|
|
// PLL. Registers are offsets from base of this subsystem
|
98 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL0CON 0x0080
|
99 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLLCON_PLLE (1<<0)
|
100 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLLCON_PLLC (1<<1)
|
101 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL0CFG 0x0084
|
102 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL0STAT 0x0088
|
103 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL0STAT_PLLE (1<<24)
|
104 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL0STAT_PLLC (1<<25)
|
105 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL0STAT_PLOCK (1<<26)
|
106 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL0FEED 0x008C
|
107 |
|
|
|
108 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL1CON 0x00A0
|
109 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL1CFG 0x00A4
|
110 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL1STAT 0x00A8
|
111 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL1STAT_PLLE (1<<8)
|
112 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL1STAT_PLLC (1<<9)
|
113 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL1STAT_PLOCK (1<<10)
|
114 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PLL1FEED 0x00AC
|
115 |
|
|
|
116 |
|
|
// Clock source selection register
|
117 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_CLKSRCSEL 0x010C
|
118 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_CLKSRCSEL_IRC 0x00
|
119 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_CLKSRCSEL_MAIN 0x01
|
120 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_CLKSRCSEL_RTC 0x10
|
121 |
|
|
|
122 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_CCLKCFG 0x0104
|
123 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_USBCLKCFG 0x0108
|
124 |
|
|
/* #define CYGHWR_HAL_LPC17XX_REG_IRCTRIM 0x01A4 */
|
125 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCLKSEL0 0x01A8
|
126 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCLKSEL1 0x01AC
|
127 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_INTWAKE 0x0144
|
128 |
|
|
|
129 |
|
|
// Power Control
|
130 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCON 0x00C0
|
131 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCON_IDL (1<<0)
|
132 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCON_PD (1<<1)
|
133 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP 0x00C4
|
134 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_TIM0 (1<<1)
|
135 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_TIM1 (1<<2)
|
136 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_URT0 (1<<3)
|
137 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_URT1 (1<<4)
|
138 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_PWM0 (1<<5)
|
139 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_PWM1 (1<<6)
|
140 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_I2C0 (1<<7)
|
141 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_SPI (1<<8)
|
142 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_RTC (1<<9)
|
143 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_SSP1 (1<<10)
|
144 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_EMC (1<<11)
|
145 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_AD (1<<12)
|
146 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_CAN1 (1<<13)
|
147 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_CAN2 (1<<14)
|
148 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_I2C1 (1<<19)
|
149 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_LCD (1<<20)
|
150 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_SSP0 (1<<21)
|
151 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_TIM2 (1<<22)
|
152 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_TIM3 (1<<23)
|
153 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_URT2 (1<<24)
|
154 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_URT3 (1<<25)
|
155 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_I2C2 (1<<26)
|
156 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_I2S (1<<27)
|
157 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_SD (1<<28)
|
158 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_DMA (1<<29)
|
159 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_ENET (1<<30)
|
160 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PCONP_USB (1<<31)
|
161 |
|
|
|
162 |
|
|
// Utility
|
163 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_CLKOUTCFG 0x01C8
|
164 |
|
|
|
165 |
|
|
// System control and status register
|
166 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_SCS 0x01A0
|
167 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_SCS_OSCEN 0x20
|
168 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_SCS_OSCSTAT 0x40
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
//=============================================================================
|
172 |
|
|
// Pin Connect Block (PIN)
|
173 |
|
|
|
174 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PIN_BASE 0x4002C000
|
175 |
|
|
|
176 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL0 0x000
|
177 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL1 0x004
|
178 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL2 0x008
|
179 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL3 0x00C
|
180 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL4 0x010
|
181 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL5 0x014
|
182 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL6 0x018
|
183 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL7 0x01C
|
184 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL8 0x020
|
185 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL9 0x024
|
186 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL10 0x028
|
187 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINSEL11 0x02C
|
188 |
|
|
|
189 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE0 0x040
|
190 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE1 0x044
|
191 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE2 0x048
|
192 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE3 0x04C
|
193 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE4 0x050
|
194 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE5 0x054
|
195 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE6 0x058
|
196 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE7 0x05C
|
197 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE8 0x060
|
198 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_PINMODE9 0x064
|
199 |
|
|
|
200 |
|
|
#define CYGHWR_HAL_LPC17XX_PIN_SET(_reg, _func) \
|
201 |
|
|
HAL_WRITE_UINT32(CYGHWR_HAL_LPC17XX_REG_PIN_BASE + _reg, _func)
|
202 |
|
|
|
203 |
|
|
#define CYGHWR_HAL_LPC17XX_PIN_GET(_reg, _dst) \
|
204 |
|
|
HAL_READ_UINT32(CYGHWR_HAL_LPC17XX_REG_PIN_BASE + _reg, _dst)
|
205 |
|
|
|
206 |
|
|
//=============================================================================
|
207 |
|
|
// UARTs (Ux)
|
208 |
|
|
|
209 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UART0_BASE 0x4000C000
|
210 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UART1_BASE 0x40010000
|
211 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UART2_BASE 0x40098000
|
212 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UART3_BASE 0x4009C000
|
213 |
|
|
|
214 |
|
|
// Registers are offsets from base for each UART
|
215 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxRBR 0x0000 // DLAB=0 read
|
216 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxTHR 0x0000 // DLAB=0 write
|
217 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxDLL 0x0000 // DLAB=1 r/w
|
218 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIER 0x0004 // DLAB=0
|
219 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIER_RXDATA_INT (1<<0)
|
220 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIER_THRE_INT (1<<1)
|
221 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIER_RXLS_INT (1<<2)
|
222 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1IER_RXMS_INT (1<<3) // U1 only
|
223 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxDLM 0x0004 // DLAB=1
|
224 |
|
|
|
225 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIIR 0x0008 // read
|
226 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIIR_IIR0 (1<<0)
|
227 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIIR_IIR1 (1<<1)
|
228 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIIR_IIR2 (1<<2)
|
229 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIIR_IIR3 (1<<3)
|
230 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxIIR_FIFOS (0xB0)
|
231 |
|
|
|
232 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR 0x0008 // write
|
233 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR_FIFO_ENA (1<<0)
|
234 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR_RX_FIFO_RESET (1<<1)
|
235 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR_TX_FIFO_RESET (1<<2)
|
236 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR_RX_TRIGGER_0 (0x00)
|
237 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR_RX_TRIGGER_1 (0x40)
|
238 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR_RX_TRIGGER_2 (0x80)
|
239 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFCR_RX_TRIGGER_3 (0xB0)
|
240 |
|
|
|
241 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR 0x000C
|
242 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_WORD_LENGTH_5 (0x00)
|
243 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_WORD_LENGTH_6 (0x01)
|
244 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_WORD_LENGTH_7 (0x02)
|
245 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_WORD_LENGTH_8 (0x03)
|
246 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_STOP_1 (0x00)
|
247 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_STOP_2 (0x04)
|
248 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_PARITY_ENA (0x08)
|
249 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_PARITY_ODD (0x00)
|
250 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_PARITY_EVEN (0x10)
|
251 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_PARITY_ONE (0x20)
|
252 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_PARITY_ZERO (0x30)
|
253 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_BREAK_ENA (0x40)
|
254 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLCR_DLAB (0x80)
|
255 |
|
|
|
256 |
|
|
// Modem Control Register is UART1 only
|
257 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MCR 0x0010
|
258 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MCR_DTR (1<<0)
|
259 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MCR_RTS (1<<1)
|
260 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MCR_LOOPBACK (1<<4)
|
261 |
|
|
|
262 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR 0x0014
|
263 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_RDR (1<<0)
|
264 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_OE (1<<1)
|
265 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_PE (1<<2)
|
266 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_FE (1<<3)
|
267 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_BI (1<<4)
|
268 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_THRE (1<<5)
|
269 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_TEMT (1<<6)
|
270 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxLSR_RX_FIFO_ERR (1<<7)
|
271 |
|
|
|
272 |
|
|
// Modem Status Register is UART1 only
|
273 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR 0x0018
|
274 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_DCTS (1<<0)
|
275 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_DDSR (1<<1)
|
276 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_RI_FALL (1<<2)
|
277 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_DDCD (1<<3)
|
278 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_CTS (1<<4)
|
279 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_DSR (1<<5)
|
280 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_RI (1<<6)
|
281 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U1MSR_DCD (1<<7)
|
282 |
|
|
|
283 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxSCR 0x001C
|
284 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxACR 0x0020
|
285 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_U3ICR 0x0024
|
286 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxFDR 0x0028
|
287 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_UxTER 0x0030
|
288 |
|
|
|
289 |
|
|
// RTC
|
290 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_BASE 0x40024000
|
291 |
|
|
#define CYGARC_HAL_LPC2XXX_REG_RTC_BASE CYGHWR_HAL_LPC17XX_REG_RTC_BASE
|
292 |
|
|
|
293 |
|
|
// Registers are offsets from base of this subsystem
|
294 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ILR 0x0000
|
295 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ILR_CIF (1<<0)
|
296 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ILR_ALF (1<<1)
|
297 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CTC 0x0004
|
298 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CCR 0x0008
|
299 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CCR_CLKEN (1<<0)
|
300 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CCR_CTCRST (1<<1)
|
301 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CIIR 0x000C
|
302 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_AMR 0x0010
|
303 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CTIME0 0x0014
|
304 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CTIME1 0x0018
|
305 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_CTIME2 0x001C
|
306 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_SEC 0x0020
|
307 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_MIN 0x0024
|
308 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_HOUR 0x0028
|
309 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_DOM 0x002C
|
310 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_DOW 0x0030
|
311 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_DOY 0x0034
|
312 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_MONTH 0x0038
|
313 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_YEAR 0x003C
|
314 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALSEC 0x0060
|
315 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALMIN 0x0064
|
316 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALHOUR 0x0068
|
317 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALDOM 0x006C
|
318 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALDOW 0x0070
|
319 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALDOY 0x0074
|
320 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALMON 0x0078
|
321 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_ALYEAR 0x007C
|
322 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_PREINT 0x0080
|
323 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_RTC_PREFRAC 0x0084
|
324 |
|
|
|
325 |
|
|
// Ethernet (EMAC)
|
326 |
|
|
#define CYGHWR_HAL_LPC17XX_REG_EMAC_BASE 0x50000000
|
327 |
|
|
|
328 |
|
|
// End Peripherals
|
329 |
|
|
|
330 |
|
|
#ifndef __ASSEMBLER__
|
331 |
|
|
|
332 |
|
|
__externC void hal_plf_uart_setbaud( CYG_ADDRESS uart, cyg_uint32 baud );
|
333 |
|
|
|
334 |
|
|
//-----------------------------------------------------------------------------
|
335 |
|
|
// Configure pin function
|
336 |
|
|
//
|
337 |
|
|
__externC void hal_set_pin_function(cyg_uint8 port, cyg_uint8 pin,
|
338 |
|
|
cyg_uint8 function);
|
339 |
|
|
|
340 |
|
|
//-----------------------------------------------------------------------------
|
341 |
|
|
// Function to enable/disable power for certain peripheral
|
342 |
|
|
// Use PCONP identifiers from below
|
343 |
|
|
//
|
344 |
|
|
externC void hal_lpc_set_power(cyg_uint8 pconp_id, int on);
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
//-----------------------------------------------------------------------------
|
348 |
|
|
// Identifiers for power control, hal_get_pclk()
|
349 |
|
|
//
|
350 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_TIMER0 1
|
351 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_TIMER1 2
|
352 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_UART0 3
|
353 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_UART1 4
|
354 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_PWM0 5
|
355 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_PWM1 6
|
356 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_I2C0 7
|
357 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_SPI 8
|
358 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_RTC 9
|
359 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_SSP1 10
|
360 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_EMC 11
|
361 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_ADC 12
|
362 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_CAN1 13
|
363 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_CAN2 14
|
364 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_I2C1 19
|
365 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_LCD 20
|
366 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_SSP0 21
|
367 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_TIMER2 22
|
368 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_TIMER3 23
|
369 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_UART2 24
|
370 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_UART3 25
|
371 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_I2C2 26
|
372 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_I2S 27
|
373 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_SDC 28
|
374 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_GPDMA 29
|
375 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_ENET 30
|
376 |
|
|
#define CYNUM_HAL_LPC17XX_PCONP_USB 31
|
377 |
|
|
|
378 |
|
|
#endif // ifndef __ASSEMBLER__
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
//-----------------------------------------------------------------------------
|
382 |
|
|
// LPC2xxx compatibility block
|
383 |
|
|
// These definitions enable reusing of compatible LPC2xxx devs.
|
384 |
|
|
|
385 |
|
|
// UART
|
386 |
|
|
#define CYGARC_HAL_LPC24XX_REG_UART0_BASE CYGHWR_HAL_LPC17XX_REG_UART0_BASE
|
387 |
|
|
#define CYGARC_HAL_LPC24XX_REG_UART1_BASE CYGHWR_HAL_LPC17XX_REG_UART1_BASE
|
388 |
|
|
#define CYGARC_HAL_LPC24XX_REG_UART2_BASE CYGHWR_HAL_LPC17XX_REG_UART2_BASE
|
389 |
|
|
#define CYGARC_HAL_LPC24XX_REG_UART3_BASE CYGHWR_HAL_LPC17XX_REG_UART3_BASE
|
390 |
|
|
|
391 |
|
|
// RTC
|
392 |
|
|
#define CYGARC_HAL_LPC2XXX_REG_RTC_BASE CYGHWR_HAL_LPC17XX_REG_RTC_BASE
|
393 |
|
|
|
394 |
|
|
// Ethernet (EMAC)
|
395 |
|
|
#define CYGARC_HAL_LPC2XXX_REG_EMAC_BASE CYGHWR_HAL_LPC17XX_REG_EMAC_BASE
|
396 |
|
|
|
397 |
|
|
// System Control Block
|
398 |
|
|
#define CYGARC_HAL_LPC24XX_REG_SCB_BASE CYGHWR_HAL_LPC17XX_REG_SCB_BASE
|
399 |
|
|
|
400 |
|
|
// Power Control
|
401 |
|
|
#define CYGARC_HAL_LPC24XX_REG_PCONP CYGHWR_HAL_LPC17XX_REG_PCONP
|
402 |
|
|
#define CYGARC_HAL_LPC24XX_REG_PCONP_ENET CYGHWR_HAL_LPC17XX_REG_PCONP_ENET
|
403 |
|
|
|
404 |
|
|
// Pin Connect Block (PIN)
|
405 |
|
|
#define CYGARC_HAL_LPC24XX_REG_PIN_BASE CYGHWR_HAL_LPC17XX_REG_PIN_BASE
|
406 |
|
|
#define CYGARC_HAL_LPC24XX_REG_PINSEL2 CYGHWR_HAL_LPC17XX_REG_PINSEL2
|
407 |
|
|
#define CYGARC_HAL_LPC24XX_REG_PINSEL3 CYGHWR_HAL_LPC17XX_REG_PINSEL3
|
408 |
|
|
|
409 |
|
|
// End of LPC2xxx device compatibiliy block.
|
410 |
|
|
|
411 |
|
|
//-----------------------------------------------------------------------------
|
412 |
|
|
#endif // CYGONCE_HAL_VAR_IO_H
|
413 |
|
|
// End of var_io.h
|