VirtualBox

source: vbox/trunk/include/VBox/pdmqueue.h@ 24130

Last change on this file since 24130 was 21363, checked in by vboxsync, 15 years ago

PDMQueue&users-thereof: Named the queues and added statistics.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Queues. (VMM)
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_pdmqueue_h
31#define ___VBox_pdmqueue_h
32
33#include <VBox/types.h>
34
35RT_C_DECLS_BEGIN
36
37/** @defgroup grp_pdm_queue The PDM Queues API
38 * @ingroup grp_pdm
39 * @{
40 */
41
42/** Pointer to a PDM queue. Also called PDM queue handle. */
43typedef struct PDMQUEUE *PPDMQUEUE;
44
45/** Pointer to a PDM queue item core. */
46typedef struct PDMQUEUEITEMCORE *PPDMQUEUEITEMCORE;
47
48/**
49 * PDM queue item core.
50 */
51typedef struct PDMQUEUEITEMCORE
52{
53 /** Pointer to the next item in the pending list - R3 Pointer. */
54 R3PTRTYPE(PPDMQUEUEITEMCORE) pNextR3;
55 /** Pointer to the next item in the pending list - R0 Pointer. */
56 R0PTRTYPE(PPDMQUEUEITEMCORE) pNextR0;
57 /** Pointer to the next item in the pending list - RC Pointer. */
58 RCPTRTYPE(PPDMQUEUEITEMCORE) pNextRC;
59#if HC_ARCH_BITS == 64
60 RTRCPTR Alignment0;
61#endif
62} PDMQUEUEITEMCORE;
63
64
65/**
66 * Queue consumer callback for devices.
67 *
68 * @returns Success indicator.
69 * If false the item will not be removed and the flushing will stop.
70 * @param pDevIns The device instance.
71 * @param pItem The item to consume. Upon return this item will be freed.
72 */
73typedef DECLCALLBACK(bool) FNPDMQUEUEDEV(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem);
74/** Pointer to a FNPDMQUEUEDEV(). */
75typedef FNPDMQUEUEDEV *PFNPDMQUEUEDEV;
76
77/**
78 * Queue consumer callback for drivers.
79 *
80 * @returns Success indicator.
81 * If false the item will not be removed and the flushing will stop.
82 * @param pDrvIns The driver instance.
83 * @param pItem The item to consume. Upon return this item will be freed.
84 */
85typedef DECLCALLBACK(bool) FNPDMQUEUEDRV(PPDMDRVINS pDrvIns, PPDMQUEUEITEMCORE pItem);
86/** Pointer to a FNPDMQUEUEDRV(). */
87typedef FNPDMQUEUEDRV *PFNPDMQUEUEDRV;
88
89/**
90 * Queue consumer callback for internal component.
91 *
92 * @returns Success indicator.
93 * If false the item will not be removed and the flushing will stop.
94 * @param pVM The VM handle.
95 * @param pItem The item to consume. Upon return this item will be freed.
96 */
97typedef DECLCALLBACK(bool) FNPDMQUEUEINT(PVM pVM, PPDMQUEUEITEMCORE pItem);
98/** Pointer to a FNPDMQUEUEINT(). */
99typedef FNPDMQUEUEINT *PFNPDMQUEUEINT;
100
101/**
102 * Queue consumer callback for external component.
103 *
104 * @returns Success indicator.
105 * If false the item will not be removed and the flushing will stop.
106 * @param pvUser User argument.
107 * @param pItem The item to consume. Upon return this item will be freed.
108 */
109typedef DECLCALLBACK(bool) FNPDMQUEUEEXT(void *pvUser, PPDMQUEUEITEMCORE pItem);
110/** Pointer to a FNPDMQUEUEEXT(). */
111typedef FNPDMQUEUEEXT *PFNPDMQUEUEEXT;
112
113VMMR3DECL(int) PDMR3QueueCreateDevice(PVM pVM, PPDMDEVINS pDevIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
114 PFNPDMQUEUEDEV pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue);
115VMMR3DECL(int) PDMR3QueueCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
116 PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue);
117VMMR3DECL(int) PDMR3QueueCreateInternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
118 PFNPDMQUEUEINT pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue);
119VMMR3DECL(int) PDMR3QueueCreateExternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
120 PFNPDMQUEUEEXT pfnCallback, void *pvUser, const char *pszName, PPDMQUEUE *ppQueue);
121VMMR3DECL(int) PDMR3QueueDestroy(PPDMQUEUE pQueue);
122VMMR3DECL(int) PDMR3QueueDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
123VMMR3DECL(int) PDMR3QueueDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
124VMMR3DECL(void) PDMR3QueueFlushAll(PVM pVM);
125VMMR3DECL(void) PDMR3QueueFlushWorker(PVM pVM, PPDMQUEUE pQueue);
126
127VMMDECL(void) PDMQueueFlush(PPDMQUEUE pQueue);
128VMMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue);
129VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem);
130VMMDECL(void) PDMQueueInsertEx(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem, uint64_t NanoMaxDelay);
131VMMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue);
132VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue);
133
134/** @} */
135
136RT_C_DECLS_END
137
138#endif
139
140
Note: See TracBrowser for help on using the repository browser.

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