2
* PDM - Pluggable Device Manager, Queues. (VMM)
6
* Copyright (C) 2006-2007 Oracle Corporation
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.
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.
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.
26
#ifndef ___VBox_pdmqueue_h
27
#define ___VBox_pdmqueue_h
29
#include <VBox/types.h>
33
/** @defgroup grp_pdm_queue The PDM Queues API
38
/** Pointer to a PDM queue. Also called PDM queue handle. */
39
typedef struct PDMQUEUE *PPDMQUEUE;
41
/** Pointer to a PDM queue item core. */
42
typedef struct PDMQUEUEITEMCORE *PPDMQUEUEITEMCORE;
45
* PDM queue item core.
47
typedef struct PDMQUEUEITEMCORE
49
/** Pointer to the next item in the pending list - R3 Pointer. */
50
R3PTRTYPE(PPDMQUEUEITEMCORE) pNextR3;
51
/** Pointer to the next item in the pending list - R0 Pointer. */
52
R0PTRTYPE(PPDMQUEUEITEMCORE) pNextR0;
53
/** Pointer to the next item in the pending list - RC Pointer. */
54
RCPTRTYPE(PPDMQUEUEITEMCORE) pNextRC;
55
#if HC_ARCH_BITS == 64
62
* Queue consumer callback for devices.
64
* @returns Success indicator.
65
* If false the item will not be removed and the flushing will stop.
66
* @param pDevIns The device instance.
67
* @param pItem The item to consume. Upon return this item will be freed.
69
typedef DECLCALLBACK(bool) FNPDMQUEUEDEV(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem);
70
/** Pointer to a FNPDMQUEUEDEV(). */
71
typedef FNPDMQUEUEDEV *PFNPDMQUEUEDEV;
74
* Queue consumer callback for USB devices.
76
* @returns Success indicator.
77
* If false the item will not be removed and the flushing will stop.
78
* @param pDevIns The USB device instance.
79
* @param pItem The item to consume. Upon return this item will be freed.
81
typedef DECLCALLBACK(bool) FNPDMQUEUEUSB(PPDMUSBINS pUsbIns, PPDMQUEUEITEMCORE pItem);
82
/** Pointer to a FNPDMQUEUEUSB(). */
83
typedef FNPDMQUEUEUSB *PFNPDMQUEUEUSB;
86
* Queue consumer callback for drivers.
88
* @returns Success indicator.
89
* If false the item will not be removed and the flushing will stop.
90
* @param pDrvIns The driver instance.
91
* @param pItem The item to consume. Upon return this item will be freed.
93
typedef DECLCALLBACK(bool) FNPDMQUEUEDRV(PPDMDRVINS pDrvIns, PPDMQUEUEITEMCORE pItem);
94
/** Pointer to a FNPDMQUEUEDRV(). */
95
typedef FNPDMQUEUEDRV *PFNPDMQUEUEDRV;
98
* Queue consumer callback for internal component.
100
* @returns Success indicator.
101
* If false the item will not be removed and the flushing will stop.
102
* @param pVM The VM handle.
103
* @param pItem The item to consume. Upon return this item will be freed.
105
typedef DECLCALLBACK(bool) FNPDMQUEUEINT(PVM pVM, PPDMQUEUEITEMCORE pItem);
106
/** Pointer to a FNPDMQUEUEINT(). */
107
typedef FNPDMQUEUEINT *PFNPDMQUEUEINT;
110
* Queue consumer callback for external component.
112
* @returns Success indicator.
113
* If false the item will not be removed and the flushing will stop.
114
* @param pvUser User argument.
115
* @param pItem The item to consume. Upon return this item will be freed.
117
typedef DECLCALLBACK(bool) FNPDMQUEUEEXT(void *pvUser, PPDMQUEUEITEMCORE pItem);
118
/** Pointer to a FNPDMQUEUEEXT(). */
119
typedef FNPDMQUEUEEXT *PFNPDMQUEUEEXT;
121
VMMR3DECL(int) PDMR3QueueCreateDevice(PVM pVM, PPDMDEVINS pDevIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
122
PFNPDMQUEUEDEV pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue);
123
VMMR3DECL(int) PDMR3QueueCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
124
PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue);
125
VMMR3DECL(int) PDMR3QueueCreateInternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
126
PFNPDMQUEUEINT pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue);
127
VMMR3DECL(int) PDMR3QueueCreateExternal(PVM pVM, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
128
PFNPDMQUEUEEXT pfnCallback, void *pvUser, const char *pszName, PPDMQUEUE *ppQueue);
129
VMMR3DECL(int) PDMR3QueueDestroy(PPDMQUEUE pQueue);
130
VMMR3DECL(int) PDMR3QueueDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
131
VMMR3DECL(int) PDMR3QueueDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
132
VMMR3DECL(void) PDMR3QueueFlushAll(PVM pVM);
134
VMMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue);
135
VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem);
136
VMMDECL(void) PDMQueueInsertEx(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem, uint64_t NanoMaxDelay);
137
VMMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue);
138
VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue);