]> git.zerfleddert.de Git - proxmark3-svn/blame - armsrc/iso14443a.h
Fixed writing em410x 40bits UID on T5555/T55x7 tags on 32bits systems
[proxmark3-svn] / armsrc / iso14443a.h
CommitLineData
f397b5cc
M
1//-----------------------------------------------------------------------------
2// Merlok - June 2011
3// Gerhard de Koning Gans - May 2008
4// Hagen Fritsch - June 2010
5//
6// This code is licensed to you under the terms of the GNU GPL, version 2 or,
7// at your option, any later version. See the LICENSE.txt file for the text of
8// the license.
9//-----------------------------------------------------------------------------
10// Routines to support ISO 14443 type A.
11//-----------------------------------------------------------------------------
12
534983d7 13#ifndef __ISO14443A_H
14#define __ISO14443A_H
15#include "common.h"
16
8f51ddb0
M
17// mifare reader over DMA buffer (SnoopIso14443a())!!!
18#define MIFARE_BUFF_OFFSET 3560 // \/ \/ \/
19// card emulator memory
20#define EML_RESPONSES 4000
21#define CARD_MEMORY 6000
aea4d766 22#define CARD_MEMORY_LEN 4096
8f51ddb0 23
f89c7050
M
24typedef struct nestedVector { uint32_t nt, ks1; } nestedVector;
25
b62a5a84
M
26typedef struct {
27 enum {
28 DEMOD_UNSYNCD,
29 DEMOD_START_OF_COMMUNICATION,
30 DEMOD_MANCHESTER_D,
31 DEMOD_MANCHESTER_E,
32 DEMOD_MANCHESTER_F,
33 DEMOD_ERROR_WAIT
34 } state;
35 int bitCount;
36 int posCount;
37 int syncBit;
38 int parityBits;
39 uint16_t shiftReg;
40 int buffer;
41 int buff;
42 int samples;
43 int len;
44 enum {
45 SUB_NONE,
46 SUB_FIRST_HALF,
47 SUB_SECOND_HALF
48 } sub;
49 uint8_t *output;
50} tDemod;
51
52typedef struct {
53 enum {
54 STATE_UNSYNCD,
55 STATE_START_OF_COMMUNICATION,
56 STATE_MILLER_X,
57 STATE_MILLER_Y,
58 STATE_MILLER_Z,
59 STATE_ERROR_WAIT
60 } state;
61 uint16_t shiftReg;
62 int bitCnt;
63 int byteCnt;
64 int byteCntMax;
65 int posCnt;
66 int syncBit;
67 int parityBits;
68 int samples;
69 int highCnt;
70 int bitBuffer;
71 enum {
72 DROP_NONE,
73 DROP_FIRST_HALF,
74 DROP_SECOND_HALF
75 } drop;
76 uint8_t *output;
77} tUart;
78
79
20f9a2a1
M
80extern byte_t oddparity (const byte_t bt);
81extern uint32_t GetParity(const uint8_t * pbtCmd, int iLen);
534983d7 82extern void AppendCrc14443a(uint8_t* data, int len);
20f9a2a1 83
534983d7 84extern void ReaderTransmitShort(const uint8_t* bt);
85extern void ReaderTransmit(uint8_t* frame, int len);
20f9a2a1 86extern void ReaderTransmitPar(uint8_t* frame, int len, uint32_t par);
534983d7 87extern int ReaderReceive(uint8_t* receivedAnswer);
f89c7050 88extern int ReaderReceivePar(uint8_t* receivedAnswer, uint32_t * parptr);
20f9a2a1 89
534983d7 90extern void iso14443a_setup();
20f9a2a1 91extern int iso14443a_select_card(uint8_t * uid_ptr, iso14a_card_select_t * resp_data, uint32_t * cuid_ptr);
534983d7 92extern void iso14a_set_trigger(int enable);
93
8556b852
M
94extern void iso14a_clear_tracelen(void);
95extern void iso14a_set_tracing(int enable);
8556b852 96
534983d7 97#endif /* __ISO14443A_H */
Impressum, Datenschutz