root / hw / syborg_serial.c @ a8a00822
History | View | Annotate | Download (9.2 kB)
1 | 4af39611 | Paul Brook | /*
|
---|---|---|---|
2 | 4af39611 | Paul Brook | * Syborg serial port
|
3 | 4af39611 | Paul Brook | *
|
4 | 4af39611 | Paul Brook | * Copyright (c) 2008 CodeSourcery
|
5 | 4af39611 | Paul Brook | *
|
6 | 4af39611 | Paul Brook | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 4af39611 | Paul Brook | * of this software and associated documentation files (the "Software"), to deal
|
8 | 4af39611 | Paul Brook | * in the Software without restriction, including without limitation the rights
|
9 | 4af39611 | Paul Brook | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 4af39611 | Paul Brook | * copies of the Software, and to permit persons to whom the Software is
|
11 | 4af39611 | Paul Brook | * furnished to do so, subject to the following conditions:
|
12 | 4af39611 | Paul Brook | *
|
13 | 4af39611 | Paul Brook | * The above copyright notice and this permission notice shall be included in
|
14 | 4af39611 | Paul Brook | * all copies or substantial portions of the Software.
|
15 | 4af39611 | Paul Brook | *
|
16 | 4af39611 | Paul Brook | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 4af39611 | Paul Brook | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 4af39611 | Paul Brook | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 4af39611 | Paul Brook | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 4af39611 | Paul Brook | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 4af39611 | Paul Brook | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 4af39611 | Paul Brook | * THE SOFTWARE.
|
23 | 4af39611 | Paul Brook | */
|
24 | 4af39611 | Paul Brook | |
25 | 4af39611 | Paul Brook | #include "sysbus.h" |
26 | 4af39611 | Paul Brook | #include "qemu-char.h" |
27 | 4af39611 | Paul Brook | #include "syborg.h" |
28 | 4af39611 | Paul Brook | |
29 | 4af39611 | Paul Brook | //#define DEBUG_SYBORG_SERIAL
|
30 | 4af39611 | Paul Brook | |
31 | 4af39611 | Paul Brook | #ifdef DEBUG_SYBORG_SERIAL
|
32 | 4af39611 | Paul Brook | #define DPRINTF(fmt, ...) \
|
33 | 4af39611 | Paul Brook | do { printf("syborg_serial: " fmt , ##args); } while (0) |
34 | 4af39611 | Paul Brook | #define BADF(fmt, ...) \
|
35 | 4af39611 | Paul Brook | do { fprintf(stderr, "syborg_serial: error: " fmt , ## __VA_ARGS__); \ |
36 | 4af39611 | Paul Brook | exit(1);} while (0) |
37 | 4af39611 | Paul Brook | #else
|
38 | 4af39611 | Paul Brook | #define DPRINTF(fmt, ...) do {} while(0) |
39 | 4af39611 | Paul Brook | #define BADF(fmt, ...) \
|
40 | 4af39611 | Paul Brook | do { fprintf(stderr, "syborg_serial: error: " fmt , ## __VA_ARGS__);} while (0) |
41 | 4af39611 | Paul Brook | #endif
|
42 | 4af39611 | Paul Brook | |
43 | 4af39611 | Paul Brook | enum {
|
44 | 4af39611 | Paul Brook | SERIAL_ID = 0,
|
45 | 4af39611 | Paul Brook | SERIAL_DATA = 1,
|
46 | 4af39611 | Paul Brook | SERIAL_FIFO_COUNT = 2,
|
47 | 4af39611 | Paul Brook | SERIAL_INT_ENABLE = 3,
|
48 | 4af39611 | Paul Brook | SERIAL_DMA_TX_ADDR = 4,
|
49 | 4af39611 | Paul Brook | SERIAL_DMA_TX_COUNT = 5, /* triggers dma */ |
50 | 4af39611 | Paul Brook | SERIAL_DMA_RX_ADDR = 6,
|
51 | 4af39611 | Paul Brook | SERIAL_DMA_RX_COUNT = 7, /* triggers dma */ |
52 | 4af39611 | Paul Brook | SERIAL_FIFO_SIZE = 8
|
53 | 4af39611 | Paul Brook | }; |
54 | 4af39611 | Paul Brook | |
55 | 4af39611 | Paul Brook | #define SERIAL_INT_FIFO (1u << 0) |
56 | 4af39611 | Paul Brook | #define SERIAL_INT_DMA_TX (1u << 1) |
57 | 4af39611 | Paul Brook | #define SERIAL_INT_DMA_RX (1u << 2) |
58 | 4af39611 | Paul Brook | |
59 | 4af39611 | Paul Brook | typedef struct { |
60 | 4af39611 | Paul Brook | SysBusDevice busdev; |
61 | a8a00822 | Benoît Canet | MemoryRegion iomem; |
62 | 4af39611 | Paul Brook | uint32_t int_enable; |
63 | ee6847d1 | Gerd Hoffmann | uint32_t fifo_size; |
64 | 4af39611 | Paul Brook | uint32_t *read_fifo; |
65 | 4af39611 | Paul Brook | int read_pos;
|
66 | 4af39611 | Paul Brook | int read_count;
|
67 | 4af39611 | Paul Brook | CharDriverState *chr; |
68 | 4af39611 | Paul Brook | qemu_irq irq; |
69 | 4af39611 | Paul Brook | uint32_t dma_tx_ptr; |
70 | 4af39611 | Paul Brook | uint32_t dma_rx_ptr; |
71 | 4af39611 | Paul Brook | uint32_t dma_rx_size; |
72 | 4af39611 | Paul Brook | } SyborgSerialState; |
73 | 4af39611 | Paul Brook | |
74 | 4af39611 | Paul Brook | static void syborg_serial_update(SyborgSerialState *s) |
75 | 4af39611 | Paul Brook | { |
76 | 4af39611 | Paul Brook | int level;
|
77 | 4af39611 | Paul Brook | level = 0;
|
78 | 4af39611 | Paul Brook | if ((s->int_enable & SERIAL_INT_FIFO) && s->read_count)
|
79 | 4af39611 | Paul Brook | level = 1;
|
80 | 4af39611 | Paul Brook | if (s->int_enable & SERIAL_INT_DMA_TX)
|
81 | 4af39611 | Paul Brook | level = 1;
|
82 | 4af39611 | Paul Brook | if ((s->int_enable & SERIAL_INT_DMA_RX) && s->dma_rx_size == 0) |
83 | 4af39611 | Paul Brook | level = 1;
|
84 | 4af39611 | Paul Brook | |
85 | 4af39611 | Paul Brook | qemu_set_irq(s->irq, level); |
86 | 4af39611 | Paul Brook | } |
87 | 4af39611 | Paul Brook | |
88 | 4af39611 | Paul Brook | static uint32_t fifo_pop(SyborgSerialState *s)
|
89 | 4af39611 | Paul Brook | { |
90 | 4af39611 | Paul Brook | const uint32_t c = s->read_fifo[s->read_pos];
|
91 | 4af39611 | Paul Brook | s->read_count--; |
92 | 4af39611 | Paul Brook | s->read_pos++; |
93 | 4af39611 | Paul Brook | if (s->read_pos == s->fifo_size)
|
94 | 4af39611 | Paul Brook | s->read_pos = 0;
|
95 | 4af39611 | Paul Brook | |
96 | 4af39611 | Paul Brook | DPRINTF("FIFO pop %x (%d)\n", c, s->read_count);
|
97 | 4af39611 | Paul Brook | return c;
|
98 | 4af39611 | Paul Brook | } |
99 | 4af39611 | Paul Brook | |
100 | 4af39611 | Paul Brook | static void fifo_push(SyborgSerialState *s, uint32_t new_value) |
101 | 4af39611 | Paul Brook | { |
102 | 4af39611 | Paul Brook | int slot;
|
103 | 4af39611 | Paul Brook | |
104 | 4af39611 | Paul Brook | DPRINTF("FIFO push %x (%d)\n", new_value, s->read_count);
|
105 | 4af39611 | Paul Brook | slot = s->read_pos + s->read_count; |
106 | 4af39611 | Paul Brook | if (slot >= s->fifo_size)
|
107 | 4af39611 | Paul Brook | slot -= s->fifo_size; |
108 | 4af39611 | Paul Brook | s->read_fifo[slot] = new_value; |
109 | 4af39611 | Paul Brook | s->read_count++; |
110 | 4af39611 | Paul Brook | } |
111 | 4af39611 | Paul Brook | |
112 | 4af39611 | Paul Brook | static void do_dma_tx(SyborgSerialState *s, uint32_t count) |
113 | 4af39611 | Paul Brook | { |
114 | 4af39611 | Paul Brook | unsigned char ch; |
115 | 4af39611 | Paul Brook | |
116 | 4af39611 | Paul Brook | if (count == 0) |
117 | 4af39611 | Paul Brook | return;
|
118 | 4af39611 | Paul Brook | |
119 | 4af39611 | Paul Brook | if (s->chr != NULL) { |
120 | 4af39611 | Paul Brook | /* optimize later. Now, 1 byte per iteration */
|
121 | 4af39611 | Paul Brook | while (count--) {
|
122 | 4af39611 | Paul Brook | cpu_physical_memory_read(s->dma_tx_ptr, &ch, 1);
|
123 | 2cc6e0a1 | Anthony Liguori | qemu_chr_fe_write(s->chr, &ch, 1);
|
124 | 4af39611 | Paul Brook | s->dma_tx_ptr++; |
125 | 4af39611 | Paul Brook | } |
126 | 4af39611 | Paul Brook | } else {
|
127 | 4af39611 | Paul Brook | s->dma_tx_ptr += count; |
128 | 4af39611 | Paul Brook | } |
129 | 4af39611 | Paul Brook | /* QEMU char backends do not have a nonblocking mode, so we transmit all
|
130 | 4b71051e | Stefan Weil | the data immediately and the interrupt status will be unchanged. */
|
131 | 4af39611 | Paul Brook | } |
132 | 4af39611 | Paul Brook | |
133 | 4af39611 | Paul Brook | /* Initiate RX DMA, and transfer data from the FIFO. */
|
134 | 4af39611 | Paul Brook | static void dma_rx_start(SyborgSerialState *s, uint32_t len) |
135 | 4af39611 | Paul Brook | { |
136 | 4af39611 | Paul Brook | uint32_t dest; |
137 | 4af39611 | Paul Brook | unsigned char ch; |
138 | 4af39611 | Paul Brook | |
139 | 4af39611 | Paul Brook | dest = s->dma_rx_ptr; |
140 | 4af39611 | Paul Brook | if (s->read_count < len) {
|
141 | 4af39611 | Paul Brook | s->dma_rx_size = len - s->read_count; |
142 | 4af39611 | Paul Brook | len = s->read_count; |
143 | 4af39611 | Paul Brook | } else {
|
144 | 4af39611 | Paul Brook | s->dma_rx_size = 0;
|
145 | 4af39611 | Paul Brook | } |
146 | 4af39611 | Paul Brook | |
147 | 4af39611 | Paul Brook | while (len--) {
|
148 | 4af39611 | Paul Brook | ch = fifo_pop(s); |
149 | 4af39611 | Paul Brook | cpu_physical_memory_write(dest, &ch, 1);
|
150 | 4af39611 | Paul Brook | dest++; |
151 | 4af39611 | Paul Brook | } |
152 | 4af39611 | Paul Brook | s->dma_rx_ptr = dest; |
153 | 4af39611 | Paul Brook | syborg_serial_update(s); |
154 | 4af39611 | Paul Brook | } |
155 | 4af39611 | Paul Brook | |
156 | a8a00822 | Benoît Canet | static uint64_t syborg_serial_read(void *opaque, target_phys_addr_t offset, |
157 | a8a00822 | Benoît Canet | unsigned size)
|
158 | 4af39611 | Paul Brook | { |
159 | 4af39611 | Paul Brook | SyborgSerialState *s = (SyborgSerialState *)opaque; |
160 | 4af39611 | Paul Brook | uint32_t c; |
161 | 4af39611 | Paul Brook | |
162 | 4af39611 | Paul Brook | offset &= 0xfff;
|
163 | 4af39611 | Paul Brook | DPRINTF("read 0x%x\n", (int)offset); |
164 | 4af39611 | Paul Brook | switch(offset >> 2) { |
165 | 4af39611 | Paul Brook | case SERIAL_ID:
|
166 | 4af39611 | Paul Brook | return SYBORG_ID_SERIAL;
|
167 | 4af39611 | Paul Brook | case SERIAL_DATA:
|
168 | 4af39611 | Paul Brook | if (s->read_count > 0) |
169 | 4af39611 | Paul Brook | c = fifo_pop(s); |
170 | 4af39611 | Paul Brook | else
|
171 | 4af39611 | Paul Brook | c = -1;
|
172 | 4af39611 | Paul Brook | syborg_serial_update(s); |
173 | 4af39611 | Paul Brook | return c;
|
174 | 4af39611 | Paul Brook | case SERIAL_FIFO_COUNT:
|
175 | 4af39611 | Paul Brook | return s->read_count;
|
176 | 4af39611 | Paul Brook | case SERIAL_INT_ENABLE:
|
177 | 4af39611 | Paul Brook | return s->int_enable;
|
178 | 4af39611 | Paul Brook | case SERIAL_DMA_TX_ADDR:
|
179 | 4af39611 | Paul Brook | return s->dma_tx_ptr;
|
180 | 4af39611 | Paul Brook | case SERIAL_DMA_TX_COUNT:
|
181 | 4af39611 | Paul Brook | return 0; |
182 | 4af39611 | Paul Brook | case SERIAL_DMA_RX_ADDR:
|
183 | 4af39611 | Paul Brook | return s->dma_rx_ptr;
|
184 | 4af39611 | Paul Brook | case SERIAL_DMA_RX_COUNT:
|
185 | 4af39611 | Paul Brook | return s->dma_rx_size;
|
186 | 4af39611 | Paul Brook | case SERIAL_FIFO_SIZE:
|
187 | 4af39611 | Paul Brook | return s->fifo_size;
|
188 | 4af39611 | Paul Brook | |
189 | 4af39611 | Paul Brook | default:
|
190 | 4af39611 | Paul Brook | cpu_abort(cpu_single_env, "syborg_serial_read: Bad offset %x\n",
|
191 | 4af39611 | Paul Brook | (int)offset);
|
192 | 4af39611 | Paul Brook | return 0; |
193 | 4af39611 | Paul Brook | } |
194 | 4af39611 | Paul Brook | } |
195 | 4af39611 | Paul Brook | |
196 | c227f099 | Anthony Liguori | static void syborg_serial_write(void *opaque, target_phys_addr_t offset, |
197 | a8a00822 | Benoît Canet | uint64_t value, unsigned size)
|
198 | 4af39611 | Paul Brook | { |
199 | 4af39611 | Paul Brook | SyborgSerialState *s = (SyborgSerialState *)opaque; |
200 | 4af39611 | Paul Brook | unsigned char ch; |
201 | 4af39611 | Paul Brook | |
202 | 4af39611 | Paul Brook | offset &= 0xfff;
|
203 | 4af39611 | Paul Brook | DPRINTF("Write 0x%x=0x%x\n", (int)offset, value); |
204 | 4af39611 | Paul Brook | switch (offset >> 2) { |
205 | 4af39611 | Paul Brook | case SERIAL_DATA:
|
206 | 4af39611 | Paul Brook | ch = value; |
207 | 4af39611 | Paul Brook | if (s->chr)
|
208 | 2cc6e0a1 | Anthony Liguori | qemu_chr_fe_write(s->chr, &ch, 1);
|
209 | 4af39611 | Paul Brook | break;
|
210 | 4af39611 | Paul Brook | case SERIAL_INT_ENABLE:
|
211 | 4af39611 | Paul Brook | s->int_enable = value; |
212 | 4af39611 | Paul Brook | syborg_serial_update(s); |
213 | 4af39611 | Paul Brook | break;
|
214 | 4af39611 | Paul Brook | case SERIAL_DMA_TX_ADDR:
|
215 | 4af39611 | Paul Brook | s->dma_tx_ptr = value; |
216 | 4af39611 | Paul Brook | break;
|
217 | 4af39611 | Paul Brook | case SERIAL_DMA_TX_COUNT:
|
218 | 4af39611 | Paul Brook | do_dma_tx(s, value); |
219 | 4af39611 | Paul Brook | break;
|
220 | 4af39611 | Paul Brook | case SERIAL_DMA_RX_ADDR:
|
221 | 4af39611 | Paul Brook | /* For safety, writes to this register cancel any pending DMA. */
|
222 | 4af39611 | Paul Brook | s->dma_rx_size = 0;
|
223 | 4af39611 | Paul Brook | s->dma_rx_ptr = value; |
224 | 4af39611 | Paul Brook | break;
|
225 | 4af39611 | Paul Brook | case SERIAL_DMA_RX_COUNT:
|
226 | 4af39611 | Paul Brook | dma_rx_start(s, value); |
227 | 4af39611 | Paul Brook | break;
|
228 | 4af39611 | Paul Brook | default:
|
229 | 4af39611 | Paul Brook | cpu_abort(cpu_single_env, "syborg_serial_write: Bad offset %x\n",
|
230 | 4af39611 | Paul Brook | (int)offset);
|
231 | 4af39611 | Paul Brook | break;
|
232 | 4af39611 | Paul Brook | } |
233 | 4af39611 | Paul Brook | } |
234 | 4af39611 | Paul Brook | |
235 | 4af39611 | Paul Brook | static int syborg_serial_can_receive(void *opaque) |
236 | 4af39611 | Paul Brook | { |
237 | 4af39611 | Paul Brook | SyborgSerialState *s = (SyborgSerialState *)opaque; |
238 | 4af39611 | Paul Brook | |
239 | 4af39611 | Paul Brook | if (s->dma_rx_size)
|
240 | 4af39611 | Paul Brook | return s->dma_rx_size;
|
241 | 4af39611 | Paul Brook | return s->fifo_size - s->read_count;
|
242 | 4af39611 | Paul Brook | } |
243 | 4af39611 | Paul Brook | |
244 | 4af39611 | Paul Brook | static void syborg_serial_receive(void *opaque, const uint8_t *buf, int size) |
245 | 4af39611 | Paul Brook | { |
246 | 4af39611 | Paul Brook | SyborgSerialState *s = (SyborgSerialState *)opaque; |
247 | 4af39611 | Paul Brook | |
248 | 4af39611 | Paul Brook | if (s->dma_rx_size) {
|
249 | 4af39611 | Paul Brook | /* Place it in the DMA buffer. */
|
250 | 4af39611 | Paul Brook | cpu_physical_memory_write(s->dma_rx_ptr, buf, size); |
251 | 4af39611 | Paul Brook | s->dma_rx_size -= size; |
252 | 4af39611 | Paul Brook | s->dma_rx_ptr += size; |
253 | 4af39611 | Paul Brook | } else {
|
254 | 4af39611 | Paul Brook | while (size--)
|
255 | 4af39611 | Paul Brook | fifo_push(s, *buf); |
256 | 4af39611 | Paul Brook | } |
257 | 4af39611 | Paul Brook | |
258 | 4af39611 | Paul Brook | syborg_serial_update(s); |
259 | 4af39611 | Paul Brook | } |
260 | 4af39611 | Paul Brook | |
261 | 4af39611 | Paul Brook | static void syborg_serial_event(void *opaque, int event) |
262 | 4af39611 | Paul Brook | { |
263 | 4af39611 | Paul Brook | /* TODO: Report BREAK events? */
|
264 | 4af39611 | Paul Brook | } |
265 | 4af39611 | Paul Brook | |
266 | a8a00822 | Benoît Canet | static const MemoryRegionOps syborg_serial_ops = { |
267 | a8a00822 | Benoît Canet | .read = syborg_serial_read, |
268 | a8a00822 | Benoît Canet | .write = syborg_serial_write, |
269 | a8a00822 | Benoît Canet | .endianness = DEVICE_NATIVE_ENDIAN, |
270 | 4af39611 | Paul Brook | }; |
271 | 4af39611 | Paul Brook | |
272 | 8dc59070 | Juan Quintela | static const VMStateDescription vmstate_syborg_serial = { |
273 | 8dc59070 | Juan Quintela | .name = "syborg_serial",
|
274 | 8dc59070 | Juan Quintela | .version_id = 1,
|
275 | 8dc59070 | Juan Quintela | .minimum_version_id = 1,
|
276 | 8dc59070 | Juan Quintela | .minimum_version_id_old = 1,
|
277 | 8dc59070 | Juan Quintela | .fields = (VMStateField[]) { |
278 | 8dc59070 | Juan Quintela | VMSTATE_UINT32_EQUAL(fifo_size, SyborgSerialState), |
279 | 8dc59070 | Juan Quintela | VMSTATE_UINT32(int_enable, SyborgSerialState), |
280 | 8dc59070 | Juan Quintela | VMSTATE_INT32(read_pos, SyborgSerialState), |
281 | 8dc59070 | Juan Quintela | VMSTATE_INT32(read_count, SyborgSerialState), |
282 | 8dc59070 | Juan Quintela | VMSTATE_UINT32(dma_tx_ptr, SyborgSerialState), |
283 | 8dc59070 | Juan Quintela | VMSTATE_UINT32(dma_rx_ptr, SyborgSerialState), |
284 | 8dc59070 | Juan Quintela | VMSTATE_UINT32(dma_rx_size, SyborgSerialState), |
285 | 8dc59070 | Juan Quintela | VMSTATE_VARRAY_UINT32(read_fifo, SyborgSerialState, fifo_size, 1,
|
286 | 8dc59070 | Juan Quintela | vmstate_info_uint32, uint32), |
287 | 8dc59070 | Juan Quintela | VMSTATE_END_OF_LIST() |
288 | 4af39611 | Paul Brook | } |
289 | 8dc59070 | Juan Quintela | }; |
290 | 4af39611 | Paul Brook | |
291 | 81a322d4 | Gerd Hoffmann | static int syborg_serial_init(SysBusDevice *dev) |
292 | 4af39611 | Paul Brook | { |
293 | 4af39611 | Paul Brook | SyborgSerialState *s = FROM_SYSBUS(SyborgSerialState, dev); |
294 | 4af39611 | Paul Brook | |
295 | 4af39611 | Paul Brook | sysbus_init_irq(dev, &s->irq); |
296 | a8a00822 | Benoît Canet | memory_region_init_io(&s->iomem, &syborg_serial_ops, s, |
297 | a8a00822 | Benoît Canet | "serial", 0x1000); |
298 | a8a00822 | Benoît Canet | sysbus_init_mmio_region(dev, &s->iomem); |
299 | 4af39611 | Paul Brook | s->chr = qdev_init_chardev(&dev->qdev); |
300 | 4af39611 | Paul Brook | if (s->chr) {
|
301 | 4af39611 | Paul Brook | qemu_chr_add_handlers(s->chr, syborg_serial_can_receive, |
302 | 4af39611 | Paul Brook | syborg_serial_receive, syborg_serial_event, s); |
303 | 4af39611 | Paul Brook | } |
304 | 4af39611 | Paul Brook | if (s->fifo_size <= 0) { |
305 | 4af39611 | Paul Brook | fprintf(stderr, "syborg_serial: fifo too small\n");
|
306 | 4af39611 | Paul Brook | s->fifo_size = 16;
|
307 | 4af39611 | Paul Brook | } |
308 | 7267c094 | Anthony Liguori | s->read_fifo = g_malloc0(s->fifo_size * sizeof(s->read_fifo[0])); |
309 | 4af39611 | Paul Brook | |
310 | 81a322d4 | Gerd Hoffmann | return 0; |
311 | 4af39611 | Paul Brook | } |
312 | 4af39611 | Paul Brook | |
313 | ee6847d1 | Gerd Hoffmann | static SysBusDeviceInfo syborg_serial_info = {
|
314 | ee6847d1 | Gerd Hoffmann | .init = syborg_serial_init, |
315 | ee6847d1 | Gerd Hoffmann | .qdev.name = "syborg,serial",
|
316 | ee6847d1 | Gerd Hoffmann | .qdev.size = sizeof(SyborgSerialState),
|
317 | 8dc59070 | Juan Quintela | .qdev.vmsd = &vmstate_syborg_serial, |
318 | ee6847d1 | Gerd Hoffmann | .qdev.props = (Property[]) { |
319 | c4470b25 | Gerd Hoffmann | DEFINE_PROP_UINT32("fifo-size", SyborgSerialState, fifo_size, 16), |
320 | c4470b25 | Gerd Hoffmann | DEFINE_PROP_END_OF_LIST(), |
321 | ee6847d1 | Gerd Hoffmann | } |
322 | ee6847d1 | Gerd Hoffmann | }; |
323 | ee6847d1 | Gerd Hoffmann | |
324 | 4af39611 | Paul Brook | static void syborg_serial_register_devices(void) |
325 | 4af39611 | Paul Brook | { |
326 | ee6847d1 | Gerd Hoffmann | sysbus_register_withprop(&syborg_serial_info); |
327 | 4af39611 | Paul Brook | } |
328 | 4af39611 | Paul Brook | |
329 | 4af39611 | Paul Brook | device_init(syborg_serial_register_devices) |