Colour targets: Revert an optimisation from almost 18 months ago that actually turned...
[Rockbox.git] / firmware / export / pp5002.h
blobb235a2154b759154b2f5614e57d448a66e73a47a
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2004 by Thom Johansen
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 __PP5002_H__
22 #define __PP5002_H__
24 /* Much info gleaned and/or copied from the iPodLinux project. */
25 #define DRAM_START 0x28000000
27 /* LCD bridge */
28 #define LCD1_BASE 0xc0001000
30 #define LCD1_CONTROL (*(volatile unsigned long *)(0xc0001000))
31 #define LCD1_CMD (*(volatile unsigned long *)(0xc0001008))
32 #define LCD1_DATA (*(volatile unsigned long *)(0xc0001010))
34 #define LCD1_BUSY_MASK 0x8000
36 /* I2S controller */
37 #define IISCONFIG (*(volatile unsigned long *)(0xc0002500))
38 #define IISFIFO_CFG (*(volatile unsigned long *)(0xc000251c))
39 #define IISFIFO_WR (*(volatile unsigned long *)(0xc0002540))
40 #define IISFIFO_RD (*(volatile unsigned long *)(0xc0002580))
42 /* IISCONFIG bits: */
43 #define IIS_TXFIFOEN (1 << 2)
44 #define IIS_TX_FREE_MASK (0xf << 23)
45 #define IIS_TX_FREE_COUNT ((IISFIFO_CFG & IIS_TX_FREE_MASK) >> 23)
47 /* IISFIFO_CFG bits: */
48 #define IIS_IRQTX_REG IISFIFO_CFG
49 #define IIS_IRQTX (1 << 9)
51 #define IDE_BASE 0xc0003000
53 #define IDE_CFG_STATUS (*(volatile unsigned long *)(0xc0003024))
55 #define USB_BASE 0xc0005000
57 #define I2C_BASE 0xc0008000
59 /* Processor ID */
60 #define PROCESSOR_ID (*(volatile unsigned long *)(0xc4000000))
62 #define PROC_ID_CPU 0x55
63 #define PROC_ID_COP 0xaa
65 #define GPIOA_ENABLE (*(volatile unsigned char *)(0xcf000000))
66 #define GPIOB_ENABLE (*(volatile unsigned char *)(0xcf000004))
67 #define GPIOC_ENABLE (*(volatile unsigned char *)(0xcf000008))
68 #define GPIOD_ENABLE (*(volatile unsigned char *)(0xcf00000c))
69 #define GPIOA_OUTPUT_EN (*(volatile unsigned char *)(0xcf000010))
70 #define GPIOB_OUTPUT_EN (*(volatile unsigned char *)(0xcf000014))
71 #define GPIOC_OUTPUT_EN (*(volatile unsigned char *)(0xcf000018))
72 #define GPIOD_OUTPUT_EN (*(volatile unsigned char *)(0xcf00001c))
73 #define GPIOA_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000020))
74 #define GPIOB_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000024))
75 #define GPIOC_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000028))
76 #define GPIOD_OUTPUT_VAL (*(volatile unsigned char *)(0xcf00002c))
77 #define GPIOA_INPUT_VAL (*(volatile unsigned char *)(0xcf000030))
78 #define GPIOB_INPUT_VAL (*(volatile unsigned char *)(0xcf000034))
79 #define GPIOC_INPUT_VAL (*(volatile unsigned char *)(0xcf000038))
80 #define GPIOD_INPUT_VAL (*(volatile unsigned char *)(0xcf00003c))
81 #define GPIOA_INT_STAT (*(volatile unsigned char *)(0xcf000040))
82 #define GPIOB_INT_STAT (*(volatile unsigned char *)(0xcf000044))
83 #define GPIOC_INT_STAT (*(volatile unsigned char *)(0xcf000048))
84 #define GPIOD_INT_STAT (*(volatile unsigned char *)(0xcf00004c))
85 #define GPIOA_INT_EN (*(volatile unsigned char *)(0xcf000050))
86 #define GPIOB_INT_EN (*(volatile unsigned char *)(0xcf000054))
87 #define GPIOC_INT_EN (*(volatile unsigned char *)(0xcf000058))
88 #define GPIOD_INT_EN (*(volatile unsigned char *)(0xcf00005c))
89 #define GPIOA_INT_LEV (*(volatile unsigned char *)(0xcf000060))
90 #define GPIOB_INT_LEV (*(volatile unsigned char *)(0xcf000064))
91 #define GPIOC_INT_LEV (*(volatile unsigned char *)(0xcf000068))
92 #define GPIOD_INT_LEV (*(volatile unsigned char *)(0xcf00006c))
93 #define GPIOA_INT_CLR (*(volatile unsigned char *)(0xcf000070))
94 #define GPIOB_INT_CLR (*(volatile unsigned char *)(0xcf000074))
95 #define GPIOC_INT_CLR (*(volatile unsigned char *)(0xcf000078))
96 #define GPIOD_INT_CLR (*(volatile unsigned char *)(0xcf00007c))
98 #define CPU_INT_STAT (*(volatile unsigned long *)(0xcf001000))
99 #define COP_INT_STAT (*(volatile unsigned long *)(0xcf001004))
100 #define CPU_FIQ_STAT (*(volatile unsigned long *)(0xcf001008))
101 #define COP_FIQ_STAT (*(volatile unsigned long *)(0xcf00100c))
103 #define INT_STAT (*(volatile unsigned long *)(0xcf001010))
104 #define INT_FORCED_STAT (*(volatile unsigned long *)(0xcf001014))
105 #define INT_FORCED_SET (*(volatile unsigned long *)(0xcf001018))
106 #define INT_FORCED_CLR (*(volatile unsigned long *)(0xcf00101c))
108 #define CPU_INT_EN_STAT (*(volatile unsigned long *)(0xcf001020))
109 #define CPU_INT_EN (*(volatile unsigned long *)(0xcf001024))
110 #define CPU_INT_DIS (*(volatile unsigned long *)(0xcf001028))
111 #define CPU_INT_PRIORITY (*(volatile unsigned long *)(0xcf00102c))
113 #define COP_INT_EN_STAT (*(volatile unsigned long *)(0xcf001030))
114 #define COP_INT_EN (*(volatile unsigned long *)(0xcf001034))
115 #define COP_INT_DIS (*(volatile unsigned long *)(0xcf001038))
116 #define COP_INT_PRIORITY (*(volatile unsigned long *)(0xcf00103c))
118 #define IDE_IRQ 1
119 #define SER0_IRQ 4
120 #define I2S_IRQ 5
121 #define SER1_IRQ 7
122 #define TIMER1_IRQ 11
123 #define TIMER2_IRQ 12
124 #define GPIO_IRQ 14
125 #define DMA_OUT_IRQ 30
126 #define DMA_IN_IRQ 31
128 #define IDE_MASK (1 << IDE_IRQ)
129 #define SER0_MASK (1 << SER0_IRQ)
130 #define I2S_MASK (1 << I2S_IRQ)
131 #define SER1_MASK (1 << SER1_IRQ)
132 #define TIMER1_MASK (1 << TIMER1_IRQ)
133 #define TIMER2_MASK (1 << TIMER2_IRQ)
134 #define GPIO_MASK (1 << GPIO_IRQ)
135 #define DMA_OUT_MASK (1 << DMA_OUT_IRQ)
136 #define DMA_IN_MASK (1 << DMA_IN_IRQ)
138 /* Yes, there is I2S_MASK but this cleans up the pcm code */
139 #define IIS_MASK DMA_OUT_MASK
141 #define TIMER1_CFG (*(volatile unsigned long *)(0xcf001100))
142 #define TIMER1_VAL (*(volatile unsigned long *)(0xcf001104))
143 #define TIMER2_CFG (*(volatile unsigned long *)(0xcf001108))
144 #define TIMER2_VAL (*(volatile unsigned long *)(0xcf00110c))
146 #define USEC_TIMER (*(volatile unsigned long *)(0xcf001110))
148 #define TIMING1_CTL (*(volatile unsigned long *)(0xcf004000))
149 #define TIMING2_CTL (*(volatile unsigned long *)(0xcf004008))
151 #define PP_VER1 (*(volatile unsigned long *)(0xcf004030))
152 #define PP_VER2 (*(volatile unsigned long *)(0xcf004034))
153 #define PP_VER3 (*(volatile unsigned long *)(0xcf004038))
154 #define PP_VER4 (*(volatile unsigned long *)(0xcf00403c))
156 /* Processors Control */
157 #define PROC_STAT (*(volatile unsigned long *)(0xcf004050))
158 #define CPU_CTL (*(volatile unsigned char *)(0xcf004054))
159 #define COP_CTL (*(volatile unsigned char *)(0xcf004058))
161 #define CPU_SLEEPING 0x8000
162 #define COP_SLEEPING 0x4000
163 #define PROC_SLEEPING(core) (0x8000 >> (core))
165 #define PROC_CTL(core) ((&CPU_CTL)[(core)*4])
167 #define PROC_SLEEP 0xca
168 #define PROC_WAKE 0xce
170 /* Cache Control */
171 #define CACHE_CTL (*(volatile unsigned long *)(0xcf004024))
172 #define CACHE_RUN 0x1
173 #define CACHE_INIT 0x2
175 #define CACHE_MASK (*(volatile unsigned long *)(0xf000f020))
176 #define CACHE_OPERATION (*(volatile unsigned long *)(0xf000f024))
177 #define CACHE_FLUSH_BASE (*(volatile unsigned long *)(0xf000c000))
178 #define CACHE_INVALIDATE_BASE (*(volatile unsigned long *)(0xf0004000))
179 #define CACHE_SIZE 0x2000 /* PP5002 has 8KB cache */
181 #define CACHE_OP_UNKNOWN1 (1<<11) /* 0x800 */
183 #define DEV_EN (*(volatile unsigned long *)(0xcf005000))
184 #define DEV_RS (*(volatile unsigned long *)(0xcf005030))
186 #define DEV_I2C (1<<8)
187 #define DEV_USB 0x400000
189 #define CLOCK_ENABLE (*(volatile unsigned long *)(0xcf005008))
190 #define CLOCK_SOURCE (*(volatile unsigned long *)(0xcf00500c))
191 #define PLL_CONTROL (*(volatile unsigned long *)(0xcf005010))
192 #define PLL_DIV (*(volatile unsigned long *)(0xcf005018))
193 #define PLL_MULT (*(volatile unsigned long *)(0xcf00501c))
194 #define PLL_UNLOCK (*(volatile unsigned long *)(0xcf005038))
196 #define MMAP0_LOGICAL (*(volatile unsigned long *)(0xf000f000))
197 #define MMAP0_PHYSICAL (*(volatile unsigned long *)(0xf000f004))
198 #define MMAP1_LOGICAL (*(volatile unsigned long *)(0xf000f008))
199 #define MMAP1_PHYSICAL (*(volatile unsigned long *)(0xf000f00c))
200 #define MMAP2_LOGICAL (*(volatile unsigned long *)(0xf000f010))
201 #define MMAP2_PHYSICAL (*(volatile unsigned long *)(0xf000f014))
202 #define MMAP3_LOGICAL (*(volatile unsigned long *)(0xf000f018))
203 #define MMAP3_PHYSICAL (*(volatile unsigned long *)(0xf000f01c))
205 #endif