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 |
|
---|
35 | RT_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. */
|
---|
43 | typedef struct PDMQUEUE *PPDMQUEUE;
|
---|
44 |
|
---|
45 | /** Pointer to a PDM queue item core. */
|
---|
46 | typedef struct PDMQUEUEITEMCORE *PPDMQUEUEITEMCORE;
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * PDM queue item core.
|
---|
50 | */
|
---|
51 | typedef 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 | */
|
---|
73 | typedef DECLCALLBACK(bool) FNPDMQUEUEDEV(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem);
|
---|
74 | /** Pointer to a FNPDMQUEUEDEV(). */
|
---|
75 | typedef FNPDMQUEUEDEV *PFNPDMQUEUEDEV;
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Queue consumer callback for USB devices.
|
---|
79 | *
|
---|
80 | * @returns Success indicator.
|
---|
81 | * If false the item will not be removed and the flushing will stop.
|
---|
82 | * @param pDevIns The USB device instance.
|
---|
83 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
84 | */
|
---|
85 | typedef DECLCALLBACK(bool) FNPDMQUEUEUSB(PPDMUSBINS pUsbIns, PPDMQUEUEITEMCORE pItem);
|
---|
86 | /** Pointer to a FNPDMQUEUEUSB(). */
|
---|
87 | typedef FNPDMQUEUEUSB *PFNPDMQUEUEUSB;
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Queue consumer callback for drivers.
|
---|
91 | *
|
---|
92 | * @returns Success indicator.
|
---|
93 | * If false the item will not be removed and the flushing will stop.
|
---|
94 | * @param pDrvIns The driver instance.
|
---|
95 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
96 | */
|
---|
97 | typedef DECLCALLBACK(bool) FNPDMQUEUEDRV(PPDMDRVINS pDrvIns, PPDMQUEUEITEMCORE pItem);
|
---|
98 | /** Pointer to a FNPDMQUEUEDRV(). */
|
---|
99 | typedef FNPDMQUEUEDRV *PFNPDMQUEUEDRV;
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Queue consumer callback for internal component.
|
---|
103 | *
|
---|
104 | * @returns Success indicator.
|
---|
105 | * If false the item will not be removed and the flushing will stop.
|
---|
106 | * @param pVM The VM handle.
|
---|
107 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
108 | */
|
---|
109 | typedef DECLCALLBACK(bool) FNPDMQUEUEINT(PVM pVM, PPDMQUEUEITEMCORE pItem);
|
---|
110 | /** Pointer to a FNPDMQUEUEINT(). */
|
---|
111 | typedef FNPDMQUEUEINT *PFNPDMQUEUEINT;
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * Queue consumer callback for external component.
|
---|
115 | *
|
---|
116 | * @returns Success indicator.
|
---|
117 | * If false the item will not be removed and the flushing will stop.
|
---|
118 | * @param pvUser User argument.
|
---|
119 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
120 | */
|
---|
121 | typedef DECLCALLBACK(bool) FNPDMQUEUEEXT(void *pvUser, PPDMQUEUEITEMCORE pItem);
|
---|
122 | /** Pointer to a FNPDMQUEUEEXT(). */
|
---|
123 | typedef FNPDMQUEUEEXT *PFNPDMQUEUEEXT;
|
---|
124 |
|
---|
125 | VMMR3DECL(int) PDMR3QueueCreateDevice(PVM pVM, PPDMDEVINS pDevIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
126 | PFNPDMQUEUEDEV pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue);
|
---|
127 | VMMR3DECL(int) PDMR3QueueCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
128 | PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue);
|
---|
129 | VMMR3DECL(int) PDMR3QueueCreateInternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
130 | PFNPDMQUEUEINT pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue);
|
---|
131 | VMMR3DECL(int) PDMR3QueueCreateExternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
132 | PFNPDMQUEUEEXT pfnCallback, void *pvUser, const char *pszName, PPDMQUEUE *ppQueue);
|
---|
133 | VMMR3DECL(int) PDMR3QueueDestroy(PPDMQUEUE pQueue);
|
---|
134 | VMMR3DECL(int) PDMR3QueueDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
|
---|
135 | VMMR3DECL(int) PDMR3QueueDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
|
---|
136 | VMMR3DECL(void) PDMR3QueueFlushAll(PVM pVM);
|
---|
137 | VMMR3DECL(void) PDMR3QueueFlushWorker(PVM pVM, PPDMQUEUE pQueue);
|
---|
138 |
|
---|
139 | VMMDECL(void) PDMQueueFlush(PPDMQUEUE pQueue);
|
---|
140 | VMMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue);
|
---|
141 | VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem);
|
---|
142 | VMMDECL(void) PDMQueueInsertEx(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem, uint64_t NanoMaxDelay);
|
---|
143 | VMMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue);
|
---|
144 | VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue);
|
---|
145 |
|
---|
146 | /** @} */
|
---|
147 |
|
---|
148 | RT_C_DECLS_END
|
---|
149 |
|
---|
150 | #endif
|
---|
151 |
|
---|