+#include "lfdemod.h"\r
+#include "../common/crc.h"\r
+\r
+#define LF_TRACE_BUFF_SIZE 20000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..)\r
+#define LF_BITSSTREAM_LEN 1000 // more then 1000 bits shouldn't happend.. 8block * 4 bytes * 8bits = \r
+\r
+// 0 = FSK\r
+// 1 = ASK\r
+// 2 = PSK\r
+// 4 = NZR (direct)\r
+typedef struct {\r
+ uint8_t modulation;\r
+ bool inversed;\r
+ uint32_t block0;\r
+} t55xx_conf_block;\r
+\r
+// Default configuration: FSK, not inversed.\r
+t55xx_conf_block config = {0x00, FALSE, 0x00};\r
+\r
+ // FSK\r
+ // FSK inverted\r
+ //FSKrawDemod("", FALSE)\r
+ //FSKrawDemod("1", FALSE)\r
+\r
+ // ASK/MAN\r
+ // ASK/MAN inverted\r
+ //ASKmanDemod("", FALSE, FALSE)\r
+ \r
+ // NZR (autoclock, normal, maxerrors 1)\r
+ // NZR (autoclock, inverse, maxerrors 1)\r
+ //NRZrawDemod("0 0 1", FALSE) ) {\r
+ \r
+ // PSK (autoclock, normal, maxerrors 1)\r
+ // PSK (autoclock, inverse, maxerrors 1)\r
+ //PSKDemod("0 0 1", FALSE)\r
+\r
+int usage_t55xx_config(){\r
+ PrintAndLog("Usage: lf t55xx config [d <demodulation>] [i 0|1]");\r
+ PrintAndLog("Options: ");\r
+ PrintAndLog(" h This help");\r
+ PrintAndLog(" d <> Set demodulation FSK / ASK / PSK / NZR");\r
+ PrintAndLog(" i [0|1] Inverse data signal, Default: 0");\r
+ PrintAndLog("Examples:");\r
+ PrintAndLog(" lf t55xx config d FSK ");\r
+ PrintAndLog(" FSK demodulation");\r
+ PrintAndLog(" lf t55xx config d FSK i 1");\r
+ PrintAndLog(" FSK demodulation, inverse data");\r
+ PrintAndLog(" lf dump");\r
+ PrintAndLog(" Dumps all block from tag");\r
+ PrintAndLog(" lf trace");\r
+ PrintAndLog(" Read trace block and decode it");\r
+ PrintAndLog(" lf info");\r
+ PrintAndLog(" Read configuration and decode it");\r
+ return 0;\r
+}\r
+int usage_t55xx_read(){\r
+ PrintAndLog("Usage: lf t55xx read <block> <password>");\r
+ PrintAndLog(" <block>, block number to read. Between 0-7");\r
+ PrintAndLog(" <password>, OPTIONAL password (8 hex characters)");\r
+ PrintAndLog("");\r
+ PrintAndLog(" sample: lf t55xx read 0 = try reading data from block 0");\r
+ PrintAndLog(" : lf t55xx read 0 feedbeef = try reading data from block 0 using password");\r
+ PrintAndLog("");\r
+ return 0;\r
+}\r
+int usage_t55xx_write(){\r
+ PrintAndLog("Usage: lf t55xx wr <block> <data> [password]");\r
+ PrintAndLog(" <block>, block number to read. Between 0-7");\r
+ PrintAndLog(" <data>, 4 bytes of data to write (8 hex characters)");\r
+ PrintAndLog(" [password], OPTIONAL password 4bytes (8 hex characters)");\r
+ PrintAndLog("");\r
+ PrintAndLog(" sample: lf t55xx wd 3 11223344 = try writing data 11223344 to block 3");\r
+ PrintAndLog(" : lf t55xx wd 3 11223344 feedbeef = try writing data 11223344 to block 3 using password feedbeef");\r
+ PrintAndLog("");\r
+ return 0;\r
+}\r
+int usage_t55xx_trace() {\r
+ PrintAndLog("Usage: lf t55xx trace [graph buffer data]");\r
+ PrintAndLog(" [graph buffer data], if set, use Graphbuffer otherwise read data from tag.");\r
+ PrintAndLog("");\r
+ PrintAndLog(" sample: lf t55xx trace");\r
+ PrintAndLog(" : lf t55xx trace 1");\r
+ PrintAndLog("");\r
+ return 0;\r
+}\r
+int usage_t55xx_info() {\r
+ PrintAndLog("Usage: lf t55xx info [graph buffer data]");\r
+ PrintAndLog(" [graph buffer data], if set, use Graphbuffer otherwise read data from tag.");\r
+ PrintAndLog("");\r
+ PrintAndLog(" sample: lf t55xx info");\r
+ PrintAndLog(" : lf t55xx info 1");\r
+ PrintAndLog("");\r
+ return 0;\r
+}\r
+int usage_t55xx_dump(){\r
+ PrintAndLog("Usage: lf t55xx dump <password>");\r
+ PrintAndLog(" <password>, OPTIONAL password 4bytes (8 hex characters)");\r
+ PrintAndLog("");\r
+ PrintAndLog(" sample: lf t55xx dump");\r
+ PrintAndLog(" : lf t55xx dump feedbeef");\r
+ PrintAndLog("");\r
+ return 0;\r
+}\r