FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / firmware / export / tcc780x.h
blob497f1514e0861f7fa20b4d3b295d962712e1e0b5
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Rob Purchase
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef __TCC780X_H__
22 #define __TCC780X_H__
24 /* General-purpose IO */
26 #define PORTCFG0 (*(volatile unsigned long *)0xF005A000)
27 #define PORTCFG1 (*(volatile unsigned long *)0xF005A004)
28 #define PORTCFG2 (*(volatile unsigned long *)0xF005A008)
29 #define PORTCFG3 (*(volatile unsigned long *)0xF005A00C)
31 #define GPIOA (*(volatile unsigned long *)0xF005A020)
32 #define GPIOB (*(volatile unsigned long *)0xF005A040)
33 #define GPIOC (*(volatile unsigned long *)0xF005A060)
34 #define GPIOD (*(volatile unsigned long *)0xF005A080)
35 #define GPIOE (*(volatile unsigned long *)0xF005A0A0)
37 #define GPIOA_DIR (*(volatile unsigned long *)0xF005A024)
38 #define GPIOB_DIR (*(volatile unsigned long *)0xF005A044)
39 #define GPIOC_DIR (*(volatile unsigned long *)0xF005A064)
40 #define GPIOD_DIR (*(volatile unsigned long *)0xF005A084)
41 #define GPIOE_DIR (*(volatile unsigned long *)0xF005A0A4)
43 #define GPIOA_SET (*(volatile unsigned long *)0xF005A028)
44 #define GPIOB_SET (*(volatile unsigned long *)0xF005A048)
45 #define GPIOC_SET (*(volatile unsigned long *)0xF005A068)
46 #define GPIOD_SET (*(volatile unsigned long *)0xF005A088)
47 #define GPIOE_SET (*(volatile unsigned long *)0xF005A0A8)
49 #define GPIOA_CLEAR (*(volatile unsigned long *)0xF005A02C)
50 #define GPIOB_CLEAR (*(volatile unsigned long *)0xF005A04C)
51 #define GPIOC_CLEAR (*(volatile unsigned long *)0xF005A06C)
52 #define GPIOD_CLEAR (*(volatile unsigned long *)0xF005A08C)
53 #define GPIOE_CLEAR (*(volatile unsigned long *)0xF005A0AC)
55 /* Clock Generator */
57 #define CLKCTRL (*(volatile unsigned long *)0xF3000000)
58 #define PLL0CFG (*(volatile unsigned long *)0xF3000004)
59 #define PLL1CFG (*(volatile unsigned long *)0xF3000008)
60 #define CLKDIVC (*(volatile unsigned long *)0xF300000C)
61 #define CLKDIVC1 (*(volatile unsigned long *)0xF3000010)
62 #define MODECTR (*(volatile unsigned long *)0xF3000014)
63 #define BCLKCTR (*(volatile unsigned long *)0xF3000018)
64 #define SWRESET (*(volatile unsigned long *)0xF300001C)
65 #define PCLKCFG0 (*(volatile unsigned long *)0xF3000020)
66 #define PCLK_SDMMC (*(volatile unsigned long *)0xF3000024)
67 #define PCLKCFG2 (*(volatile unsigned long *)0xF3000028)
68 #define PCLKCFG3 (*(volatile unsigned long *)0xF300002C)
69 #define PCLK_LCD (*(volatile unsigned long *)0xF3000030)
70 #define PCLKCFG5 (*(volatile unsigned long *)0xF3000034)
71 #define PCLKCFG6 (*(volatile unsigned long *)0xF3000038)
72 #define PCLKCFG7 (*(volatile unsigned long *)0xF300003C)
73 #define PCLKCFG8 (*(volatile unsigned long *)0xF3000040)
74 #define PCLK_TCT (*(volatile unsigned long *)0xF3000044)
75 #define PCLKCFG10 (*(volatile unsigned long *)0xF3000048)
76 #define PCLKCFG11 (*(volatile unsigned long *)0xF300004C)
77 #define PCLK_ADC (*(volatile unsigned long *)0xF3000050)
78 #define PCLK_DAI (*(volatile unsigned long *)0xF3000054)
79 #define PCLKCFG14 (*(volatile unsigned long *)0xF3000058)
80 #define PCLK_RFREQ (*(volatile unsigned long *)0xF300005C)
81 #define PCLKCFG16 (*(volatile unsigned long *)0xF3000060)
82 #define PCLKCFG17 (*(volatile unsigned long *)0xF3000064)
84 #define PCK_EN (1<<28)
86 #define CKSEL_PLL0 0
87 #define CKSEL_PLL1 1
88 #define CKSEL_XIN 4
90 /* Device bits for SWRESET & BCLKCTR */
92 #define DEV_USBD (1<<1)
93 #define DEV_LCDC (1<<2)
94 #define DEV_SDMMC (1<<6)
95 #define DEV_NAND (1<<9)
96 #define DEV_DAI (1<<14)
97 #define DEV_ECC (1<<16)
98 #define DEV_RTC (1<<21)
99 #define DEV_SDRAM (1<<22)
100 #define DEV_COP (1<<23)
101 #define DEV_ADC (1<<24)
102 #define DEV_TIMER (1<<26)
103 #define DEV_CPU (1<<27)
104 #define DEV_IRQ (1<<28)
105 #define DEV_MAIN (1<<31)
107 /* IRQ Controller */
109 #define IEN (*(volatile unsigned long *)0xF3001000)
110 #define CREQ (*(volatile unsigned long *)0xF3001004)
111 #define IRQSEL (*(volatile unsigned long *)0xF300100C)
112 #define MREQ (*(volatile unsigned long *)0xF3001014)
113 #define POL (*(volatile unsigned long *)0xF300101C)
114 #define MIRQ (*(volatile unsigned long *)0xF3001028)
115 #define MFIQ (*(volatile unsigned long *)0xF300102C)
116 #define TMODE (*(volatile unsigned long *)0xF3001030)
117 #define TMODEA (*(volatile unsigned long *)0xF300103C)
118 #define ALLMASK (*(volatile unsigned long *)0xF3001044)
119 #define VAIRQ (*(volatile unsigned long *)0xF3001080)
120 #define VAFIQ (*(volatile unsigned long *)0xF3001084)
121 #define VNIRQ (*(volatile unsigned long *)0xF3001088)
122 #define VNFIQ (*(volatile unsigned long *)0xF300108C)
123 #define VCTRL (*(volatile unsigned long *)0xF3001090)
125 #define IRQ_PRIORITY_TABLE ((volatile unsigned int *)0xF30010A0)
127 #define EXT0_IRQ_MASK (1<<0)
128 #define EXT3_IRQ_MASK (1<<3)
129 #define TIMER0_IRQ_MASK (1<<6)
130 #define DAI_RX_IRQ_MASK (1<<14)
131 #define DAI_TX_IRQ_MASK (1<<15)
132 #define USBD_IRQ_MASK (1<<21)
133 #define ADC_IRQ_MASK (1<<30)
135 /* Timer / Counters */
137 /* Note: Timers 0-3 have a 16 bit counter, 4-5 have 20 bits */
138 #define TCFG(_x_) (*(volatile unsigned int *)(0xF3003000+0x10*(_x_)))
139 #define TCNT(_x_) (*(volatile unsigned int *)(0xF3003004+0x10*(_x_)))
140 #define TREF(_x_) (*(volatile unsigned int *)(0xF3003008+0x10*(_x_)))
142 #define TIREQ (*(volatile unsigned long *)0xF3003060)
144 /* TCFG flags */
145 #define TCFG_EN (1<<0) /* enable timer */
146 #define TCFG_CONT (1<<1) /* continue from zero once TREF is reached */
147 #define TCFG_PWM (1<<2) /* PWM mode */
148 #define TCFG_IEN (1<<3) /* IRQ enable */
149 #define TCFG_SEL (1<<4) /* clock source & divider */
150 #define TCFG_POL (1<<7) /* polarity */
151 #define TCFG_CLEAR (1<<8) /* reset TCNT to zero */
152 #define TCFG_STOP (1<<9) /* stop counting once TREF reached */
154 /* TIREQ flags */
155 #define TIREQ_TI0 (1<<0) /* Timer N IRQ flag */
156 #define TIREQ_TI1 (1<<1)
157 #define TIREQ_TI2 (1<<2)
158 #define TIREQ_TI3 (1<<3)
159 #define TIREQ_TI4 (1<<4)
160 #define TIREQ_TI5 (1<<5)
162 #define TIREQ_TF0 (1<<8) /* Timer N reference value reached */
163 #define TIREQ_TF1 (1<<9)
164 #define TIREQ_TF2 (1<<10)
165 #define TIREQ_TF3 (1<<11)
166 #define TIREQ_TF4 (1<<12)
167 #define TIREQ_TF5 (1<<13)
169 #define TC32EN (*(volatile unsigned long *)0xF3003080)
170 #define TC32LDV (*(volatile unsigned long *)0xF3003084)
171 #define TC32MCNT (*(volatile unsigned long *)0xF3003094)
172 #define TC32IRQ (*(volatile unsigned long *)0xF3003098)
174 /* ADC */
176 #define ADCCON (*(volatile unsigned long *)0xF3004000)
177 #define ADCDATA (*(volatile unsigned long *)0xF3004004)
178 #define ADCCONA (*(volatile unsigned long *)0xF3004080)
179 #define ADCSTATUS (*(volatile unsigned long *)0xF3004084)
180 #define ADCCFG (*(volatile unsigned long *)0xF3004088)
182 /* Memory Controller */
184 #define SDCFG (*(volatile unsigned long *)0xF1000000)
185 #define SDFSM (*(volatile unsigned long *)0xF1000004)
186 #define MCFG (*(volatile unsigned long *)0xF1000008)
187 #define CSCFG0 (*(volatile unsigned long *)0xF1000010)
188 #define CSCFG1 (*(volatile unsigned long *)0xF1000014)
189 #define CSCFG2 (*(volatile unsigned long *)0xF1000018)
190 #define CSCFG3 (*(volatile unsigned long *)0xF100001C)
191 #define CLKCFG (*(volatile unsigned long *)0xF1000020)
192 #define SDCMD (*(volatile unsigned long *)0xF1000024)
194 #define SDCFG1 (*(volatile unsigned long *)0xF1001000)
195 #define MCFG1 (*(volatile unsigned long *)0xF1001008)
197 /* DAI */
199 #define DADO_L0 (*(volatile unsigned long *)0xF0059020)
200 #define DADO_R0 (*(volatile unsigned long *)0xF0059024)
201 #define DADO_L1 (*(volatile unsigned long *)0xF0059028)
202 #define DADO_R1 (*(volatile unsigned long *)0xF005902c)
203 #define DADO_L2 (*(volatile unsigned long *)0xF0059030)
204 #define DADO_R2 (*(volatile unsigned long *)0xF0059034)
205 #define DADO_L3 (*(volatile unsigned long *)0xF0059038)
206 #define DADO_R3 (*(volatile unsigned long *)0xF005903c)
207 #define DADO_L(_x_) (*(volatile unsigned int *)(0xF0059020+8*(_x_)))
208 #define DADO_R(_x_) (*(volatile unsigned int *)(0xF0059024+8*(_x_)))
209 #define DAMR (*(volatile unsigned long *)0xF0059040)
210 #define DAVC (*(volatile unsigned long *)0xF0059044)
212 /* Misc */
214 #define ECFG0 (*(volatile unsigned long *)0xF300500C)
215 #define MBCFG (*(volatile unsigned long *)0xF3005020)
217 #define TCC780_VER (*(volatile unsigned long *)0xE0001FFC)
219 /* NAND Flash Controller */
221 #define NFC_CMD (*(volatile unsigned long *)0xF0053000)
222 #define NFC_SADDR (*(volatile unsigned long *)0xF005300C)
223 #define NFC_SDATA (*(volatile unsigned long *)0xF0053040)
224 #define NFC_WDATA (*(volatile unsigned long *)0xF0053010)
225 #define NFC_CTRL (*(volatile unsigned long *)0xF0053050)
226 #define NFC_16BIT (1<<26)
227 #define NFC_CS0 (1<<23)
228 #define NFC_CS1 (1<<22)
229 #define NFC_READY (1<<20)
230 #define NFC_IREQ (*(volatile unsigned long *)0xF0053060)
231 #define NFC_RST (*(volatile unsigned long *)0xF0053064)
233 /* ECC Controller */
235 #define ECC_CTRL (*(volatile unsigned long *)0xF005B000)
236 #define ECC_ENC (1<<27)
237 #define ECC_READY (1<<26)
238 #define ECC_M4EN (1<<6)
239 #define ECC_BASE (*(volatile unsigned long *)0xF005B004)
240 #define ECC_CLR (*(volatile unsigned long *)0xF005B00C)
241 #define MLC_ECC0W (*(volatile unsigned long *)0xF005B030)
242 #define MLC_ECC1W (*(volatile unsigned long *)0xF005B034)
243 #define MLC_ECC2W (*(volatile unsigned long *)0xF005B038)
244 #define ECC_ERRADDR(x) (*(volatile unsigned long *)(0xF005B050+4*(x)))
245 #define ECC_ERRDATA(x) (*(volatile unsigned long *)(0xF005B060+4*(x)))
246 #define ECC_ERR_NUM (*(volatile unsigned long *)0xF005B070)
248 /* SD/MMC Controller */
250 #define SDICLK (*(volatile unsigned long *)0xF0058004)
251 #define SDIARGU (*(volatile unsigned long *)0xF0058008)
252 #define SDICMD (*(volatile unsigned long *)0xF005800C)
253 #define SDIRSPCMD (*(volatile unsigned long *)0xF0058010)
254 #define SDIRSPARGU0 (*(volatile unsigned long *)0xF0058014)
255 #define SDIRSPARGU1 (*(volatile unsigned long *)0xF0058018)
256 #define SDIRSPARGU2 (*(volatile unsigned long *)0xF005801C)
257 #define SDIRSPARGU3 (*(volatile unsigned long *)0xF0058020)
258 #define SDIDTIMER (*(volatile unsigned long *)0xF0058024)
259 #define SDIDCTRL2 (*(volatile unsigned long *)0xF0058028)
260 #define SDIDCTRL (*(volatile unsigned long *)0xF005802C)
261 #define SDISTATUS (*(volatile unsigned long *)0xF0058030)
262 #define SDIIFLAG (*(volatile unsigned long *)0xF0058034)
263 #define SDIWDATA (*(volatile unsigned long *)0xF0058038)
264 #define SDIRDATA (*(volatile unsigned long *)0xF005803C)
265 #define SDIIENABLE (*(volatile unsigned long *)0xF0058040)
267 #define SDICMD_RES_TYPE1 1
268 #define SDICMD_RES_TYPE1b 2
269 #define SDICMD_RES_TYPE2 3
270 #define SDICMD_RES_TYPE3 4
271 #define SDICMD_RES_TYPE4 5
272 #define SDICMD_RES_TYPE5 6
273 #define SDICMD_RES_TYPE6 7
275 #define SDISTATUS_RESP_RCVD (1<<7)
276 #define SDISTATUS_FIFO_LOAD_REQ (1<<17)
277 #define SDISTATUS_FIFO_FETCH_REQ (1<<18)
278 #define SDISTATUS_CMD_PATH_RDY (1<<21)
279 #define SDISTATUS_MULTIBLOCK_END (1<<25)
281 /* USB 2.0 device system MMR base address */
282 #define USB_BASE 0xf0010000
284 #define USB_NUM_ENDPOINTS 3
285 #define USB_DEVBSS_ATTR IBSS_ATTR
287 /* Timer frequency */
288 /* Timer is based on PCK_TCT (set to 2Mhz in system.c) */
289 #define TIMER_FREQ (2000000)
291 #endif