Statistics
| Branch: | Revision:

root / vl.h @ 63066f4f

History | View | Annotate | Download (19.1 kB)

1
/*
2
 * QEMU System Emulator header
3
 * 
4
 * Copyright (c) 2003 Fabrice Bellard
5
 * 
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
 * THE SOFTWARE.
23
 */
24
#ifndef VL_H
25
#define VL_H
26

    
27
/* we put basic includes here to avoid repeating them in device drivers */
28
#include <stdlib.h>
29
#include <stdio.h>
30
#include <stdarg.h>
31
#include <string.h>
32
#include <inttypes.h>
33
#include <time.h>
34
#include <ctype.h>
35
#include <errno.h>
36
#include <unistd.h>
37
#include <fcntl.h>
38
#include <sys/stat.h>
39

    
40
#ifndef O_LARGEFILE
41
#define O_LARGEFILE 0
42
#endif
43
#ifndef O_BINARY
44
#define O_BINARY 0
45
#endif
46

    
47
#ifdef _WIN32
48
#define lseek64 _lseeki64
49
#endif
50

    
51
#include "cpu.h"
52

    
53
#ifndef glue
54
#define xglue(x, y) x ## y
55
#define glue(x, y) xglue(x, y)
56
#define stringify(s)        tostring(s)
57
#define tostring(s)        #s
58
#endif
59

    
60
#if defined(WORDS_BIGENDIAN)
61
static inline uint32_t be32_to_cpu(uint32_t v)
62
{
63
    return v;
64
}
65

    
66
static inline uint16_t be16_to_cpu(uint16_t v)
67
{
68
    return v;
69
}
70

    
71
static inline uint32_t cpu_to_be32(uint32_t v)
72
{
73
    return v;
74
}
75

    
76
static inline uint16_t cpu_to_be16(uint16_t v)
77
{
78
    return v;
79
}
80

    
81
static inline uint32_t le32_to_cpu(uint32_t v)
82
{
83
    return bswap32(v);
84
}
85

    
86
static inline uint16_t le16_to_cpu(uint16_t v)
87
{
88
    return bswap16(v);
89
}
90

    
91
static inline uint32_t cpu_to_le32(uint32_t v)
92
{
93
    return bswap32(v);
94
}
95

    
96
static inline uint16_t cpu_to_le16(uint16_t v)
97
{
98
    return bswap16(v);
99
}
100

    
101
#else
102

    
103
static inline uint32_t be32_to_cpu(uint32_t v)
104
{
105
    return bswap32(v);
106
}
107

    
108
static inline uint16_t be16_to_cpu(uint16_t v)
109
{
110
    return bswap16(v);
111
}
112

    
113
static inline uint32_t cpu_to_be32(uint32_t v)
114
{
115
    return bswap32(v);
116
}
117

    
118
static inline uint16_t cpu_to_be16(uint16_t v)
119
{
120
    return bswap16(v);
121
}
122

    
123
static inline uint32_t le32_to_cpu(uint32_t v)
124
{
125
    return v;
126
}
127

    
128
static inline uint16_t le16_to_cpu(uint16_t v)
129
{
130
    return v;
131
}
132

    
133
static inline uint32_t cpu_to_le32(uint32_t v)
134
{
135
    return v;
136
}
137

    
138
static inline uint16_t cpu_to_le16(uint16_t v)
139
{
140
    return v;
141
}
142
#endif
143

    
144

    
145
/* vl.c */
146
extern int reset_requested;
147

    
148
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
149

    
150
void hw_error(const char *fmt, ...);
151

    
152
int load_image(const char *filename, uint8_t *addr);
153
extern const char *bios_dir;
154

    
155
void pstrcpy(char *buf, int buf_size, const char *str);
156
char *pstrcat(char *buf, int buf_size, const char *s);
157

    
158
int serial_open_device(void);
159

    
160
extern int vm_running;
161

    
162
typedef void VMStopHandler(void *opaque, int reason);
163

    
164
int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque);
165
void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque);
166

    
167
void vm_start(void);
168
void vm_stop(int reason);
169

    
170
extern int audio_enabled;
171
extern int ram_size;
172
extern int bios_size;
173
extern int rtc_utc;
174

    
175
/* XXX: make it dynamic */
176
#if defined (TARGET_PPC)
177
#define BIOS_SIZE (512 * 1024)
178
#else
179
#define BIOS_SIZE 0
180
#endif
181

    
182
/* keyboard/mouse support */
183

    
184
#define MOUSE_EVENT_LBUTTON 0x01
185
#define MOUSE_EVENT_RBUTTON 0x02
186
#define MOUSE_EVENT_MBUTTON 0x04
187

    
188
typedef void QEMUPutKBDEvent(void *opaque, int keycode);
189
typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
190

    
191
void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque);
192
void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque);
193

    
194
void kbd_put_keycode(int keycode);
195
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
196

    
197
/* async I/O support */
198

    
199
typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
200
typedef int IOCanRWHandler(void *opaque);
201

    
202
int qemu_add_fd_read_handler(int fd, IOCanRWHandler *fd_can_read, 
203
                             IOReadHandler *fd_read, void *opaque);
