1 | /* $Id: pdmcardreaderinfs.h 45031 2013-03-13 21:21:34Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * cardreaderinfs - interface between Usb Card Reader device and its driver.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2012 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 | typedef struct PDMICARDREADER_IO_REQUEST
|
---|
34 | {
|
---|
35 | uint32_t u32Protocol; /* Protocol identifier */
|
---|
36 | uint32_t cbPciLength; /* Protocol Control Information Length */
|
---|
37 | /* 'cbPciLength - 8' bytes of control info may follow. */
|
---|
38 | } PDMICARDREADER_IO_REQUEST;
|
---|
39 |
|
---|
40 | typedef struct PDMICARDREADER_READERSTATE
|
---|
41 | {
|
---|
42 | char *pszReaderName;
|
---|
43 | uint32_t u32CurrentState; /* Current state of reader at time of call. */
|
---|
44 | uint32_t u32EventState; /* State of reader after state change */
|
---|
45 | uint32_t cbAtr; /* Number of bytes in the returned ATR. */
|
---|
46 | uint8_t au8Atr[36]; /* Atr of inserted card, (extra alignment bytes) */
|
---|
47 | } PDMICARDREADER_READERSTATE;
|
---|
48 |
|
---|
49 |
|
---|
50 | #define PDMICARDREADERDOWN_IID "78d65378-889c-4418-8bc2-7a89a5af2817"
|
---|
51 | typedef struct PDMICARDREADERDOWN PDMICARDREADERDOWN;
|
---|
52 | typedef PDMICARDREADERDOWN *PPDMICARDREADERDOWN;
|
---|
53 | struct PDMICARDREADERDOWN
|
---|
54 | {
|
---|
55 | /** @todo r=bird: Why on earth is CardReaderDown part of the names here??
|
---|
56 | * Please do s/pfnCardReaderDown/pfn/g. */
|
---|
57 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownEstablishContext,(PPDMICARDREADERDOWN pInterface));
|
---|
58 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownConnect,(PPDMICARDREADERDOWN pInterface, void *pvUser, const char *pszCardReaderName,
|
---|
59 | uint32_t u32ShareMode, uint32_t u32PreferredProtocols));
|
---|
60 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownDisconnect,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
61 | uint32_t u32Disposition));
|
---|
62 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownStatus,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
63 | uint32_t cchReaderName, uint32_t cbAtrLen));
|
---|
64 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownReleaseContext,(PPDMICARDREADERDOWN pInterface, void *pvUser));
|
---|
65 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownGetStatusChange,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
66 | uint32_t u32Timeout, PDMICARDREADER_READERSTATE *paReaderStats, uint32_t cReaderStats));
|
---|
67 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownBeginTransaction,(PPDMICARDREADERDOWN pInterface, void *pvUser));
|
---|
68 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownEndTransaction,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
69 | uint32_t u32Disposition));
|
---|
70 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownTransmit,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
71 | const PDMICARDREADER_IO_REQUEST *pioSendRequest,
|
---|
72 | const uint8_t *pu8SendBuffer, uint32_t cbSendBuffer, uint32_t cbRecvBuffer));
|
---|
73 | /**
|
---|
74 | * Up level provides pvInBuffer of cbInBuffer bytes to call SCardControl, also it specify bytes it expects to receive
|
---|
75 | * @note Device/driver implementation should copy buffers before execution in
|
---|
76 | * async mode, and both layers shouldn't expect permanent storage for the
|
---|
77 | * buffer.
|
---|
78 | */
|
---|
79 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownControl,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
80 | uint32_t u32ControlCode, const void *pvInBuffer, uint32_t cbInBuffer, uint32_t cbOutBuffer));
|
---|
81 | /**
|
---|
82 | * This function ask driver to provide attribute (dwAttribId) and provide limit (cbAttrib) of buffer size for attribute value,
|
---|
83 | * Callback UpGetAttrib returns buffer containing the value and altered size of the buffer.
|
---|
84 | */
|
---|
85 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownGetAttr,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
86 | uint32_t u32AttribId, uint32_t cbAttrib));
|
---|
87 | DECLR3CALLBACKMEMBER(int, pfnCardReaderDownSetAttr,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
88 | uint32_t u32AttribId, const void *pvAttrib, uint32_t cbAttrib));
|
---|
89 | };
|
---|
90 |
|
---|
91 | #define PDMICARDREADERUP_IID "c0d7498e-0635-48ca-aab1-b11b6a55cf7d"
|
---|
92 | typedef struct PDMICARDREADERUP PDMICARDREADERUP;
|
---|
93 | typedef PDMICARDREADERUP *PPDMICARDREADERUP;
|
---|
94 | struct PDMICARDREADERUP
|
---|
95 | {
|
---|
96 | /** @todo r=bird: Why on earth is CardReaderUp part of the names here??
|
---|
97 | * Please do s/pfnCardReaderUp/pfn/g. */
|
---|
98 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpEstablishContext,(PPDMICARDREADERUP pInterface, int32_t lSCardRc));
|
---|
99 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpStatus,(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, pfnCardReaderUpConnect,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
103 | uint32_t u32ActiveProtocol));
|
---|
104 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpDisconnect,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
|
---|
105 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpSetStatusChange,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
106 | PDMICARDREADER_READERSTATE *paReaderStats, uint32_t cReaderStats));
|
---|
107 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpBeginTransaction,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
|
---|
108 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpEndTransaction,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc));
|
---|
109 | /* Note: pioRecvPci stack variable */
|
---|
110 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpTransmit,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
111 | const PDMICARDREADER_IO_REQUEST *pioRecvPci, uint8_t *pu8RecvBuffer, uint32_t cbRecvBuffer));
|
---|
112 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpControl,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
113 | uint32_t u32ControlCode, void *pvOutBuffer, uint32_t cbOutBuffer));
|
---|
114 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpGetAttrib,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
115 | uint32_t u32AttribId, void *pvAttrib, uint32_t cbAttrib));
|
---|
116 | DECLR3CALLBACKMEMBER(int, pfnCardReaderUpSetAttrib,(PPDMICARDREADERUP pInterface, void *pvUser, int32_t lSCardRc,
|
---|
117 | uint32_t u32AttribId));
|
---|
118 | };
|
---|
119 |
|
---|
120 | #endif
|
---|
121 |
|
---|