From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34696 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8cyi-0002Gi-UZ for qemu-devel@nongnu.org; Wed, 20 Oct 2010 14:01:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8cyh-0001IS-3O for qemu-devel@nongnu.org; Wed, 20 Oct 2010 14:01:32 -0400 Received: from hartman.uits.indiana.edu ([129.79.1.194]:45646 helo=internal-relay.indiana.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8cyg-0001HU-VF for qemu-devel@nongnu.org; Wed, 20 Oct 2010 14:01:31 -0400 Received: from mail-relay.iu.edu (candy.uits.indiana.edu [129.79.1.201]) by internal-relay.indiana.edu (8.14.4/8.14.4/IU Messaging Team) with ESMTP id o9KI1RXR015235 for ; Wed, 20 Oct 2010 14:01:27 -0400 Received: from [129.79.35.119] (nibbler.dlib.indiana.edu [129.79.35.119]) (authenticated bits=0) by mail-relay.iu.edu (8.14.4/8.14.4/IU Messaging Team Submission) with ESMTP id o9KI1RGZ003795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 20 Oct 2010 14:01:27 -0400 From: Brian Wheeler Content-Type: text/plain; charset="UTF-8" Date: Wed, 20 Oct 2010 14:01:27 -0400 Message-ID: <1287597687.2393.63.camel@nibbler.dlib.indiana.edu> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Can't compile ISA device... List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I'm trying to write a busmouse driver and I can't get it to compile. It seems like there's a header issue of some sort that I can't work out. Of course, if someone has a working busmouse driver for qemu, that would be great: OpenStep won't work with the ps/2 emulation and even after pounding on it for a few days I can't seem to narrow down why it OS stops paying attention to it. The consensus in 2006 was "fix the ps/2 emulation" but apparently nobody has been able to figure out how its broken and this seems like a reasonable solution.=20 My code is based on the pc98 busmouse driver by TAKEDA, toshiya and the busmouse patches that floated around the list over the last few years. Anyway, it seems like a typedef is wrong. Did I miss something obvious? Thanks Brian I'm getting: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D In file included from /home/bdwheele/Projects/qemu/hw/pc.h:7, from /home/bdwheele/Projects/qemu/hw/busmouse.c:30: /home/bdwheele/Projects/qemu/hw/isa.h:33: error: expected =E2=80=98=3D=E2= =80=99, =E2=80=98,=E2=80=99, =E2=80=98;=E2=80=99, =E2=80=98asm=E2=80=99 o= r =E2=80=98__attribute__=E2=80=99 before =E2=80=98isa_mem_base=E2=80=99 /home/bdwheele/Projects/qemu/hw/isa.h:35: error: expected =E2=80=98)=E2=80= =99 before =E2=80=98base=E2=80=99 In file included from /home/bdwheele/Projects/qemu/hw/pc.h:8, from /home/bdwheele/Projects/qemu/hw/busmouse.c:30: /home/bdwheele/Projects/qemu/hw/fdc.h:11: error: expected declaration spe= cifiers or =E2=80=98...=E2=80=99 before =E2=80=98target_phys_addr_t=E2=80= =99 /home/bdwheele/Projects/qemu/hw/fdc.h:12: error: expected declaration spe= cifiers or =E2=80=98...=E2=80=99 before =E2=80=98target_phys_addr_t=E2=80= =99 In file included from /home/bdwheele/Projects/qemu/hw/busmouse.c:30: /home/bdwheele/Projects/qemu/hw/pc.h:15: error: expected =E2=80=98)=E2=80= =99 before =E2=80=98base=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:26: error: expected =E2=80=98)=E2=80= =99 before =E2=80=98base=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:78: error: expected declaration spec= ifiers or =E2=80=98...=E2=80=99 before =E2=80=98target_phys_addr_t=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:78: error: expected declaration spec= ifiers or =E2=80=98...=E2=80=99 before =E2=80=98ram_addr_t=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:79: error: expected declaration spec= ifiers or =E2=80=98...=E2=80=99 before =E2=80=98target_phys_addr_t=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:91: error: expected =E2=80=98)=E2=80= =99 before =E2=80=98ram_size=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:106: error: expected =E2=80=98)=E2=80= =99 before =E2=80=98ram_size=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:141: error: expected declaration spe= cifiers or =E2=80=98...=E2=80=99 before =E2=80=98ram_addr_t=E2=80=99 /home/bdwheele/Projects/qemu/hw/pc.h:159: error: expected =E2=80=98)=E2=80= =99 before =E2=80=98vram_base=E2=80=99 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I've added it to Makefile.objs: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/Makefile.objs b/Makefile.objs index 816194a..908c21f 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -81,7 +81,7 @@ common-obj-y +=3D bt.o bt-host.o bt-vhci.o bt-l2cap.o b= t-sdp.o bt-hci.o bt-hid.o u common-obj-y +=3D bt-hci-csr.o common-obj-y +=3D buffered_file.o migration.o migration-tcp.o qemu-socke= ts.o common-obj-y +=3D qemu-char.o savevm.o #aio.o -common-obj-y +=3D msmouse.o ps2.o +common-obj-y +=3D msmouse.o ps2.o busmouse.o common-obj-y +=3D qdev.o qdev-properties.o common-obj-y +=3D block-migration.o common-obj-y +=3D pflib.o =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D and here's the source: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include "hw.h" #include "pc.h" #include "isa.h" #include "qdev.h" #include "console.h" struct mouse_t { int button; int dx, dy; uint8_t index; qemu_irq irq; int irq_pending; }; typedef struct mouse_isabus_t { ISADevice busdev; struct mouse_t state; } mouse_isabus_t; typedef struct mouse_t mouse_t; /* mouse */ static void mouse_event_handler(void *opaque, int dx, int dy, int dz, int buttons_state= ) { mouse_t *s =3D opaque; s->button =3D buttons_state; s->dx +=3D dx; s->dy +=3D dy; s->irq_pending =3D 1; } static void busmouse_update_irq(mouse_t *s) { if (s->irq_pending) { qemu_set_irq(s->irq, 1); } else { qemu_set_irq(s->irq, 0); } } /* pio */ static void busmouse_pio_write(void *opaque, uint32_t addr, uint32_t val) { mouse_t *s =3D opaque; switch(addr) { case 0: //data break; case 1: // signature break; case 2: // control s->index =3D val; break; case 3: // config break; } =09 } static uint32_t busmouse_pio_read(void *opaque, uint32_t addr) { mouse_t *s =3D opaque; uint32_t val =3D 0; static int interrupt_val =3D 0x01; s->irq_pending =3D 0; switch(addr) { case 0: // data s->irq_pending =3D 0; val |=3D (s->button & 1)? 0x80 : 0x00; val |=3D (s->button & 2)? 0x40 : 0x00; val |=3D (s->button & 4)? 0x20 : 0x00; val |=3D ((s->index & 0x40? s->dy : s->dx) >> (s->index & 0x20? 4 : 0)) = & 0x0f; busmouse_update_irq(s); break; case 1: // signature val =3D 0xa5;=20 busmouse_update_irq(s); break; case 2: // control val =3D interrupt_val; interrupt_val =3D (interrupt_val << 1) && 0xff; if (interrupt_val =3D=3D 0) interrupt_val =3D 1; break; case 3: // config? break; } return val; } /* interface */ static void busmouse_reset(void *opaque) { mouse_t *s =3D opaque; s->button =3D 0; s->dx =3D s->dy =3D 0; s->index =3D 0xf0; } static int busmouse_pre_load(void *opaque) { busmouse_reset(opaque); return 0; } static const VMStateDescription vmstate_mouse =3D { .name =3D "logitech-busmouse", .version_id =3D 1, .minimum_version_id =3D 1, .minimum_version_id_old =3D 1, .pre_load =3D busmouse_pre_load, .fields =3D (VMStateField []) { VMSTATE_UINT8(index, mouse_t), VMSTATE_END_OF_LIST() } }; static int busmouse_init1(ISADevice *dev) { mouse_isabus_t *isa =3D DO_UPCAST(mouse_isabus_t, busdev, dev); mouse_t *s =3D &isa->state; register_ioport_read(0x23c, 4, 1, busmouse_pio_read, s); register_ioport_write(0x23c, 4, 1, busmouse_pio_write, s); isa_init_irq(&isa->busdev, &s->irq, 3); qemu_add_mouse_event_handler(mouse_event_handler, s, 0, "busmouse"); //vmstate_register(-1, &vmstate_mouse, s); busmouse_reset(s); qemu_register_reset(busmouse_reset, s); return 0; } static ISADeviceInfo busmouse_info =3D { .init =3D busmouse_init1, .qdev.name =3D "busmouse", .qdev.size =3D sizeof(mouse_isabus_t), }; static void busmouse_register_devices(void) { isa_qdev_register(&busmouse_info); } device_init(busmouse_register_devices) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D