DrvHostParallel.cpp revision 571c90a734400801da973f986190fac9fc5efd0d
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VirtualBox Host Parallel Port Driver.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Contributed by: Alexander Eichner
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * available from http://www.virtualbox.org. This file is free software;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * General Public License (GPL) as published by the Free Software
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * additional information or have any questions.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*******************************************************************************
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* Header Files *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync*******************************************************************************/
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*******************************************************************************
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* Structures and Typedefs *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync*******************************************************************************/
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Host parallel port driver instance data.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Pointer to the driver instance structure. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Pointer to the char port interface of the driver/device above us. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Our host device interface. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Our host device port interface. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Device Path */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Device Handle */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Thread waiting for interrupts. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Wakeup pipe read end. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync /** Wakeup pipe write end. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/** Converts a pointer to DRVHOSTPARALLEL::IHostDeviceConnector to a PDRHOSTPARALLEL. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#define PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface) ( (PDRVHOSTPARALLEL)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPARALLEL, IHostParallelConnector)) )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/** Converts a pointer to DRVHOSTPARALLEL::IHostDevicePort to a PDRHOSTPARALLEL. */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#define PDMIHOSTPARALLELPORT_2_DRVHOSTPARALLEL(pInterface) ( (PDRVHOSTPARALLEL)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPARALLEL, IHostParallelPort)) )
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/* -=-=-=-=- IBase -=-=-=-=- */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Queries an interface to the driver.
106ee6c5692ad0546845ce72b29e0fddbed2a455vboxsync * @returns Pointer to interface.
106ee6c5692ad0546845ce72b29e0fddbed2a455vboxsync * @returns NULL if the interface was not supported by the driver.
106ee6c5692ad0546845ce72b29e0fddbed2a455vboxsync * @param pInterface Pointer to this interface structure.
106ee6c5692ad0546845ce72b29e0fddbed2a455vboxsync * @param enmInterface The requested interface identification.
106ee6c5692ad0546845ce72b29e0fddbed2a455vboxsyncstatic DECLCALLBACK(void *) drvHostParallelQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
106ee6c5692ad0546845ce72b29e0fddbed2a455vboxsync PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
106ee6c5692ad0546845ce72b29e0fddbed2a455vboxsync PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
static DECLCALLBACK(int) drvHostParallelWrite(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf, size_t *cbWrite)
return VINF_SUCCESS;
static DECLCALLBACK(int) drvHostParallelRead(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t *cbRead)
return VINF_SUCCESS;
static DECLCALLBACK(int) drvHostParallelSetMode(PPDMIHOSTPARALLELCONNECTOR pInterface, PDMPARALLELPORTMODE enmMode)
int ppdev_mode;
switch (enmMode) {
return VINF_SUCCESS;
static DECLCALLBACK(int) drvHostParallelWriteControl(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg)
return VINF_SUCCESS;
static DECLCALLBACK(int) drvHostParallelReadControl(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg)
return VINF_SUCCESS;
static DECLCALLBACK(int) drvHostParallelReadStatus(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg)
return VINF_SUCCESS;
int rc;
if (rc < 0)
char ch;
return VINF_SUCCESS;
return rc;
if (rc < 0)
if (rc < 0)
pThis->pDrvHostParallelPort = (PPDMIHOSTPARALLELPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HOST_PARALLEL_PORT);
return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, RT_SRC_POS, N_("Parallel#%d has no parallel port interface above"),
return rc;
rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->pMonitorThread, pThis, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0,
return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostParallel#%d cannot create monitor thread"), pDrvIns->iInstance);
return VINF_SUCCESS;
sizeof(DRVHOSTPARALLEL),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,