]>
Commit | Line | Data |
---|---|---|
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 | ||
16 | #include <stdint.h> | |
17 | #include <stdbool.h> | |
18 | #include "usb_cmd.h" | |
19 | #include "mifare.h" | |
20 | ||
21 | typedef struct { | |
22 | uint8_t* response; | |
23 | uint8_t* modulation; | |
24 | uint16_t response_n; | |
25 | uint16_t modulation_n; | |
26 | uint32_t ProxToAirDuration; | |
27 | uint8_t par; // enough for precalculated parity of 8 Byte responses | |
28 | } tag_response_info_t; | |
29 | ||
30 | extern void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par); | |
31 | extern void AppendCrc14443a(uint8_t *data, int len); | |
32 | ||
33 | extern void RAMFUNC SnoopIso14443a(uint8_t param); | |
34 | extern void SimulateIso14443aTag(int tagType, int uid_1st, int uid_2nd, byte_t *data); | |
35 | extern void ReaderIso14443a(UsbCommand *c); | |
36 | extern void ReaderTransmit(uint8_t *frame, uint16_t len, uint32_t *timing); | |
37 | extern void ReaderTransmitBitsPar(uint8_t *frame, uint16_t bits, uint8_t *par, uint32_t *timing); | |
38 | extern void ReaderTransmitPar(uint8_t *frame, uint16_t len, uint8_t *par, uint32_t *timing); | |
39 | extern int ReaderReceive(uint8_t *receivedAnswer, uint8_t *par); | |
40 | extern void ReaderMifare(bool first_try); | |
41 | ||
42 | extern int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *parity); | |
43 | extern int EmSendCmd(uint8_t *resp, uint16_t respLen); | |
44 | extern int EmSendCmdEx(uint8_t *resp, uint16_t respLen); | |
45 | extern int EmSend4bit(uint8_t resp); | |
46 | extern int EmSendCmdPar(uint8_t *resp, uint16_t respLen, uint8_t *par); | |
47 | extern int EmSendPrecompiledCmd(tag_response_info_t *response_info); | |
48 | ||
49 | extern bool prepare_allocated_tag_modulation(tag_response_info_t *response_info, uint8_t **buffer, size_t *buffer_size); | |
50 | ||
51 | extern void iso14443a_setup(uint8_t fpga_minor_mode); | |
52 | extern int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, void *data); | |
53 | extern int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *resp_data, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats); | |
54 | extern void iso14a_set_trigger(bool enable); | |
55 | extern void iso14a_set_timeout(uint32_t timeout); | |
56 | #endif /* __ISO14443A_H */ |