~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Devices/Serial/DrvChar.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    uint32_t                    iSendQueueHead;
71
71
    uint32_t                    iSendQueueTail;
72
72
 
 
73
    uintptr_t                   AlignmentPadding;
73
74
    /** Read/write statistics */
74
75
    STAMCOUNTER                 StatBytesRead;
75
76
    STAMCOUNTER                 StatBytesWritten;
76
77
} DRVCHAR, *PDRVCHAR;
 
78
AssertCompileMemberAlignment(DRVCHAR, StatBytesRead, 8);
77
79
 
78
80
 
79
81
/** Converts a pointer to DRVCHAR::IChar to a PDRVCHAR. */
283
285
    return VINF_SUCCESS;
284
286
}
285
287
 
 
288
/**
 
289
 * Sets the TD line into break condition.
 
290
 *
 
291
 * @returns VBox status code.
 
292
 * @param   pInterface  Pointer to the interface structure containing the called function pointer.
 
293
 * @param   fBreak      Set to true to let the device send a break false to put into normal operation.
 
294
 * @thread  Any thread.
 
295
 */
 
296
static DECLCALLBACK(int) drvCharSetBreak(PPDMICHAR pInterface, bool fBreak)
 
297
{
 
298
    /* Nothing to do here. */
 
299
    return VINF_SUCCESS;
 
300
}
 
301
 
286
302
/* -=-=-=-=- driver interface -=-=-=-=- */
287
303
 
288
304
/**
289
305
 * Construct a char driver instance.
290
 
 *
291
 
 * @returns VBox status.
292
 
 * @param   pDrvIns     The driver instance data.
293
 
 *                      If the registration structure is needed,
294
 
 *                      pDrvIns->pDrvReg points to it.
295
 
 * @param   pCfgHandle  Configuration node handle for the driver. Use this to
296
 
 *                      obtain the configuration of the driver instance. It's
297
 
 *                      also found in pDrvIns->pCfgHandle as it's expected to
298
 
 *                      be used frequently in this function.
 
306
 *  
 
307
 * @copydoc FNPDMDRVCONSTRUCT
299
308
 */
300
 
static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
 
309
static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
301
310
{
302
311
    PDRVCHAR pThis = PDMINS_2_DATA(pDrvIns, PDRVCHAR);
303
312
    LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
313
322
    pThis->IChar.pfnWrite                   = drvCharWrite;
314
323
    pThis->IChar.pfnSetParameters           = drvCharSetParameters;
315
324
    pThis->IChar.pfnSetModemLines           = drvCharSetModemLines;
 
325
    pThis->IChar.pfnSetBreak                = drvCharSetBreak;
316
326
 
317
327
    /*
318
328
     * Get the ICharPort interface of the above driver/device.
325
335
     * Attach driver below and query its stream interface.
326
336
     */
327
337
    PPDMIBASE pBase;
328
 
    int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);
 
338
    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBase);
329
339
    if (RT_FAILURE(rc))
330
340
        return rc; /* Don't call PDMDrvHlpVMSetError here as we assume that the driver already set an appropriate error */
331
341
    pThis->pDrvStream = (PPDMISTREAM)pBase->pfnQueryInterface(pBase, PDMINTERFACE_STREAM);
427
437
    NULL,
428
438
    /* pfnResume */
429
439
    NULL,
 
440
    /* pfnAttach */
 
441
    NULL,
430
442
    /* pfnDetach */
 
443
    NULL, 
 
444
    /* pfnPowerOff */
 
445
    NULL, 
 
446
    /* pfnSoftReset */
431
447
    NULL,
432
 
    /** pfnPowerOff */
433
 
    NULL
 
448
    /* u32EndVersion */
 
449
    PDM_DRVREG_VERSION
434
450
};
435
451