VirtualBox

source: vbox/trunk/src/VBox/Devices/testcase/tstDeviceInternal.h@ 69162

Last change on this file since 69162 was 69162, checked in by vboxsync, 7 years ago

Devices/testcase: Skeleton for PDM device unit test framework, disabled by default (for backup purposes and to move more easily between hosts)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/** @file
2 * tstDevice: Shared definitions between the framework and the shim library.
3 */
4
5/*
6 * Copyright (C) 2017 Oracle Corporation
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
26#ifndef ___tstDeviceInternal_h
27#define ___tstDeviceInternal_h
28
29#include <VBox/types.h>
30#include <iprt/assert.h>
31#include <iprt/list.h>
32
33#include "tstDevicePlugin.h"
34#include "tstDeviceVMMInternal.h"
35
36RT_C_DECLS_BEGIN
37
38/**
39 * PDM module descriptor type.
40 */
41typedef enum TSTDEVPDMMODTYPE
42{
43 /** Invalid module type. */
44 TSTDEVPDMMODTYPE_INVALID = 0,
45 /** Ring 3 module. */
46 TSTDEVPDMMODTYPE_R3,
47 /** Ring 0 module. */
48 TSTDEVPDMMODTYPE_R0,
49 /** Raw context module. */
50 TSTDEVPDMMODTYPE_RC,
51 /** 32bit hack. */
52 TSTDEVPDMMODTYPE_32BIT_HACK = 0x7fffffff
53} TSTDEVPDMMODTYPE;
54
55/**
56 * Registered I/O port access handler.
57 */
58typedef struct RTDEVDUTIOPORT
59{
60 /** Node for the list of registered handlers. */
61 RTLISTNODE NdIoPorts;
62 /** Start I/O port the handler is for. */
63 RTIOPORT PortStart;
64 /** Number of ports handled. */
65 RTIOPORT cPorts;
66 /** Opaque user data - R3. */
67 void *pvUserR3;
68 /** Out handler - R3. */
69 PFNIOMIOPORTOUT pfnOutR3;
70 /** In handler - R3. */
71 PFNIOMIOPORTIN pfnInR3;
72 /** Out string handler - R3. */
73 PFNIOMIOPORTOUTSTRING pfnOutStrR3;
74 /** In string handler - R3. */
75 PFNIOMIOPORTINSTRING pfnInStrR3;
76
77 /** Opaque user data - R0. */
78 void *pvUserR0;
79 /** Out handler - R3. */
80 PFNIOMIOPORTOUT pfnOutR0;
81 /** In handler - R3. */
82 PFNIOMIOPORTIN pfnInR0;
83 /** Out string handler - R3. */
84 PFNIOMIOPORTOUTSTRING pfnOutStrR0;
85 /** In string handler - R3. */
86 PFNIOMIOPORTINSTRING pfnInStrR0;
87
88 /** @todo: RC */
89} RTDEVDUTIOPORT;
90/** Pointer to a registered I/O port handler. */
91typedef RTDEVDUTIOPORT *PRTDEVDUTIOPORT;
92/** Pointer to a const I/O port handler. */
93typedef const RTDEVDUTIOPORT *PCRTDEVDUTIOPORT;
94
95/**
96 * The contex the device under test is currently in.
97 */
98typedef enum TSTDEVDUTCTX
99{
100 /** Invalid context. */
101 TSTDEVDUTCTX_INVALID = 0,
102 /** R3 context. */
103 TSTDEVDUTCTX_R3,
104 /** R0 context. */
105 TSTDEVDUTCTX_R0,
106 /** RC context. */
107 TSTDEVDUTCTX_RC,
108 /** 32bit hack. */
109 TSTDEVDUTCTX_32BIT_HACK = 0x7fffffff
110} TSTDEVDUTCTX;
111
112/**
113 * Device under test instance data.
114 */
115typedef struct TSTDEVDUTINT
116{
117 /** Pointer to the testcase this device is part of. */
118 PCTSTDEVTESTCASEREG pTestcaseReg;
119 /** Pointer to the PDM device instance. */
120 PPDMDEVINS pDevIns;
121 /** Current device context. */
122 TSTDEVDUTCTX enmCtx;
123 /** List of registered I/O port handlers. */
124 RTLISTANCHOR LstIoPorts;
125 /** List of timers registered. */
126 RTLISTANCHOR LstTimers;
127} TSTDEVDUTINT;
128/** Pointer to the internal device under test instance data. */
129typedef TSTDEVDUTINT *PDEVDUTINT;
130
131DECLHIDDEN(int) tstDevPdmLdrGetSymbol(PDEVDUTINT pThis, const char *pszR0Mod, TSTDEVPDMMODTYPE enmModType,
132 const char *pszSymbol, PFNRT *ppfn);
133
134RT_C_DECLS_END
135
136#endif
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