VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmcardreaderinfs.h

Last change on this file was 98276, checked in by vboxsync, 16 months ago

Main/UsbCardReader.cpp: rc -> hrc/vrc. bugref:10223

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1/* $Id: pdmcardreaderinfs.h 98276 2023-01-24 11:34:55Z vboxsync $ */
2/** @file
3 * cardreaderinfs - interface between USB Card Reader device and its driver.
4 */
5
6/*
7 * Copyright (C) 2011-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef VBOX_INCLUDED_vmm_pdmcardreaderinfs_h
38#define VBOX_INCLUDED_vmm_pdmcardreaderinfs_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43#include <VBox/types.h>
44
45
46/** @defgroup grp_pdm_ifs_cardreader PDM USB Card Reader Interfaces
47 * @ingroup grp_pdm_interfaces
48 * @{
49 */
50
51
52typedef struct PDMICARDREADER_IO_REQUEST
53{
54 uint32_t u32Protocol; /**< Protocol identifier */
55 uint32_t cbPciLength; /**< Protocol Control Information Length */
56 /* 'cbPciLength - 8' bytes of control info may follow. */
57} PDMICARDREADER_IO_REQUEST;
58
59typedef struct PDMICARDREADER_READERSTATE
60{
61 char *pszReaderName;
62 uint32_t u32CurrentState; /**< Current state of reader at time of call. */
63 uint32_t u32EventState; /**< State of reader after state change */
64 uint32_t cbAtr; /**< Number of bytes in the returned ATR. */
65 uint8_t au8Atr[36]; /**< Atr of inserted card, (extra alignment bytes) */
66} PDMICARDREADER_READERSTATE;
67
68
69#define PDMICARDREADERDOWN_IID "78d65378-889c-4418-8bc2-7a89a5af2817"
70typedef struct PDMICARDREADERDOWN PDMICARDREADERDOWN;
71typedef PDMICARDREADERDOWN *PPDMICARDREADERDOWN;
72struct PDMICARDREADERDOWN
73{
74 DECLR3CALLBACKMEMBER(int, pfnEstablishContext,(PPDMICARDREADERDOWN pInterface));
75 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMICARDREADERDOWN pInterface, void *pvUser, const char *pszCardReaderName,
76 uint32_t u32ShareMode, uint32_t u32PreferredProtocols));
77 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t u32Disposition));
78 DECLR3CALLBACKMEMBER(int, pfnStatus,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t cchReaderName, uint32_t cbAtrLen));
79 DECLR3CALLBACKMEMBER(int, pfnReleaseContext,(PPDMICARDREADERDOWN pInterface, void *pvUser));
80 DECLR3CALLBACKMEMBER(int, pfnGetStatusChange,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t u32Timeout,
81 PDMICARDREADER_READERSTATE *paReaderStats, uint32_t cReaderStats));
82 DECLR3CALLBACKMEMBER(int, pfnBeginTransaction,(PPDMICARDREADERDOWN pInterface, void *pvUser));
83 DECLR3CALLBACKMEMBER(int, pfnEndTransaction,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t u32Disposition));
84 DECLR3CALLBACKMEMBER(int, pfnTransmit,(PPDMICARDREADERDOWN pInterface, void *pvUser,
85 const PDMICARDREADER_IO_REQUEST *pIoSendRequest,
86 const uint8_t *pu8SendBuffer, uint32_t cbSendBuffer, uint32_t cbRecvBuffer));
87 /**
88 * Up level provides pvInBuffer of cbInBuffer bytes to call SCardControl, also it specify bytes it expects to receive
89 * @note Device/driver implementation should copy buffers before execution in
90 * async mode, and both layers shouldn't expect permanent storage for the
91 * buffer.
92 */
93 DECLR3CALLBACKMEMBER(int, pfnControl,(PPDMICARDREADERDOWN pInterface, void *pvUser,
94 uint32_t u32ControlCode, const void *pvInBuffer,
95 uint32_t cbInBuffer, uint32_t cbOutBuffer));
96 /**
97 * This function ask driver to provide attribute (dwAttribId) and provide limit (cbAttrib) of buffer size for attribute value,
98 * Callback UpGetAttrib returns buffer containing the value and altered size of the buffer.
99 */
100 DECLR3CALLBACKMEMBER(int, pfnGetAttr,(PPDMICARDREADERDOWN pInterface, void *pvUser,
101 uint32_t u32AttribId, uint32_t cbAttrib));
102 DECLR3CALLBACKMEMBER(int, pfnSetAttr,(PPDMICARDREADERDOWN pInterface, void *pvUser,
103 uint32_t u32AttribId, const void *pvAttrib, uint32_t cbAttrib));
104};
105
106#define PDMICARDREADERUP_IID "c0d7498e-0635-48ca-aab1-b11b6a55cf7d"
107typedef struct PDMICARDREADERUP PDMICARDREADERUP;
108typedef PDMICARDREADERUP *PPDMICARDREADERUP;
109struct PDMICARDREADERUP
110{
111 DECLR3CALLBACKMEMBER(int, pfnEstablishContext,(PPDMICARDREADERUP pInterface, int32_t lSCardRc));
112 DECLR3CALLBACKMEMBER(int, pfnStatus,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
113 char *pszReaderName, uint32_t cchReaderName, uint32_t u32CardState,
114 uint32_t u32Protocol, uint8_t *pu8Atr, uint32_t cbAtr));
115 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
116 uint32_t u32ActiveProtocol));
117 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
118 DECLR3CALLBACKMEMBER(int, pfnSetStatusChange,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
119 PDMICARDREADER_READERSTATE *paReaderStats, uint32_t cReaderStats));
120 DECLR3CALLBACKMEMBER(int, pfnBeginTransaction,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
121 DECLR3CALLBACKMEMBER(int, pfnEndTransaction,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
122 /* Note: pioRecvPci stack variable */
123 DECLR3CALLBACKMEMBER(int, pfnTransmit,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
124 const PDMICARDREADER_IO_REQUEST *pioRecvPci,
125 uint8_t *pu8RecvBuffer, uint32_t cbRecvBuffer));
126 DECLR3CALLBACKMEMBER(int, pfnControl,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
127 uint32_t u32ControlCode, void *pvOutBuffer, uint32_t cbOutBuffer));
128 DECLR3CALLBACKMEMBER(int, pfnGetAttrib,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
129 uint32_t u32AttribId, void *pvAttrib, uint32_t cbAttrib));
130 DECLR3CALLBACKMEMBER(int, pfnSetAttrib,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc, uint32_t u32AttribId));
131};
132
133/** @} */
134
135#endif /* !VBOX_INCLUDED_vmm_pdmcardreaderinfs_h */
136
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use