204
void qemu_del_fd_read_handler(int fd);
205

    
206
/* network redirectors support */
207

    
208
#define MAX_NICS 8
209

    
210
typedef struct NetDriverState {
211
    int index; /* index number in QEMU */
212
    uint8_t macaddr[6];
213
    char ifname[16];
214
    void (*send_packet)(struct NetDriverState *nd, 
215
                        const uint8_t *buf, int size);
216
    void (*add_read_packet)(struct NetDriverState *nd, 
217
                            IOCanRWHandler *fd_can_read, 
218
                            IOReadHandler *fd_read, void *opaque);
219
    /* tun specific data */
220
    int fd;
221
    /* slirp specific data */
222
} NetDriverState;
223

    
224
extern int nb_nics;
225
extern NetDriverState nd_table[MAX_NICS];
226

    
227
void qemu_send_packet(NetDriverState *nd, const uint8_t *buf, int size);
228
void qemu_add_read_packet(NetDriverState *nd, IOCanRWHandler *fd_can_read, 
229
                          IOReadHandler *fd_read, void *opaque);
230

    
231
/* timers */
232

    
233
typedef struct QEMUClock QEMUClock;
234
typedef struct QEMUTimer QEMUTimer;
235
typedef void QEMUTimerCB(void *opaque);
236

    
237
/* The real time clock should be used only for stuff which does not
238
   change the virtual machine state, as it is run even if the virtual
239
   machine is stopped. The real time clock has a frequency of 1000
240
   Hz. */
241
extern QEMUClock *rt_clock;
242

    
243
/* Rge virtual clock is only run during the emulation. It is stopped
244
   when the virtual machine is stopped. Virtual timers use a high
245
   precision clock, usually cpu cycles (use ticks_per_sec). */
