fix const params, logic, casting
[RRG-proxmark3.git] / include / iso15.h
blob0d19c17565ea3dd023f9f9ec99c732d333f6d14c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // ISO 15693 type prototyping
17 //-----------------------------------------------------------------------------
19 #ifndef _ISO15_H_
20 #define _ISO15_H_
22 #include "common.h"
23 typedef struct {
24 uint8_t uid[8];
25 uint8_t uidlen;
26 uint8_t atqb[7];
27 uint8_t chipid;
28 uint8_t cid;
29 } PACKED iso15_card_select_t;
31 typedef enum ISO15_COMMAND {
32 ISO15_CONNECT = (1 << 0),
33 ISO15_NO_DISCONNECT = (1 << 1),
34 ISO15_RAW = (1 << 2),
35 ISO15_APPEND_CRC = (1 << 3),
36 ISO15_HIGH_SPEED = (1 << 4),
37 ISO15_READ_RESPONSE = (1 << 5),
38 ISO15_LONG_WAIT = (1 << 6),
39 } iso15_command_t;
41 typedef struct {
42 uint8_t flags; // PM3 Flags - see iso15_command_t
43 uint16_t rawlen;
44 uint8_t raw[]; // First byte in raw, raw[0] is ISO15693 protocol flag byte
45 } PACKED iso15_raw_cmd_t;
47 #define ISO15693_TAG_MAX_PAGES 160 // in pages (0xA0)
48 #define ISO15693_TAG_MAX_SIZE 2048 // in byte (64 pages of 256 bits)
50 typedef struct {
51 uint8_t uid[8];
52 uint8_t dsfid;
53 bool dsfidLock;
54 uint8_t afi;
55 bool afiLock;
56 uint8_t bytesPerPage;
57 uint8_t pagesCount;
58 uint8_t ic;
59 uint8_t locks[ISO15693_TAG_MAX_PAGES];
60 uint8_t data[ISO15693_TAG_MAX_SIZE];
61 uint8_t random[2];
62 uint8_t privacyPasswd[4];
63 enum {
64 TAG_STATE_NO_FIELD,
65 TAG_STATE_READY,
66 TAG_STATE_ACTIVATED, // useless ?
67 TAG_STATE_SELECTED,
68 TAG_STATE_SILENCED
69 } state;
70 bool expectFast;
71 bool expectFsk;
72 } PACKED iso15_tag_t;
74 #endif // _ISO15_H_