]>
Commit | Line | Data |
---|---|---|
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 | |
1f065e1d | 15 | |
de77d4ac | 16 | #include <stdint.h> |
17 | #include <stdbool.h> | |
6e49717b | 18 | #include "usb_cmd.h" |
de77d4ac | 19 | #include "mifare.h" |
b62a5a84 | 20 | |
6e49717b | 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 | ||
6a1f2d82 | 30 | extern void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par); |
e691fc45 | 31 | extern void AppendCrc14443a(uint8_t *data, int len); |
20f9a2a1 | 32 | |
6e49717b | 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); | |
6a1f2d82 | 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); | |
6e49717b | 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); | |
b35e04a7 | 44 | extern int EmSendCmdEx(uint8_t *resp, uint16_t respLen); |
6e49717b | 45 | extern int EmSend4bit(uint8_t resp); |
46 | extern int EmSendCmdPar(uint8_t *resp, uint16_t respLen, uint8_t *par); | |
b35e04a7 | 47 | extern int EmSendPrecompiledCmd(tag_response_info_t *response_info); |
6e49717b | 48 | |
49 | extern bool prepare_allocated_tag_modulation(tag_response_info_t *response_info, uint8_t **buffer, size_t *buffer_size); | |
20f9a2a1 | 50 | |
7bc95e2e | 51 | extern void iso14443a_setup(uint8_t fpga_minor_mode); |
6a1f2d82 | 52 | extern int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, void *data); |
c04a4b60 | 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); |
902cb3c0 | 54 | extern void iso14a_set_trigger(bool enable); |
275d9e61 | 55 | extern void iso14a_set_timeout(uint32_t timeout); |
534983d7 | 56 | #endif /* __ISO14443A_H */ |