root / hw / pl110.c @ 1298fe63
History | View | Annotate | Download (9.3 kB)
1 | bdd5003a | pbrook | /*
|
---|---|---|---|
2 | bdd5003a | pbrook | * Arm PrimeCell PL110 Color LCD Controller
|
3 | bdd5003a | pbrook | *
|
4 | bdd5003a | pbrook | * Copyright (c) 2005 CodeSourcery, LLC.
|
5 | bdd5003a | pbrook | * Written by Paul Brook
|
6 | bdd5003a | pbrook | *
|
7 | bdd5003a | pbrook | * This code is licenced under the GNU LGPL
|
8 | bdd5003a | pbrook | */
|
9 | bdd5003a | pbrook | |
10 | bdd5003a | pbrook | #include "vl.h" |
11 | bdd5003a | pbrook | |
12 | bdd5003a | pbrook | #define PL110_CR_EN 0x001 |
13 | bdd5003a | pbrook | #define PL110_CR_BEBO 0x200 |
14 | bdd5003a | pbrook | #define PL110_CR_BEPO 0x400 |
15 | bdd5003a | pbrook | #define PL110_CR_PWR 0x800 |
16 | bdd5003a | pbrook | |
17 | bdd5003a | pbrook | enum pl110_bppmode
|
18 | bdd5003a | pbrook | { |
19 | bdd5003a | pbrook | BPP_1, |
20 | bdd5003a | pbrook | BPP_2, |
21 | bdd5003a | pbrook | BPP_4, |
22 | bdd5003a | pbrook | BPP_8, |
23 | bdd5003a | pbrook | BPP_16, |
24 | bdd5003a | pbrook | BPP_32 |
25 | bdd5003a | pbrook | }; |
26 | bdd5003a | pbrook | |
27 | bdd5003a | pbrook | typedef struct { |
28 | bdd5003a | pbrook | uint32_t base; |
29 | bdd5003a | pbrook | DisplayState *ds; |
30 | bdd5003a | pbrook | void *pic;
|
31 | bdd5003a | pbrook | uint32_t timing[4];
|
32 | bdd5003a | pbrook | uint32_t cr; |
33 | bdd5003a | pbrook | uint32_t upbase; |
34 | bdd5003a | pbrook | uint32_t lpbase; |
35 | bdd5003a | pbrook | uint32_t int_status; |
36 | bdd5003a | pbrook | uint32_t int_mask; |
37 | bdd5003a | pbrook | int cols;
|
38 | bdd5003a | pbrook | int rows;
|
39 | bdd5003a | pbrook | enum pl110_bppmode bpp;
|
40 | bdd5003a | pbrook | int invalidate;
|
41 | bdd5003a | pbrook | uint32_t pallette[256];
|
42 | bdd5003a | pbrook | uint32_t raw_pallette[128];
|
43 | bdd5003a | pbrook | int irq;
|
44 | bdd5003a | pbrook | } pl110_state; |
45 | bdd5003a | pbrook | |
46 | bdd5003a | pbrook | static const unsigned char pl110_id[] = |
47 | bdd5003a | pbrook | { 0x10, 0x11, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; |
48 | bdd5003a | pbrook | |
49 | bdd5003a | pbrook | static inline uint32_t rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b) |
50 | bdd5003a | pbrook | { |
51 | bdd5003a | pbrook | return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6); |
52 | bdd5003a | pbrook | } |
53 | bdd5003a | pbrook | |
54 | bdd5003a | pbrook | static inline uint32_t rgb_to_pixel15(unsigned int r, unsigned int g, unsigned b) |
55 | bdd5003a | pbrook | { |
56 | bdd5003a | pbrook | return ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); |
57 | bdd5003a | pbrook | } |
58 | bdd5003a | pbrook | |
59 | bdd5003a | pbrook | static inline uint32_t rgb_to_pixel16(unsigned int r, unsigned int g, unsigned b) |
60 | bdd5003a | pbrook | { |
61 | bdd5003a | pbrook | return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); |
62 | bdd5003a | pbrook | } |
63 | bdd5003a | pbrook | |
64 | bdd5003a | pbrook | static inline uint32_t rgb_to_pixel24(unsigned int r, unsigned int g, unsigned b) |
65 | bdd5003a | pbrook | { |
66 | bdd5003a | pbrook | return (r << 16) | (g << 8) | b; |
67 | bdd5003a | pbrook | } |
68 | bdd5003a | pbrook | |
69 | bdd5003a | pbrook | static inline uint32_t rgb_to_pixel32(unsigned int r, unsigned int g, unsigned b) |
70 | bdd5003a | pbrook | { |
71 | bdd5003a | pbrook | return (r << 16) | (g << 8) | b; |
72 | bdd5003a | pbrook | } |
73 | bdd5003a | pbrook | |
74 | bdd5003a | pbrook | typedef void (*drawfn)(uint32_t *, uint8_t *, const uint8_t *, int); |
75 | bdd5003a | pbrook | |
76 | bdd5003a | pbrook | #define BITS 8 |
77 | bdd5003a | pbrook | #include "pl110_template.h" |
78 | bdd5003a | pbrook | #define BITS 15 |
79 | bdd5003a | pbrook | #include "pl110_template.h" |
80 | bdd5003a | pbrook | #define BITS 16 |
81 | bdd5003a | pbrook | #include "pl110_template.h" |
82 | bdd5003a | pbrook | #define BITS 24 |
83 | bdd5003a | pbrook | #include "pl110_template.h" |
84 | bdd5003a | pbrook | #define BITS 32 |
85 | bdd5003a | pbrook | #include "pl110_template.h" |
86 | bdd5003a | pbrook | |
87 | bdd5003a | pbrook | static int pl110_enabled(pl110_state *s) |
88 | bdd5003a | pbrook | { |
89 | bdd5003a | pbrook | return (s->cr & PL110_CR_EN) && (s->cr & PL110_CR_PWR);
|
90 | bdd5003a | pbrook | } |
91 | bdd5003a | pbrook | |
92 | bdd5003a | pbrook | void pl110_update_display(void *opaque) |
93 | bdd5003a | pbrook | { |
94 | bdd5003a | pbrook | pl110_state *s = (pl110_state *)opaque; |
95 | bdd5003a | pbrook | drawfn* fntable; |
96 | bdd5003a | pbrook | drawfn fn; |
97 | bdd5003a | pbrook | uint32_t *pallette; |
98 | bdd5003a | pbrook | uint32_t addr; |
99 | bdd5003a | pbrook | uint32_t base; |
100 | bdd5003a | pbrook | int dest_width;
|
101 | bdd5003a | pbrook | int src_width;
|
102 | bdd5003a | pbrook | uint8_t *dest; |
103 | bdd5003a | pbrook | uint8_t *src; |
104 | bdd5003a | pbrook | int first, last;
|
105 | bdd5003a | pbrook | int dirty, new_dirty;
|
106 | bdd5003a | pbrook | int i;
|
107 | bdd5003a | pbrook | |
108 | bdd5003a | pbrook | if (!pl110_enabled(s))
|
109 | bdd5003a | pbrook | return;
|
110 | bdd5003a | pbrook | |
111 | bdd5003a | pbrook | switch (s->ds->depth) {
|
112 | af2f6733 | pbrook | case 0: |
113 | af2f6733 | pbrook | return;
|
114 | bdd5003a | pbrook | case 8: |
115 | bdd5003a | pbrook | fntable = pl110_draw_fn_8; |
116 | bdd5003a | pbrook | dest_width = 1;
|
117 | bdd5003a | pbrook | break;
|
118 | bdd5003a | pbrook | case 15: |
119 | bdd5003a | pbrook | fntable = pl110_draw_fn_15; |
120 | bdd5003a | pbrook | dest_width = 2;
|
121 | bdd5003a | pbrook | break;
|
122 | bdd5003a | pbrook | case 16: |
123 | bdd5003a | pbrook | fntable = pl110_draw_fn_16; |
124 | bdd5003a | pbrook | dest_width = 2;
|
125 | bdd5003a | pbrook | break;
|
126 | bdd5003a | pbrook | case 24: |
127 | bdd5003a | pbrook | fntable = pl110_draw_fn_24; |
128 | bdd5003a | pbrook | dest_width = 3;
|
129 | bdd5003a | pbrook | break;
|
130 | bdd5003a | pbrook | case 32: |
131 | bdd5003a | pbrook | fntable = pl110_draw_fn_32; |
132 | bdd5003a | pbrook | dest_width = 4;
|
133 | bdd5003a | pbrook | break;
|
134 | bdd5003a | pbrook | default:
|
135 | af2f6733 | pbrook | fprintf(stderr, "pl110: Bad color depth\n");
|
136 | bdd5003a | pbrook | exit(1);
|
137 | bdd5003a | pbrook | } |
138 | bdd5003a | pbrook | if (s->cr & PL110_CR_BEBO)
|
139 | bdd5003a | pbrook | fn = fntable[s->bpp + 6];
|
140 | bdd5003a | pbrook | else if (s->cr & PL110_CR_BEPO) |
141 | bdd5003a | pbrook | fn = fntable[s->bpp + 12];
|
142 | bdd5003a | pbrook | else
|
143 | bdd5003a | pbrook | fn = fntable[s->bpp]; |
144 | bdd5003a | pbrook | |
145 | bdd5003a | pbrook | src_width = s->cols; |
146 | bdd5003a | pbrook | switch (s->bpp) {
|
147 | bdd5003a | pbrook | case BPP_1:
|
148 | bdd5003a | pbrook | src_width >>= 3;
|
149 | bdd5003a | pbrook | break;
|
150 | bdd5003a | pbrook | case BPP_2:
|
151 | bdd5003a | pbrook | src_width >>= 2;
|
152 | bdd5003a | pbrook | break;
|
153 | bdd5003a | pbrook | case BPP_4:
|
154 | bdd5003a | pbrook | src_width >>= 1;
|
155 | bdd5003a | pbrook | break;
|
156 | bdd5003a | pbrook | case BPP_8:
|
157 | bdd5003a | pbrook | break;
|
158 | bdd5003a | pbrook | case BPP_16:
|
159 | bdd5003a | pbrook | src_width <<= 1;
|
160 | bdd5003a | pbrook | break;
|
161 | bdd5003a | pbrook | case BPP_32:
|
162 | bdd5003a | pbrook | src_width <<= 2;
|
163 | bdd5003a | pbrook | break;
|
164 | bdd5003a | pbrook | } |
165 | bdd5003a | pbrook | dest_width *= s->cols; |
166 | bdd5003a | pbrook | pallette = s->pallette; |
167 | bdd5003a | pbrook | base = s->upbase; |
168 | bdd5003a | pbrook | /* HACK: Arm aliases physical memory at 0x80000000. */
|
169 | bdd5003a | pbrook | if (base > 0x80000000) |
170 | bdd5003a | pbrook | base -= 0x80000000;
|
171 | bdd5003a | pbrook | src = phys_ram_base + base; |
172 | bdd5003a | pbrook | dest = s->ds->data; |
173 | bdd5003a | pbrook | first = -1;
|
174 | bdd5003a | pbrook | addr = base; |
175 | bdd5003a | pbrook | |
176 | bdd5003a | pbrook | dirty = cpu_physical_memory_get_dirty(addr, VGA_DIRTY_FLAG); |
177 | bdd5003a | pbrook | for (i = 0; i < s->rows; i++) { |
178 | bdd5003a | pbrook | new_dirty = 0;
|
179 | bdd5003a | pbrook | if ((addr & TARGET_PAGE_MASK) + src_width >= TARGET_PAGE_SIZE) {
|
180 | bdd5003a | pbrook | uint32_t tmp; |
181 | bdd5003a | pbrook | for (tmp = 0; tmp < src_width; tmp += TARGET_PAGE_SIZE) { |
182 | bdd5003a | pbrook | new_dirty |= cpu_physical_memory_get_dirty(addr + tmp, |
183 | bdd5003a | pbrook | VGA_DIRTY_FLAG); |
184 | bdd5003a | pbrook | } |
185 | bdd5003a | pbrook | } |
186 | bdd5003a | pbrook | |
187 | bdd5003a | pbrook | if (dirty || new_dirty || s->invalidate) {
|
188 | bdd5003a | pbrook | fn(pallette, dest, src, s->cols); |
189 | bdd5003a | pbrook | if (first == -1) |
190 | bdd5003a | pbrook | first = i; |
191 | bdd5003a | pbrook | last = i; |
192 | bdd5003a | pbrook | } |
193 | bdd5003a | pbrook | dirty = new_dirty; |
194 | bdd5003a | pbrook | addr += src_width; |
195 | bdd5003a | pbrook | dest += dest_width; |
196 | bdd5003a | pbrook | src += src_width; |
197 | bdd5003a | pbrook | } |
198 | bdd5003a | pbrook | if (first < 0) |
199 | bdd5003a | pbrook | return;
|
200 | bdd5003a | pbrook | |
201 | bdd5003a | pbrook | s->invalidate = 0;
|
202 | bdd5003a | pbrook | cpu_physical_memory_reset_dirty(base + first * src_width, |
203 | bdd5003a | pbrook | base + (last + 1) * src_width,
|
204 | bdd5003a | pbrook | VGA_DIRTY_FLAG); |
205 | bdd5003a | pbrook | dpy_update(s->ds, 0, first, s->cols, last - first + 1); |
206 | bdd5003a | pbrook | } |
207 | bdd5003a | pbrook | |
208 | bdd5003a | pbrook | void pl110_invalidate_display(void * opaque) |
209 | bdd5003a | pbrook | { |
210 | bdd5003a | pbrook | pl110_state *s = (pl110_state *)opaque; |
211 | bdd5003a | pbrook | s->invalidate = 1;
|
212 | bdd5003a | pbrook | } |
213 | bdd5003a | pbrook | |
214 | bdd5003a | pbrook | static void pl110_update_pallette(pl110_state *s, int n) |
215 | bdd5003a | pbrook | { |
216 | bdd5003a | pbrook | int i;
|
217 | bdd5003a | pbrook | uint32_t raw; |
218 | bdd5003a | pbrook | unsigned int r, g, b; |
219 | bdd5003a | pbrook | |
220 | bdd5003a | pbrook | raw = s->raw_pallette[n]; |
221 | bdd5003a | pbrook | n <<= 1;
|
222 | bdd5003a | pbrook | for (i = 0; i < 2; i++) { |
223 | bdd5003a | pbrook | r = (raw & 0x1f) << 3; |
224 | bdd5003a | pbrook | raw >>= 5;
|
225 | bdd5003a | pbrook | g = (raw & 0x1f) << 3; |
226 | bdd5003a | pbrook | raw >>= 5;
|
227 | bdd5003a | pbrook | b = (raw & 0x1f) << 3; |
228 | bdd5003a | pbrook | /* The I bit is ignored. */
|
229 | bdd5003a | pbrook | raw >>= 6;
|
230 | bdd5003a | pbrook | switch (s->ds->depth) {
|
231 | bdd5003a | pbrook | case 8: |
232 | bdd5003a | pbrook | s->pallette[n] = rgb_to_pixel8(r, g, b); |
233 | bdd5003a | pbrook | break;
|
234 | bdd5003a | pbrook | case 15: |
235 | bdd5003a | pbrook | s->pallette[n] = rgb_to_pixel15(r, g, b); |
236 | bdd5003a | pbrook | break;
|
237 | bdd5003a | pbrook | case 16: |
238 | bdd5003a | pbrook | s->pallette[n] = rgb_to_pixel16(r, g, b); |
239 | bdd5003a | pbrook | break;
|
240 | bdd5003a | pbrook | case 24: |
241 | bdd5003a | pbrook | case 32: |
242 | bdd5003a | pbrook | s->pallette[n] = rgb_to_pixel32(r, g, b); |
243 | bdd5003a | pbrook | break;
|
244 | bdd5003a | pbrook | } |
245 | bdd5003a | pbrook | n++; |
246 | bdd5003a | pbrook | } |
247 | bdd5003a | pbrook | } |
248 | bdd5003a | pbrook | |
249 | bdd5003a | pbrook | static void pl110_resize(pl110_state *s, int width, int height) |
250 | bdd5003a | pbrook | { |
251 | bdd5003a | pbrook | if (width != s->cols || height != s->rows) {
|
252 | bdd5003a | pbrook | if (pl110_enabled(s)) {
|
253 | bdd5003a | pbrook | dpy_resize(s->ds, s->cols, s->rows); |
254 | bdd5003a | pbrook | } |
255 | bdd5003a | pbrook | } |
256 | bdd5003a | pbrook | s->cols = width; |
257 | bdd5003a | pbrook | s->rows = height; |
258 | bdd5003a | pbrook | } |
259 | bdd5003a | pbrook | |
260 | bdd5003a | pbrook | /* Update interrupts. */
|
261 | bdd5003a | pbrook | static void pl110_update(pl110_state *s) |
262 | bdd5003a | pbrook | { |
263 | bdd5003a | pbrook | /* TODO: Implement interrupts. */
|
264 | bdd5003a | pbrook | } |
265 | bdd5003a | pbrook | |
266 | bdd5003a | pbrook | static uint32_t pl110_read(void *opaque, target_phys_addr_t offset) |
267 | bdd5003a | pbrook | { |
268 | bdd5003a | pbrook | pl110_state *s = (pl110_state *)opaque; |
269 | bdd5003a | pbrook | |
270 | bdd5003a | pbrook | offset -= s->base; |
271 | bdd5003a | pbrook | if (offset >= 0xfe0 && offset < 0x1000) { |
272 | bdd5003a | pbrook | return pl110_id[(offset - 0xfe0) >> 2]; |
273 | bdd5003a | pbrook | } |
274 | bdd5003a | pbrook | if (offset >= 0x200 && offset < 0x400) { |
275 | bdd5003a | pbrook | return s->raw_pallette[(offset - 0x200) >> 2]; |
276 | bdd5003a | pbrook | } |
277 | bdd5003a | pbrook | switch (offset >> 2) { |
278 | bdd5003a | pbrook | case 0: /* LCDTiming0 */ |
279 | bdd5003a | pbrook | return s->timing[0]; |
280 | bdd5003a | pbrook | case 1: /* LCDTiming1 */ |
281 | bdd5003a | pbrook | return s->timing[1]; |
282 | bdd5003a | pbrook | case 2: /* LCDTiming2 */ |
283 | bdd5003a | pbrook | return s->timing[2]; |
284 | bdd5003a | pbrook | case 3: /* LCDTiming3 */ |
285 | bdd5003a | pbrook | return s->timing[3]; |
286 | bdd5003a | pbrook | case 4: /* LCDUPBASE */ |
287 | bdd5003a | pbrook | return s->upbase;
|
288 | bdd5003a | pbrook | case 5: /* LCDLPBASE */ |
289 | bdd5003a | pbrook | return s->lpbase;
|
290 | bdd5003a | pbrook | case 6: /* LCDIMSC */ |
291 | bdd5003a | pbrook | return s->int_mask;
|
292 | bdd5003a | pbrook | case 7: /* LCDControl */ |
293 | bdd5003a | pbrook | return s->cr;
|
294 | bdd5003a | pbrook | case 8: /* LCDRIS */ |
295 | bdd5003a | pbrook | return s->int_status;
|
296 | bdd5003a | pbrook | case 9: /* LCDMIS */ |
297 | bdd5003a | pbrook | return s->int_status & s->int_mask;
|
298 | bdd5003a | pbrook | case 11: /* LCDUPCURR */ |
299 | bdd5003a | pbrook | /* TODO: Implement vertical refresh. */
|
300 | bdd5003a | pbrook | return s->upbase;
|
301 | bdd5003a | pbrook | case 12: /* LCDLPCURR */ |
302 | bdd5003a | pbrook | return s->lpbase;
|
303 | bdd5003a | pbrook | default:
|
304 | bdd5003a | pbrook | cpu_abort (cpu_single_env, "pl110_read: Bad offset %x\n", offset);
|
305 | bdd5003a | pbrook | return 0; |
306 | bdd5003a | pbrook | } |
307 | bdd5003a | pbrook | } |
308 | bdd5003a | pbrook | |
309 | bdd5003a | pbrook | static void pl110_write(void *opaque, target_phys_addr_t offset, |
310 | bdd5003a | pbrook | uint32_t val) |
311 | bdd5003a | pbrook | { |
312 | bdd5003a | pbrook | pl110_state *s = (pl110_state *)opaque; |
313 | bdd5003a | pbrook | int n;
|
314 | bdd5003a | pbrook | |
315 | bdd5003a | pbrook | /* For simplicity invalidate the display whenever a control register
|
316 | bdd5003a | pbrook | is writen to. */
|
317 | bdd5003a | pbrook | s->invalidate = 1;
|
318 | bdd5003a | pbrook | offset -= s->base; |
319 | bdd5003a | pbrook | if (offset >= 0x200 && offset < 0x400) { |
320 | bdd5003a | pbrook | /* Pallette. */
|
321 | bdd5003a | pbrook | n = (offset - 0x200) >> 2; |
322 | bdd5003a | pbrook | s->raw_pallette[(offset - 0x200) >> 2] = val; |
323 | bdd5003a | pbrook | pl110_update_pallette(s, n); |
324 | e10c2bfb | pbrook | return;
|
325 | bdd5003a | pbrook | } |
326 | bdd5003a | pbrook | switch (offset >> 2) { |
327 | bdd5003a | pbrook | case 0: /* LCDTiming0 */ |
328 | bdd5003a | pbrook | s->timing[0] = val;
|
329 | bdd5003a | pbrook | n = ((val & 0xfc) + 4) * 4; |
330 | bdd5003a | pbrook | pl110_resize(s, n, s->rows); |
331 | bdd5003a | pbrook | break;
|
332 | bdd5003a | pbrook | case 1: /* LCDTiming1 */ |
333 | bdd5003a | pbrook | s->timing[1] = val;
|
334 | bdd5003a | pbrook | n = (val & 0x3ff) + 1; |
335 | bdd5003a | pbrook | pl110_resize(s, s->cols, n); |
336 | bdd5003a | pbrook | break;
|
337 | bdd5003a | pbrook | case 2: /* LCDTiming2 */ |
338 | bdd5003a | pbrook | s->timing[2] = val;
|
339 | bdd5003a | pbrook | break;
|
340 | bdd5003a | pbrook | case 3: /* LCDTiming3 */ |
341 | bdd5003a | pbrook | s->timing[3] = val;
|
342 | bdd5003a | pbrook | break;
|
343 | bdd5003a | pbrook | case 4: /* LCDUPBASE */ |
344 | bdd5003a | pbrook | s->upbase = val; |
345 | bdd5003a | pbrook | break;
|
346 | bdd5003a | pbrook | case 5: /* LCDLPBASE */ |
347 | bdd5003a | pbrook | s->lpbase = val; |
348 | bdd5003a | pbrook | break;
|
349 | bdd5003a | pbrook | case 6: /* LCDIMSC */ |
350 | bdd5003a | pbrook | s->int_mask = val; |
351 | bdd5003a | pbrook | pl110_update(s); |
352 | bdd5003a | pbrook | break;
|
353 | bdd5003a | pbrook | case 7: /* LCDControl */ |
354 | bdd5003a | pbrook | s->cr = val; |
355 | bdd5003a | pbrook | s->bpp = (val >> 1) & 7; |
356 | bdd5003a | pbrook | if (pl110_enabled(s)) {
|
357 | bdd5003a | pbrook | dpy_resize(s->ds, s->cols, s->rows); |
358 | bdd5003a | pbrook | } |
359 | bdd5003a | pbrook | break;
|
360 | bdd5003a | pbrook | case 10: /* LCDICR */ |
361 | bdd5003a | pbrook | s->int_status &= ~val; |
362 | bdd5003a | pbrook | pl110_update(s); |
363 | bdd5003a | pbrook | break;
|
364 | bdd5003a | pbrook | default:
|
365 | bdd5003a | pbrook | cpu_abort (cpu_single_env, "pl110_write: Bad offset %x\n", offset);
|
366 | bdd5003a | pbrook | } |
367 | bdd5003a | pbrook | } |
368 | bdd5003a | pbrook | |
369 | bdd5003a | pbrook | static CPUReadMemoryFunc *pl110_readfn[] = {
|
370 | bdd5003a | pbrook | pl110_read, |
371 | bdd5003a | pbrook | pl110_read, |
372 | bdd5003a | pbrook | pl110_read |
373 | bdd5003a | pbrook | }; |
374 | bdd5003a | pbrook | |
375 | bdd5003a | pbrook | static CPUWriteMemoryFunc *pl110_writefn[] = {
|
376 | bdd5003a | pbrook | pl110_write, |
377 | bdd5003a | pbrook | pl110_write, |
378 | bdd5003a | pbrook | pl110_write |
379 | bdd5003a | pbrook | }; |
380 | bdd5003a | pbrook | |
381 | bdd5003a | pbrook | void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq) |
382 | bdd5003a | pbrook | { |
383 | bdd5003a | pbrook | pl110_state *s; |
384 | bdd5003a | pbrook | int iomemtype;
|
385 | bdd5003a | pbrook | |
386 | bdd5003a | pbrook | s = (pl110_state *)qemu_mallocz(sizeof(pl110_state));
|
387 | bdd5003a | pbrook | iomemtype = cpu_register_io_memory(0, pl110_readfn,
|
388 | bdd5003a | pbrook | pl110_writefn, s); |
389 | bdd5003a | pbrook | cpu_register_physical_memory(base, 0x007fffff, iomemtype);
|
390 | bdd5003a | pbrook | s->base = base; |
391 | bdd5003a | pbrook | s->ds = ds; |
392 | bdd5003a | pbrook | s->pic = pic; |
393 | bdd5003a | pbrook | s->irq = irq; |
394 | bdd5003a | pbrook | /* ??? Save/restore. */
|
395 | bdd5003a | pbrook | return s;
|
396 | bdd5003a | pbrook | } |