VirtualBox

Changeset 40591 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 23, 2012 12:26:17 PM (13 years ago)
Author:
vboxsync
Message:

Devices/Parallel: DrvHostParallel formatting fixes and some todo's.

Location:
trunk/src/VBox/Devices
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Makefile.kmk

    r40586 r40591  
    637637        Audio/dsoundaudio.c \
    638638        Serial/DrvHostSerial.cpp
    639         ifdef VBOX_WITH_WIN_PARPORT_SUP
    640         VBoxDD_SOURCES.win += Parallel/DrvHostParallel.cpp
    641         endif
     639 ifdef VBOX_WITH_WIN_PARPORT_SUP
     640  VBoxDD_SOURCES.win += Parallel/DrvHostParallel.cpp
     641 endif
    642642
    643643 if defined(VBOX_WITH_NETFLT)
  • trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp

    r40585 r40591  
    7373#include <setupapi.h>
    7474#include <regstr.h>
    75 #include<string.h>
     75#include <string.h>
    7676#include <cfgmgr32.h>
    7777#include <iprt/mem.h>
     
    8080#include "VBoxDD.h"
    8181
     82
    8283/*******************************************************************************
    8384*   Structures and Typedefs                                                    *
     
    9293    PPDMDRVINS                    pDrvIns;
    9394    /** Pointer to the driver instance. */
    94     PPDMDRVINSR3                    pDrvInsR3;
    95     PPDMDRVINSR0                    pDrvInsR0;
     95    PPDMDRVINSR3                  pDrvInsR3;
     96    PPDMDRVINSR0                  pDrvInsR0;
    9697    /** Pointer to the char port interface of the driver/device above us. */
    9798    PPDMIHOSTPARALLELPORT         pDrvHostParallelPort;
     
    101102    PDMIHOSTPARALLELCONNECTOR     IHostParallelConnectorR3;
    102103    /** Ring-3 base interface for the ring-0 context. */
    103     PDMIBASER0                      IBaseR0;
     104    PDMIBASER0                    IBaseR0;
    104105    /** Device Path */
    105106    char                         *pszDevicePath;
     
    114115    /** Current mode the parallel port is in. */
    115116    PDMPARALLELPORTMODE           enmModeCur;
    116 
    117117#ifdef VBOX_WITH_WIN_PARPORT_SUP
    118    
     118    /** Data register. */
    119119    uint32_t                      u32LptAddr;
     120    /** Status register. */
    120121    uint32_t                      u32LptAddrStatus;
     122    /** Control register.  */
    121123    uint32_t                      u32LptAddrControl;
     124    /** Data read buffer. */
    122125    uint8_t                       bReadIn;
     126    /** Control read buffer. */
    123127    uint8_t                       bReadInControl;
     128    /** Status read buffer. */
    124129    uint8_t                       bReadInStatus;
    125     uint8_t                        bParportAvail;
    126     #ifdef IN_RING0
    127        
    128         typedef struct DEVICE_EXTNESION
    129         {
    130             PPARALLEL_PORT_INFORMATION  pParallelInfo;
    131             PPARALLEL_PNP_INFORMATION   pPnpInfo;
    132             UNICODE_STRING              uniName;
    133             PFILE_OBJECT                FileObj;
    134             PDEVICE_OBJECT              pParallelDeviceObject;
    135         }DEVICE_EXTENSION, *PDEVICE_EXTENSION;
    136         PDEVICE_EXTENSION   pDevExtn;   
    137     #endif
     130    /** Whether the parallel port is available or not. */
     131    uint8_t                       bParportAvail;
     132# ifdef IN_RING0
     133    typedef struct DEVICE_EXTENSION
     134    {
     135        PPARALLEL_PORT_INFORMATION  pParallelInfo;
     136        PPARALLEL_PNP_INFORMATION   pPnpInfo;
     137        UNICODE_STRING              uniName;
     138        PFILE_OBJECT                FileObj;
     139        PDEVICE_OBJECT              pParallelDeviceObject;
     140    } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
     141    PDEVICE_EXTENSION             pDevExtn;
     142# endif
    138143#endif
    139 
    140144} DRVHOSTPARALLEL, *PDRVHOSTPARALLEL;
    141145
     
    146150typedef enum DRVHOSTPARALLELR0OP
    147151{
    148     /** Invalid zero value.. */
     152    /** Invalid zero value. */
    149153    DRVHOSTPARALLELR0OP_INVALID = 0,
    150     /** Perform DrvHostparallel R0 initialization stuff */
     154    /** Perform R0 initialization. */
    151155    DRVHOSTPARALLELR0OP_INITR0STUFF,
    152     /** To read a byte from parallel port. */
     156    /** Read data. */
    153157    DRVHOSTPARALLELR0OP_READ,
    154     /**Read status register */
     158    /** Read status register. */
    155159    DRVHOSTPARALLELR0OP_READSTATUS,
    156     /**Read control register */
     160    /** Read control register. */
    157161    DRVHOSTPARALLELR0OP_READCONTROL,
    158     /** To write a byte to parallel port. */
     162    /** Write data. */
    159163    DRVHOSTPARALLELR0OP_WRITE,
    160     /**Write to control register. */
     164    /** Write control register. */
    161165    DRVHOSTPARALLELR0OP_WRITECONTROL,
    162     /**Set Port Direciton */
     166    /** Set port direction. */
    163167    DRVHOSTPARALLELR0OP_SETPORTDIRECTION
    164168} DRVHOSTPARALLELR0OP;
     
    171175/**
    172176 * R0 mode function to write byte value to data port.
    173  * @returns VBox status code..
    174  * @param   pDrvIns    Driver instance,
    175  * @param u64Arg   data to be written to parallel port data
    176  *                 register
     177 * @returns VBox status code.
     178 * @param   pDrvIns    Driver instance.
     179 * @param   u64Arg     Data to be written to data register.
     180 *
    177181 */
    178182PDMBOTHCBDECL(int) drvR0HostParallelReqWrite(PPDMDRVINS pDrvIns, uint64_t u64Arg)
     
    185189
    186190/**
    187  * R0 mode function to write byte value to paralell port control 
    188  * register .
    189  * @returns VBox status code..
    190  * @param   pDrvIns    Driver instance,
    191  * @param u64Arg   data to be written
     191 * R0 mode function to write byte value to paralell port control
     192 * register.
     193 * @returns VBox status code.
     194 * @param   pDrvIns     Driver instance.
     195 * @param   u64Arg      Data to be written to control register.
    192196 */
    193197PDMBOTHCBDECL(int) drvR0HostParallelReqWriteControl(PPDMDRVINS pDrvIns, uint64_t u64Arg)
     
    200204
    201205/**
    202  * R0 mode function to ready byte value from the parallel port 
    203  * data register 
    204  * @returns VBox status code..
    205  * @param   pDrvIns    Driver instance,
    206  * @param u64Arg   0 (not used)
     206 * R0 mode function to ready byte value from the parallel port
     207 * data register
     208 * @returns VBox status code.
     209 * @param   pDrvIns    Driver instance.
     210 * @param   u64Arg     Not used.
    207211 */
    208212PDMBOTHCBDECL(int) drvR0HostParallelReqRead(PPDMDRVINS pDrvIns, uint64_t u64Arg)
     
    217221}
    218222
    219 
    220 /**
    221  * R0 mode function to ready byte value from the parallel port
    222  * control  register
    223  * @returns VBox status code..
    224  * @param   pDrvIns    Driver instance,
    225  * @param u64Arg   0 (not used)
     223/**
     224 * R0 mode function to ready byte value from the parallel port
     225 * control register.
     226 * @returns VBox status code.
     227 * @param   pDrvIns    Driver instance.
     228 * @param   u64Arg     Not used.
    226229 */
    227230PDMBOTHCBDECL(int) drvR0HostParallelReqReadControl(PPDMDRVINS pDrvIns, uint64_t u64Arg)
     
    237240
    238241/**
    239  * R0 mode function to ready byte value from the parallel port 
    240  * status register 
    241  * @returns VBox status code..
    242  * @param   pDrvIns    Driver instance,
    243  * @param u64Arg   0 (not used)
     242 * R0 mode function to ready byte value from the parallel port
     243 * status register.
     244 * @returns VBox status code.
     245 * @param   pDrvIns    Driver instance.
     246 * @param   u64Arg     Not used.
    244247 */
    245248PDMBOTHCBDECL(int) drvR0HostParallelReqReadStatus(PPDMDRVINS pDrvIns, uint64_t u64Arg)
     
    253256    return VINF_SUCCESS;
    254257}
    255 /**
    256  * R0 mode function to set the direction of parallel port -
    257  * operate in bidirectional mode or single direction
    258  * @returns VBox status code..
    259  * @param   pDrvIns    Driver instance,
    260  * @param u64Arg        mode
     258
     259/**
     260 * R0 mode function to set the direction of parallel port -
     261 * operate in bidirectional mode or single direction.
     262 * @returns VBox status code.
     263 * @param   pDrvIns    Driver instance.
     264 * @param   u64Arg     Mode.
    261265 */
    262266PDMBOTHCBDECL(int) drvR0HostParallelReqSetPortDir(PPDMDRVINS pDrvIns, uint64_t u64Arg)
     
    267271    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    268272
    269     if(u64Arg) {
    270            u8TmpData = 0x08; /**setting the control bit*/
    271            u8ReadControlVal = ASMInU8(pThis->u32LptAddrControl);
    272            u8WriteControlVal = u8ReadControlVal | u8TmpData;
    273            ASMOutU8(pThis->u32LptAddrControl, u8WriteControlVal);               
     273    if (u64Arg)
     274    {
     275       u8TmpData = 0x08; /* Set the control bit */
     276       u8ReadControlVal = ASMInU8(pThis->u32LptAddrControl);
     277       u8WriteControlVal = u8ReadControlVal | u8TmpData;
     278       ASMOutU8(pThis->u32LptAddrControl, u8WriteControlVal);
    274279    }
    275280    else
    276281    {
    277         u8TmpData = 0xF7; /** clearing the control register 5th bit*/
     282        u8TmpData = 0xF7; /* Clear the control register 5th bit */
    278283        u8ReadControlVal = ASMInU8(pThis->u32LptAddrControl);
    279284        u8WriteControlVal = u8ReadControlVal & u8TmpData;
     
    281286    }
    282287    return VINF_SUCCESS;
    283 
    284 }
    285 
     288}
    286289
    287290/**
     
    296299            LogFlow(("Read Op\n"));
    297300            return drvR0HostParallelReqRead(pDrvIns, u64Arg);
    298             break;
     301
    299302        case DRVHOSTPARALLELR0OP_READSTATUS:
    300303            LogFlow(("Read Status \n"));
    301304            return drvR0HostParallelReqReadStatus(pDrvIns, u64Arg);
    302             break;
     305
    303306        case DRVHOSTPARALLELR0OP_READCONTROL:
    304307            LogFlow(("Read CTRL\n"));
    305308            return drvR0HostParallelReqReadControl(pDrvIns, u64Arg);
    306             break;
     309
    307310        case DRVHOSTPARALLELR0OP_WRITE:
    308311            LogFlow(("Write Ope\n"));
    309312            return drvR0HostParallelReqWrite(pDrvIns, u64Arg);
    310             break;
     313
    311314        case DRVHOSTPARALLELR0OP_WRITECONTROL:
    312315            LogFlow(("Write CTRL\n"));
    313316            return drvR0HostParallelReqWriteControl(pDrvIns, u64Arg);
    314             break;
     317
    315318        case DRVHOSTPARALLELR0OP_SETPORTDIRECTION:
    316319            LogFlow(("Set Port Direction"));
    317320            return drvR0HostParallelReqSetPortDir(pDrvIns, u64Arg);
    318         default:
    319             return 0;
    320             /** Not Supported. */
     321
     322        default:        /* Not Supported. */
     323            return 0;   /** @todo is this correct for not supported case? */
    321324    }
    322325}
     
    328331/**
    329332 * Find IO port range for the parallel port and return the lower
    330  * address. 
     333 * address.
    331334 * @returns parallel port IO address.
    332335 * @param   DevInst    Device Instance for parallel port.
     
    335338{
    336339    uint8_t  *pBuf  = NULL;
    337     short wHeaderSize;
    338     uint32_t u32Size;
     340    short     wHeaderSize;
     341    uint32_t  u32Size;
    339342    CONFIGRET cmRet;
    340343    LOG_CONF  firstLogConf;
     
    351354            return 0;
    352355    }
    353     cmRet = CM_Get_Next_Res_Des(&nextLogConf, firstLogConf, 2, 0L,0L);
     356    cmRet = CM_Get_Next_Res_Des(&nextLogConf, firstLogConf, 2, 0L, 0L);
    354357    if (cmRet != CR_SUCCESS)
    355358    {
     
    357360        return 0;
    358361    }
    359     while (1)
     362
     363    for (;;)
    360364    {
    361365        u32Size = 0;
     
    366370            break;
    367371        }
    368         pBuf = (uint8_t *)((char*)RTMemAlloc(u32Size+1));
     372        pBuf = (uint8_t *)((char*)RTMemAlloc(u32Size + 1));
    369373        if (!pBuf)
    370374        {
    371375            CM_Free_Res_Des_Handle(nextLogConf);
    372376            break;
    373         };
     377        };  /** @todo Is this semicolon intended? */
    374378        cmRet = CM_Get_Res_Des_Data(nextLogConf, pBuf, u32Size, 0L);
    375379        if (cmRet != CR_SUCCESS)
     
    403407
    404408/**
    405  * Get Parallel port address and update the shared data 
    406  * structure. 
     409 * Get Parallel port address and update the shared data
     410 * structure.
    407411 * @returns VBox status code.
    408412 * @param   pThis    The host parallel port instance data.
     
    416420    int rc = VINF_SUCCESS;
    417421
    418     hDevInfo = SetupDiGetClassDevs(NULL,0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES );
     422    hDevInfo = SetupDiGetClassDevs(NULL, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES);
    419423    if (hDevInfo == INVALID_HANDLE_VALUE)
    420424        return VERR_INVALID_HANDLE;
    421425
    422     // Enumerate through all devices in Set.
     426    /* Enumerate through all devices in Set. */
    423427    DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
    424     for (u32Idx=0;SetupDiEnumDeviceInfo(hDevInfo,u32Idx,&DeviceInfoData);u32Idx++)
     428    for (u32Idx = 0; SetupDiEnumDeviceInfo(hDevInfo, u32Idx, &DeviceInfoData); u32Idx++)
    425429    {
    426430        uint32_t u32DataType;
     
    428432        uint32_t u32BufSize = 0;
    429433
    430         while (!SetupDiGetDeviceRegistryProperty(hDevInfo,&DeviceInfoData, SPDRP_FRIENDLYNAME,(PDWORD)&u32DataType,(uint8_t *)pBuf,
    431                                                  u32BufSize,(PDWORD)&u32BufSize))
     434        while (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, (PDWORD)&u32DataType, (uint8_t *)pBuf,
     435                                                 u32BufSize, (PDWORD)&u32BufSize))
    432436        {
    433437            if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
    434438            {
    435                 if (pBuf) 
     439                if (pBuf)
    436440                     RTMemFree(pBuf);
    437                 /**Max size will never reach more than 2048 bytes */
     441                /* Max size will never be more than 2048 bytes */
    438442                pBuf = (uint8_t *)((char*)RTMemAlloc(u32BufSize * 2));
    439443            }
     
    441445                break;
    442446        }
    443  
    444         if(pBuf)
     447
     448        if (pBuf)
    445449        {
    446450             LogFlow(("Buffer = %s\n", pBuf));
    447              if(strstr((char*)pBuf, "LPT"))
     451             if (strstr((char*)pBuf, "LPT"))        /** @todo Use IPRT equivalent? */
    448452             {
    449453                 LogFlow(("Found parallel port\n"));
    450454                 u32ParportAddr = FindIORangeResource(DeviceInfoData.DevInst);
    451                  if(u32ParportAddr)
    452                  {                                 
    453                      pThis->bParportAvail = true; 
     455                 if (u32ParportAddr)
     456                 {
     457                     pThis->bParportAvail = true;
    454458                     pThis->u32LptAddr = u32ParportAddr;
    455                      pThis->u32LptAddrControl = pThis->u32LptAddr +2;
     459                     pThis->u32LptAddrControl = pThis->u32LptAddr + 2;
    456460                     pThis->u32LptAddrStatus = pThis->u32LptAddr + 1;
    457461                 }
    458                  if(pThis->bParportAvail)
     462                 if (pThis->bParportAvail)
    459463                     break;
    460464             }
    461465        }
    462         if (pBuf) /**cleanup*/
     466        if (pBuf)
    463467            RTMemFree(pBuf);
    464         if(pThis->bParportAvail) {
    465             /**parport address has been found. No Need to iterate
    466              * further. */
     468        if (pThis->bParportAvail)
     469        {
     470            /* Parport address has been found. No Need to iterate further. */
    467471            break;
    468472        }
    469473    }
    470474
    471     if ( GetLastError()!=NO_ERROR &&GetLastError()!=ERROR_NO_MORE_ITEMS )
    472     {
     475    if (GetLastError() != NO_ERROR && GetLastError() != ERROR_NO_MORE_ITEMS)
    473476        rc =  VERR_GENERAL_FAILURE;;
    474     }
    475     SetupDiDestroyDeviceInfoList(hDevInfo);       
     477
     478    SetupDiDestroyDeviceInfoList(hDevInfo);
    476479    return rc;
    477480
     
    491494    int rc = VINF_SUCCESS;
    492495    LogFlow(("%s: mode=%d\n", __FUNCTION__, enmMode));
     496
    493497#ifndef VBOX_WITH_WIN_PARPORT_SUP
    494498    int rcLnx;
     
    569573    }
    570574    if (RT_UNLIKELY(rcLnx < 0))
    571         rc = RTErrConvertFromErrno(errno); 
     575        rc = RTErrConvertFromErrno(errno);
    572576#else /*VBOX_WITH_WIN_PARPORT_SUP*/
    573577    uint64_t u64Data;
    574578    u64Data = (uint8_t) *((uint8_t *)(pvBuf));
    575579    LogFlow(("%s: Calling R0 to write to parallel port. Data is %d\n", __FUNCTION__, u64Data));
    576     if(pThis->bParportAvail)
     580    if (pThis->bParportAvail)
    577581    {
    578582        rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_WRITE, u64Data);
     
    588592 */
    589593static DECLCALLBACK(int) drvHostParallelRead(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t cbRead, PDMPARALLELPORTMODE enmMode)
    590 {   
     594{
    591595    PDRVHOSTPARALLEL    pThis   = RT_FROM_MEMBER(pInterface, DRVHOSTPARALLEL, CTX_SUFF(IHostParallelConnector));
    592596    int rc = VINF_SUCCESS;
    593597
    594     #ifndef VBOX_WITH_WIN_PARPORT_SUP
     598#ifndef VBOX_WITH_WIN_PARPORT_SUP
    595599    int rcLnx = 0;
    596600    LogFlow(("%s: pvBuf=%#p cbRead=%d\n", __FUNCTION__, pvBuf, cbRead));
     
    612616    if (RT_UNLIKELY(rcLnx < 0))
    613617        rc = RTErrConvertFromErrno(errno);
    614     #else /* VBOX_WITH_WIN_PARPORT_SUP */
    615     *((uint8_t*)(pvBuf)) = 0; /** initialize the buffer*/
     618#else /* VBOX_WITH_WIN_PARPORT_SUP */
     619    *((uint8_t*)(pvBuf)) = 0; /* Initialize the buffer. */
    616620    LogFlow(("%s: Calling R0 to Read from PPort\n", __FUNCTION__));
    617     if(pThis->bParportAvail)
     621    if (pThis->bParportAvail)
    618622    {
    619623        int rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_READ, 0);
     
    622626        *((uint8_t*)(pvBuf)) = (uint8_t)pThis->bReadIn;
    623627    }
    624     #endif
     628#endif
    625629    return rc;
    626630}
     
    643647    u64Data = (uint8_t)iMode;
    644648    LogFlow(("%s: Calling R0 to write CTRL . Data is %x\n", __FUNCTION__, u64Data));
    645     if(pThis->bParportAvail)
     649    if (pThis->bParportAvail)
    646650    {
    647651        rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_SETPORTDIRECTION, u64Data);
    648         if (RT_FAILURE(rc)) 
     652        if (RT_FAILURE(rc))
    649653            AssertRC(rc);
    650654    }
     
    671675    u64Data = (uint8_t)fReg;
    672676    LogFlow(("%s: Calling R0 to write CTRL . Data is %x\n", __FUNCTION__, u64Data));
    673     if(pThis->bParportAvail)
     677    if (pThis->bParportAvail)
    674678    {
    675679        rc = PDMDrvHlpCallR0(pThis->CTX_SUFF(pDrvIns), DRVHOSTPARALLELR0OP_WRITECONTROL, u64Data);
    676         if (RT_FAILURE(rc)) 
     680        if (RT_FAILURE(rc))
    677681            AssertRC(rc);
    678682    }
     
    692696    uint8_t fReg = 0;
    693697
    694  #ifndef VBOX_WITH_WIN_PARPORT_SUP
     698#ifndef VBOX_WITH_WIN_PARPORT_SUP
    695699    rcLnx = ioctl(RTFileToNative(pThis->hFileDevice), PPRCONTROL, &fReg);
    696700    if (RT_UNLIKELY(rcLnx < 0))
     
    702706    }
    703707#else /* VBOX_WITH_WIN_PARPORT_SUP */
    704     *pfReg = 0; /** initialize the buffer*/
    705     if(pThis->bParportAvail)
     708    *pfReg = 0; /* Initialize the buffer*/
     709    if (pThis->bParportAvail)
    706710    {
    707711        LogFlow(("%s: Calling R0 to Read Control from PPort\n", __FUNCTION__));
     
    734738    }
    735739#else /* VBOX_WITH_WIN_PARPORT_SUP */
    736     *pfReg = 0; /**intialize the buffer*/
    737     if(pThis->bParportAvail)
     740    *pfReg = 0; /* Intialize the buffer. */
     741    if (pThis->bParportAvail)
    738742    {
    739743        LogFlow(("%s: Calling R0 to Read Status from Pport\n", __FUNCTION__));
     
    753757#ifndef VBOX_WITH_WIN_PARPORT_SUP
    754758    struct pollfd aFDs[2];
     759
    755760    /*
    756761     * We can wait for interrupts using poll on linux hosts.
     
    790795        AssertRC(rc);
    791796    }
    792 #else /* VBOX_WITH_WIN_PARPORT_SUP */
    793797#endif /* VBOX_WITH_WIN_PARPORT_SUP */
    794798
     
    823827    LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
    824828    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     829
    825830#ifndef VBOX_WITH_WIN_PARPORT_SUP
    826    
     831
    827832    int rc;
    828833
     
    844849        pThis->pszDevicePath = NULL;
    845850    }
    846 #else /* VBOX_WITH_WIN_PARPORT_SUP */
    847851#endif /* VBOX_WITH_WIN_PARPORT_SUP */
    848852}
     
    883887    pThis->IHostParallelConnectorR3.pfnReadControl      = drvHostParallelReadControl;
    884888    pThis->IHostParallelConnectorR3.pfnReadStatus       = drvHostParallelReadStatus;
    885    
     889
    886890    /*
    887891     * Validate the config.
     
    909913        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Parallel#%d could not open '%s'"),
    910914                                   pDrvIns->iInstance, pThis->pszDevicePath);
     915
    911916#ifndef VBOX_WITH_WIN_PARPORT_SUP
    912917    /*
     
    955960     * Start waiting for interrupts.
    956961     */
    957      rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pMonitorThread, pThis, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0,
     962    rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pMonitorThread, pThis, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0,
    958963                               RTTHREADTYPE_IO, "ParMon");
    959964    if (RT_FAILURE(rc))
    960965        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostParallel#%d cannot create monitor thread"), pDrvIns->iInstance);
    961    
     966
    962967#else /* VBOX_WITH_WIN_PARPORT_SUP */
    963     /**intialize with parallel port availability = false */
    964968    pThis->bParportAvail = false;
    965     /**initialize parallel port data register address to NULL */
    966     pThis->u32LptAddr =0L;
    967     /**initialize parallel port control register address to NULL */
     969    pThis->u32LptAddr = 0L;
    968970    pThis->u32LptAddrControl = 0L;
    969     /**initialize parallel port Status register address to NULL */
    970971    pThis->u32LptAddrStatus = 0L;
    971972    rc = drvHostParallelGetParportAddr(pThis);
    972973    return rc;
     974    /** @todo code after unconditional return? Either #if 0 it or remove. */
    973975    HANDLE hPort;
    974976    hPort = CreateFile("LPT1", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
    975977                NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    976     if (INVALID_HANDLE_VALUE == hPort) {
     978    if (INVALID_HANDLE_VALUE == hPort)
     979    {
    977980        LogFlow(("Failed to get exclusive access to parallel port\n"));
    978981        return (GetLastError());
    979     } 
     982    }
    980983#endif /* VBOX_WITH_WIN_PARPORT_SUP  */
    981984    return VINF_SUCCESS;
     
    10001003    /* fFlags */
    10011004#if defined(VBOX_WITH_WIN_PARPORT_SUP)
    1002     PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT| PDM_DRVREG_FLAGS_R0,
     1005    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DRVREG_FLAGS_R0,
    10031006#else
    10041007    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
  • trunk/src/VBox/Devices/build/VBoxDD.cpp

    r40585 r40591  
    282282    if (RT_FAILURE(rc))
    283283        return rc;
     284
    284285#if defined(RT_OS_LINUX) || defined(VBOX_WITH_WIN_PARPORT_SUP)
    285286    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
     
    287288        return rc;
    288289#endif
    289 
    290 
    291290
    292291#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette