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