]>
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 <stddef.h> | |
17 | #include <stdint.h> | |
18 | #include <stdbool.h> | |
19 | #include "usb_cmd.h" | |
20 | #include "mifare.h" | |
21 | ||
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 | ||
31 | extern void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par); | |
32 | extern void AppendCrc14443a(uint8_t *data, int len); | |
33 | ||
34 | extern void RAMFUNC SnoopIso14443a(uint8_t param); | |
35 | extern void SimulateIso14443aTag(int tagType, int uid_1st, int uid_2nd, uint8_t *data); | |
36 | extern void ReaderIso14443a(UsbCommand *c); | |
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); | |
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); | |
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, bool send_chaining, void *data, uint8_t *res); | |
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 | extern uint32_t iso14a_get_timeout(void); | |
57 | #endif /* __ISO14443A_H */ |