246
extern QEMUClock *vm_clock;
247

    
248
int64_t qemu_get_clock(QEMUClock *clock);
249

    
250
QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);
251
void qemu_free_timer(QEMUTimer *ts);
252
void qemu_del_timer(QEMUTimer *ts);
253
void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
254
int qemu_timer_pending(QEMUTimer *ts);
255

    
256
extern int64_t ticks_per_sec;
257
extern int pit_min_timer_count;
258

    
259
void cpu_enable_ticks(void);
260
void cpu_disable_ticks(void);
261

    
262
/* VM Load/Save */
263

    
264
typedef FILE QEMUFile;
265

    
266
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
267
void qemu_put_byte(QEMUFile *f, int v);
268
void qemu_put_be16(QEMUFile *f, unsigned int v);
269
void qemu_put_be32(QEMUFile *f, unsigned int v);
270
void qemu_put_be64(QEMUFile *f, uint64_t v);
271
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size);
272
int qemu_get_byte(QEMUFile *f);
273
unsigned int qemu_get_be16(QEMUFile *f);
274
unsigned int qemu_get_be32(QEMUFile *f);
275
uint64_t qemu_get_be64(QEMUFile *f);
276

    
277
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
278
{
279
    qemu_put_be64(f, *pv);
280
}
281

    
282
static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
283
{
284
    qemu_put_be32(f, *pv);
285
}
286

    
287
static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
288
{
289
    qemu_put_be16(f, *pv);
290
}
291

    
292
static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
293
{
294
    qemu_put_byte(f, *pv);
295
}
296

    
297
static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
298
{
299
    *pv = qemu_get_be64(f);
300
}
301

    
302
static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
303
{
304
    *pv = qemu_get_be32(f);
305
}
306

    
307
static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
308
{
309
    *pv = qemu_get_be16(f);
310
}
311

    
312
static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
313
{
314
    *pv = qemu_get_byte(f);
315
}
316

    
317
int64_t qemu_ftell(QEMUFile *f);
318
int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
319

    
320
typedef void SaveStateHandler(QEMUFile *f, void *opaque);
321
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
322

    
323
int qemu_loadvm(const char *filename);
324
int qemu_savevm(const char *filename);
325
int register_savevm(const char *idstr, 
326
                    int instance_id, 
327
                    int version_id,
328
                    SaveStateHandler *save_state,
329
                    LoadStateHandler *load_state,
330
                    void *opaque);
331
void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
332
void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
333

    
334
/* block.c */
335
typedef struct BlockDriverState BlockDriverState;
336

    
337
BlockDriverState *bdrv_new(const char *device_name);
338
void bdrv_delete(BlockDriverState *bs);
339
int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot);
340
void bdrv_close(BlockDriverState *bs);
341
int bdrv_read(BlockDriverState *bs, int64_t sector_num, 
342
              uint8_t *buf, int nb_sectors);
343
int bdrv_write(BlockDriverState *bs, int64_t sector_num, 
344
               const uint8_t *buf, int nb_sectors);
345
void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr);
346
int bdrv_commit(BlockDriverState *bs);
347
void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size);
348

    
349
#define BDRV_TYPE_HD     0
350
#define BDRV_TYPE_CDROM  1
351
#define BDRV_TYPE_FLOPPY 2
352

    
353
void bdrv_set_geometry_hint(BlockDriverState *bs, 
354
                            int cyls, int heads, int secs);
355
void bdrv_set_type_hint(BlockDriverState *bs, int type);
356
void bdrv_get_geometry_hint(BlockDriverState *bs, 
357
                            int *pcyls, int *pheads, int *psecs);
358
int bdrv_get_type_hint(BlockDriverState *bs);
359
int bdrv_is_removable(BlockDriverState *bs);
360
int bdrv_is_read_only(BlockDriverState *bs);
361
int bdrv_is_inserted(BlockDriverState *bs);
362
int bdrv_is_locked(BlockDriverState *bs);
363
void bdrv_set_locked(BlockDriverState *bs, int locked);
364
void bdrv_set_change_cb(BlockDriverState *bs, 
365
                        void (*change_cb)(void *opaque), void *opaque);
366

    
367
void bdrv_info(void);
368
BlockDriverState *bdrv_find(const char *name);
369

    
370
/* ISA bus */
371

    
372
extern target_phys_addr_t isa_mem_base;
373

    
374
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
375
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
376

    
377
int register_ioport_read(int start, int length, int size, 
378
                         IOPortReadFunc *func, void *opaque);
379
int register_ioport_write(int start, int length, int size, 
380
                          IOPortWriteFunc *func, void *opaque);
381
void isa_unassign_ioport(int start, int length);
382

    
383
/* PCI bus */
384

    
385
extern int pci_enabled;
386

    
387
extern target_phys_addr_t pci_mem_base;
388

    
389
typedef struct PCIDevice PCIDevice;
390

    
391
typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, 
392
                                uint32_t address, uint32_t data, int len);
393
typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev, 
394
                                   uint32_t address, int len);
395
typedef void PCIMapIORegionFunc(PCIDevice *pci_dev, int region_num, 
396
                                uint32_t addr, uint32_t size, int type);
397

    
398
#define PCI_ADDRESS_SPACE_MEM                0x00
399
#define PCI_ADDRESS_SPACE_IO                0x01
400
#define PCI_ADDRESS_SPACE_MEM_PREFETCH        0x08
401

    
402
typedef struct PCIIORegion {
403
    uint32_t addr; /* current PCI mapping address. -1 means not mapped */
404
    uint32_t size;
405
    uint8_t type;
406
    PCIMapIORegionFunc *map_func;
407
} PCIIORegion;
408

    
409
#define PCI_ROM_SLOT 6
410
#define PCI_NUM_REGIONS 7
411
struct PCIDevice {
412
    /* PCI config space */
413
    uint8_t config[256];
414

    
415
    /* the following fields are read only */
416
    int bus_num;
417
    int devfn;
418
    char name[64];
419
    PCIIORegion io_regions[PCI_NUM_REGIONS];
420
    
421
    /* do not access the following fields */
422
    PCIConfigReadFunc *config_read;
423
    PCIConfigWriteFunc *config_write;
424
    int irq_index;
425
};
426

    
427
PCIDevice *pci_register_device(const char *name, int instance_size,
428
                               int bus_num, int devfn,
429
                               PCIConfigReadFunc *config_read, 
430
                               PCIConfigWriteFunc *config_write);
431

    
432
void pci_register_io_region(PCIDevice *pci_dev, int region_num, 
433
                            uint32_t size, int type, 
434
                            PCIMapIORegionFunc *map_func);
435

    
436
void pci_set_irq(PCIDevice *pci_dev, int irq_num, int level);
437

    
438
uint32_t pci_default_read_config(PCIDevice *d, 
439
                                 uint32_t address, int len);
440
void pci_default_write_config(PCIDevice *d, 
441
                              uint32_t address, uint32_t val, int len);
442

    
443
extern struct PIIX3State *piix3_state;
444

    
445
void i440fx_init(void);
446
void piix3_init(void);
447
void pci_bios_init(void);
448
void pci_info(void);
449

    
450
/* temporary: will be moved in platform specific file */
451
void pci_prep_init(void);
452
void pci_pmac_init(void);
453
void pci_ppc_bios_init(void);
454

    
455
/* vga.c */
456

    
457
#define VGA_RAM_SIZE (4096 * 1024)
458

    
459
typedef struct DisplayState {
460
    uint8_t *data;
461
    int linesize;
462
    int depth;
463
    void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
464
    void (*dpy_resize)(struct DisplayState *s, int w, int h);
465
    void (*dpy_refresh)(struct DisplayState *s);
466
} DisplayState;
467

    
468
static inline void dpy_update(DisplayState *s, int x, int y, int w, int h)
469
{
470
    s->dpy_update(s, x, y, w, h);
471
}
472

    
473
static inline void dpy_resize(DisplayState *s, int w, int h)
474
{
475
    s->dpy_resize(s, w, h);
476
}
477

    
478
int vga_initialize(DisplayState *ds, uint8_t *vga_ram_base, 
479
                   unsigned long vga_ram_offset, int vga_ram_size, 
480
                   int is_pci);
481
void vga_update_display(void);
482
void vga_screen_dump(const char *filename);
483

    
484
/* sdl.c */
485
void sdl_display_init(DisplayState *ds);
486

    
487
/* ide.c */
488
#define MAX_DISKS 4
489

    
490
extern BlockDriverState *bs_table[MAX_DISKS];
491

    
492
void isa_ide_init(int iobase, int iobase2, int irq,
493
                  BlockDriverState *hd0, BlockDriverState *hd1);
