]>
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 | |
72622d64 | 16 | #include <stddef.h> |
de77d4ac | 17 | #include <stdint.h> |
18 | #include <stdbool.h> | |
6e49717b | 19 | #include "usb_cmd.h" |
de77d4ac | 20 | #include "mifare.h" |
b62a5a84 | 21 | |
6e49717b | 22 | typedef struct { |
23 | uint8_t* response; | |
24 | uint8_t* modulation; | |
25 | uint16_t response_n; | |
26 | uint16_t modulation_n; | |
27 | uint32_t ProxToAirDuration; | |
28 | uint8_t par; // enough for precalculated parity of 8 Byte responses | |
29 | } tag_response_info_t; | |
30 | ||
6a1f2d82 | 31 | extern void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par); |
e691fc45 | 32 | extern void AppendCrc14443a(uint8_t *data, int len); |
20f9a2a1 | 33 | |
6e49717b | 34 | extern void RAMFUNC SnoopIso14443a(uint8_t param); |
72622d64 | 35 | extern void SimulateIso14443aTag(int tagType, int uid_1st, int uid_2nd, uint8_t *data); |
6e49717b | 36 | extern void ReaderIso14443a(UsbCommand *c); |
6a1f2d82 | 37 | extern void ReaderTransmit(uint8_t *frame, uint16_t len, uint32_t *timing); |
38 | extern void ReaderTransmitBitsPar(uint8_t *frame, uint16_t bits, uint8_t *par, uint32_t *timing); | |
39 | extern void ReaderTransmitPar(uint8_t *frame, uint16_t len, uint8_t *par, uint32_t *timing); | |
40 | extern int ReaderReceive(uint8_t *receivedAnswer, uint8_t *par); | |
6e49717b | 41 | extern void ReaderMifare(bool first_try); |
42 | ||
43 | extern int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *parity); | |
44 | extern int EmSendCmd(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); |
189b8177 | 52 | extern int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, bool send_chaining, void *data, uint8_t *res); |
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); |
a749b1e5 | 56 | extern uint32_t iso14a_get_timeout(void); |
534983d7 | 57 | #endif /* __ISO14443A_H */ |