goldfish_device.h revision 8b23a6c7e1aee255004dd19098d4c2462b61b849
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
15struct 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
29void goldfish_device_set_irq(struct goldfish_device *dev, int irq, int level);
30int goldfish_device_add(struct goldfish_device *dev,
31                       CPUReadMemoryFunc **mem_read,
32                       CPUWriteMemoryFunc **mem_write,
33                       void *opaque);
34
35int goldfish_add_device_no_io(struct goldfish_device *dev);
36
37void goldfish_device_init(qemu_irq *pic, uint32_t base, uint32_t size, uint32_t irq, uint32_t irq_count);
38int goldfish_device_bus_init(uint32_t base, uint32_t irq);
39
40// device init functions:
41qemu_irq *goldfish_interrupt_init(uint32_t base, qemu_irq parent_irq, qemu_irq parent_fiq);
42void goldfish_timer_and_rtc_init(uint32_t timerbase, int timerirq);
43int goldfish_tty_add(CharDriverState *cs, int id, uint32_t base, int irq);
44void goldfish_fb_init(DisplayState *ds, int id);
45void goldfish_audio_init(uint32_t base, int id, const char* input_source);
46void goldfish_battery_init();
47void goldfish_battery_set_prop(int ac, int property, int value);
48void goldfish_battery_display(void (* callback)(void *data, const char* string), void *data);
49void goldfish_mmc_init(uint32_t base, int id, BlockDriverState* bs);
50void *goldfish_switch_add(char *name, uint32_t (*writefn)(void *opaque, uint32_t state), void *writeopaque, int id);
51void goldfish_switch_set_state(void *opaque, uint32_t state);
52
53// these do not add a device
54void trace_dev_init(uint32_t base);
55void events_dev_init(uint32_t base, qemu_irq irq);
56void nand_dev_init(uint32_t base);
57
58#endif
59