Use unsigned 32-bit load for ld/lduw
[qemu/qemu_0_9_1_stable.git] / hw / pxa.h
blob90ffd6076893d3d0346455c687b901a4b4adab67
1 /*
2 * Intel XScale PXA255/270 processor support.
4 * Copyright (c) 2006 Openedhand Ltd.
5 * Written by Andrzej Zaborowski <balrog@zabor.org>
7 * This code is licenced under the GPL.
8 */
9 #ifndef PXA_H
10 # define PXA_H "pxa.h"
12 /* Interrupt numbers */
13 # define PXA2XX_PIC_SSP3 0
14 # define PXA2XX_PIC_USBH2 2
15 # define PXA2XX_PIC_USBH1 3
16 # define PXA2XX_PIC_PWRI2C 6
17 # define PXA25X_PIC_HWUART 7
18 # define PXA27X_PIC_OST_4_11 7
19 # define PXA2XX_PIC_GPIO_0 8
20 # define PXA2XX_PIC_GPIO_1 9
21 # define PXA2XX_PIC_GPIO_X 10
22 # define PXA2XX_PIC_I2S 13
23 # define PXA26X_PIC_ASSP 15
24 # define PXA25X_PIC_NSSP 16
25 # define PXA27X_PIC_SSP2 16
26 # define PXA2XX_PIC_LCD 17
27 # define PXA2XX_PIC_I2C 18
28 # define PXA2XX_PIC_ICP 19
29 # define PXA2XX_PIC_STUART 20
30 # define PXA2XX_PIC_BTUART 21
31 # define PXA2XX_PIC_FFUART 22
32 # define PXA2XX_PIC_MMC 23
33 # define PXA2XX_PIC_SSP 24
34 # define PXA2XX_PIC_DMA 25
35 # define PXA2XX_PIC_OST_0 26
36 # define PXA2XX_PIC_RTC1HZ 30
37 # define PXA2XX_PIC_RTCALARM 31
39 /* DMA requests */
40 # define PXA2XX_RX_RQ_I2S 2
41 # define PXA2XX_TX_RQ_I2S 3
42 # define PXA2XX_RX_RQ_BTUART 4
43 # define PXA2XX_TX_RQ_BTUART 5
44 # define PXA2XX_RX_RQ_FFUART 6
45 # define PXA2XX_TX_RQ_FFUART 7
46 # define PXA2XX_RX_RQ_SSP1 13
47 # define PXA2XX_TX_RQ_SSP1 14
48 # define PXA2XX_RX_RQ_SSP2 15
49 # define PXA2XX_TX_RQ_SSP2 16
50 # define PXA2XX_RX_RQ_ICP 17
51 # define PXA2XX_TX_RQ_ICP 18
52 # define PXA2XX_RX_RQ_STUART 19
53 # define PXA2XX_TX_RQ_STUART 20
54 # define PXA2XX_RX_RQ_MMCI 21
55 # define PXA2XX_TX_RQ_MMCI 22
56 # define PXA2XX_USB_RQ(x) ((x) + 24)
57 # define PXA2XX_RX_RQ_SSP3 66
58 # define PXA2XX_TX_RQ_SSP3 67
60 # define PXA2XX_SDRAM_BASE 0xa0000000
61 # define PXA2XX_INTERNAL_BASE 0x5c000000
62 # define PXA2XX_INTERNAL_SIZE 0x40000
64 /* pxa2xx_pic.c */
65 qemu_irq *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env);
67 /* pxa2xx_timer.c */
68 void pxa25x_timer_init(target_phys_addr_t base, qemu_irq *irqs);
69 void pxa27x_timer_init(target_phys_addr_t base, qemu_irq *irqs, qemu_irq irq4);
71 /* pxa2xx_gpio.c */
72 struct pxa2xx_gpio_info_s;
73 struct pxa2xx_gpio_info_s *pxa2xx_gpio_init(target_phys_addr_t base,
74 CPUState *env, qemu_irq *pic, int lines);
75 void pxa2xx_gpio_set(struct pxa2xx_gpio_info_s *s, int line, int level);
76 void pxa2xx_gpio_handler_set(struct pxa2xx_gpio_info_s *s, int line,
77 gpio_handler_t handler, void *opaque);
78 void pxa2xx_gpio_read_notifier(struct pxa2xx_gpio_info_s *s,
79 void (*handler)(void *opaque), void *opaque);
81 /* pxa2xx_dma.c */
82 struct pxa2xx_dma_state_s;
83 struct pxa2xx_dma_state_s *pxa255_dma_init(target_phys_addr_t base,
84 qemu_irq irq);
85 struct pxa2xx_dma_state_s *pxa27x_dma_init(target_phys_addr_t base,
86 qemu_irq irq);
87 void pxa2xx_dma_request(struct pxa2xx_dma_state_s *s, int req_num, int on);
89 /* pxa2xx_lcd.c */
90 struct pxa2xx_lcdc_s;
91 struct pxa2xx_lcdc_s *pxa2xx_lcdc_init(target_phys_addr_t base,
92 qemu_irq irq, DisplayState *ds);
93 void pxa2xx_lcd_vsync_cb(struct pxa2xx_lcdc_s *s,
94 void (*cb)(void *opaque), void *opaque);
95 void pxa2xx_lcdc_oritentation(void *opaque, int angle);
97 /* pxa2xx_mmci.c */
98 struct pxa2xx_mmci_s;
99 struct pxa2xx_mmci_s *pxa2xx_mmci_init(target_phys_addr_t base,
100 qemu_irq irq, void *dma);
101 void pxa2xx_mmci_handlers(struct pxa2xx_mmci_s *s, void *opaque,
102 void (*readonly_cb)(void *, int),
103 void (*coverswitch_cb)(void *, int));
105 /* pxa2xx_pcmcia.c */
106 struct pxa2xx_pcmcia_s;
107 struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init(target_phys_addr_t base);
108 int pxa2xx_pcmcia_attach(void *opaque, struct pcmcia_card_s *card);
109 int pxa2xx_pcmcia_dettach(void *opaque);
110 void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq);
112 /* pxa2xx.c */
113 struct pxa2xx_ssp_s;
114 void pxa2xx_ssp_attach(struct pxa2xx_ssp_s *port,
115 uint32_t (*readfn)(void *opaque),
116 void (*writefn)(void *opaque, uint32_t value), void *opaque);
118 struct pxa2xx_i2c_s;
119 struct pxa2xx_i2c_s *pxa2xx_i2c_init(target_phys_addr_t base,
120 qemu_irq irq, uint32_t page_size);
121 i2c_bus *pxa2xx_i2c_bus(struct pxa2xx_i2c_s *s);
123 struct pxa2xx_i2s_s;
124 struct pxa2xx_fir_s;
126 struct pxa2xx_state_s {
127 CPUState *env;
128 qemu_irq *pic;
129 struct pxa2xx_dma_state_s *dma;
130 struct pxa2xx_gpio_info_s *gpio;
131 struct pxa2xx_lcdc_s *lcd;
132 struct pxa2xx_ssp_s **ssp;
133 struct pxa2xx_i2c_s *i2c[2];
134 struct pxa2xx_mmci_s *mmc;
135 struct pxa2xx_pcmcia_s *pcmcia[2];
136 struct pxa2xx_i2s_s *i2s;
137 struct pxa2xx_fir_s *fir;
139 /* Power management */
140 target_phys_addr_t pm_base;
141 uint32_t pm_regs[0x40];
143 /* Clock management */
144 target_phys_addr_t cm_base;
145 uint32_t cm_regs[4];
146 uint32_t clkcfg;
148 /* Memory management */
149 target_phys_addr_t mm_base;
150 uint32_t mm_regs[0x1a];
152 /* Performance monitoring */
153 uint32_t pmnc;
155 /* Real-Time clock */
156 target_phys_addr_t rtc_base;
157 uint32_t rttr;
158 uint32_t rtsr;
159 uint32_t rtar;
160 uint32_t rdar1;
161 uint32_t rdar2;
162 uint32_t ryar1;
163 uint32_t ryar2;
164 uint32_t swar1;
165 uint32_t swar2;
166 uint32_t piar;
167 uint32_t last_rcnr;
168 uint32_t last_rdcr;
169 uint32_t last_rycr;
170 uint32_t last_swcr;
171 uint32_t last_rtcpicr;
172 int64_t last_hz;
173 int64_t last_sw;
174 int64_t last_pi;
175 QEMUTimer *rtc_hz;
176 QEMUTimer *rtc_rdal1;
177 QEMUTimer *rtc_rdal2;
178 QEMUTimer *rtc_swal1;
179 QEMUTimer *rtc_swal2;
180 QEMUTimer *rtc_pi;
183 struct pxa2xx_i2s_s {
184 target_phys_addr_t base;
185 qemu_irq irq;
186 struct pxa2xx_dma_state_s *dma;
187 void (*data_req)(void *, int, int);
189 uint32_t control[2];
190 uint32_t status;
191 uint32_t mask;
192 uint32_t clk;
194 int enable;
195 int rx_len;
196 int tx_len;
197 void (*codec_out)(void *, uint32_t);
198 uint32_t (*codec_in)(void *);
199 void *opaque;
201 int fifo_len;
202 uint32_t fifo[16];
205 # define PA_FMT "0x%08lx"
206 # define REG_FMT "0x%lx"
208 struct pxa2xx_state_s *pxa270_init(unsigned int sdram_size, DisplayState *ds,
209 const char *revision);
210 struct pxa2xx_state_s *pxa255_init(unsigned int sdram_size, DisplayState *ds);
212 void pxa2xx_reset(int line, int level, void *opaque);
214 #endif /* PXA_H */