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