VirtualBox

Changeset 11269 in vbox for trunk/src/VBox/Devices/Parallel


Ignore:
Timestamp:
Aug 8, 2008 4:24:48 PM (16 years ago)
Author:
vboxsync
Message:

Devices: pData -> pThis.

Location:
trunk/src/VBox/Devices/Parallel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Parallel/DevParallel.cpp

    r11267 r11269  
    402402static DECLCALLBACK(int) parallelNotifyInterrupt(PPDMIHOSTPARALLELPORT pInterface)
    403403{
    404     ParallelState *pData = PDMIHOSTPARALLELPORT_2_PARALLELSTATE(pInterface);
    405 
    406     PDMCritSectEnter(&pData->CritSect, VINF_SUCCESS);
    407     parallel_set_irq(pData);
    408     PDMCritSectLeave(&pData->CritSect);
     404    ParallelState *pThis = PDMIHOSTPARALLELPORT_2_PARALLELSTATE(pInterface);
     405
     406    PDMCritSectEnter(&pThis->CritSect, VINF_SUCCESS);
     407    parallel_set_irq(pThis);
     408    PDMCritSectLeave(&pThis->CritSect);
    409409
    410410    return VINF_SUCCESS;
     
    426426                                       RTIOPORT Port, uint32_t u32, unsigned cb)
    427427{
    428     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
     428    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
    429429    int          rc = VINF_SUCCESS;
    430430
    431431    if (cb == 1)
    432432    {
    433         rc = PDMCritSectEnter(&pData->CritSect, VINF_IOM_HC_IOPORT_WRITE);
     433        rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_HC_IOPORT_WRITE);
    434434        if (rc == VINF_SUCCESS)
    435435        {
    436436            Log2(("%s: port %#06x val %#04x\n", __FUNCTION__, Port, u32));
    437             rc = parallel_ioport_write (pData, Port, u32);
    438             PDMCritSectLeave(&pData->CritSect);
     437            rc = parallel_ioport_write (pThis, Port, u32);
     438            PDMCritSectLeave(&pThis->CritSect);
    439439        }
    440440    }
     
    459459                                      RTIOPORT Port, uint32_t *pu32, unsigned cb)
    460460{
    461     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
     461    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
    462462    int          rc = VINF_SUCCESS;
    463463
    464464    if (cb == 1)
    465465    {
    466         rc = PDMCritSectEnter(&pData->CritSect, VINF_IOM_HC_IOPORT_READ);
     466        rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_HC_IOPORT_READ);
    467467        if (rc == VINF_SUCCESS)
    468468        {
    469             *pu32 = parallel_ioport_read (pData, Port, &rc);
     469            *pu32 = parallel_ioport_read (pThis, Port, &rc);
    470470            Log2(("%s: port %#06x val %#04x\n", __FUNCTION__, Port, *pu32));
    471             PDMCritSectLeave(&pData->CritSect);
     471            PDMCritSectLeave(&pThis->CritSect);
    472472        }
    473473    }
     
    493493                                          RTIOPORT Port, uint32_t u32, unsigned cb)
    494494{
    495     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
     495    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
    496496    int          rc = VINF_SUCCESS;
    497497
    498498    if (cb == 1)
    499499    {
    500         rc = PDMCritSectEnter(&pData->CritSect, VINF_IOM_HC_IOPORT_WRITE);
     500        rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_HC_IOPORT_WRITE);
    501501        if (rc == VINF_SUCCESS)
    502502        {
    503503            Log2(("%s: ecp port %#06x val %#04x\n", __FUNCTION__, Port, u32));
    504             rc = parallel_ioport_write_ecp (pData, Port, u32);
    505             PDMCritSectLeave(&pData->CritSect);
     504            rc = parallel_ioport_write_ecp (pThis, Port, u32);
     505            PDMCritSectLeave(&pThis->CritSect);
    506506        }
    507507    }
     
    526526                                         RTIOPORT Port, uint32_t *pu32, unsigned cb)
    527527{
    528     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
     528    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
    529529    int          rc = VINF_SUCCESS;
    530530
    531531    if (cb == 1)
    532532    {
    533         rc = PDMCritSectEnter(&pData->CritSect, VINF_IOM_HC_IOPORT_READ);
     533        rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_HC_IOPORT_READ);
    534534        if (rc == VINF_SUCCESS)
    535535        {
    536             *pu32 = parallel_ioport_read_ecp (pData, Port, &rc);
     536            *pu32 = parallel_ioport_read_ecp (pThis, Port, &rc);
    537537            Log2(("%s: ecp port %#06x val %#04x\n", __FUNCTION__, Port, *pu32));
    538             PDMCritSectLeave(&pData->CritSect);
     538            PDMCritSectLeave(&pThis->CritSect);
    539539        }
    540540    }
     
    557557                                          PSSMHANDLE pSSMHandle)
    558558{
    559     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
    560 
    561     SSMR3PutU8(pSSMHandle, pData->reg_data);
    562     SSMR3PutU8(pSSMHandle, pData->reg_status);
    563     SSMR3PutU8(pSSMHandle, pData->reg_control);
    564     SSMR3PutS32(pSSMHandle, pData->irq);
    565     SSMR3PutU32(pSSMHandle, pData->base);
     559    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
     560
     561    SSMR3PutU8(pSSMHandle, pThis->reg_data);
     562    SSMR3PutU8(pSSMHandle, pThis->reg_status);
     563    SSMR3PutU8(pSSMHandle, pThis->reg_control);
     564    SSMR3PutS32(pSSMHandle, pThis->irq);
     565    SSMR3PutU32(pSSMHandle, pThis->base);
    566566
    567567    return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */
     
    582582    int          rc;
    583583    uint32_t     u32;
    584     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
     584    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
    585585
    586586    if (u32Version != PARALLEL_SAVED_STATE_VERSION)
     
    590590    }
    591591
    592     SSMR3GetU8(pSSMHandle, &pData->reg_data);
    593     SSMR3GetU8(pSSMHandle, &pData->reg_status);
    594     SSMR3GetU8(pSSMHandle, &pData->reg_control);
    595     SSMR3GetS32(pSSMHandle, &pData->irq);
    596     SSMR3GetU32(pSSMHandle, &pData->base);
     592    SSMR3GetU8(pSSMHandle, &pThis->reg_data);
     593    SSMR3GetU8(pSSMHandle, &pThis->reg_status);
     594    SSMR3GetU8(pSSMHandle, &pThis->reg_control);
     595    SSMR3GetS32(pSSMHandle, &pThis->irq);
     596    SSMR3GetU32(pSSMHandle, &pThis->base);
    597597
    598598    rc = SSMR3GetU32(pSSMHandle, &u32);
     
    606606    }
    607607
    608     pData->pDevInsHC = pDevIns;
    609     pData->pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns);
     608    pThis->pDevInsHC = pDevIns;
     609    pThis->pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns);
    610610    return VINF_SUCCESS;
    611611}
     
    617617static DECLCALLBACK(void) parallelRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    618618{
    619     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
    620     pData->pDevInsGC     += offDelta;
     619    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
     620    pThis->pDevInsGC     += offDelta;
    621621}
    622622
     
    624624static DECLCALLBACK(void *) parallelQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    625625{
    626     ParallelState *pData = PDMIBASE_2_PARALLELSTATE(pInterface);
     626    ParallelState *pThis = PDMIBASE_2_PARALLELSTATE(pInterface);
    627627    switch (enmInterface)
    628628    {
    629629        case PDMINTERFACE_BASE:
    630             return &pData->IBase;
     630            return &pThis->IBase;
    631631        case PDMINTERFACE_HOST_PARALLEL_PORT:
    632             return &pData->IHostParallelPort;
     632            return &pThis->IHostParallelPort;
    633633        default:
    634634            return NULL;
     
    647647static DECLCALLBACK(int) parallelDestruct(PPDMDEVINS pDevIns)
    648648{
    649     ParallelState *pData = PDMINS_2_DATA(pDevIns, ParallelState *);
    650 
    651     PDMR3CritSectDelete(&pData->CritSect);
    652     RTSemEventDestroy(pData->ReceiveSem);
     649    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
     650
     651    PDMR3CritSectDelete(&pThis->CritSect);
     652    RTSemEventDestroy(pThis->ReceiveSem);
    653653
    654654    return VINF_SUCCESS;
     
    674674{
    675675    int            rc;
    676     ParallelState  *pData = PDMINS_2_DATA(pDevIns, ParallelState*);
     676    ParallelState  *pThis = PDMINS_2_DATA(pDevIns, ParallelState*);
    677677    uint16_t       io_base;
    678678    uint8_t        irq_lvl;
     
    680680    Assert(iInstance < 4);
    681681
    682     pData->pDevInsHC = pDevIns;
    683     pData->pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns);
     682    pThis->pDevInsHC = pDevIns;
     683    pThis->pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns);
    684684
    685685    /*
     
    690690                                N_("Configuration error: Unknown config key"));
    691691
    692     rc = CFGMR3QueryBool(pCfgHandle, "GCEnabled", &pData->fGCEnabled);
     692    rc = CFGMR3QueryBool(pCfgHandle, "GCEnabled", &pThis->fGCEnabled);
    693693    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    694         pData->fGCEnabled = true;
     694        pThis->fGCEnabled = true;
    695695    else if (RT_FAILURE(rc))
    696696        return PDMDEV_SET_ERROR(pDevIns, rc,
    697697                                N_("Configuration error: Failed to get the \"GCEnabled\" value"));
    698698
    699     rc = CFGMR3QueryBool(pCfgHandle, "R0Enabled", &pData->fR0Enabled);
     699    rc = CFGMR3QueryBool(pCfgHandle, "R0Enabled", &pThis->fR0Enabled);
    700700    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    701         pData->fR0Enabled = true;
     701        pThis->fR0Enabled = true;
    702702    else if (RT_FAILURE(rc))
    703703        return PDMDEV_SET_ERROR(pDevIns, rc,
     
    705705
    706706    /* IBase */
    707     pData->IBase.pfnQueryInterface = parallelQueryInterface;
     707    pThis->IBase.pfnQueryInterface = parallelQueryInterface;
    708708
    709709    /* IHostParallelPort */
    710     pData->IHostParallelPort.pfnNotifyInterrupt = parallelNotifyInterrupt;
    711 
    712     rc = RTSemEventCreate(&pData->ReceiveSem);
     710    pThis->IHostParallelPort.pfnNotifyInterrupt = parallelNotifyInterrupt;
     711
     712    rc = RTSemEventCreate(&pThis->ReceiveSem);
    713713    AssertRC(rc);
    714714
     
    719719    char szName[24];
    720720    RTStrPrintf(szName, sizeof(szName), "Parallel#%d", iInstance);
    721     rc = PDMDevHlpCritSectInit(pDevIns, &pData->CritSect, szName);
     721    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSect, szName);
    722722    if (RT_FAILURE(rc))
    723723        return rc;
     
    739739    Log(("parallelConstruct instance %d iobase=%04x irq=%d\n", iInstance, io_base, irq_lvl));
    740740
    741     pData->irq = irq_lvl;
    742     pData->base = io_base;
     741    pThis->irq = irq_lvl;
     742    pThis->base = io_base;
    743743
    744744    /* Init parallel state */
    745     pData->reg_data = 0;
    746     pData->reg_ecp_ecr = LPT_ECP_ECR_CHIPMODE_COMPAT | LPT_ECP_ECR_FIFO_EMPTY;
    747     pData->act_fifo_pos_read = 0;
    748     pData->act_fifo_pos_write = 0;
     745    pThis->reg_data = 0;
     746    pThis->reg_ecp_ecr = LPT_ECP_ECR_CHIPMODE_COMPAT | LPT_ECP_ECR_FIFO_EMPTY;
     747    pThis->act_fifo_pos_read = 0;
     748    pThis->act_fifo_pos_write = 0;
    749749
    750750    rc = PDMDevHlpIOPortRegister(pDevIns, io_base, 8, 0,
     
    763763#endif
    764764
    765     if (pData->fGCEnabled)
     765    if (pThis->fGCEnabled)
    766766    {
    767767        rc = PDMDevHlpIOPortRegisterGC(pDevIns, io_base, 8, 0, "parallelIOPortWrite",
     
    778778    }
    779779
    780     if (pData->fR0Enabled)
     780    if (pThis->fR0Enabled)
    781781    {
    782782        rc = PDMDevHlpIOPortRegisterR0(pDevIns, io_base, 8, 0, "parallelIOPortWrite",
     
    795795    /* Attach the parallel port driver and get the interfaces. For now no run-time
    796796     * changes are supported. */
    797     rc = PDMDevHlpDriverAttach(pDevIns, 0, &pData->IBase, &pData->pDrvBase, "Parallel Host");
     797    rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Parallel Host");
    798798    if (RT_SUCCESS(rc))
    799799    {
    800         pData->pDrvHostParallelConnector = (PDMIHOSTPARALLELCONNECTOR *)pData->pDrvBase->pfnQueryInterface(pData->pDrvBase,
     800        pThis->pDrvHostParallelConnector = (PDMIHOSTPARALLELCONNECTOR *)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase,
    801801                                                                                                           PDMINTERFACE_HOST_PARALLEL_CONNECTOR);
    802         if (!pData->pDrvHostParallelConnector)
     802        if (!pThis->pDrvHostParallelConnector)
    803803        {
    804804            AssertMsgFailed(("Configuration error: instance %d has no host parallel interface!\n", iInstance));
     
    809809    else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    810810    {
    811         pData->pDrvBase = NULL;
    812         pData->pDrvHostParallelConnector = NULL;
     811        pThis->pDrvBase = NULL;
     812        pThis->pDrvHostParallelConnector = NULL;
    813813        LogRel(("Parallel%d: no unit\n", iInstance));
    814814    }
     
    821821
    822822    /* Set compatibility mode */
    823     pData->pDrvHostParallelConnector->pfnSetMode(pData->pDrvHostParallelConnector, PDM_PARALLEL_PORT_MODE_COMPAT);
     823    pThis->pDrvHostParallelConnector->pfnSetMode(pThis->pDrvHostParallelConnector, PDM_PARALLEL_PORT_MODE_COMPAT);
    824824    /* Get status of control register */
    825     pData->pDrvHostParallelConnector->pfnReadControl(pData->pDrvHostParallelConnector, &pData->reg_control);
     825    pThis->pDrvHostParallelConnector->pfnReadControl(pThis->pDrvHostParallelConnector, &pThis->reg_control);
    826826
    827827    rc = PDMDevHlpSSMRegister(
     
    830830        iInstance,                      /* u32Instance */
    831831        PARALLEL_SAVED_STATE_VERSION,   /* u32Version */
    832         sizeof (*pData),                /* cbGuess */
     832        sizeof (*pThis),                /* cbGuess */
    833833        NULL,                           /* pfnSavePrep */
    834834        parallelSaveExec,               /* pfnSaveExec */
  • trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp

    r11268 r11269  
    9494{
    9595    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    96     PDRVHOSTPARALLEL    pData = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     96    PDRVHOSTPARALLEL    pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    9797    switch (enmInterface)
    9898    {
     
    100100            return &pDrvIns->IBase;
    101101        case PDMINTERFACE_HOST_PARALLEL_CONNECTOR:
    102             return &pData->IHostParallelConnector;
     102            return &pThis->IHostParallelConnector;
    103103        default:
    104104            return NULL;
     
    111111static DECLCALLBACK(int) drvHostParallelWrite(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf, size_t *cbWrite)
    112112{
    113     PDRVHOSTPARALLEL pData = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
     113    PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
    114114    const unsigned char *pBuffer = (const unsigned char *)pvBuf;
    115115
    116116    LogFlow(("%s: pvBuf=%#p cbWrite=%d\n", __FUNCTION__, pvBuf, *cbWrite));
    117117
    118     ioctl(pData->FileDevice, PPWDATA, pBuffer);
     118    ioctl(pThis->FileDevice, PPWDATA, pBuffer);
    119119    *cbWrite = 1;
    120120
     
    124124static DECLCALLBACK(int) drvHostParallelRead(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t *cbRead)
    125125{
    126     PDRVHOSTPARALLEL pData = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
     126    PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
    127127    unsigned char *pBuffer = (unsigned char *)pvBuf;
    128128
    129129    LogFlow(("%s: pvBuf=%#p cbRead=%d\n", __FUNCTION__, pvBuf, cbRead));
    130130
    131     ioctl(pData->FileDevice, PPRDATA, pBuffer);
     131    ioctl(pThis->FileDevice, PPRDATA, pBuffer);
    132132    *cbRead = 1;
    133133
     
    137137static DECLCALLBACK(int) drvHostParallelSetMode(PPDMIHOSTPARALLELCONNECTOR pInterface, PDMPARALLELPORTMODE enmMode)
    138138{
    139     PDRVHOSTPARALLEL pData = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
     139    PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
    140140    int ppdev_mode;
    141141
     
    154154    }
    155155
    156     ioctl(pData->FileDevice, PPSETMODE, &ppdev_mode);
     156    ioctl(pThis->FileDevice, PPSETMODE, &ppdev_mode);
    157157
    158158    return VINF_SUCCESS;
     
    161161static DECLCALLBACK(int) drvHostParallelWriteControl(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg)
    162162{
    163     PDRVHOSTPARALLEL pData = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
     163    PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
    164164
    165165    LogFlow(("%s: fReg=%d\n", __FUNCTION__, fReg));
    166166
    167     ioctl(pData->FileDevice, PPWCONTROL, &fReg);
     167    ioctl(pThis->FileDevice, PPWCONTROL, &fReg);
    168168
    169169    return VINF_SUCCESS;
     
    172172static DECLCALLBACK(int) drvHostParallelReadControl(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg)
    173173{
    174     PDRVHOSTPARALLEL pData = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
     174    PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
    175175    uint8_t fReg;
    176176
    177     ioctl(pData->FileDevice, PPRCONTROL, &fReg);
     177    ioctl(pThis->FileDevice, PPRCONTROL, &fReg);
    178178
    179179    LogFlow(("%s: fReg=%d\n", __FUNCTION__, fReg));
     
    186186static DECLCALLBACK(int) drvHostParallelReadStatus(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg)
    187187{
    188     PDRVHOSTPARALLEL pData = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
     188    PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
    189189    uint8_t fReg;
    190190
    191     ioctl(pData->FileDevice, PPRSTATUS, &fReg);
     191    ioctl(pThis->FileDevice, PPRSTATUS, &fReg);
    192192
    193193    LogFlow(("%s: fReg=%d\n", __FUNCTION__, fReg));
     
    200200static DECLCALLBACK(int) drvHostParallelMonitorThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
    201201{
    202     PDRVHOSTPARALLEL pData = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     202    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    203203    struct pollfd aFDs[2];
    204204
     
    210210        int rc;
    211211
    212         aFDs[0].fd      = pData->FileDevice;
     212        aFDs[0].fd      = pThis->FileDevice;
    213213        aFDs[0].events  = POLLIN;
    214214        aFDs[0].revents = 0;
    215         aFDs[1].fd      = pData->WakeupPipeR;
     215        aFDs[1].fd      = pThis->WakeupPipeR;
    216216        aFDs[1].events  = POLLIN | POLLERR | POLLHUP;
    217217        aFDs[1].revents = 0;
     
    232232            char ch;
    233233            size_t cbRead;
    234             RTFileRead(pData->WakeupPipeR, &ch, 1, &cbRead);
     234            RTFileRead(pThis->WakeupPipeR, &ch, 1, &cbRead);
    235235            continue;
    236236        }
    237237
    238238        /* Interrupt occured. */
    239         rc = pData->pDrvHostParallelPort->pfnNotifyInterrupt(pData->pDrvHostParallelPort);
     239        rc = pThis->pDrvHostParallelPort->pfnNotifyInterrupt(pThis->pDrvHostParallelPort);
    240240        AssertRC(rc);
    241241    }
     
    253253static DECLCALLBACK(int) drvHostParallelWakeupMonitorThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
    254254{
    255     PDRVHOSTPARALLEL pData = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    256 
    257     return RTFileWrite(pData->WakeupPipeW, "", 1, NULL);
     255    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     256
     257    return RTFileWrite(pThis->WakeupPipeW, "", 1, NULL);
    258258}
    259259
     
    272272static DECLCALLBACK(int) drvHostParallelConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
    273273{
    274     PDRVHOSTPARALLEL pData = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     274    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    275275    LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
    276276
     
    289289    pDrvIns->IBase.pfnQueryInterface               = drvHostParallelQueryInterface;
    290290    /* IHostParallelConnector. */
    291     pData->IHostParallelConnector.pfnWrite         = drvHostParallelWrite;
    292     pData->IHostParallelConnector.pfnRead          = drvHostParallelRead;
    293     pData->IHostParallelConnector.pfnSetMode       = drvHostParallelSetMode;
    294     pData->IHostParallelConnector.pfnWriteControl  = drvHostParallelWriteControl;
    295     pData->IHostParallelConnector.pfnReadControl   = drvHostParallelReadControl;
    296     pData->IHostParallelConnector.pfnReadStatus    = drvHostParallelReadStatus;
     291    pThis->IHostParallelConnector.pfnWrite         = drvHostParallelWrite;
     292    pThis->IHostParallelConnector.pfnRead          = drvHostParallelRead;
     293    pThis->IHostParallelConnector.pfnSetMode       = drvHostParallelSetMode;
     294    pThis->IHostParallelConnector.pfnWriteControl  = drvHostParallelWriteControl;
     295    pThis->IHostParallelConnector.pfnReadControl   = drvHostParallelReadControl;
     296    pThis->IHostParallelConnector.pfnReadStatus    = drvHostParallelReadStatus;
    297297
    298298    /*
     
    300300     */
    301301    /* Device */
    302     int rc = CFGMR3QueryStringAlloc(pCfgHandle, "DevicePath", &pData->pszDevicePath);
     302    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "DevicePath", &pThis->pszDevicePath);
    303303    if (RT_FAILURE(rc))
    304304    {
     
    310310     * Open the device
    311311     */
    312     rc = RTFileOpen(&pData->FileDevice, pData->pszDevicePath, RTFILE_O_OPEN | RTFILE_O_READWRITE);
     312    rc = RTFileOpen(&pThis->FileDevice, pThis->pszDevicePath, RTFILE_O_OPEN | RTFILE_O_READWRITE);
    313313    if (RT_FAILURE(rc))
    314314        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Parallel#%d could not open '%s'"),
    315                                    pDrvIns->iInstance, pData->pszDevicePath);
     315                                   pDrvIns->iInstance, pThis->pszDevicePath);
    316316
    317317    /*
    318318     * Try to get exclusive access to parallel port
    319319     */
    320     rc = ioctl(pData->FileDevice, PPEXCL);
     320    rc = ioctl(pThis->FileDevice, PPEXCL);
    321321    if (rc < 0)
    322322        return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
    323323                                   N_("Parallel#%d could not get exclusive access for parallel port '%s'"
    324324                                      "Be sure that no other process or driver accesses this port"),
    325                                    pDrvIns->iInstance, pData->pszDevicePath);
     325                                   pDrvIns->iInstance, pThis->pszDevicePath);
    326326
    327327    /*
    328328     * Claim the parallel port
    329329     */
    330     rc = ioctl(pData->FileDevice, PPCLAIM);
     330    rc = ioctl(pThis->FileDevice, PPCLAIM);
    331331    if (rc < 0)
    332332        return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
    333333                                   N_("Parallel#%d could not claim parallel port '%s'"
    334334                                      "Be sure that no other process or driver accesses this port"),
    335                                    pDrvIns->iInstance, pData->pszDevicePath);
     335                                   pDrvIns->iInstance, pThis->pszDevicePath);
    336336
    337337    /*
    338338     * Get the IHostParallelPort interface of the above driver/device.
    339339     */
    340     pData->pDrvHostParallelPort = (PPDMIHOSTPARALLELPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HOST_PARALLEL_PORT);
    341     if (!pData->pDrvHostParallelPort)
     340    pThis->pDrvHostParallelPort = (PPDMIHOSTPARALLELPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HOST_PARALLEL_PORT);
     341    if (!pThis->pDrvHostParallelPort)
    342342        return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, RT_SRC_POS, N_("Parallel#%d has no parallel port interface above"),
    343343                                   pDrvIns->iInstance);
     
    353353        return rc;
    354354    }
    355     pData->WakeupPipeR = aFDs[0];
    356     pData->WakeupPipeW = aFDs[1];
     355    pThis->WakeupPipeR = aFDs[0];
     356    pThis->WakeupPipeW = aFDs[1];
    357357
    358358    /*
    359359     * Start waiting for interrupts.
    360360     */
    361     rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pData->pMonitorThread, pData, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0,
     361    rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->pMonitorThread, pThis, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0,
    362362                                  RTTHREADTYPE_IO, "ParMon");
    363363    if (RT_FAILURE(rc))
     
    378378static DECLCALLBACK(void) drvHostParallelDestruct(PPDMDRVINS pDrvIns)
    379379{
    380     PDRVHOSTPARALLEL pData = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     380    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    381381
    382382    LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
    383383
    384     ioctl(pData->FileDevice, PPRELEASE);
    385 
    386     if (pData->WakeupPipeW != NIL_RTFILE)
    387     {
    388         int rc = RTFileClose(pData->WakeupPipeW);
     384    ioctl(pThis->FileDevice, PPRELEASE);
     385
     386    if (pThis->WakeupPipeW != NIL_RTFILE)
     387    {
     388        int rc = RTFileClose(pThis->WakeupPipeW);
    389389        AssertRC(rc);
    390         pData->WakeupPipeW = NIL_RTFILE;
    391     }
    392     if (pData->WakeupPipeR != NIL_RTFILE)
    393     {
    394         int rc = RTFileClose(pData->WakeupPipeR);
     390        pThis->WakeupPipeW = NIL_RTFILE;
     391    }
     392    if (pThis->WakeupPipeR != NIL_RTFILE)
     393    {
     394        int rc = RTFileClose(pThis->WakeupPipeR);
    395395        AssertRC(rc);
    396         pData->WakeupPipeR = NIL_RTFILE;
    397     }
    398     if (pData->FileDevice != NIL_RTFILE)
    399     {
    400         int rc = RTFileClose(pData->FileDevice);
     396        pThis->WakeupPipeR = NIL_RTFILE;
     397    }
     398    if (pThis->FileDevice != NIL_RTFILE)
     399    {
     400        int rc = RTFileClose(pThis->FileDevice);
    401401        AssertRC(rc);
    402         pData->FileDevice = NIL_RTFILE;
     402        pThis->FileDevice = NIL_RTFILE;
    403403    }
    404404}
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