root / hw / i8254_internal.h @ 136be99e
History | View | Annotate | Download (3 kB)
1 | d11e859e | Jan Kiszka | /*
|
---|---|---|---|
2 | d11e859e | Jan Kiszka | * QEMU 8253/8254 - internal interfaces
|
3 | d11e859e | Jan Kiszka | *
|
4 | d11e859e | Jan Kiszka | * Copyright (c) 2011 Jan Kiszka, Siemens AG
|
5 | d11e859e | Jan Kiszka | *
|
6 | d11e859e | Jan Kiszka | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | d11e859e | Jan Kiszka | * of this software and associated documentation files (the "Software"), to deal
|
8 | d11e859e | Jan Kiszka | * in the Software without restriction, including without limitation the rights
|
9 | d11e859e | Jan Kiszka | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | d11e859e | Jan Kiszka | * copies of the Software, and to permit persons to whom the Software is
|
11 | d11e859e | Jan Kiszka | * furnished to do so, subject to the following conditions:
|
12 | d11e859e | Jan Kiszka | *
|
13 | d11e859e | Jan Kiszka | * The above copyright notice and this permission notice shall be included in
|
14 | d11e859e | Jan Kiszka | * all copies or substantial portions of the Software.
|
15 | d11e859e | Jan Kiszka | *
|
16 | d11e859e | Jan Kiszka | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | d11e859e | Jan Kiszka | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | d11e859e | Jan Kiszka | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | d11e859e | Jan Kiszka | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | d11e859e | Jan Kiszka | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | d11e859e | Jan Kiszka | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | d11e859e | Jan Kiszka | * THE SOFTWARE.
|
23 | d11e859e | Jan Kiszka | */
|
24 | d11e859e | Jan Kiszka | |
25 | d11e859e | Jan Kiszka | #ifndef QEMU_I8254_INTERNAL_H
|
26 | d11e859e | Jan Kiszka | #define QEMU_I8254_INTERNAL_H
|
27 | d11e859e | Jan Kiszka | |
28 | d11e859e | Jan Kiszka | #include "hw.h" |
29 | d11e859e | Jan Kiszka | #include "pc.h" |
30 | d11e859e | Jan Kiszka | #include "isa.h" |
31 | d11e859e | Jan Kiszka | |
32 | d11e859e | Jan Kiszka | typedef struct PITChannelState { |
33 | d11e859e | Jan Kiszka | int count; /* can be 65536 */ |
34 | d11e859e | Jan Kiszka | uint16_t latched_count; |
35 | d11e859e | Jan Kiszka | uint8_t count_latched; |
36 | d11e859e | Jan Kiszka | uint8_t status_latched; |
37 | d11e859e | Jan Kiszka | uint8_t status; |
38 | d11e859e | Jan Kiszka | uint8_t read_state; |
39 | d11e859e | Jan Kiszka | uint8_t write_state; |
40 | d11e859e | Jan Kiszka | uint8_t write_latch; |
41 | d11e859e | Jan Kiszka | uint8_t rw_mode; |
42 | d11e859e | Jan Kiszka | uint8_t mode; |
43 | d11e859e | Jan Kiszka | uint8_t bcd; /* not supported */
|
44 | d11e859e | Jan Kiszka | uint8_t gate; /* timer start */
|
45 | d11e859e | Jan Kiszka | int64_t count_load_time; |
46 | d11e859e | Jan Kiszka | /* irq handling */
|
47 | d11e859e | Jan Kiszka | int64_t next_transition_time; |
48 | d11e859e | Jan Kiszka | QEMUTimer *irq_timer; |
49 | d11e859e | Jan Kiszka | qemu_irq irq; |
50 | d11e859e | Jan Kiszka | uint32_t irq_disabled; |
51 | d11e859e | Jan Kiszka | } PITChannelState; |
52 | d11e859e | Jan Kiszka | |
53 | d11e859e | Jan Kiszka | typedef struct PITCommonState { |
54 | d11e859e | Jan Kiszka | ISADevice dev; |
55 | d11e859e | Jan Kiszka | MemoryRegion ioports; |
56 | d11e859e | Jan Kiszka | uint32_t iobase; |
57 | d11e859e | Jan Kiszka | PITChannelState channels[3];
|
58 | d11e859e | Jan Kiszka | } PITCommonState; |
59 | d11e859e | Jan Kiszka | |
60 | d11e859e | Jan Kiszka | #define TYPE_PIT_COMMON "pit-common" |
61 | d11e859e | Jan Kiszka | #define PIT_COMMON(obj) \
|
62 | d11e859e | Jan Kiszka | OBJECT_CHECK(PITCommonState, (obj), TYPE_PIT_COMMON) |
63 | d11e859e | Jan Kiszka | #define PIT_COMMON_CLASS(klass) \
|
64 | d11e859e | Jan Kiszka | OBJECT_CLASS_CHECK(PITCommonClass, (klass), TYPE_PIT_COMMON) |
65 | d11e859e | Jan Kiszka | #define PIT_COMMON_GET_CLASS(obj) \
|
66 | d11e859e | Jan Kiszka | OBJECT_GET_CLASS(PITCommonClass, (obj), TYPE_PIT_COMMON) |
67 | d11e859e | Jan Kiszka | |
68 | d11e859e | Jan Kiszka | typedef struct PITCommonClass { |
69 | d11e859e | Jan Kiszka | ISADeviceClass parent_class; |
70 | d11e859e | Jan Kiszka | |
71 | d11e859e | Jan Kiszka | int (*init)(PITCommonState *s);
|
72 | d11e859e | Jan Kiszka | void (*set_channel_gate)(PITCommonState *s, PITChannelState *sc, int val); |
73 | d11e859e | Jan Kiszka | void (*get_channel_info)(PITCommonState *s, PITChannelState *sc,
|
74 | d11e859e | Jan Kiszka | PITChannelInfo *info); |
75 | d11e859e | Jan Kiszka | void (*pre_save)(PITCommonState *s);
|
76 | d11e859e | Jan Kiszka | void (*post_load)(PITCommonState *s);
|
77 | d11e859e | Jan Kiszka | } PITCommonClass; |
78 | d11e859e | Jan Kiszka | |
79 | d11e859e | Jan Kiszka | int pit_get_out(PITChannelState *s, int64_t current_time);
|
80 | d11e859e | Jan Kiszka | int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time); |
81 | d11e859e | Jan Kiszka | void pit_get_channel_info_common(PITCommonState *s, PITChannelState *sc,
|
82 | d11e859e | Jan Kiszka | PITChannelInfo *info); |
83 | d11e859e | Jan Kiszka | void pit_reset_common(PITCommonState *s);
|
84 | d11e859e | Jan Kiszka | |
85 | d11e859e | Jan Kiszka | #endif /* !QEMU_I8254_INTERNAL_H */ |