1 //-----------------------------------------------------------------------------
2 // Copyright (C) Jonathan Westhues, Nov 2006
3 // Copyright (C) Greg Jones, Jan 2009
4 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // See LICENSE.txt for the text of the license.
17 //-----------------------------------------------------------------------------
18 // Definitions internal to the app source.
19 //-----------------------------------------------------------------------------
24 #include "pm3_cmd.h" // struct
28 // Delays in SSP_CLK ticks.
29 // SSP_CLK runs at 13,56MHz / 32 = 423.75kHz when simulating a tag
30 #define DELAY_ISO15693_VCD_TO_VICC_SIM 132 // 132/423.75kHz = 311.5us from end of command EOF to start of tag response
32 //SSP_CLK runs at 13.56MHz / 4 = 3,39MHz when acting as reader. All values should be multiples of 16
33 #define DELAY_ISO15693_VCD_TO_VICC_READER 1056 // 1056/3,39MHz = 311.5us from end of command EOF to start of tag response
34 #define DELAY_ISO15693_VICC_TO_VCD_READER 1024 // 1024/3.39MHz = 302.1us between end of tag response and next reader command
36 void Iso15693InitReader(void);
37 void Iso15693InitTag(void);
38 void CodeIso15693AsReader(const uint8_t *cmd
, int n
);
39 void CodeIso15693AsTag(const uint8_t *cmd
, size_t len
);
41 void TransmitTo15693Reader(const uint8_t *cmd
, size_t len
, uint32_t *start_time
, uint32_t slot_time
, bool slow
);
42 int GetIso15693CommandFromReader(uint8_t *received
, size_t max_len
, uint32_t *eof_time
);
43 void TransmitTo15693Tag(const uint8_t *cmd
, int len
, uint32_t *start_time
, bool shallow_mod
);
44 int GetIso15693AnswerFromTag(uint8_t *response
, uint16_t max_len
, uint16_t timeout
, uint32_t *eof_time
, bool fsk
, bool recv_speed
, uint16_t *resp_len
);
46 //void RecordRawAdcSamplesIso15693(void);
47 void AcquireRawAdcSamplesIso15693(void);
48 void ReaderIso15693(iso15_card_select_t
*p_card
); // ISO15693 reader
49 void EmlClearIso15693(void);
50 void SimTagIso15693(const uint8_t *uid
, uint8_t block_size
); // simulate an ISO15693 tag
51 void BruteforceIso15693Afi(uint32_t flags
); // find an AFI of a tag
52 void SendRawCommand15693(iso15_raw_cmd_t
*packet
); // send arbitrary commands from CLI
54 void SniffIso15693(uint8_t jam_search_len
, uint8_t *jam_search_string
, bool iclass
);
56 int SendDataTag(const uint8_t *send
, int sendlen
, bool init
, bool speed_fast
, uint8_t *recv
,
57 uint16_t max_recv_len
, uint32_t start_time
, uint16_t timeout
, uint32_t *eof_time
, uint16_t *resp_len
);
59 int SendDataTagEOF(uint8_t *recv
, uint16_t max_recv_len
, uint32_t start_time
, uint16_t timeout
, uint32_t *eof_time
, bool fsk
, bool recv_speed
, uint16_t *resp_len
);
61 void SetTag15693Uid(const uint8_t *uid
);
62 void SetTag15693Uid_v2(const uint8_t *uid
);
64 void WritePasswordSlixIso15693(const uint8_t *old_password
, const uint8_t *new_password
, uint8_t pwd_id
);
65 void DisablePrivacySlixIso15693(const uint8_t *password
);
66 void EnablePrivacySlixIso15693(const uint8_t *password
);
67 void DisableEAS_AFISlixIso15693(const uint8_t *password
, bool usepwd
);
68 void EnableEAS_AFISlixIso15693(const uint8_t *password
, bool usepwd
);
69 void PassProtextEASSlixIso15693(const uint8_t *password
);
70 void PassProtectAFISlixIso15693(const uint8_t *password
);
71 void WriteAFIIso15693(const uint8_t *password
, bool use_pwd
, uint8_t *uid
, bool use_uid
, uint8_t afi
);