root / ioport.h @ 37952117
History | View | Annotate | Download (2.6 kB)
1 | 32993977 | Isaku Yamahata | /*
|
---|---|---|---|
2 | 32993977 | Isaku Yamahata | * defines ioport related functions
|
3 | 32993977 | Isaku Yamahata | *
|
4 | 32993977 | Isaku Yamahata | * Copyright (c) 2003 Fabrice Bellard
|
5 | 32993977 | Isaku Yamahata | *
|
6 | 32993977 | Isaku Yamahata | * This library is free software; you can redistribute it and/or
|
7 | 32993977 | Isaku Yamahata | * modify it under the terms of the GNU Lesser General Public
|
8 | 32993977 | Isaku Yamahata | * License as published by the Free Software Foundation; either
|
9 | 32993977 | Isaku Yamahata | * version 2 of the License, or (at your option) any later version.
|
10 | 32993977 | Isaku Yamahata | *
|
11 | 32993977 | Isaku Yamahata | * This library is distributed in the hope that it will be useful,
|
12 | 32993977 | Isaku Yamahata | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 32993977 | Isaku Yamahata | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 32993977 | Isaku Yamahata | * Lesser General Public License for more details.
|
15 | 32993977 | Isaku Yamahata | *
|
16 | 32993977 | Isaku Yamahata | * You should have received a copy of the GNU Lesser General Public
|
17 | 8167ee88 | Blue Swirl | * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
18 | 32993977 | Isaku Yamahata | */
|
19 | 32993977 | Isaku Yamahata | |
20 | 32993977 | Isaku Yamahata | /**************************************************************************
|
21 | 32993977 | Isaku Yamahata | * IO ports API
|
22 | 32993977 | Isaku Yamahata | */
|
23 | 32993977 | Isaku Yamahata | |
24 | 32993977 | Isaku Yamahata | #ifndef IOPORT_H
|
25 | 32993977 | Isaku Yamahata | #define IOPORT_H
|
26 | 32993977 | Isaku Yamahata | |
27 | 32993977 | Isaku Yamahata | #include "qemu-common.h" |
28 | acd1c812 | Avi Kivity | #include "iorange.h" |
29 | 32993977 | Isaku Yamahata | |
30 | c227f099 | Anthony Liguori | typedef uint32_t pio_addr_t;
|
31 | 07323531 | Isaku Yamahata | #define FMT_pioaddr PRIx32
|
32 | 07323531 | Isaku Yamahata | |
33 | 32993977 | Isaku Yamahata | #define MAX_IOPORTS (64 * 1024) |
34 | d56dd6cf | Isaku Yamahata | #define IOPORTS_MASK (MAX_IOPORTS - 1) |
35 | 32993977 | Isaku Yamahata | |
36 | 32993977 | Isaku Yamahata | /* These should really be in isa.h, but are here to make pc.h happy. */
|
37 | 32993977 | Isaku Yamahata | typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); |
38 | 32993977 | Isaku Yamahata | typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address); |
39 | c5b703ac | Avi Kivity | typedef void (IOPortDestructor)(void *opaque); |
40 | 32993977 | Isaku Yamahata | |
41 | acd1c812 | Avi Kivity | void ioport_register(IORange *iorange);
|
42 | c227f099 | Anthony Liguori | int register_ioport_read(pio_addr_t start, int length, int size, |
43 | 32993977 | Isaku Yamahata | IOPortReadFunc *func, void *opaque);
|
44 | c227f099 | Anthony Liguori | int register_ioport_write(pio_addr_t start, int length, int size, |
45 | 32993977 | Isaku Yamahata | IOPortWriteFunc *func, void *opaque);
|
46 | c227f099 | Anthony Liguori | void isa_unassign_ioport(pio_addr_t start, int length); |
47 | 6141dbfe | Paolo Bonzini | bool isa_is_ioport_assigned(pio_addr_t start);
|
48 | 32993977 | Isaku Yamahata | |
49 | c227f099 | Anthony Liguori | void cpu_outb(pio_addr_t addr, uint8_t val);
|
50 | c227f099 | Anthony Liguori | void cpu_outw(pio_addr_t addr, uint16_t val);
|
51 | c227f099 | Anthony Liguori | void cpu_outl(pio_addr_t addr, uint32_t val);
|
52 | c227f099 | Anthony Liguori | uint8_t cpu_inb(pio_addr_t addr); |
53 | c227f099 | Anthony Liguori | uint16_t cpu_inw(pio_addr_t addr); |
54 | c227f099 | Anthony Liguori | uint32_t cpu_inl(pio_addr_t addr); |
55 | 32993977 | Isaku Yamahata | |
56 | 6bf9fd43 | Avi Kivity | struct MemoryRegion;
|
57 | 6bf9fd43 | Avi Kivity | struct MemoryRegionPortio;
|
58 | 6bf9fd43 | Avi Kivity | |
59 | 6bf9fd43 | Avi Kivity | typedef struct PortioList { |
60 | 6bf9fd43 | Avi Kivity | const struct MemoryRegionPortio *ports; |
61 | 6bf9fd43 | Avi Kivity | struct MemoryRegion *address_space;
|
62 | 6bf9fd43 | Avi Kivity | unsigned nr;
|
63 | 6bf9fd43 | Avi Kivity | struct MemoryRegion **regions;
|
64 | de58ac72 | Avi Kivity | struct MemoryRegion **aliases;
|
65 | 6bf9fd43 | Avi Kivity | void *opaque;
|
66 | 6bf9fd43 | Avi Kivity | const char *name; |
67 | 6bf9fd43 | Avi Kivity | } PortioList; |
68 | 6bf9fd43 | Avi Kivity | |
69 | 6bf9fd43 | Avi Kivity | void portio_list_init(PortioList *piolist,
|
70 | 6bf9fd43 | Avi Kivity | const struct MemoryRegionPortio *callbacks, |
71 | 6bf9fd43 | Avi Kivity | void *opaque, const char *name); |
72 | 6bf9fd43 | Avi Kivity | void portio_list_destroy(PortioList *piolist);
|
73 | 6bf9fd43 | Avi Kivity | void portio_list_add(PortioList *piolist,
|
74 | 6bf9fd43 | Avi Kivity | struct MemoryRegion *address_space,
|
75 | 6bf9fd43 | Avi Kivity | uint32_t addr); |
76 | 6bf9fd43 | Avi Kivity | void portio_list_del(PortioList *piolist);
|
77 | 6bf9fd43 | Avi Kivity | |
78 | 32993977 | Isaku Yamahata | #endif /* IOPORT_H */ |