494
void pci_ide_init(BlockDriverState **hd_table);
495
void pci_piix3_ide_init(BlockDriverState **hd_table);
496

    
497
/* oss.c */
498
typedef enum {
499
  AUD_FMT_U8,
500
  AUD_FMT_S8,
501
  AUD_FMT_U16,
502
  AUD_FMT_S16
503
} audfmt_e;
504

    
505
void AUD_open (int rfreq, int rnchannels, audfmt_e rfmt);
506
void AUD_reset (int rfreq, int rnchannels, audfmt_e rfmt);
507
int AUD_write (void *in_buf, int size);
508
void AUD_run (void);
509
void AUD_adjust_estimate (int _leftover);
510
int AUD_get_free (void);
511
int AUD_get_live (void);
512
int AUD_get_buffer_size (void);
513
void AUD_init (void);
514

    
515
/* dma.c */
516
typedef int (*DMA_transfer_handler) (void *opaque, target_ulong addr, int size);
517
int DMA_get_channel_mode (int nchan);
518
void DMA_hold_DREQ (int nchan);
519
void DMA_release_DREQ (int nchan);
520
void DMA_schedule(int nchan);
521
void DMA_run (void);
522
void DMA_init (void);
523
void DMA_register_channel (int nchan,
524
                           DMA_transfer_handler transfer_handler, void *opaque);
525

    
526
/* sb16.c */
527
void SB16_run (void);
528
void SB16_init (void);
529
 
530
/* fdc.c */
531
#define MAX_FD 2
532
extern BlockDriverState *fd_table[MAX_FD];
533

    
534
typedef struct fdctrl_t fdctrl_t;
535

    
536
fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped, 
537
                       uint32_t io_base,
538
                       BlockDriverState **fds);
539
int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num);
540

    
541
/* ne2000.c */
542

    
543
void isa_ne2000_init(int base, int irq, NetDriverState *nd);
544
void pci_ne2000_init(NetDriverState *nd);
545

    
546
/* pckbd.c */
547

    
548
void kbd_init(void);
549

    
550
/* mc146818rtc.c */
551

    
552
typedef struct RTCState RTCState;
553

    
554
RTCState *rtc_init(int base, int irq);
555
void rtc_set_memory(RTCState *s, int addr, int val);
556
void rtc_set_date(RTCState *s, const struct tm *tm);
557

    
558
/* serial.c */
559

    
560
typedef struct SerialState SerialState;
561

    
562
extern SerialState *serial_console;
563

    
564
SerialState *serial_init(int base, int irq, int fd);
565
int serial_can_receive(SerialState *s);
566
void serial_receive_byte(SerialState *s, int ch);
567
void serial_receive_break(SerialState *s);
568

    
569
/* i8259.c */
570

    
571
void pic_set_irq(int irq, int level);
572
void pic_init(void);
573
uint32_t pic_intack_read(CPUState *env);
574
void pic_info(void);
575
void irq_info(void);
576

    
577
/* i8254.c */
578

    
579
#define PIT_FREQ 1193182
580

    
581
typedef struct PITState PITState;
582

    
583
PITState *pit_init(int base, int irq);
584
void pit_set_gate(PITState *pit, int channel, int val);
585
int pit_get_gate(PITState *pit, int channel);
586
int pit_get_out(PITState *pit, int channel, int64_t current_time);
587

    
588
/* pc.c */
589
void pc_init(int ram_size, int vga_ram_size, int boot_device,
590
             DisplayState *ds, const char **fd_filename, int snapshot,
591
             const char *kernel_filename, const char *kernel_cmdline,
592
             const char *initrd_filename);
593

    
594
/* ppc.c */
595
void ppc_init (int ram_size, int vga_ram_size, int boot_device,
596
               DisplayState *ds, const char **fd_filename, int snapshot,
597
               const char *kernel_filename, const char *kernel_cmdline,
598
               const char *initrd_filename);
