2 * Copyright (c) 2006-2007 Daniel Roethlisberger <daniel@roe.ch>
3 * Copyright (c) 2000-2004 OMNIKEY GmbH (www.omnikey.com)
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 /* I/O port registers */
31 #define REG_OFFSET_DTR 0 /* data transfer register */
32 #define REG_OFFSET_BSR 1 /* buffer status register */
33 #define REG_OFFSET_SCR 2 /* sync control register */
35 /* buffer status register flags */
36 #define BSR_BULK_OUT_FULL 0x01
37 #define BSR_BULK_IN_FULL 0x02
39 /* sync control register flags */
40 #define SCR_POWER_DOWN 0x01
41 #define SCR_PULSE_INTERRUPT 0x02
42 #define SCR_HOST_TO_READER_DONE 0x04
43 #define SCR_READER_TO_HOST_DONE 0x08
44 #define SCR_ACK_NOTIFY 0x10
45 #define SCR_EN_NOTIFY 0x20
46 #define SCR_ABORT 0x40
47 #define SCR_HOST_TO_READER_START 0x80
50 #define CMD_PC_TO_RDR_SETPARAMETERS 0x61
51 #define CMD_PC_TO_RDR_ICCPOWERON 0x62
52 #define CMD_PC_TO_RDR_ICCPOWEROFF 0x63
53 #define CMD_PC_TO_RDR_GETSLOTSTATUS 0x65
54 #define CMD_PC_TO_RDR_SECURE 0x69
55 #define CMD_PC_TO_RDR_ESCAPE 0x6B
56 #define CMD_PC_TO_RDR_GETPARAMETERS 0x6C
57 #define CMD_PC_TO_RDR_RESETPARAMETERS 0x6D
58 #define CMD_PC_TO_RDR_ICCCLOCK 0x6E
59 #define CMD_PC_TO_RDR_XFRBLOCK 0x6F
60 #define CMD_PC_TO_RDR_TEST_SECURE 0x74
61 #define CMD_PC_TO_RDR_OK_SECURE 0x89
62 #define CMD_RDR_TO_PC_DATABLOCK 0x80
63 #define CMD_RDR_TO_PC_SLOTSTATUS 0x81
64 #define CMD_RDR_TO_PC_PARAMETERS 0x82
65 #define CMD_RDR_TO_PC_ESCAPE 0x83
66 #define CMD_RDR_TO_PC_OK_SECURE 0x89