Revision bc24a225 hw/max111x.c
b/hw/max111x.c | ||
---|---|---|
10 | 10 |
#include "hw.h" |
11 | 11 |
#include "i2c.h" |
12 | 12 |
|
13 |
struct max111x_s {
|
|
13 |
struct MAX111xState {
|
|
14 | 14 |
qemu_irq interrupt; |
15 | 15 |
uint8_t tb1, rb2, rb3; |
16 | 16 |
int cycle; |
... | ... | |
36 | 36 |
|
37 | 37 |
uint32_t max111x_read(void *opaque) |
38 | 38 |
{ |
39 |
struct max111x_s *s = (struct max111x_s *) opaque;
|
|
39 |
MAX111xState *s = (MAX111xState *) opaque;
|
|
40 | 40 |
|
41 | 41 |
if (!s->tb1) |
42 | 42 |
return 0; |
... | ... | |
54 | 54 |
/* Interpret a control-byte */ |
55 | 55 |
void max111x_write(void *opaque, uint32_t value) |
56 | 56 |
{ |
57 |
struct max111x_s *s = (struct max111x_s *) opaque;
|
|
57 |
MAX111xState *s = (MAX111xState *) opaque;
|
|
58 | 58 |
int measure, chan; |
59 | 59 |
|
60 | 60 |
/* Ignore the value if START bit is zero */ |
... | ... | |
92 | 92 |
|
93 | 93 |
static void max111x_save(QEMUFile *f, void *opaque) |
94 | 94 |
{ |
95 |
struct max111x_s *s = (struct max111x_s *) opaque;
|
|
95 |
MAX111xState *s = (MAX111xState *) opaque;
|
|
96 | 96 |
int i; |
97 | 97 |
|
98 | 98 |
qemu_put_8s(f, &s->tb1); |
... | ... | |
106 | 106 |
|
107 | 107 |
static int max111x_load(QEMUFile *f, void *opaque, int version_id) |
108 | 108 |
{ |
109 |
struct max111x_s *s = (struct max111x_s *) opaque;
|
|
109 |
MAX111xState *s = (MAX111xState *) opaque;
|
|
110 | 110 |
int i; |
111 | 111 |
|
112 | 112 |
qemu_get_8s(f, &s->tb1); |
... | ... | |
121 | 121 |
return 0; |
122 | 122 |
} |
123 | 123 |
|
124 |
static struct max111x_s *max111x_init(qemu_irq cb)
|
|
124 |
static MAX111xState *max111x_init(qemu_irq cb)
|
|
125 | 125 |
{ |
126 |
struct max111x_s *s;
|
|
127 |
s = (struct max111x_s *)
|
|
128 |
qemu_mallocz(sizeof(struct max111x_s));
|
|
129 |
memset(s, 0, sizeof(struct max111x_s));
|
|
126 |
MAX111xState *s;
|
|
127 |
s = (MAX111xState *)
|
|
128 |
qemu_mallocz(sizeof(MAX111xState));
|
|
129 |
memset(s, 0, sizeof(MAX111xState));
|
|
130 | 130 |
|
131 | 131 |
s->interrupt = cb; |
132 | 132 |
|
... | ... | |
146 | 146 |
return s; |
147 | 147 |
} |
148 | 148 |
|
149 |
struct max111x_s *max1110_init(qemu_irq cb)
|
|
149 |
MAX111xState *max1110_init(qemu_irq cb)
|
|
150 | 150 |
{ |
151 |
struct max111x_s *s = max111x_init(cb);
|
|
151 |
MAX111xState *s = max111x_init(cb);
|
|
152 | 152 |
s->inputs = 8; |
153 | 153 |
return s; |
154 | 154 |
} |
155 | 155 |
|
156 |
struct max111x_s *max1111_init(qemu_irq cb)
|
|
156 |
MAX111xState *max1111_init(qemu_irq cb)
|
|
157 | 157 |
{ |
158 |
struct max111x_s *s = max111x_init(cb);
|
|
158 |
MAX111xState *s = max111x_init(cb);
|
|
159 | 159 |
s->inputs = 4; |
160 | 160 |
return s; |
161 | 161 |
} |
162 | 162 |
|
163 |
void max111x_set_input(struct max111x_s *s, int line, uint8_t value)
|
|
163 |
void max111x_set_input(MAX111xState *s, int line, uint8_t value)
|
|
164 | 164 |
{ |
165 | 165 |
if (line >= s->inputs) { |
166 | 166 |
printf("%s: There's no input %i\n", __FUNCTION__, line); |
Also available in: Unified diff