599
void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
600
                    DisplayState *ds, const char **fd_filename, int snapshot,
601
                    const char *kernel_filename, const char *kernel_cmdline,
602
                    const char *initrd_filename);
603
void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
604
                   DisplayState *ds, const char **fd_filename, int snapshot,
605
                   const char *kernel_filename, const char *kernel_cmdline,
606
                   const char *initrd_filename);
607
#ifdef TARGET_PPC
608
ppc_tb_t *cpu_ppc_tb_init (CPUState *env, uint32_t freq);
609
#endif
610
void PREP_debug_write (void *opaque, uint32_t addr, uint32_t val);
611

    
612
extern CPUWriteMemoryFunc *PPC_io_write[];
613
extern CPUReadMemoryFunc *PPC_io_read[];
614
extern int prep_enabled;
615

    
616
/* NVRAM helpers */
617
#include "hw/m48t59.h"
618

    
619
void NVRAM_set_byte (m48t59_t *nvram, uint32_t addr, uint8_t value);
620
uint8_t NVRAM_get_byte (m48t59_t *nvram, uint32_t addr);
621
void NVRAM_set_word (m48t59_t *nvram, uint32_t addr, uint16_t value);
622
uint16_t NVRAM_get_word (m48t59_t *nvram, uint32_t addr);
623
void NVRAM_set_lword (m48t59_t *nvram, uint32_t addr, uint32_t value);
624
uint32_t NVRAM_get_lword (m48t59_t *nvram, uint32_t addr);
625
void NVRAM_set_string (m48t59_t *nvram, uint32_t addr,
626
                       const unsigned char *str, uint32_t max);
627
int NVRAM_get_string (m48t59_t *nvram, uint8_t *dst, uint16_t addr, int max);
628
void NVRAM_set_crc (m48t59_t *nvram, uint32_t addr,
629
                    uint32_t start, uint32_t count);
630
int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
631
                          const unsigned char *arch,
632
                          uint32_t RAM_size, int boot_device,
633
                          uint32_t kernel_image, uint32_t kernel_size,
634
                          uint32_t cmdline, uint32_t cmdline_size,
635
                          uint32_t initrd_image, uint32_t initrd_size,
636
                          uint32_t NVRAM_image);
637

    
638
/* adb.c */
639

    
640
#define MAX_ADB_DEVICES 16
641

    
642
typedef struct ADBDevice ADBDevice;
643

    
644
typedef void ADBDeviceReceivePacket(ADBDevice *d, const uint8_t *buf, int len);
645

    
646
struct ADBDevice {
647
    struct ADBBusState *bus;
648
    int devaddr;
649
    int handler;
650
    ADBDeviceReceivePacket *receive_packet;
651
    void *opaque;
652
};
653

    
654
typedef struct ADBBusState {
655
    ADBDevice devices[MAX_ADB_DEVICES];
656
    int nb_devices;
657
} ADBBusState;
658

    
659
void adb_receive_packet(ADBBusState *s, const uint8_t *buf, int len);
660
void adb_send_packet(ADBBusState *s, const uint8_t *buf, int len);
661

    
662
ADBDevice *adb_register_device(ADBBusState *s, int devaddr, 
663
                               ADBDeviceReceivePacket *receive_packet, 
664
                               void *opaque);
665
void adb_kbd_init(ADBBusState *bus);
666
void adb_mouse_init(ADBBusState *bus);
667

    
668
/* cuda.c */
669

    
670
extern ADBBusState adb_bus;
671
int cuda_init(void);
672

    
673
/* monitor.c */
674
void monitor_init(void);
675
void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
676
void term_flush(void);
677
void term_print_help(void);
678

    
679
/* gdbstub.c */
680

    
681
#define DEFAULT_GDBSTUB_PORT 1234
682

    
683
int gdbserver_start(int port);
684

    
685
#endif /* VL_H */