• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (C) 2007-2008 The Android Open Source Project
2 **
3 ** This software is licensed under the terms of the GNU General Public
4 ** License version 2, as published by the Free Software Foundation, and
5 ** may be copied, distributed, and modified under those terms.
6 **
7 ** This program is distributed in the hope that it will be useful,
8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 ** GNU General Public License for more details.
11 */
12 #ifndef GOLDFISH_DEVICE_H
13 #define GOLDFISH_DEVICE_H
14 
15 struct goldfish_device {
16     struct goldfish_device *next;
17     struct goldfish_device *prev;
18     uint32_t reported_state;
19     void *cookie;
20     const char *name;
21     uint32_t id;
22     uint32_t base; // filled in by goldfish_device_add if 0
23     uint32_t size;
24     uint32_t irq; // filled in by goldfish_device_add if 0
25     uint32_t irq_count;
26 };
27 
28 
29 void goldfish_device_set_irq(struct goldfish_device *dev, int irq, int level);
30 int goldfish_device_add(struct goldfish_device *dev,
31                        CPUReadMemoryFunc **mem_read,
32                        CPUWriteMemoryFunc **mem_write,
33                        void *opaque);
34 
35 int goldfish_add_device_no_io(struct goldfish_device *dev);
36 
37 void goldfish_device_init(qemu_irq *pic, uint32_t base, uint32_t size, uint32_t irq, uint32_t irq_count);
38 int goldfish_device_bus_init(uint32_t base, uint32_t irq);
39 
40 // device init functions:
41 qemu_irq *goldfish_interrupt_init(uint32_t base, qemu_irq parent_irq, qemu_irq parent_fiq);
42 void goldfish_timer_and_rtc_init(uint32_t timerbase, int timerirq);
43 int goldfish_tty_add(CharDriverState *cs, int id, uint32_t base, int irq);
44 void goldfish_fb_init(DisplayState *ds, int id);
45 void goldfish_audio_init(uint32_t base, int id, const char* input_source);
46 void goldfish_battery_init();
47 void goldfish_battery_set_prop(int ac, int property, int value);
48 void goldfish_battery_display(void (* callback)(void *data, const char* string), void *data);
49 void goldfish_mmc_init(uint32_t base, int id, BlockDriverState* bs);
50 void *goldfish_switch_add(char *name, uint32_t (*writefn)(void *opaque, uint32_t state), void *writeopaque, int id);
51 void goldfish_switch_set_state(void *opaque, uint32_t state);
52 
53 // these do not add a device
54 void trace_dev_init();
55 void events_dev_init(uint32_t base, qemu_irq irq);
56 void nand_dev_init(uint32_t base);
57 
58 #endif
59