Mercurial > code > home > repos > homeauto
annotate service/cardReader/pyfreefare/nfc.h @ 1708:3cfd3693a4ac
quick fixes for cyclone sse
author | drewp@bigasterisk.com |
---|---|
date | Wed, 17 Nov 2021 14:25:14 -0800 |
parents | 1ecceb2e92a3 |
children |
rev | line source |
---|---|
402
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
1 /*- |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
2 * Free/Libre Near Field Communication (NFC) library |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
3 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
4 * Libnfc historical contributors: |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
5 * Copyright (C) 2009 Roel Verdult |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
6 * Copyright (C) 2009-2013 Romuald Conty |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
7 * Copyright (C) 2010-2012 Romain Tartière |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
8 * Copyright (C) 2010-2013 Philippe Teuwen |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
9 * Copyright (C) 2012-2013 Ludovic Rousseau |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
10 * See AUTHORS file for a more comprehensive list of contributors. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
11 * Additional contributors of this file: |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
12 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
13 * This program is free software: you can redistribute it and/or modify it |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
14 * under the terms of the GNU Lesser General Public License as published by the |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
15 * Free Software Foundation, either version 3 of the License, or (at your |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
16 * option) any later version. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
17 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
18 * This program is distributed in the hope that it will be useful, but WITHOUT |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
21 * more details. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
22 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
23 * You should have received a copy of the GNU Lesser General Public License |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
24 * along with this program. If not, see <http://www.gnu.org/licenses/> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
25 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
26 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
27 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
28 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
29 * @file nfc.h |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
30 * @brief libnfc interface |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
31 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
32 * Provide all usefull functions (API) to handle NFC devices. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
33 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
34 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
35 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
36 typedef unsigned char uint8_t; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
37 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
38 # include <sys/time.h> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
39 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
40 # include <stdint.h> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
41 # include <stdbool.h> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
42 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
43 /*- |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
44 * Free/Libre Near Field Communication (NFC) library |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
45 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
46 * Libnfc historical contributors: |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
47 * Copyright (C) 2009 Roel Verdult |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
48 * Copyright (C) 2009-2013 Romuald Conty |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
49 * Copyright (C) 2010-2012 Romain Tartière |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
50 * Copyright (C) 2010-2013 Philippe Teuwen |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
51 * Copyright (C) 2012-2013 Ludovic Rousseau |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
52 * See AUTHORS file for a more comprehensive list of contributors. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
53 * Additional contributors of this file: |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
54 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
55 * This program is free software: you can redistribute it and/or modify it |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
56 * under the terms of the GNU Lesser General Public License as published by the |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
57 * Free Software Foundation, either version 3 of the License, or (at your |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
58 * option) any later version. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
59 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
60 * This program is distributed in the hope that it will be useful, but WITHOUT |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
61 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
62 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
63 * more details. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
64 * |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
65 * You should have received a copy of the GNU Lesser General Public License |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
66 * along with this program. If not, see <http://www.gnu.org/licenses/> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
67 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
68 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
69 * @file nfc-types.h |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
70 * @brief Define NFC types |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
71 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
72 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
73 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
74 #include <stddef.h> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
75 #include <stdint.h> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
76 #include <stdbool.h> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
77 #include <stdio.h> |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
78 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
79 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
80 #define NFC_BUFSIZE_CONNSTRING 1024 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
81 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
82 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
83 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
84 * NFC context |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
85 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
86 struct nfc_context; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
87 typedef struct nfc_context nfc_context; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
88 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
89 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
90 * NFC device |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
91 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
92 struct nfc_device; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
93 typedef struct nfc_device nfc_device; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
94 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
95 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
96 * NFC device driver |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
97 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
98 struct nfc_driver; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
99 typedef struct nfc_driver nfc_driver; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
100 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
101 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
102 * Connection string |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
103 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
104 typedef char nfc_connstring[NFC_BUFSIZE_CONNSTRING]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
105 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
106 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
107 * Properties |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
108 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
109 typedef enum { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
110 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
111 * Default command processing timeout |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
112 * Property value's (duration) unit is ms and 0 means no timeout (infinite). |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
113 * Default value is set by driver layer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
114 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
115 NP_TIMEOUT_COMMAND, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
116 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
117 * Timeout between ATR_REQ and ATR_RES |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
118 * When the device is in initiator mode, a target is considered as mute if no |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
119 * valid ATR_RES is received within this timeout value. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
120 * Default value for this property is 103 ms on PN53x based devices. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
121 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
122 NP_TIMEOUT_ATR, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
123 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
124 * Timeout value to give up reception from the target in case of no answer. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
125 * Default value for this property is 52 ms). |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
126 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
127 NP_TIMEOUT_COM, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
128 /** Let the PN53X chip handle the CRC bytes. This means that the chip appends |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
129 * the CRC bytes to the frames that are transmitted. It will parse the last |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
130 * bytes from received frames as incoming CRC bytes. They will be verified |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
131 * against the used modulation and protocol. If an frame is expected with |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
132 * incorrect CRC bytes this option should be disabled. Example frames where |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
133 * this is useful are the ATQA and UID+BCC that are transmitted without CRC |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
134 * bytes during the anti-collision phase of the ISO14443-A protocol. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
135 NP_HANDLE_CRC, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
136 /** Parity bits in the network layer of ISO14443-A are by default generated and |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
137 * validated in the PN53X chip. This is a very convenient feature. On certain |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
138 * times though it is useful to get full control of the transmitted data. The |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
139 * proprietary MIFARE Classic protocol uses for example custom (encrypted) |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
140 * parity bits. For interoperability it is required to be completely |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
141 * compatible, including the arbitrary parity bits. When this option is |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
142 * disabled, the functions to communicating bits should be used. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
143 NP_HANDLE_PARITY, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
144 /** This option can be used to enable or disable the electronic field of the |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
145 * NFC device. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
146 NP_ACTIVATE_FIELD, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
147 /** The internal CRYPTO1 co-processor can be used to transmit messages |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
148 * encrypted. This option is automatically activated after a successful MIFARE |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
149 * Classic authentication. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
150 NP_ACTIVATE_CRYPTO1, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
151 /** The default configuration defines that the PN53X chip will try indefinitely |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
152 * to invite a tag in the field to respond. This could be desired when it is |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
153 * certain a tag will enter the field. On the other hand, when this is |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
154 * uncertain, it will block the application. This option could best be compared |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
155 * to the (NON)BLOCKING option used by (socket)network programming. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
156 NP_INFINITE_SELECT, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
157 /** If this option is enabled, frames that carry less than 4 bits are allowed. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
158 * According to the standards these frames should normally be handles as |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
159 * invalid frames. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
160 NP_ACCEPT_INVALID_FRAMES, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
161 /** If the NFC device should only listen to frames, it could be useful to let |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
162 * it gather multiple frames in a sequence. They will be stored in the internal |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
163 * FIFO of the PN53X chip. This could be retrieved by using the receive data |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
164 * functions. Note that if the chip runs out of bytes (FIFO = 64 bytes long), |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
165 * it will overwrite the first received frames, so quick retrieving of the |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
166 * received data is desirable. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
167 NP_ACCEPT_MULTIPLE_FRAMES, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
168 /** This option can be used to enable or disable the auto-switching mode to |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
169 * ISO14443-4 is device is compliant. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
170 * In initiator mode, it means that NFC chip will send RATS automatically when |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
171 * select and it will automatically poll for ISO14443-4 card when ISO14443A is |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
172 * requested. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
173 * In target mode, with a NFC chip compliant (ie. PN532), the chip will |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
174 * emulate a 14443-4 PICC using hardware capability */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
175 NP_AUTO_ISO14443_4, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
176 /** Use automatic frames encapsulation and chaining. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
177 NP_EASY_FRAMING, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
178 /** Force the chip to switch in ISO14443-A */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
179 NP_FORCE_ISO14443_A, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
180 /** Force the chip to switch in ISO14443-B */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
181 NP_FORCE_ISO14443_B, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
182 /** Force the chip to run at 106 kbps */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
183 NP_FORCE_SPEED_106, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
184 } nfc_property; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
185 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
186 // Compiler directive, set struct alignment to 1 uint8_t for compatibility |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
187 # pragma pack(1) |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
188 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
189 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
190 * @enum nfc_dep_mode |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
191 * @brief NFC D.E.P. (Data Exchange Protocol) active/passive mode |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
192 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
193 typedef enum { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
194 NDM_UNDEFINED = 0, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
195 NDM_PASSIVE, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
196 NDM_ACTIVE, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
197 } nfc_dep_mode; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
198 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
199 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
200 * @struct nfc_dep_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
201 * @brief NFC target information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092 (NFCIP-1) |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
202 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
203 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
204 /** NFCID3 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
205 uint8_t abtNFCID3[10]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
206 /** DID */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
207 uint8_t btDID; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
208 /** Supported send-bit rate */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
209 uint8_t btBS; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
210 /** Supported receive-bit rate */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
211 uint8_t btBR; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
212 /** Timeout value */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
213 uint8_t btTO; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
214 /** PP Parameters */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
215 uint8_t btPP; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
216 /** General Bytes */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
217 uint8_t abtGB[48]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
218 size_t szGB; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
219 /** DEP mode */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
220 nfc_dep_mode ndm; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
221 } nfc_dep_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
222 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
223 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
224 * @struct nfc_iso14443a_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
225 * @brief NFC ISO14443A tag (MIFARE) information |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
226 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
227 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
228 uint8_t abtAtqa[2]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
229 uint8_t btSak; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
230 size_t szUidLen; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
231 uint8_t abtUid[10]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
232 size_t szAtsLen; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
233 uint8_t abtAts[254]; // Maximal theoretical ATS is FSD-2, FSD=256 for FSDI=8 in RATS |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
234 } nfc_iso14443a_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
235 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
236 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
237 * @struct nfc_felica_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
238 * @brief NFC FeLiCa tag information |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
239 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
240 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
241 size_t szLen; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
242 uint8_t btResCode; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
243 uint8_t abtId[8]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
244 uint8_t abtPad[8]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
245 uint8_t abtSysCode[2]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
246 } nfc_felica_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
247 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
248 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
249 * @struct nfc_iso14443b_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
250 * @brief NFC ISO14443B tag information |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
251 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
252 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
253 /** abtPupi store PUPI contained in ATQB (Answer To reQuest of type B) (see ISO14443-3) */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
254 uint8_t abtPupi[4]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
255 /** abtApplicationData store Application Data contained in ATQB (see ISO14443-3) */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
256 uint8_t abtApplicationData[4]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
257 /** abtProtocolInfo store Protocol Info contained in ATQB (see ISO14443-3) */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
258 uint8_t abtProtocolInfo[3]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
259 /** ui8CardIdentifier store CID (Card Identifier) attributted by PCD to the PICC */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
260 uint8_t ui8CardIdentifier; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
261 } nfc_iso14443b_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
262 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
263 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
264 * @struct nfc_iso14443bi_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
265 * @brief NFC ISO14443B' tag information |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
266 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
267 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
268 /** DIV: 4 LSBytes of tag serial number */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
269 uint8_t abtDIV[4]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
270 /** Software version & type of REPGEN */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
271 uint8_t btVerLog; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
272 /** Config Byte, present if long REPGEN */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
273 uint8_t btConfig; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
274 /** ATR, if any */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
275 size_t szAtrLen; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
276 uint8_t abtAtr[33]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
277 } nfc_iso14443bi_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
278 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
279 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
280 * @struct nfc_iso14443b2sr_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
281 * @brief NFC ISO14443-2B ST SRx tag information |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
282 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
283 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
284 uint8_t abtUID[8]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
285 } nfc_iso14443b2sr_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
286 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
287 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
288 * @struct nfc_iso14443b2ct_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
289 * @brief NFC ISO14443-2B ASK CTx tag information |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
290 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
291 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
292 uint8_t abtUID[4]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
293 uint8_t btProdCode; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
294 uint8_t btFabCode; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
295 } nfc_iso14443b2ct_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
296 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
297 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
298 * @struct nfc_jewel_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
299 * @brief NFC Jewel tag information |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
300 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
301 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
302 uint8_t btSensRes[2]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
303 uint8_t btId[4]; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
304 } nfc_jewel_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
305 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
306 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
307 * @union nfc_target_info |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
308 * @brief Union between all kind of tags information structures. |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
309 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
310 typedef union { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
311 nfc_iso14443a_info nai; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
312 nfc_felica_info nfi; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
313 nfc_iso14443b_info nbi; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
314 nfc_iso14443bi_info nii; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
315 nfc_iso14443b2sr_info nsi; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
316 nfc_iso14443b2ct_info nci; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
317 nfc_jewel_info nji; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
318 nfc_dep_info ndi; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
319 } nfc_target_info; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
320 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
321 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
322 * @enum nfc_baud_rate |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
323 * @brief NFC baud rate enumeration |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
324 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
325 typedef enum { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
326 NBR_UNDEFINED = 0, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
327 NBR_106, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
328 NBR_212, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
329 NBR_424, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
330 NBR_847, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
331 } nfc_baud_rate; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
332 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
333 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
334 * @enum nfc_modulation_type |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
335 * @brief NFC modulation type enumeration |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
336 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
337 typedef enum { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
338 NMT_ISO14443A = 1, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
339 NMT_JEWEL, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
340 NMT_ISO14443B, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
341 NMT_ISO14443BI, // pre-ISO14443B aka ISO/IEC 14443 B' or Type B' |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
342 NMT_ISO14443B2SR, // ISO14443-2B ST SRx |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
343 NMT_ISO14443B2CT, // ISO14443-2B ASK CTx |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
344 NMT_FELICA, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
345 NMT_DEP, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
346 } nfc_modulation_type; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
347 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
348 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
349 * @enum nfc_mode |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
350 * @brief NFC mode type enumeration |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
351 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
352 typedef enum { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
353 N_TARGET, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
354 N_INITIATOR, |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
355 } nfc_mode; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
356 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
357 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
358 * @struct nfc_modulation |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
359 * @brief NFC modulation structure |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
360 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
361 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
362 nfc_modulation_type nmt; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
363 nfc_baud_rate nbr; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
364 } nfc_modulation; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
365 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
366 /** |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
367 * @struct nfc_target |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
368 * @brief NFC target structure |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
369 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
370 typedef struct { |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
371 nfc_target_info nti; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
372 nfc_modulation nm; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
373 } nfc_target; |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
374 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
375 // Reset struct alignment to default |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
376 # pragma pack() |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
377 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
378 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
379 /* Library initialization/deinitialization */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
380 void nfc_init(nfc_context **context); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
381 void nfc_exit(nfc_context *context); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
382 int nfc_register_driver(const nfc_driver *driver); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
383 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
384 /* NFC Device/Hardware manipulation */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
385 nfc_device *nfc_open(nfc_context *context, const nfc_connstring connstring); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
386 void nfc_close(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
387 int nfc_abort_command(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
388 size_t nfc_list_devices(nfc_context *context, nfc_connstring connstrings[], size_t connstrings_len); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
389 int nfc_idle(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
390 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
391 /* NFC initiator: act as "reader" */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
392 int nfc_initiator_init(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
393 int nfc_initiator_init_secure_element(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
394 int nfc_initiator_select_passive_target(nfc_device *pnd, const nfc_modulation nm, const uint8_t *pbtInitData, const size_t szInitData, nfc_target *pnt); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
395 int nfc_initiator_list_passive_targets(nfc_device *pnd, const nfc_modulation nm, nfc_target ant[], const size_t szTargets); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
396 int nfc_initiator_poll_target(nfc_device *pnd, const nfc_modulation *pnmTargetTypes, const size_t szTargetTypes, const uint8_t uiPollNr, const uint8_t uiPeriod, nfc_target *pnt); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
397 int nfc_initiator_select_dep_target(nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
398 int nfc_initiator_poll_dep_target(nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
399 int nfc_initiator_deselect_target(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
400 int nfc_initiator_transceive_bytes(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, int timeout); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
401 int nfc_initiator_transceive_bits(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
402 int nfc_initiator_transceive_bytes_timed(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, uint32_t *cycles); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
403 int nfc_initiator_transceive_bits_timed(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar, uint32_t *cycles); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
404 int nfc_initiator_target_is_present(nfc_device *pnd, const nfc_target *pnt); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
405 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
406 /* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
407 int nfc_target_init(nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRx, int timeout); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
408 int nfc_target_send_bytes(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
409 int nfc_target_receive_bytes(nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, int timeout); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
410 int nfc_target_send_bits(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
411 int nfc_target_receive_bits(nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
412 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
413 /* Error reporting */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
414 const char *nfc_strerror(const nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
415 int nfc_strerror_r(const nfc_device *pnd, char *buf, size_t buflen); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
416 void nfc_perror(const nfc_device *pnd, const char *s); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
417 int nfc_device_get_last_error(const nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
418 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
419 /* Special data accessors */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
420 const char *nfc_device_get_name(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
421 const char *nfc_device_get_connstring(nfc_device *pnd); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
422 int nfc_device_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
423 int nfc_device_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
424 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
425 /* Properties accessors */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
426 int nfc_device_set_property_int(nfc_device *pnd, const nfc_property property, const int value); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
427 int nfc_device_set_property_bool(nfc_device *pnd, const nfc_property property, const bool bEnable); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
428 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
429 /* Misc. functions */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
430 void iso14443a_crc(uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
431 void iso14443a_crc_append(uint8_t *pbtData, size_t szLen); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
432 void iso14443b_crc(uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
433 void iso14443b_crc_append(uint8_t *pbtData, size_t szLen); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
434 uint8_t *iso14443a_locate_historical_bytes(uint8_t *pbtAts, size_t szAts, size_t *pszTk); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
435 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
436 void nfc_free(void *p); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
437 const char *nfc_version(void); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
438 int nfc_device_get_information_about(nfc_device *pnd, char **buf); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
439 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
440 /* String converter functions */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
441 const char *str_nfc_modulation_type(const nfc_modulation_type nmt); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
442 const char *str_nfc_baud_rate(const nfc_baud_rate nbr); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
443 int str_nfc_target(char **buf, const nfc_target *pnt, bool verbose); |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
444 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
445 /* Error codes */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
446 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
447 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
448 * Success (no error) |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
449 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
450 #define NFC_SUCCESS 0 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
451 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
452 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
453 * Input / output error, device may not be usable anymore without re-open it |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
454 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
455 #define NFC_EIO -1 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
456 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
457 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
458 * Invalid argument(s) |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
459 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
460 #define NFC_EINVARG -2 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
461 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
462 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
463 * Operation not supported by device |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
464 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
465 #define NFC_EDEVNOTSUPP -3 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
466 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
467 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
468 * No such device |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
469 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
470 #define NFC_ENOTSUCHDEV -4 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
471 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
472 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
473 * Buffer overflow |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
474 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
475 #define NFC_EOVFLOW -5 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
476 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
477 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
478 * Operation timed out |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
479 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
480 #define NFC_ETIMEOUT -6 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
481 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
482 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
483 * Operation aborted (by user) |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
484 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
485 #define NFC_EOPABORTED -7 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
486 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
487 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
488 * Not (yet) implemented |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
489 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
490 #define NFC_ENOTIMPL -8 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
491 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
492 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
493 * Target released |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
494 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
495 #define NFC_ETGRELEASED -10 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
496 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
497 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
498 * Error while RF transmission |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
499 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
500 #define NFC_ERFTRANS -20 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
501 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
502 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
503 * MIFARE Classic: authentication failed |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
504 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
505 #define NFC_EMFCAUTHFAIL -30 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
506 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
507 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
508 * Software error (allocation, file/pipe creation, etc.) |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
509 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
510 #define NFC_ESOFT -80 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
511 /** @ingroup error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
512 * @hideinitializer |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
513 * Device's internal chip error |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
514 */ |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
515 #define NFC_ECHIP -90 |
2e684f93ec25
hacked up nfc/freefare headers for reading with ctypes2py
drewp@bigasterisk.com
parents:
diff
changeset
|
516 |