BusMouse.cpp revision aa327535f5ce61d8851bf6495ca1b507f013252b
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/* $Id$ */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/** @file
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * BusMouse - Microsoft Bus (parallel) mouse controller device.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/*
904810c4c6668233349b025cc58013cb7c11c701vboxsync * Copyright (C) 2006-2013 Oracle Corporation
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Permission is hereby granted, free of charge, to any person
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * obtaining a copy of this software and associated documentation
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * files (the "Software"), to deal in the Software without
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * restriction, including without limitation the rights to use,
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * copy, modify, merge, publish, distribute, sublicense, and/or sell
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * copies of the Software, and to permit persons to whom the
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Software is furnished to do so, subject to the following
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * conditions:
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * The above copyright notice and this permission notice shall be
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * included in all copies or substantial portions of the Software.
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync *
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e0778e583cb4a0bdc9bcc48f5957e00a01108388vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync * OTHER DEALINGS IN THE SOFTWARE.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/*******************************************************************************
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync* Header Files *
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync*******************************************************************************/
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync#define LOG_GROUP LOG_GROUP_DEV_KBD
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync#include <VBox/vmm/pdmdev.h>
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync#include <iprt/assert.h>
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync#include <iprt/uuid.h>
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync/** @page pg_busmouse DevBusMouse - Microsoft Bus Mouse Emulation
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync *
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * The Microsoft Bus Mouse was an early mouse sold by Microsoft, originally
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * introduced in 1983. The mouse had a D-shaped 9-pin connector which plugged
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * into a small ISA add-in board.
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync *
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * The mouse itself was very simple (compared to a serial mouse) and most of the
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * logic was located on the ISA board. Later, Microsoft sold an InPort mouse,
b0ad0bbadf3a5b5258acda1bfe16f0ad8bee5ff0vboxsync * which was also called a "bus mouse", but used a different interface.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Microsoft part numbers for the Bus Mouse were 037-099 (100 ppi)
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync * and 037-199 (200 ppi).
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * The Bus Mouse adapter included IRQ configuration jumpers (ref. MS article
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Q12230). The IRQ could be set to one of 2, 3, 4, 5. The typical setting
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * would be IRQ 2 for a PC/XT and IRQ 5 for an AT compatible. Because IRQ 5
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * may conflict with a SoundBlaster or a PCI device, this device defaults to
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * IRQ 3. Note that IRQ 3 is also used by the COM 2 device, not often needed.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * The ISA adapter was built around an Intel 8255A compatible chip (ref.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * MS article Q46369). Once enabled, the adapter raises the configured IRQ
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * 30 times per second; the rate is not configurable. The interrupts
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * occur regardless of whether the mouse state has changed or not.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * To function properly, the 8255A must be programmed as follows:
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * - Port A: Input. Used to read motion deltas and button states.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * - Port B: Output. Not used except for mouse detection.
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync * - Port C: Split. Upper bits set as output, used for control purposes.
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync * Lower bits set as input, reflecting IRQ state.
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync *
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync * Detailed information was gleaned from Windows and OS/2 DDK mouse samples.
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/*******************************************************************************
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync* Defined Constants And Macros *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync*******************************************************************************/
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync/** The original bus mouse controller is fixed at I/O port 0x23C. */
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync#define BMS_IO_BASE 0x23C
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync#define BMS_IO_SIZE 4
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync/** @name Offsets relative to the I/O base.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *@{ */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#define BMS_PORT_DATA 0 /**< 8255 Port A. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#define BMS_PORT_SIG 1 /**< 8255 Port B. */
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync#define BMS_PORT_CTRL 2 /**< 8255 Port C. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#define BMS_PORT_INIT 3 /**< 8255 Control Port. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/** @} */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync/** @name Port C bits (control port).
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @{ */
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync#define BMS_CTL_INT_DIS RT_BIT(4) /**< Disable IRQ (else enabled). */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#define BMS_CTL_SEL_HIGH RT_BIT(5) /**< Select hi nibble (else lo). */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#define BMS_CTL_SEL_Y RT_BIT(6) /**< Select X to read (else Y). */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#define BMS_CTL_HOLD RT_BIT(7) /**< Hold counter (else clear). */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync/** @} */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/** @name Port A bits (data port).
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @{ */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#define BMS_DATA_DELTA 0x0F /**< Motion delta in lower nibble. */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync#define BMS_DATA_B3_UP RT_BIT(5) /**< Button 3 (right) is up. */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync#define BMS_DATA_B2_UP RT_BIT(6) /**< Button 2 (middle) is up. */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync#define BMS_DATA_B1_UP RT_BIT(7) /**< Button 1 (left) is up. */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/** @} */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/** Convert IRQ level (2/3/4/5) to a bit in the control register. */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync#define BMS_IRQ_BIT(a) (1 << (5 - a))
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/** IRQ period, corresponds to approx. 30 Hz. */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync#define BMS_IRQ_PERIOD_MS 34
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/** Default IRQ setting. */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync#define BMS_DEFAULT_IRQ 3
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/** The saved state version. */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync#define BMS_SAVED_STATE_VERSION 1
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/*******************************************************************************
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync* Structures and Typedefs *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync*******************************************************************************/
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/**
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * The device state.
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync */
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsynctypedef struct MouState
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync{
7c1f498692cd2393f8ba68cb62be482495106f93vboxsync /** @name 8255A state
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync * @{ */
7c1f498692cd2393f8ba68cb62be482495106f93vboxsync uint8_t port_a;
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync uint8_t port_b;
4715f6e2473402353acb43c06a8986f957758259vboxsync uint8_t port_c;
4715f6e2473402353acb43c06a8986f957758259vboxsync uint8_t ctrl_port;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync uint8_t cnt_held; /**< Counters held for reading. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync uint8_t held_dx;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync uint8_t held_dy;
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync uint8_t irq; /**< The "jumpered" IRQ level. */
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync int32_t irq_toggle_counter;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /** Mouse timer handle - HC. */
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync PTMTIMERR3 MouseTimer;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync /** Timer period in milliseconds. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync uint32_t cTimerPeriodMs;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /** @} */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync /** @name mouse state
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * @{ */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync int32_t disable_counter;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync uint8_t mouse_enabled;
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync int32_t mouse_dx; /* current values, needed for 'poll' mode */
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync int32_t mouse_dy;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync uint8_t mouse_buttons;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync uint8_t mouse_buttons_reported;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /** @} */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync /** Pointer to the device instance - RC. */
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync PPDMDEVINSRC pDevInsRC;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /** Pointer to the device instance - R3 . */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync PPDMDEVINSR3 pDevInsR3;
7e8d44e04156d78379666f20d5daa2a79e5cbf44vboxsync /** Pointer to the device instance. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync PPDMDEVINSR0 pDevInsR0;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /**
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Mouse port - LUN#0.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * @implements PDMIBASE
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync * @implements PDMIMOUSEPORT
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync struct
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync /** The base interface for the mouse port. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync PDMIBASE IBase;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /** The mouse port base interface. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync PDMIMOUSEPORT IPort;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync /** The base interface of the attached mouse driver. */
505ddd00252720bfb5569fcb17bfda53dc141e3bvboxsync R3PTRTYPE(PPDMIBASE) pDrvBase;
505ddd00252720bfb5569fcb17bfda53dc141e3bvboxsync /** The mouse interface of the attached mouse driver. */
505ddd00252720bfb5569fcb17bfda53dc141e3bvboxsync R3PTRTYPE(PPDMIMOUSECONNECTOR) pDrv;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync } Mouse;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync} MouState;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync#ifndef VBOX_DEVICE_STRUCT_TESTCASE
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
ee1d93e48caef47c819586e7d765befa196be79cvboxsync# ifdef IN_RING3
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync/**
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * Report a change in status down the driver chain.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync *
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * We want to report the mouse as enabled if and only if the guest is "using"
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * it. That way, other devices (e.g. a PS/2 or USB mouse) can receive mouse
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * events when the bus mouse is disabled. Enabling interrupts constitutes
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * enabling the bus mouse. The mouse is considered disabled if interrupts are
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * disabled for several consecutive mouse timer ticks; this is because the
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * interrupt handler in the guest typically temporarily disables interrupts and
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * we do not want to toggle the enabled/disabled state more often than
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync * necessary.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsyncstatic void bms_update_downstream_status(MouState *pThis)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync PPDMIMOUSECONNECTOR pDrv = pThis->Mouse.pDrv;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync bool fEnabled = !!pThis->mouse_enabled;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pDrv->pfnReportModes(pDrv, fEnabled, false, false);
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync}
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync/**
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * Set the emulated hardware to a known initial state.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncstatic void bms_reset(MouState *pThis)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* Clear the device setup. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_a = pThis->port_b = 0;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_c = BMS_CTL_INT_DIS; /* Interrupts disabled. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->ctrl_port = 0x91; /* Default 8255A setup. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync /* Clear motion/button state. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->cnt_held = false;
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync pThis->mouse_dx = pThis->mouse_dy = 0;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->mouse_buttons = 0;
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync pThis->mouse_buttons_reported = 0;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->disable_counter = 0;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->irq_toggle_counter = 1000;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
5453eb2f2719bf3895ac3daeec4c26e0b6e2eb4avboxsync if (pThis->mouse_enabled)
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync {
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync pThis->mouse_enabled = false;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync bms_update_downstream_status(pThis);
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync}
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/* Process a mouse event coming from the host. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncstatic void bms_mouse_event(MouState *pThis, int dx, int dy, int dz, int dw,
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync int buttons_state)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync LogRel3(("%s: dx=%d, dy=%d, dz=%d, dw=%d, buttons_state=0x%x\n",
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync __PRETTY_FUNCTION__, dx, dy, dz, dw, buttons_state));
93c114476cca834cde109c60bfb95094fcd2c995vboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* Only record X/Y movement and buttons. */
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync pThis->mouse_dx += dx;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->mouse_dy += dy;
7c1f498692cd2393f8ba68cb62be482495106f93vboxsync pThis->mouse_buttons = buttons_state;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync}
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsyncstatic DECLCALLBACK(void) bmsTimerCallback(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync{
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync uint8_t irq_bit;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* Toggle the IRQ line if interrupts are enabled. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync irq_bit = BMS_IRQ_BIT(pThis->irq);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (pThis->port_c & irq_bit)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (!(pThis->port_c & BMS_CTL_INT_DIS))
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync PDMDevHlpISASetIrq(pThis->CTX_SUFF(pDevIns), pThis->irq, PDM_IRQ_LEVEL_LOW);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_c &= ~irq_bit;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync else
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_c |= irq_bit;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (!(pThis->port_c & BMS_CTL_INT_DIS))
a85c47589af3385deccdbb1367b75108806d7cf5vboxsync PDMDevHlpISASetIrq(pThis->CTX_SUFF(pDevIns), pThis->irq, PDM_IRQ_LEVEL_HIGH);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* Handle enabling/disabling of the mouse interface. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (pThis->port_c & BMS_CTL_INT_DIS)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (pThis->disable_counter)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync --pThis->disable_counter;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync if (pThis->disable_counter == 0 && pThis->mouse_enabled)
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync {
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync pThis->mouse_enabled = false;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync bms_update_downstream_status(pThis);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync }
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync }
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync else
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync {
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync pThis->disable_counter = 8; /* Re-arm the disable countdown. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync if (!pThis->mouse_enabled)
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync {
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync pThis->mouse_enabled = true;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync bms_update_downstream_status(pThis);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync }
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync }
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync /* Re-arm the timer. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync TMTimerSetMillies(pTimer, pThis->cTimerPeriodMs);
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync}
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync# endif /* IN_RING3 */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsyncstatic void bms_set_reported_buttons(MouState *pThis, unsigned fButtons, unsigned fButtonMask)
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync{
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync pThis->mouse_buttons_reported |= (fButtons & fButtonMask);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->mouse_buttons_reported &= (fButtons | ~fButtonMask);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync}
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/* Update the internal state after a write to port C. */
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsyncstatic void bms_update_ctrl(MouState *pThis)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync int32_t dx, dy;
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync /* If the controller is in hold state, transfer data from counters. */
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync if (pThis->port_c & BMS_CTL_HOLD)
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync {
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync if (!pThis->cnt_held)
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->cnt_held = true;
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync dx = pThis->mouse_dx < 0 ? RT_MAX(pThis->mouse_dx, -128)
229a63857c5fd2e441a62206eacce4156d0b2a26vboxsync : RT_MIN(pThis->mouse_dx, 127);
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync dy = pThis->mouse_dy < 0 ? RT_MAX(pThis->mouse_dy, -128)
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync : RT_MIN(pThis->mouse_dy, 127);
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync pThis->mouse_dx -= dx;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync pThis->mouse_dy -= dy;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync bms_set_reported_buttons(pThis, pThis->mouse_buttons & 0x07, 0x07);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* Force type conversion. */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync pThis->held_dx = dx;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync pThis->held_dy = dy;
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync }
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync else
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->cnt_held = false;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync /* Move the appropriate nibble into port A. */
cc74f15083bf80fbc96723a89faa06c15d0dead8vboxsync if (pThis->cnt_held)
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync if (pThis->port_c & BMS_CTL_SEL_Y)
cc74f15083bf80fbc96723a89faa06c15d0dead8vboxsync {
36a04912b64bea8318327fe0723535f1b3f041b0vboxsync if (pThis->port_c & BMS_CTL_SEL_HIGH)
36a04912b64bea8318327fe0723535f1b3f041b0vboxsync pThis->port_a = pThis->held_dy >> 4;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync else
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync pThis->port_a = pThis->held_dy & 0xF;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync }
3933885bc0c2c93436d858a14564c6179ec72872vboxsync else
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync if (pThis->port_c & BMS_CTL_SEL_HIGH)
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync pThis->port_a = pThis->held_dx >> 4;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync else
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_a = pThis->held_dx & 0xF;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* And update the button bits. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_a |= pThis->mouse_buttons & 1 ? 0 : BMS_DATA_B1_UP;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_a |= pThis->mouse_buttons & 2 ? 0 : BMS_DATA_B3_UP;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_a |= pThis->mouse_buttons & 4 ? 0 : BMS_DATA_B2_UP;
23d9dbdaf1b83107abf9882246a4a46933f733efvboxsync }
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync /* Immediately clear the IRQ if necessary. */
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync if (pThis->port_c & BMS_CTL_INT_DIS)
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync {
80b09746c07120c881b61b18f30c9c4a2a4af9c5vboxsync PDMDevHlpISASetIrq(pThis->CTX_SUFF(pDevIns), pThis->irq, PDM_IRQ_LEVEL_LOW);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->port_c &= ~(BMS_IRQ_BIT(pThis->irq));
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
80b09746c07120c881b61b18f30c9c4a2a4af9c5vboxsync}
d7c2269005543188a6fb12775f6d416431e39ebcvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncstatic int bms_write_port(MouState *pThis, uint32_t offPort, uint32_t uValue)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync int rc = VINF_SUCCESS;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync LogRel3(("%s: write port %d: 0x%02x\n", __PRETTY_FUNCTION__, offPort, uValue));
7708252d252a55417a6a817041e4356797e34255vboxsync
7708252d252a55417a6a817041e4356797e34255vboxsync switch (offPort)
7708252d252a55417a6a817041e4356797e34255vboxsync {
d7c2269005543188a6fb12775f6d416431e39ebcvboxsync case BMS_PORT_SIG:
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync /* Update port B. */
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync pThis->port_b = uValue;
9a32cc64d7694b4b8c46bbf17fdbb5e5f60d2d4avboxsync break;
94c4b844625733fedcd2b473c207981b31316bd9vboxsync case BMS_PORT_DATA:
94c4b844625733fedcd2b473c207981b31316bd9vboxsync /* Do nothing, port A is not writable. */
2c6d6ff2ff146c92be6ec38cb87465c4f867a8fevboxsync break;
2c6d6ff2ff146c92be6ec38cb87465c4f867a8fevboxsync case BMS_PORT_INIT:
2c6d6ff2ff146c92be6ec38cb87465c4f867a8fevboxsync pThis->ctrl_port = uValue;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync break;
2c6d6ff2ff146c92be6ec38cb87465c4f867a8fevboxsync case BMS_PORT_CTRL:
2c6d6ff2ff146c92be6ec38cb87465c4f867a8fevboxsync /* Update the high nibble of port C. */
2c6d6ff2ff146c92be6ec38cb87465c4f867a8fevboxsync pThis->port_c = (uValue & 0xF0) | (pThis->port_c & 0x0F);
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync bms_update_ctrl(pThis);
cccc6ee5f7156cfcdf13acca545cf65124d9ed44vboxsync break;
9a32cc64d7694b4b8c46bbf17fdbb5e5f60d2d4avboxsync default:
904810c4c6668233349b025cc58013cb7c11c701vboxsync AssertMsgFailed(("invalid port %#x\n", offPort));
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync break;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync }
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync return rc;
f271f5e8fefdfe224f8bdeac77fefe6c655ae87evboxsync}
f271f5e8fefdfe224f8bdeac77fefe6c655ae87evboxsync
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsyncstatic uint32_t bms_read_port(MouState *pThis, uint32_t offPort)
776985d1f8ee71ad78aa1067cce88766803c7b30vboxsync{
b7fc0ed6c80bf49e581b983ee0039b67f001d849vboxsync uint32_t uValue;
bd5c7d04b57ea9dfea041aad6a07cd8823b4e7c0vboxsync
bd5c7d04b57ea9dfea041aad6a07cd8823b4e7c0vboxsync switch (offPort)
f271f5e8fefdfe224f8bdeac77fefe6c655ae87evboxsync {
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync case BMS_PORT_DATA:
f271f5e8fefdfe224f8bdeac77fefe6c655ae87evboxsync /* Read port A. */
f271f5e8fefdfe224f8bdeac77fefe6c655ae87evboxsync uValue = pThis->port_a;
f271f5e8fefdfe224f8bdeac77fefe6c655ae87evboxsync break;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync case BMS_PORT_SIG:
f271f5e8fefdfe224f8bdeac77fefe6c655ae87evboxsync /* Read port B. */
b8c2e8ba48bd659fa09a06770a7cedfae977d73bvboxsync uValue = pThis->port_b;
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync break;
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync case BMS_PORT_CTRL:
8ae161fca703d669e1306fafee128914f831f72bvboxsync /* Read port C. */
8ae161fca703d669e1306fafee128914f831f72bvboxsync uValue = pThis->port_c;
8ae161fca703d669e1306fafee128914f831f72bvboxsync /* Some Microsoft driver code reads the control port 10,000 times when
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * determining the IRQ level. This can occur faster than the IRQ line
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * transitions and the detection fails. To work around this, we force
b8c2e8ba48bd659fa09a06770a7cedfae977d73bvboxsync * the IRQ bit to toggle every once in a while.
b8c2e8ba48bd659fa09a06770a7cedfae977d73bvboxsync */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync if (pThis->irq_toggle_counter)
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync pThis->irq_toggle_counter--;
454ac5c6ef4960887035ceea6b5247789d3272davboxsync else
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->irq_toggle_counter = 1000;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync uValue ^= BMS_IRQ_BIT(pThis->irq);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync break;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync case BMS_PORT_INIT:
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* Read the 8255A control port. */
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync uValue = pThis->ctrl_port;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync break;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync default:
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync AssertMsgFailed(("invalid port %#x\n", offPort));
b8c2e8ba48bd659fa09a06770a7cedfae977d73bvboxsync break;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync }
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync LogRel3(("%s: read port %d: 0x%02x\n", __PRETTY_FUNCTION__, offPort, uValue));
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync return uValue;
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync}
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
a2d9f81753c129b5e3bbe3769627dcd25a3724bdvboxsync/**
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * Port I/O Handler for port IN operations.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync *
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * @returns VBox status code.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param pDevIns The device instance.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param pvUser User argument - ignored.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param Port Port number used for the IN operation.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param pu32 Where to store the result.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * @param cb Number of bytes read.
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncPDMBOTHCBDECL(int) mouIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync NOREF(pvUser);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (cb == 1)
a1a2e3f1c3ca7d6190c90ff67b7995b50b258794vboxsync {
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync *pu32 = bms_read_port(pThis, Port & 3);
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync Log2(("mouIOPortRead: Port=%#x cb=%d *pu32=%#x\n", Port, cb, *pu32));
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync return VINF_SUCCESS;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync AssertMsgFailed(("Port=%#x cb=%d\n", Port, cb));
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync return VERR_IOM_IOPORT_UNUSED;
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync}
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync/**
b4bcdbd7ac35c938e6f71a6403fe9f3ebf106a07vboxsync * Port I/O Handler for port OUT operations.
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync *
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync * @returns VBox status code.
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync *
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * @param pDevIns The device instance.
6fe1329154975472e055284198df7fa8e64dee3avboxsync * @param pvUser User argument - ignored.
6fe1329154975472e055284198df7fa8e64dee3avboxsync * @param Port Port number used for the IN operation.
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync * @param u32 The value to output.
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync * @param cb The value size in bytes.
6fe1329154975472e055284198df7fa8e64dee3avboxsync */
36a04912b64bea8318327fe0723535f1b3f041b0vboxsyncPDMBOTHCBDECL(int) mouIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
cc74f15083bf80fbc96723a89faa06c15d0dead8vboxsync{
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync int rc = VINF_SUCCESS;
28ae9ced88db55943497a8bb98682bc2be513476vboxsync NOREF(pvUser);
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync if (cb == 1)
28ae9ced88db55943497a8bb98682bc2be513476vboxsync {
9ce5d949e4f1572d445a5c0aecabe9de8b672c99vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
ab9d561bc33f1705a10c5e4bffed9c9e660dc32fvboxsync rc = bms_write_port(pThis, Port & 3, u32);
ab9d561bc33f1705a10c5e4bffed9c9e660dc32fvboxsync Log2(("mouIOPortWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32));
5af5f66dd66e8ed177bcb8b429a1c2f3093ab406vboxsync }
5af5f66dd66e8ed177bcb8b429a1c2f3093ab406vboxsync else
5af5f66dd66e8ed177bcb8b429a1c2f3093ab406vboxsync AssertMsgFailed(("Port=%#x cb=%d\n", Port, cb));
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync return rc;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync}
94c4b844625733fedcd2b473c207981b31316bd9vboxsync
94c4b844625733fedcd2b473c207981b31316bd9vboxsync# ifdef IN_RING3
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync/**
bc016d9f481b47ade01223d4d589080ad2e2a246vboxsync * Saves the state of the device.
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync *
101e307bb33304d9dda53a7652510880e8228b13vboxsync * @returns VBox status code.
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * @param pDevIns The device instance.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param pSSMHandle The handle to save the state to.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsyncstatic DECLCALLBACK(int) mouSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync{
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* 8255A state. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync SSMR3PutU8(pSSMHandle, pThis->port_a);
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync SSMR3PutU8(pSSMHandle, pThis->port_b);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync SSMR3PutU8(pSSMHandle, pThis->port_c);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync SSMR3PutU8(pSSMHandle, pThis->ctrl_port);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* Other device state. */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync SSMR3PutU8(pSSMHandle, pThis->cnt_held);
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync SSMR3PutU8(pSSMHandle, pThis->held_dx);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync SSMR3PutU8(pSSMHandle, pThis->held_dy);
f906aa7f33207974c4bad1bc441a63b139958499vboxsync SSMR3PutU8(pSSMHandle, pThis->irq);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync SSMR3PutU32(pSSMHandle, pThis->cTimerPeriodMs);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync /* Current mouse state deltas. */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync SSMR3PutS32(pSSMHandle, pThis->mouse_dx);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync SSMR3PutS32(pSSMHandle, pThis->mouse_dy);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync SSMR3PutU8(pSSMHandle, pThis->mouse_buttons_reported);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* Timer. */
a5224d14bb71df1d2da62ff9e4b0598ed5d2d85fvboxsync return TMR3TimerSave(pThis->MouseTimer, pSSMHandle);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync}
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync/**
ac2b2ae448fe887af9a3269e40afff11ebb1f9d3vboxsync * Loads a saved device state.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync *
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync * @returns VBox status code.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * @param pDevIns The device instance.
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * @param pSSMHandle The handle to the saved state.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param uVersion The data unit version number.
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * @param uPass The data pass.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsyncstatic DECLCALLBACK(int) mouLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t uVersion, uint32_t uPass)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
174f11bbd5c277153742aa5e6c3bd640bf379547vboxsync int rc;
1568d715e75b8d2484ea3dc87f0483d4cf377838vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
c0a5da26f7222b0a486d6d9ba4d1f475a78a2c73vboxsync Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync
aed4b2dfb1673c0b476588860c9d27705700ce0dvboxsync if (uVersion > BMS_SAVED_STATE_VERSION)
dc9555b48e3a0576258aa498825c8d10e311cd47vboxsync return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
cf289c84a0ecd24e5808b46b70d545cdc2c8805cvboxsync
80e46f984efd827517661c0e081a36014ca41af8vboxsync /* 8255A state. */
80e46f984efd827517661c0e081a36014ca41af8vboxsync SSMR3GetU8(pSSMHandle, &pThis->port_a);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync SSMR3GetU8(pSSMHandle, &pThis->port_b);
1e9377d042fa2ea3e2cd78805678f23f64db55f6vboxsync SSMR3GetU8(pSSMHandle, &pThis->port_c);
051eba4436f9c682f7873390fb327e8eceb9e0efvboxsync SSMR3GetU8(pSSMHandle, &pThis->ctrl_port);
6febf3149010855617e4a37e2c49f93d68930d44vboxsync /* Other device state. */
63b785c3291332a86a9bc473e68f08121368898bvboxsync SSMR3GetU8(pSSMHandle, &pThis->cnt_held);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync SSMR3GetU8(pSSMHandle, &pThis->held_dx);
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync SSMR3GetU8(pSSMHandle, &pThis->held_dy);
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync SSMR3GetU8(pSSMHandle, &pThis->irq);
174f11bbd5c277153742aa5e6c3bd640bf379547vboxsync SSMR3GetU32(pSSMHandle, &pThis->cTimerPeriodMs);
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync /* Current mouse state deltas. */
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync SSMR3GetS32(pSSMHandle, &pThis->mouse_dx);
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync SSMR3GetS32(pSSMHandle, &pThis->mouse_dy);
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync SSMR3GetU8(pSSMHandle, &pThis->mouse_buttons_reported);
48dafba24ef28f07a241e5857a43b327822574a8vboxsync /* Timer. */
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync rc = TMR3TimerLoad(pThis->MouseTimer, pSSMHandle);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync return rc;
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync}
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync/**
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * Reset notification.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync *
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * @returns VBox status.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * @param pDevIns The device instance data.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncstatic DECLCALLBACK(void) mouReset(PPDMDEVINS pDevIns)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
bf88068260ded16af90b7da4867240fbdd9c8017vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync /* Reinitialize the timer. */
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pThis->cTimerPeriodMs = BMS_IRQ_PERIOD_MS / 2;
63b785c3291332a86a9bc473e68f08121368898bvboxsync TMTimerSetMillies(pThis->MouseTimer, pThis->cTimerPeriodMs);
63b785c3291332a86a9bc473e68f08121368898bvboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync bms_reset(pThis);
94c4b844625733fedcd2b473c207981b31316bd9vboxsync}
94c4b844625733fedcd2b473c207981b31316bd9vboxsync
94c4b844625733fedcd2b473c207981b31316bd9vboxsync
94c4b844625733fedcd2b473c207981b31316bd9vboxsync/* -=-=-=-=-=- Mouse: IBase -=-=-=-=-=- */
e67a57a63d60b971a077d325eb0872a3ccde94a4vboxsync
e67a57a63d60b971a077d325eb0872a3ccde94a4vboxsync/**
94c4b844625733fedcd2b473c207981b31316bd9vboxsync * @interface_method_impl{PDMIBASE,pfnQueryInterface}
94c4b844625733fedcd2b473c207981b31316bd9vboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsyncstatic DECLCALLBACK(void *) mouQueryMouseInterface(PPDMIBASE pInterface, const char *pszIID)
63b785c3291332a86a9bc473e68f08121368898bvboxsync{
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync MouState *pThis = RT_FROM_MEMBER(pInterface, MouState, Mouse.IBase);
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->Mouse.IBase);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUSEPORT, &pThis->Mouse.IPort);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync return NULL;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync}
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/* -=-=-=-=-=- Mouse: IMousePort -=-=-=-=-=- */
d502d47b275da0a8ecb1c2ec00d22ac396a61af4vboxsync
0a8b697b439859902a19c75e4a1d315ab03c57f9vboxsync/**
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * @interface_method_impl{PDMIMOUSEPORT, pfnPutEvent}
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsyncstatic DECLCALLBACK(int) mouPutEvent(PPDMIMOUSEPORT pInterface, int32_t dx,
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync int32_t dy, int32_t dz, int32_t dw,
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync uint32_t fButtons)
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync{
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync MouState *pThis = RT_FROM_MEMBER(pInterface, MouState, Mouse.IPort);
aed4b2dfb1673c0b476588860c9d27705700ce0dvboxsync int rc = PDMCritSectEnter(pThis->CTX_SUFF(pDevIns)->CTX_SUFF(pCritSectRo), VERR_SEM_BUSY);
dc9555b48e3a0576258aa498825c8d10e311cd47vboxsync AssertReleaseRC(rc);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
639f8a89c08cdbefc3d4f8e1762ce9d38440e02bvboxsync bms_mouse_event(pThis, dx, dy, dz, dw, fButtons);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
5434d84d270a73565d8c3bed826cb4f95aba317bvboxsync PDMCritSectLeave(pThis->CTX_SUFF(pDevIns)->CTX_SUFF(pCritSectRo));
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync return VINF_SUCCESS;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync}
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync/**
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync * @interface_method_impl{PDMIMOUSEPORT, pfnPutEventAbs}
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsyncstatic DECLCALLBACK(int) mouPutEventAbs(PPDMIMOUSEPORT pInterface, uint32_t x,
5b298681ed3a24f71adcf7b557d3b0f850967bbfvboxsync uint32_t y, int32_t dz, int32_t dw,
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync uint32_t fButtons)
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync{
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync AssertFailedReturn(VERR_NOT_SUPPORTED);
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync}
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync/**
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * @interface_method_impl{PDMIMOUSEPORT, pfnPutEventMT}
4487ec756a4d0326ace76c20fd8a29d618b19a48vboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsyncstatic DECLCALLBACK(int) mouPutEventMT(PPDMIMOUSEPORT pInterface, uint32_t x,
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync uint32_t y, uint32_t cContact,
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync bool fContact)
4487ec756a4d0326ace76c20fd8a29d618b19a48vboxsync{
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync AssertFailedReturn(VERR_NOT_SUPPORTED);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync}
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync/* -=-=-=-=-=- setup code -=-=-=-=-=- */
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/**
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * Attach command.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * This is called to let the device attach to a driver for a specified LUN
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync * during runtime. This is not called during VM construction, the device
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * constructor have to attach to all the available drivers.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync *
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * This is like plugging in the mouse after turning on the PC.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @returns VBox status code.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * @param pDevIns The device instance.
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * @param iLUN The logical unit which is being detached.
9cc9fd4046b0e8dca741e26455a2a6e79a92ac20vboxsync * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
3933885bc0c2c93436d858a14564c6179ec72872vboxsync * @remark The controller doesn't support this action, this is just
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * implemented to try out the driver<->device structure.
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync */
200cc6562c6e5cec617903ea827cfb22083f5325vboxsyncstatic DECLCALLBACK(int) mouAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
904810c4c6668233349b025cc58013cb7c11c701vboxsync int rc;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync ("Bus mouse device does not support hotplugging\n"),
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync VERR_INVALID_PARAMETER);
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync switch (iLUN)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* LUN #0: mouse */
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync case 0:
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync rc = PDMDevHlpDriverAttach(pDevIns, iLUN, &pThis->Mouse.IBase, &pThis->Mouse.pDrvBase, "Bus Mouse Port");
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (RT_SUCCESS(rc))
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync pThis->Mouse.pDrv = PDMIBASE_QUERY_INTERFACE(pThis->Mouse.pDrvBase, PDMIMOUSECONNECTOR);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (!pThis->Mouse.pDrv)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync AssertLogRelMsgFailed(("LUN #0 doesn't have a mouse interface! rc=%Rrc\n", rc));
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync rc = VERR_PDM_MISSING_INTERFACE;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync }
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync }
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync {
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync Log(("%s/%d: warning: no driver attached to LUN #0!\n", pDevIns->pReg->szName, pDevIns->iInstance));
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync rc = VINF_SUCCESS;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync else
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync AssertLogRelMsgFailed(("Failed to attach LUN #0! rc=%Rrc\n", rc));
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync break;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync default:
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync AssertMsgFailed(("Invalid LUN #%d\n", iLUN));
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync return VERR_PDM_NO_SUCH_LUN;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync }
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync return rc;
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync}
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync/**
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync * Detach notification.
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync *
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * This is called when a driver is detaching itself from a LUN of the device.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * The device should adjust it's state to reflect this.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync *
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync * This is like unplugging the network cable to use it for the laptop or
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * something while the PC is still running.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync *
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * @param pDevIns The device instance.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param iLUN The logical unit which is being detached.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync * @remark The controller doesn't support this action, this is just
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync * implemented to try out the driver<->device structure.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsyncstatic DECLCALLBACK(void) mouDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync{
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync#if 0
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /*
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync * Reset the interfaces and update the controller state.
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
d450629f624308cb06e59a13554c697afea563d8vboxsync switch (iLUN)
d450629f624308cb06e59a13554c697afea563d8vboxsync {
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync /* LUN #0: mouse */
d450629f624308cb06e59a13554c697afea563d8vboxsync case 0:
d450629f624308cb06e59a13554c697afea563d8vboxsync pThis->Mouse.pDrv = NULL;
500b54ffef573903725ee90aa3db3485fc6a5840vboxsync pThis->Mouse.pDrvBase = NULL;
500b54ffef573903725ee90aa3db3485fc6a5840vboxsync break;
500b54ffef573903725ee90aa3db3485fc6a5840vboxsync
c6d49c0483db5a491b9394f017de7760aa5d6ac7vboxsync default:
5f32a23884cca588e95be86778770d60cbc529f7vboxsync AssertMsgFailed(("Invalid LUN #%d\n", iLUN));
c6960665b76a45ed0489be4f3b4685a3170c3f8dvboxsync break;
500b54ffef573903725ee90aa3db3485fc6a5840vboxsync }
f147b9c2c059b1af2d67e6369dcb0c0da36c05ebvboxsync#endif
f147b9c2c059b1af2d67e6369dcb0c0da36c05ebvboxsync}
f147b9c2c059b1af2d67e6369dcb0c0da36c05ebvboxsync
c6960665b76a45ed0489be4f3b4685a3170c3f8dvboxsync
c6960665b76a45ed0489be4f3b4685a3170c3f8dvboxsync/**
d36016c7e22c0a816c7eae1b6d53f46b7d180589vboxsync * @copydoc FNPDMDEVRELOCATE
d36016c7e22c0a816c7eae1b6d53f46b7d180589vboxsync */
94c4b844625733fedcd2b473c207981b31316bd9vboxsyncstatic DECLCALLBACK(void) mouRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
94c4b844625733fedcd2b473c207981b31316bd9vboxsync{
94c4b844625733fedcd2b473c207981b31316bd9vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
94c4b844625733fedcd2b473c207981b31316bd9vboxsync pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync}
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
500b54ffef573903725ee90aa3db3485fc6a5840vboxsync/**
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync * @interface_method_impl{PDMDEVREG,pfnConstruct}
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsyncstatic DECLCALLBACK(int) mouConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync{
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync MouState *pThis = PDMINS_2_DATA(pDevIns, MouState *);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync int rc;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync bool fGCEnabled;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync bool fR0Enabled;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync uint8_t irq_lvl;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync Assert(iInstance == 0);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync /*
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * Validate and read the configuration.
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync if (!CFGMR3AreValuesValid(pCfg, "IRQ\0GCEnabled\0R0Enabled\0"))
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync rc = CFGMR3QueryBoolDef(pCfg, "GCEnabled", &fGCEnabled, true);
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (RT_FAILURE(rc))
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to query \"GCEnabled\" from the config"));
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync rc = CFGMR3QueryBoolDef(pCfg, "R0Enabled", &fR0Enabled, true);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync if (RT_FAILURE(rc))
aeb9498c4d9854ed42b271541d34c7bad97b4c77vboxsync return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to query \"R0Enabled\" from the config"));
71429ad59515f9055f394527e1ae942c98373cddvboxsync rc = CFGMR3QueryU8Def(pCfg, "IRQ", &irq_lvl, BMS_DEFAULT_IRQ);
71429ad59515f9055f394527e1ae942c98373cddvboxsync if (RT_FAILURE(rc))
71429ad59515f9055f394527e1ae942c98373cddvboxsync return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to query \"IRQ\" from the config"));
71429ad59515f9055f394527e1ae942c98373cddvboxsync if ((irq_lvl < 2) || (irq_lvl > 5))
71429ad59515f9055f394527e1ae942c98373cddvboxsync return PDMDEV_SET_ERROR(pDevIns, rc, N_("Invalid \"IRQ\" config setting"));
71429ad59515f9055f394527e1ae942c98373cddvboxsync
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->irq = irq_lvl;
71429ad59515f9055f394527e1ae942c98373cddvboxsync ///@todo: remove after properly enabling RC/GC support
71429ad59515f9055f394527e1ae942c98373cddvboxsync fGCEnabled = fR0Enabled = false;
71429ad59515f9055f394527e1ae942c98373cddvboxsync Log(("busmouse: IRQ=%d fGCEnabled=%RTbool fR0Enabled=%RTbool\n", irq_lvl, fGCEnabled, fR0Enabled));
71429ad59515f9055f394527e1ae942c98373cddvboxsync
71429ad59515f9055f394527e1ae942c98373cddvboxsync /*
71429ad59515f9055f394527e1ae942c98373cddvboxsync * Initialize the interfaces.
71429ad59515f9055f394527e1ae942c98373cddvboxsync */
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->pDevInsR3 = pDevIns;
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->Mouse.IBase.pfnQueryInterface = mouQueryMouseInterface;
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->Mouse.IPort.pfnPutEvent = mouPutEvent;
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->Mouse.IPort.pfnPutEventAbs = mouPutEventAbs;
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis->Mouse.IPort.pfnPutEventMT = mouPutEventMT;
71429ad59515f9055f394527e1ae942c98373cddvboxsync
71429ad59515f9055f394527e1ae942c98373cddvboxsync /*
71429ad59515f9055f394527e1ae942c98373cddvboxsync * Create the interrupt timer.
71429ad59515f9055f394527e1ae942c98373cddvboxsync */
71429ad59515f9055f394527e1ae942c98373cddvboxsync rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, bmsTimerCallback,
71429ad59515f9055f394527e1ae942c98373cddvboxsync pThis, TMTIMER_FLAGS_DEFAULT_CRIT_SECT,
71429ad59515f9055f394527e1ae942c98373cddvboxsync "Bus Mouse Timer", &pThis->MouseTimer);
71429ad59515f9055f394527e1ae942c98373cddvboxsync if (RT_FAILURE(rc))
71429ad59515f9055f394527e1ae942c98373cddvboxsync return rc;
71429ad59515f9055f394527e1ae942c98373cddvboxsync
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync /*
ec9dc23c50665e8603e1be5a9b6b6fd4c4d949d4vboxsync * Register I/O ports, saved state, and mouse event handlers.
ec9dc23c50665e8603e1be5a9b6b6fd4c4d949d4vboxsync */
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync rc = PDMDevHlpIOPortRegister(pDevIns, BMS_IO_BASE, BMS_IO_SIZE, NULL, mouIOPortWrite, mouIOPortRead, NULL, NULL, "Bus Mouse");
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync if (RT_FAILURE(rc))
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync return rc;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (fGCEnabled)
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync {
98fbc4732a9519502e92799ef769789cbdd97dcevboxsync rc = PDMDevHlpIOPortRegisterRC(pDevIns, BMS_IO_BASE, BMS_IO_SIZE, 0, "mouIOPortWrite", "mouIOPortRead", NULL, NULL, "Bus Mouse");
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync if (RT_FAILURE(rc))
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync return rc;
ec9dc23c50665e8603e1be5a9b6b6fd4c4d949d4vboxsync }
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync if (fR0Enabled)
ec9dc23c50665e8603e1be5a9b6b6fd4c4d949d4vboxsync {
ec9dc23c50665e8603e1be5a9b6b6fd4c4d949d4vboxsync rc = PDMDevHlpIOPortRegisterR0(pDevIns, BMS_IO_BASE, BMS_IO_SIZE, 0, "mouIOPortWrite", "mouIOPortRead", NULL, NULL, "Bus Mouse");
d1fcf24d24368926be13484524a9e378070a9157vboxsync if (RT_FAILURE(rc))
d1fcf24d24368926be13484524a9e378070a9157vboxsync return rc;
d1fcf24d24368926be13484524a9e378070a9157vboxsync }
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync rc = PDMDevHlpSSMRegister(pDevIns, BMS_SAVED_STATE_VERSION, sizeof(*pThis), mouSaveExec, mouLoadExec);
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync if (RT_FAILURE(rc))
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync return rc;
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync /*
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync * Attach to the mouse driver.
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync */
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync rc = mouAttach(pDevIns, 0, PDM_TACH_FLAGS_NOT_HOT_PLUG);
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync if (RT_FAILURE(rc))
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync return rc;
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync /*
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync * Initialize the device state.
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync */
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync mouReset(pDevIns);
d1fcf24d24368926be13484524a9e378070a9157vboxsync
eaa687a9ede02b3b161a4595f7e42590a2e1b932vboxsync return VINF_SUCCESS;
eaa687a9ede02b3b161a4595f7e42590a2e1b932vboxsync}
eaa687a9ede02b3b161a4595f7e42590a2e1b932vboxsync
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync/**
4c8907a420ed66a42f729eb08cddf9c1e57f25eavboxsync * The device registration structure.
914fe6f35c397cfd7d97b44a63398c6422579c49vboxsync */
eaa687a9ede02b3b161a4595f7e42590a2e1b932vboxsyncconst PDMDEVREG g_DeviceBusMouse =
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync{
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* u32Version */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync PDM_DEVREG_VERSION,
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* szName */
53c715b46bccd175005ee523f7acc7962cfcdf94vboxsync "busmouse",
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* szRCMod */
53c715b46bccd175005ee523f7acc7962cfcdf94vboxsync "VBoxDDGC.gc",
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* szR0Mod */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync "VBoxDDR0.r0",
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync /* pszDescription */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync "Microsoft Bus Mouse controller. "
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync "LUN #0 is the mouse connector.",
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync /* fFlags */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DEVREG_FLAGS_GUEST_BITS_32_64 | PDM_DEVREG_FLAGS_PAE36
824ae3158a8b8f8233fec3f5a12c81f139933698vboxsync | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* fClass */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync PDM_DEVREG_CLASS_INPUT,
3a8aa22ef125135ef67bfc396771bcee15ef02dfvboxsync /* cMaxInstances */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync 1,
53c715b46bccd175005ee523f7acc7962cfcdf94vboxsync /* cbInstance */
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync sizeof(MouState),
2711c80499bbd95e3da4a6cd2dffd9f81a5dce98vboxsync /* pfnConstruct */
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync mouConstruct,
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync /* pfnDestruct */
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync NULL,
53c715b46bccd175005ee523f7acc7962cfcdf94vboxsync /* pfnRelocate */
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync mouRelocate,
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync /* pfnMemSetup */
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync NULL,
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync /* pfnPowerOn */
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync NULL,
53c715b46bccd175005ee523f7acc7962cfcdf94vboxsync /* pfnReset */
a55af63ead2dcca370bfc0dfe49771d9dcc61b93vboxsync mouReset,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnSuspend */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync NULL,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnResume */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync NULL,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnAttach */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync mouAttach,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnDetach */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync mouDetach,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnQueryInterface. */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync NULL,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnInitComplete */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync NULL,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnPowerOff */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync NULL,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* pfnSoftReset */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync NULL,
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync /* u32VersionEnd */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync PDM_DEVREG_VERSION
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync};
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync# endif /* IN_RING3 */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync
1ce069685b24d243eb0464f46d4c56b250c64445vboxsync