1 | /* $Id: pdmcardreaderinfs.h 58110 2015-10-07 18:36:49Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * cardreaderinfs - interface between USB Card Reader device and its driver.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2015 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_vmm_pdmcardreaderinfs_h
|
---|
28 | #define ___VBox_vmm_pdmcardreaderinfs_h
|
---|
29 |
|
---|
30 | #include <VBox/types.h>
|
---|
31 |
|
---|
32 |
|
---|
33 | /** @defgroup grp_pdm_ifs_cardreader PDM USB Card Reader Interfaces
|
---|
34 | * @ingroup grp_pdm_interfaces
|
---|
35 | * @{
|
---|
36 | */
|
---|
37 |
|
---|
38 |
|
---|
39 | typedef struct PDMICARDREADER_IO_REQUEST
|
---|
40 | {
|
---|
41 | uint32_t u32Protocol; /**< Protocol identifier */
|
---|
42 | uint32_t cbPciLength; /**< Protocol Control Information Length */
|
---|
43 | /* 'cbPciLength - 8' bytes of control info may follow. */
|
---|
44 | } PDMICARDREADER_IO_REQUEST;
|
---|
45 |
|
---|
46 | typedef struct PDMICARDREADER_READERSTATE
|
---|
47 | {
|
---|
48 | char *pszReaderName;
|
---|
49 | uint32_t u32CurrentState; /**< Current state of reader at time of call. */
|
---|
50 | uint32_t u32EventState; /**< State of reader after state change */
|
---|
51 | uint32_t cbAtr; /**< Number of bytes in the returned ATR. */
|
---|
52 | uint8_t au8Atr[36]; /**< Atr of inserted card, (extra alignment bytes) */
|
---|
53 | } PDMICARDREADER_READERSTATE;
|
---|
54 |
|
---|
55 |
|
---|
56 | #define PDMICARDREADERDOWN_IID "78d65378-889c-4418-8bc2-7a89a5af2817"
|
---|
57 | typedef struct PDMICARDREADERDOWN PDMICARDREADERDOWN;
|
---|
58 | typedef PDMICARDREADERDOWN *PPDMICARDREADERDOWN;
|
---|
59 | struct PDMICARDREADERDOWN
|
---|
60 | {
|
---|
61 | DECLR3CALLBACKMEMBER(int, pfnEstablishContext,(PPDMICARDREADERDOWN pInterface));
|
---|
62 | DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMICARDREADERDOWN pInterface, void *pvUser, const char *pszCardReaderName,
|
---|
63 | uint32_t u32ShareMode, uint32_t u32PreferredProtocols));
|
---|
64 | DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t u32Disposition));
|
---|
65 | DECLR3CALLBACKMEMBER(int, pfnStatus,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t cchReaderName, uint32_t cbAtrLen));
|
---|
66 | DECLR3CALLBACKMEMBER(int, pfnReleaseContext,(PPDMICARDREADERDOWN pInterface, void *pvUser));
|
---|
67 | DECLR3CALLBACKMEMBER(int, pfnGetStatusChange,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t u32Timeout,
|
---|
68 | PDMICARDREADER_READERSTATE *paReaderStats, uint32_t cReaderStats));
|
---|
69 | DECLR3CALLBACKMEMBER(int, pfnBeginTransaction,(PPDMICARDREADERDOWN pInterface, void *pvUser));
|
---|
70 | DECLR3CALLBACKMEMBER(int, pfnEndTransaction,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t u32Disposition));
|
---|
71 | DECLR3CALLBACKMEMBER(int, pfnTransmit,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
72 | const PDMICARDREADER_IO_REQUEST *pioSendRequest,
|
---|
73 | const uint8_t *pu8SendBuffer, uint32_t cbSendBuffer, uint32_t cbRecvBuffer));
|
---|
74 | /**
|
---|
75 | * Up level provides pvInBuffer of cbInBuffer bytes to call SCardControl, also it specify bytes it expects to receive
|
---|
76 | * @note Device/driver implementation should copy buffers before execution in
|
---|
77 | * async mode, and both layers shouldn't expect permanent storage for the
|
---|
78 | * buffer.
|
---|
79 | */
|
---|
80 | DECLR3CALLBACKMEMBER(int, pfnControl,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
81 | uint32_t u32ControlCode, const void *pvInBuffer,
|
---|
82 | uint32_t cbInBuffer, uint32_t cbOutBuffer));
|
---|
83 | /**
|
---|
84 | * This function ask driver to provide attribute (dwAttribId) and provide limit (cbAttrib) of buffer size for attribute value,
|
---|
85 | * Callback UpGetAttrib returns buffer containing the value and altered size of the buffer.
|
---|
86 | */
|
---|
87 | DECLR3CALLBACKMEMBER(int, pfnGetAttr,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
88 | uint32_t u32AttribId, uint32_t cbAttrib));
|
---|
89 | DECLR3CALLBACKMEMBER(int, pfnSetAttr,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
90 | uint32_t u32AttribId, const void *pvAttrib, uint32_t cbAttrib));
|
---|
91 | };
|
---|
92 |
|
---|
93 | #define PDMICARDREADERUP_IID "c0d7498e-0635-48ca-aab1-b11b6a55cf7d"
|
---|
94 | typedef struct PDMICARDREADERUP PDMICARDREADERUP;
|
---|
95 | typedef PDMICARDREADERUP *PPDMICARDREADERUP;
|
---|
96 | struct PDMICARDREADERUP
|
---|
97 | {
|
---|
98 | DECLR3CALLBACKMEMBER(int, pfnEstablishContext,(PPDMICARDREADERUP pInterface, int32_t lSCardRc));
|
---|
99 | DECLR3CALLBACKMEMBER(int, pfnStatus,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
100 | char *pszReaderName, uint32_t cchReaderName, uint32_t u32CardState,
|
---|
101 | uint32_t u32Protocol, uint8_t *pu8Atr, uint32_t cbAtr));
|
---|
102 | DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
103 | uint32_t u32ActiveProtocol));
|
---|
104 | DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
|
---|
105 | DECLR3CALLBACKMEMBER(int, pfnSetStatusChange,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
106 | PDMICARDREADER_READERSTATE *paReaderStats, uint32_t cReaderStats));
|
---|
107 | DECLR3CALLBACKMEMBER(int, pfnBeginTransaction,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
|
---|
108 | DECLR3CALLBACKMEMBER(int, pfnEndTransaction,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
|
---|
109 | /* Note: pioRecvPci stack variable */
|
---|
110 | DECLR3CALLBACKMEMBER(int, pfnTransmit,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
111 | const PDMICARDREADER_IO_REQUEST *pioRecvPci,
|
---|
112 | uint8_t *pu8RecvBuffer, uint32_t cbRecvBuffer));
|
---|
113 | DECLR3CALLBACKMEMBER(int, pfnControl,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
114 | uint32_t u32ControlCode, void *pvOutBuffer, uint32_t cbOutBuffer));
|
---|
115 | DECLR3CALLBACKMEMBER(int, pfnGetAttrib,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
116 | uint32_t u32AttribId, void *pvAttrib, uint32_t cbAttrib));
|
---|
117 | DECLR3CALLBACKMEMBER(int, pfnSetAttrib,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc, uint32_t u32AttribId));
|
---|
118 | };
|
---|
119 |
|
---|
120 | /** @} */
|
---|
121 |
|
---|
122 | #endif
|
---|
123 |
|
---|