]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - armsrc/iso14443a.h
Fixed writing em410x 40bits UID on T5555/T55x7 tags on 32bits systems
[proxmark3-svn] / armsrc / iso14443a.h
... / ...
CommitLineData
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
13#ifndef __ISO14443A_H
14#define __ISO14443A_H
15#include "common.h"
16
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
22#define CARD_MEMORY_LEN 4096
23
24typedef struct nestedVector { uint32_t nt, ks1; } nestedVector;
25
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
80extern byte_t oddparity (const byte_t bt);
81extern uint32_t GetParity(const uint8_t * pbtCmd, int iLen);
82extern void AppendCrc14443a(uint8_t* data, int len);
83
84extern void ReaderTransmitShort(const uint8_t* bt);
85extern void ReaderTransmit(uint8_t* frame, int len);
86extern void ReaderTransmitPar(uint8_t* frame, int len, uint32_t par);
87extern int ReaderReceive(uint8_t* receivedAnswer);
88extern int ReaderReceivePar(uint8_t* receivedAnswer, uint32_t * parptr);
89
90extern void iso14443a_setup();
91extern int iso14443a_select_card(uint8_t * uid_ptr, iso14a_card_select_t * resp_data, uint32_t * cuid_ptr);
92extern void iso14a_set_trigger(int enable);
93
94extern void iso14a_clear_tracelen(void);
95extern void iso14a_set_tracing(int enable);
96
97#endif /* __ISO14443A_H */
Impressum, Datenschutz