+ UsbCommand c = {CMD_T55XX_READ_TRACE, {0, 0, 0}};\r
+ SendCommand(&c);\r
+ if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {\r
+ PrintAndLog("command execution time out");\r
+ return 1;\r
+ }\r
+ //darn\r
+ //CmdSamples("12000");\r
+ }\r
+ \r
+ size_t bitlen = getFromGraphBuf(bits);\r
+ if ( bitlen == 0 )\r
+ return 2;\r
+ \r
+ RepaintGraphWindow();\r
+\r
+ uint8_t si = 5;\r
+ uint32_t bl0 = PackBits(si, 32, bits);\r
+ uint32_t bl1 = PackBits(si+32, 32, bits);\r
+ \r
+ uint32_t acl = PackBits(si, 8, bits); si += 8;\r
+ uint32_t mfc = PackBits(si, 8, bits); si += 8;\r
+ uint32_t cid = PackBits(si, 5, bits); si += 5;\r
+ uint32_t icr = PackBits(si, 3, bits); si += 3;\r
+ uint32_t year = PackBits(si, 4, bits); si += 4;\r
+ uint32_t quarter = PackBits(si, 2, bits); si += 2;\r
+ uint32_t lotid = PackBits(si, 12, bits); si += 12;\r
+ uint32_t wafer = PackBits(si, 5, bits); si += 5;\r
+ uint32_t dw = PackBits(si, 15, bits); \r
+ \r
+ PrintAndLog("");\r
+ PrintAndLog("-- T55xx Trace Information ----------------------------------");\r
+ PrintAndLog("-------------------------------------------------------------");\r
+ PrintAndLog(" ACL Allocation class (ISO/IEC 15963-1) : 0x%02X (%d)", acl, acl);\r
+ PrintAndLog(" MFC Manufacturer ID (ISO/IEC 7816-6) : 0x%02X (%d)", mfc, mfc);\r
+ PrintAndLog(" CID : 0x%02X (%d)", cid, cid);\r
+ PrintAndLog(" ICR IC Revision : %d",icr );\r
+ PrintAndLog(" Manufactured");\r
+ PrintAndLog(" Year/Quarter : %d/%d",2000+year, quarter );\r
+ PrintAndLog(" Lot ID : %d", lotid );\r
+ PrintAndLog(" Wafer number : %d", wafer);\r
+ PrintAndLog(" Die Number : %d", dw);\r
+ PrintAndLog("-------------------------------------------------------------");\r
+ PrintAndLog(" Raw Data - Page 1");\r
+ PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(bits+5,32) );\r
+ PrintAndLog(" Block 0 : 0x%08X %s", bl1, sprint_bin(bits+37,32) );\r
+ PrintAndLog("-------------------------------------------------------------");\r
+ /*\r
+ TRACE - BLOCK O\r
+ Bits Definition HEX\r
+ 1-8 ACL Allocation class (ISO/IEC 15963-1) 0xE0 \r
+ 9-16 MFC Manufacturer ID (ISO/IEC 7816-6) 0x15 Atmel Corporation\r
+ 17-21 CID 0x1 = Atmel ATA5577M1 0x2 = Atmel ATA5577M2 \r
+ 22-24 ICR IC revision\r
+ 25-28 YEAR (BCD encoded) 9 (= 2009)\r
+ 29-30 QUARTER 1,2,3,4 \r
+ 31-32 LOT ID\r
+ \r
+ TRACE - BLOCK 1\r
+ 1-12 LOT ID \r
+ 13-17 Wafer number\r
+ 18-32 DW, die number sequential\r
+ */\r