1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Queues.
|
---|
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 | __BEGIN_DECLS
|
---|
36 |
|
---|
37 | /** @defgroup grp_pdm_queue Queues
|
---|
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 - HC Pointer. */
|
---|
54 | R3R0PTRTYPE(PPDMQUEUEITEMCORE) pNextHC;
|
---|
55 | /** Pointer to the next item in the pending list - GC Pointer. */
|
---|
56 | RCPTRTYPE(PPDMQUEUEITEMCORE) pNextGC;
|
---|
57 | #if HC_ARCH_BITS == 64
|
---|
58 | uint32_t Alignment0;
|
---|
59 | #endif
|
---|
60 | } PDMQUEUEITEMCORE;
|
---|
61 |
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Queue consumer callback for devices.
|
---|
65 | *
|
---|
66 | * @returns Success indicator.
|
---|
67 | * If false the item will not be removed and the flushing will stop.
|
---|
68 | * @param pDevIns The device instance.
|
---|
69 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
70 | */
|
---|
71 | typedef DECLCALLBACK(bool) FNPDMQUEUEDEV(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem);
|
---|
72 | /** Pointer to a FNPDMQUEUEDEV(). */
|
---|
73 | typedef FNPDMQUEUEDEV *PFNPDMQUEUEDEV;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Queue consumer callback for drivers.
|
---|
77 | *
|
---|
78 | * @returns Success indicator.
|
---|
79 | * If false the item will not be removed and the flushing will stop.
|
---|
80 | * @param pDrvIns The driver instance.
|
---|
81 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
82 | */
|
---|
83 | typedef DECLCALLBACK(bool) FNPDMQUEUEDRV(PPDMDRVINS pDrvIns, PPDMQUEUEITEMCORE pItem);
|
---|
84 | /** Pointer to a FNPDMQUEUEDRV(). */
|
---|
85 | typedef FNPDMQUEUEDRV *PFNPDMQUEUEDRV;
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Queue consumer callback for internal component.
|
---|
89 | *
|
---|
90 | * @returns Success indicator.
|
---|
91 | * If false the item will not be removed and the flushing will stop.
|
---|
92 | * @param pVM The VM handle.
|
---|
93 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
94 | */
|
---|
95 | typedef DECLCALLBACK(bool) FNPDMQUEUEINT(PVM pVM, PPDMQUEUEITEMCORE pItem);
|
---|
96 | /** Pointer to a FNPDMQUEUEINT(). */
|
---|
97 | typedef FNPDMQUEUEINT *PFNPDMQUEUEINT;
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Queue consumer callback for external component.
|
---|
101 | *
|
---|
102 | * @returns Success indicator.
|
---|
103 | * If false the item will not be removed and the flushing will stop.
|
---|
104 | * @param pvUser User argument.
|
---|
105 | * @param pItem The item to consume. Upon return this item will be freed.
|
---|
106 | */
|
---|
107 | typedef DECLCALLBACK(bool) FNPDMQUEUEEXT(void *pvUser, PPDMQUEUEITEMCORE pItem);
|
---|
108 | /** Pointer to a FNPDMQUEUEEXT(). */
|
---|
109 | typedef FNPDMQUEUEEXT *PFNPDMQUEUEEXT;
|
---|
110 |
|
---|
111 | PDMR3DECL(int) PDMR3QueueCreateDevice(PVM pVM, PPDMDEVINS pDevIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
112 | PFNPDMQUEUEDEV pfnCallback, bool fGCEnabled, PPDMQUEUE *ppQueue);
|
---|
113 | PDMR3DECL(int) PDMR3QueueCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
114 | PFNPDMQUEUEDRV pfnCallback, PPDMQUEUE *ppQueue);
|
---|
115 | PDMR3DECL(int) PDMR3QueueCreateInternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
116 | PFNPDMQUEUEINT pfnCallback, bool fGCEnabled, PPDMQUEUE *ppQueue);
|
---|
117 | PDMR3DECL(int) PDMR3QueueCreateExternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
118 | PFNPDMQUEUEEXT pfnCallback, void *pvUser, PPDMQUEUE *ppQueue);
|
---|
119 | PDMR3DECL(int) PDMR3QueueDestroy(PPDMQUEUE pQueue);
|
---|
120 | PDMR3DECL(int) PDMR3QueueDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
|
---|
121 | PDMR3DECL(int) PDMR3QueueDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
|
---|
122 | PDMR3DECL(void) PDMR3QueueFlushAll(PVM pVM);
|
---|
123 | PDMR3DECL(void) PDMR3QueueFlushWorker(PVM pVM, PPDMQUEUE pQueue);
|
---|
124 |
|
---|
125 | PDMDECL(void) PDMQueueFlush(PPDMQUEUE pQueue);
|
---|
126 | PDMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue);
|
---|
127 | PDMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem);
|
---|
128 | PDMDECL(void) PDMQueueInsertEx(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem, uint64_t NanoMaxDelay);
|
---|
129 | PDMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue);
|
---|
130 | /** @todo eliminate PDMQueueGCPtr */
|
---|
131 | #define PDMQueueGCPtr(pQueue) PDMQueueRCPtr(pQueue)
|
---|
132 | PDMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue);
|
---|
133 |
|
---|
134 | /** @} */
|
---|
135 |
|
---|
136 | __END_DECLS
|
---|
137 |
|
---|
138 | #endif
|
---|
139 |
|
---|
140 |
|
---|