[41363] | 1 | /* $Id: pdmcardreaderinfs.h 98276 2023-01-24 11:34:55Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
[58110] | 3 | * cardreaderinfs - interface between USB Card Reader device and its driver.
|
---|
[41363] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2011-2023 Oracle and/or its affiliates.
|
---|
[41363] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
[41363] | 11 | *
|
---|
[96407] | 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 | *
|
---|
[41363] | 25 | * The contents of this file may alternatively be used under the terms
|
---|
| 26 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 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
|
---|
[41363] | 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.
|
---|
[96407] | 33 | *
|
---|
| 34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[41363] | 35 | */
|
---|
| 36 |
|
---|
[76558] | 37 | #ifndef VBOX_INCLUDED_vmm_pdmcardreaderinfs_h
|
---|
| 38 | #define VBOX_INCLUDED_vmm_pdmcardreaderinfs_h
|
---|
[76507] | 39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 40 | # pragma once
|
---|
| 41 | #endif
|
---|
[41363] | 42 |
|
---|
| 43 | #include <VBox/types.h>
|
---|
| 44 |
|
---|
| 45 |
|
---|
[58110] | 46 | /** @defgroup grp_pdm_ifs_cardreader PDM USB Card Reader Interfaces
|
---|
| 47 | * @ingroup grp_pdm_interfaces
|
---|
| 48 | * @{
|
---|
| 49 | */
|
---|
| 50 |
|
---|
| 51 |
|
---|
[41363] | 52 | typedef struct PDMICARDREADER_IO_REQUEST
|
---|
| 53 | {
|
---|
[58110] | 54 | uint32_t u32Protocol; /**< Protocol identifier */
|
---|
| 55 | uint32_t cbPciLength; /**< Protocol Control Information Length */
|
---|
[41363] | 56 | /* 'cbPciLength - 8' bytes of control info may follow. */
|
---|
| 57 | } PDMICARDREADER_IO_REQUEST;
|
---|
| 58 |
|
---|
| 59 | typedef struct PDMICARDREADER_READERSTATE
|
---|
| 60 | {
|
---|
| 61 | char *pszReaderName;
|
---|
[58110] | 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) */
|
---|
[41363] | 66 | } PDMICARDREADER_READERSTATE;
|
---|
| 67 |
|
---|
| 68 |
|
---|
[45031] | 69 | #define PDMICARDREADERDOWN_IID "78d65378-889c-4418-8bc2-7a89a5af2817"
|
---|
[41363] | 70 | typedef struct PDMICARDREADERDOWN PDMICARDREADERDOWN;
|
---|
| 71 | typedef PDMICARDREADERDOWN *PPDMICARDREADERDOWN;
|
---|
| 72 | struct PDMICARDREADERDOWN
|
---|
| 73 | {
|
---|
[45032] | 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));
|
---|
[45033] | 83 | DECLR3CALLBACKMEMBER(int, pfnEndTransaction,(PPDMICARDREADERDOWN pInterface, void *pvUser, uint32_t u32Disposition));
|
---|
[45032] | 84 | DECLR3CALLBACKMEMBER(int, pfnTransmit,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
[98276] | 85 | const PDMICARDREADER_IO_REQUEST *pIoSendRequest,
|
---|
[45032] | 86 | const uint8_t *pu8SendBuffer, uint32_t cbSendBuffer, uint32_t cbRecvBuffer));
|
---|
[41363] | 87 | /**
|
---|
| 88 | * Up level provides pvInBuffer of cbInBuffer bytes to call SCardControl, also it specify bytes it expects to receive
|
---|
[45031] | 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.
|
---|
[41363] | 92 | */
|
---|
[45032] | 93 | DECLR3CALLBACKMEMBER(int, pfnControl,(PPDMICARDREADERDOWN pInterface, void *pvUser,
|
---|
[45033] | 94 | uint32_t u32ControlCode, const void *pvInBuffer,
|
---|
| 95 | uint32_t cbInBuffer, uint32_t cbOutBuffer));
|
---|
[41363] | 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 | */
|
---|
[45032] | 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));
|
---|
[41363] | 104 | };
|
---|
| 105 |
|
---|
| 106 | #define PDMICARDREADERUP_IID "c0d7498e-0635-48ca-aab1-b11b6a55cf7d"
|
---|
| 107 | typedef struct PDMICARDREADERUP PDMICARDREADERUP;
|
---|
| 108 | typedef PDMICARDREADERUP *PPDMICARDREADERUP;
|
---|
| 109 | struct PDMICARDREADERUP
|
---|
| 110 | {
|
---|
[45033] | 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));
|
---|
[41363] | 122 | /* Note: pioRecvPci stack variable */
|
---|
[45033] | 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));
|
---|
[41363] | 131 | };
|
---|
| 132 |
|
---|
[58110] | 133 | /** @} */
|
---|
| 134 |
|
---|
[76585] | 135 | #endif /* !VBOX_INCLUDED_vmm_pdmcardreaderinfs_h */
|
---|
[45031] | 136 |
|
---|