00001 /* ---------------------------------------------------------------------------- */ 00002 /* Atmel Microcontroller Software Support */ 00003 /* SAM Software Package License */ 00004 /* ---------------------------------------------------------------------------- */ 00005 /* Copyright (c) 2015, Atmel Corporation */ 00006 /* */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without */ 00010 /* modification, are permitted provided that the following condition is met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, */ 00013 /* this list of conditions and the disclaimer below. */ 00014 /* */ 00015 /* Atmel's name may not be used to endorse or promote products derived from */ 00016 /* this software without specific prior written permission. */ 00017 /* */ 00018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00028 /* ---------------------------------------------------------------------------- */ 00029 00030 /** \file 00031 * Title: cciddriverdescriptors.h 00032 * 00033 * \section Purpose 00034 * Definitions of the descriptors required by the ccid device driver. 00035 * DWG_Smart-Card_CCID_Rev110.pdf 00036 * 00037 */ 00038 00039 #ifndef CCID_DRIVER_DESCRIPTORS_H 00040 #define CCID_DRIVER_DESCRIPTORS_H 00041 00042 /** \addtogroup usbd_ccid 00043 *@{ 00044 */ 00045 00046 /*------------------------------------------------------------------------------ 00047 * Definitions 00048 *------------------------------------------------------------------------------*/ 00049 00050 /*------------------------------------------------------------------------------ 00051 * Constants: Endpoints 00052 * CCID_EPT_DATA_OUT endpoint data out bulk 1 00053 * CCID_EPT_DATA_IN endpoint data in bulk 2 00054 * CCID_EPT_NOTIFICATION endpoint data interupt 3 00055 *------------------------------------------------------------------------------*/ 00056 #define CCID_EPT_DATA_OUT 1 00057 #define CCID_EPT_DATA_IN 2 00058 #define CCID_EPT_NOTIFICATION 3 00059 00060 /*------------------------------------------------------------------------------ 00061 * USB-ICC protocol 00062 *------------------------------------------------------------------------------*/ 00063 /* CCID specification version 1.10 */ 00064 00065 #define CCID1_10 0x0110 00066 00067 #define SMART_CARD_DEVICE_CLASS 0x0B 00068 /* Smart Card Device Class Descriptor Type */ 00069 00070 #define CCID_DECRIPTOR_TYPE 0x21 00071 00072 /* Table 5.3-1 Summary of CCID Class Specific Request */ 00073 00074 #define CCIDGenericRequest_ABORT 0x01 00075 #define CCIDGenericRequest_GET_CLOCK_FREQUENCIES 0x02 00076 #define CCIDGenericRequest_GET_DATA_RATES 0x03 00077 00078 /* 6.1 Command Pipe, Bulk-OUT Messages */ 00079 00080 #define PC_TO_RDR_ICCPOWERON 0x62 00081 #define PC_TO_RDR_ICCPOWEROFF 0x63 00082 #define PC_TO_RDR_GETSLOTSTATUS 0x65 00083 #define PC_TO_RDR_XFRBLOCK 0x6F 00084 #define PC_TO_RDR_GETPARAMETERS 0x6C 00085 #define PC_TO_RDR_RESETPARAMETERS 0x6D 00086 #define PC_TO_RDR_SETPARAMETERS 0x61 00087 #define PC_TO_RDR_ESCAPE 0x6B 00088 #define PC_TO_RDR_ICCCLOCK 0x6E 00089 #define PC_TO_RDR_T0APDU 0x6A 00090 #define PC_TO_RDR_SECURE 0x69 00091 #define PC_TO_RDR_MECHANICAL 0x71 00092 #define PC_TO_RDR_ABORT 0x72 00093 #define PC_TO_RDR_SETDATARATEANDCLOCKFREQUENCY 0x73 00094 00095 /* 6.2 Response Pipe, Bulk-IN Messages */ 00096 00097 #define RDR_TO_PC_DATABLOCK 0x80 00098 #define RDR_TO_PC_SLOTSTATUS 0x81 00099 #define RDR_TO_PC_PARAMETERS 0x82 00100 #define RDR_TO_PC_ESCAPE 0x83 00101 #define RDR_TO_PC_DATARATEANDCLOCKFREQUENCY 0x84 00102 00103 /* 6.3 Interrupt-IN Messages */ 00104 00105 #define RDR_TO_PC_NOTIFYSLOTCHANGE 0x50 00106 #define RDR_TO_PC_HARDWAREERROR 0x51 00107 00108 /* Table 6.2-2 Slot error register when bmCommandStatus = 1 */ 00109 00110 #define CMD_ABORTED 0xFF 00111 #define ICC_MUTE 0xFE 00112 #define XFR_PARITY_ERROR 0xFD 00113 #define XFR_OVERRUN 0xFC 00114 #define HW_ERROR 0xFB 00115 #define BAD_ATR_TS 0xF8 00116 #define BAD_ATR_TCK 0xF7 00117 #define ICC_PROTOCOL_NOT_SUPPORTED 0xF6 00118 #define ICC_CLASS_NOT_SUPPORTED 0xF5 00119 #define PROCEDURE_BYTE_CONFLICT 0xF4 00120 #define DEACTIVATED_PROTOCOL 0xF3 00121 #define BUSY_WITH_AUTO_SEQUENCE 0xF2 00122 #define PIN_TIMEOUT 0xF0 00123 #define PIN_CANCELLED 0xEF 00124 #define CMD_SLOT_BUSY 0xE0 00125 /* User defined 0xC0 to 0x81 */ 00126 00127 /* Reserved for futur use 0x80 */ 00128 00129 /* not supported incorrect message parameter 0x7F to 0x01 */ 00130 00131 /* Command not supported 0x00 */ 00132 00133 00134 /* CCID rev 1.1, p.27 */ 00135 00136 #define VOLTS_AUTO 0x00 00137 #define VOLTS_5_0 0x01 00138 #define VOLTS_3_0 0x02 00139 #define VOLTS_1_8 0x03 00140 00141 /* 6.3.1 RDR_to_PC_NotifySlotChange */ 00142 00143 #define ICC_NOT_PRESENT 0x00 00144 #define ICC_PRESENT 0x01 00145 #define ICC_CHANGE 0x02 00146 #define ICC_INSERTED_EVENT ICC_PRESENT+ICC_CHANGE 00147 00148 /* ICCD: Table 6.1-8 Bitmap for bStatus field */ 00149 00150 #define ICC_BS_PRESENT_ACTIVATED 0x00 /* USB-ICC is present and activated */ 00151 00152 #define ICC_BS_PRESENT_NOTACTIVATED 0x01 /* USB-ICC is present but not activated */ 00153 00154 #define ICC_BS_NOTPRESENT 0x02 /* USB-ICC is virtually not present */ 00155 00156 #define ICC_BS_RFU 0x03 /* RFU */ 00157 00158 #define ICC_CS_NO_ERROR (0x00<<6) /* Processed without error */ 00159 00160 #define ICC_CS_FAILED (0x01<<6) /* Failed, error condition given by bError */ 00161 00162 #define ICC_CS_TIME_EXT (0x02<<6) /* Time extension is requested */ 00163 00164 #define ICC_CS_RFU (0x03<<6) /* RFU */ 00165 00166 00167 /* 00168 * #define NO_ERROR 0x00 00169 * #define NO_EXTRA_BYTES 0x00 00170 * #define CCID_FLAG_INITIAL_VALUE 0x05 00171 * #define CCID_EVENT_SIZE 0x02 00172 * #define STATUS_MASK 0x41 00173 */ 00174 /*------------------------------------------------------------------------------ 00175 * Structures 00176 *------------------------------------------------------------------------------*/ 00177 00178 /**@}*/ 00179 00180 #endif /*#ifndef CCID_DRIVER_DESCRIPTORS_H */ 00181 00182