BOOL hitag2_config_block_show(BYTE *config, BYTE *password, BYTE *key) { BYTE value= hextobyte(config); // first byte only used as config UserMessage(" PWD Block (1): %.8s ", password); printhexreadable(password, 4); UserMessage("\r\n\r\n Key Block (2): %.8s ", key); printhexreadable(key, 4); UserMessage("\r\n\r\n Config Block (3): %.8s\r\n\r\n", config); UserMessageNum(" Page 1 & 2: %d = ", GET_CONFIG(value, HITAG2_MASK_PAGE_1_2_OTP_PROTECT, HITAG2_SHIFT_PAGE_1_2_OTP_PROTECT)); if(GET_CONFIG(value, HITAG2_MASK_SECURITY, HITAG2_SHIFT_SECURITY)) UserMessage("%s\r\n", GET_CONFIG(value, HITAG2_MASK_PAGE_1_2_OTP_PROTECT, HITAG2_SHIFT_PAGE_1_2_OTP_PROTECT) ? "No Read / No Write" : "Read / Write"); else UserMessage("%s\r\n", GET_CONFIG(value, HITAG2_MASK_PAGE_1_2_OTP_PROTECT, HITAG2_SHIFT_PAGE_1_2_OTP_PROTECT) ? "Page 1: No Read / No Write, Page 2: Read Only" : "Read / Write"); UserMessageNum(" Page 3: %d = ", GET_CONFIG(value, HITAG2_MASK_PAGE_3_OTP_PROTECT, HITAG2_SHIFT_PAGE_3_OTP_PROTECT)); UserMessage("%s\r\n", GET_CONFIG(value, HITAG2_MASK_PAGE_3_OTP_PROTECT, HITAG2_SHIFT_PAGE_3_OTP_PROTECT) ? "Read Only" : "Read / Write"); UserMessageNum(" Page 4 & 5: %d = ", GET_CONFIG(value, HITAG2_MASK_PAGE_4_5_PROTECT, HITAG2_SHIFT_PAGE_4_5_PROTECT)); UserMessage("%s\r\n", GET_CONFIG(value, HITAG2_MASK_PAGE_4_5_PROTECT, HITAG2_SHIFT_PAGE_4_5_PROTECT) ? "Read Only" : "Read / Write"); UserMessageNum(" Page 6 & 7: %d = ", GET_CONFIG(value, HITAG2_MASK_PAGE_6_7_PROTECT, HITAG2_SHIFT_PAGE_6_7_PROTECT)); UserMessage("%s\r\n", GET_CONFIG(value, HITAG2_MASK_PAGE_6_7_PROTECT, HITAG2_SHIFT_PAGE_6_7_PROTECT) ? "Read Only" : "Read / Write"); UserMessageNum(" Security: %d = ", GET_CONFIG(value, HITAG2_MASK_SECURITY, HITAG2_SHIFT_SECURITY)); UserMessage("%s\r\n", GET_CONFIG(value, HITAG2_MASK_SECURITY, HITAG2_SHIFT_SECURITY) ? "Crypto" : "Password"); UserMessageNum(" Mode: %d = ", GET_CONFIG(value, HITAG2_MASK_MODE, HITAG2_SHIFT_MODE)); UserMessage("%s\r\n", (BYTE *) Hitag2_Modes[GET_CONFIG(value, HITAG2_MASK_MODE, HITAG2_SHIFT_MODE)]); UserMessageNum(" Modulation: %d = ", GET_CONFIG(value, HITAG2_MASK_MODULATION, HITAG2_SHIFT_MODULATION)); UserMessage("%s\r\n", GET_CONFIG(value, HITAG2_MASK_MODULATION, HITAG2_SHIFT_MODULATION) ? "BiPhase" : "Manchester"); UserMessage("\r\n PWD Block (3): %.6s ", config + 2); printhexreadable(config + 2, 3); UserMessage("%s", "\r\n"); return TRUE; }
BOOL q5_config_block_show(BYTE *config, BYTE *password) { uint32_t value= hextoulong(config); UserMessage(" Config Block (0): %.8s\r\n\r\n", config); UserMessage(" Page Select: %s\r\n", GET_CONFIG(value, Q5_MASK_PAGE_SELECT, Q5_SHIFT_PAGE_SELECT) ? "True" : "False"); UserMessage(" Fast Write: %s\r\n", GET_CONFIG(value, Q5_MASK_FAST_WRITE, Q5_SHIFT_FAST_WRITE) ? "True" : "False"); UserMessageNum(" Data Rate: %02d = ", GET_CONFIG(value, Q5_MASK_DATA_BIT_RATE, Q5_SHIFT_DATA_BIT_RATE)); UserMessageNum("%d * FC\r\n", GET_CONFIG(value, Q5_MASK_DATA_BIT_RATE, Q5_SHIFT_DATA_BIT_RATE) * 2 + 2); UserMessage(" Use AOR: %s\r\n", GET_CONFIG(value, Q5_MASK_USE_AOR, Q5_SHIFT_USE_AOR) ? "True" : "False"); UserMessage(" Use PWD: %s\r\n", GET_CONFIG(value, Q5_MASK_USE_PWD, Q5_SHIFT_USE_PWD) ? "True" : "False"); UserMessageNum(" PSK Carrier: %d = ", GET_CONFIG(value, Q5_MASK_PSK_CARRIER_FREQ, Q5_SHIFT_PSK_CARRIER_FREQ)); UserMessageNum("%d * FC\r\n", PSK_Rates[GET_CONFIG(value, Q5_MASK_PSK_CARRIER_FREQ, Q5_SHIFT_PSK_CARRIER_FREQ)]); UserMessage(" Inverse Data: %s\r\n", GET_CONFIG(value, Q5_MASK_INVERSE_DATA, Q5_SHIFT_INVERSE_DATA) ? "True" : "False"); UserMessageNum(" Modulation: %d = ", GET_CONFIG(value, Q5_MASK_MODULATION, Q5_SHIFT_MODULATION)); UserMessage("%s\r\n", (BYTE *) Q5_Modulation[GET_CONFIG(value, Q5_MASK_MODULATION, Q5_SHIFT_MODULATION)]); UserMessageNum(" Max Block: %d\r\n", GET_CONFIG(value, Q5_MASK_MAX_BLOCK, Q5_SHIFT_MAX_BLOCK)); UserMessage(" ST: %s\r\n", GET_CONFIG(value, Q5_MASK_ST, Q5_SHIFT_ST) ? "True" : "False"); UserMessage("\r\n PWD Block (7): %.8s ", password); printhexreadable(password, 4); UserMessage("%s", "\r\n"); return TRUE; }
BOOL t55x7_config_block_show(BYTE *config, BYTE *password) { uint32_t value= hextoulong(config); BOOL xmode; UserMessage(" Config Block (0): %.8s\r\n\r\n", config); UserMessageNum(" Master Key: %d = ", GET_CONFIG(value, T55X7_MASK_MASTER_KEY, T55X7_SHIFT_MASTER_KEY)); if(GET_CONFIG(value, T55X7_MASK_MASTER_KEY, T55X7_SHIFT_MASTER_KEY) == T55X7_COMPAT_MODE) UserMessage("%s\r\n", "Compatibility Mode"); else if(GET_CONFIG(value, T55X7_MASK_MASTER_KEY, T55X7_SHIFT_MASTER_KEY) == T55X7_XMODE_MODE) UserMessage("%s\r\n", "Extended Mode"); else UserMessage("%s\r\n", "Undefined Mode"); xmode= GET_CONFIG(value, T55X7_MASK_XMODE, T55X7_SHIFT_XMODE); UserMessage(" X-Mode: %s\r\n", xmode ? "True" : "False"); // display additional/alternate fields if in xmode if(xmode) { UserMessageNum(" Data Rate: %02d = ", GET_CONFIG(value, T55X7_XMODE_MASK_DATA_BIT_RATE, T55X7_SHIFT_DATA_BIT_RATE)); UserMessageNum("%d * FC\r\n", GET_CONFIG(value, T55X7_XMODE_MASK_DATA_BIT_RATE, T55X7_SHIFT_DATA_BIT_RATE) * 2 + 2); UserMessageNum(" Modulation: %02d = ", GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION)); if(GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION) > 8) { if(GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION)== T55X7_MOD_BIPHASE_50) UserMessage("%s\r\n", "BiPhase ('50)"); else if (GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION)== T55X7_MOD_BIPHASE_57) UserMessage("%s\r\n", "BiPhase ('57)"); else UserMessage("%s\r\n", "Invalid"); } else UserMessage("%s\r\n", (BYTE *) T55x7_Compat_Modulation[GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION)]); UserMessage(" SST: %s\r\n", GET_CONFIG(value, T55X7_XMODE_MASK_SST, T55X7_SHIFT_ST_SST) ? "True" : "False"); } else { UserMessageNum(" Data Rate: %02d = ", GET_CONFIG(value, T55X7_COMPAT_MASK_DATA_BIT_RATE, T55X7_SHIFT_DATA_BIT_RATE)); UserMessageNum("%d * FC\r\n", T55x7_Compat_Data_Rates[GET_CONFIG(value, T55X7_COMPAT_MASK_DATA_BIT_RATE, T55X7_SHIFT_DATA_BIT_RATE)]); UserMessageNum(" Modulation: %02d = ", GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION)); if(GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION) > 8) { if(GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION)== 16) UserMessage("%s\r\n", "BiPhase ('50)"); else UserMessage("%s\r\n", "Reserved/Invalid"); } else UserMessage("%s\r\n", (BYTE *) T55x7_Compat_Modulation[GET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION)]); UserMessage(" ST: %s\r\n", GET_CONFIG(value, T55X7_COMPAT_MASK_ST, T55X7_SHIFT_ST_SST) ? "True" : "False"); } // display common fields UserMessageNum(" PSK Carrier: %d = ", GET_CONFIG(value, T55X7_MASK_PSK_CARRIER_FREQ, T55X7_SHIFT_PSK_CARRIER_FREQ)); if(GET_CONFIG(value, T55X7_MASK_PSK_CARRIER_FREQ, T55X7_SHIFT_PSK_CARRIER_FREQ) > 2) UserMessage("%s\r\n", "Reserved"); else UserMessageNum("%d * FC\r\n", GET_CONFIG(value, T55X7_MASK_PSK_CARRIER_FREQ, T55X7_SHIFT_PSK_CARRIER_FREQ) * 2 + 2); UserMessageNum(" Maxblock: %d\r\n", GET_CONFIG(value, T55X7_MASK_MAX_BLOCK, T55X7_SHIFT_MAX_BLOCK)); UserMessage(" AOR: %s\r\n", GET_CONFIG(value, T55X7_MASK_AOR, T55X7_SHIFT_AOR) ? "True" : "False"); UserMessage(" OTP: %s\r\n", GET_CONFIG(value, T55X7_MASK_OTP, T55X7_SHIFT_OTP) ? "True" : "False"); UserMessage(" PWD: %s\r\n", GET_CONFIG(value, T55X7_MASK_PWD, T55X7_SHIFT_PWD) ? "True" : "False"); UserMessage(" Fast Write: %s\r\n", GET_CONFIG(value, T55X7_MASK_FAST_WRITE, T55X7_SHIFT_FAST_WRITE) ? "True" : "False"); UserMessage(" Inverse Data: %s\r\n", GET_CONFIG(value, T55X7_MASK_INVERSE_DATA, T55X7_SHIFT_INVERSE_DATA) ? "True" : "False"); UserMessage(" POR Delay: %s\r\n", GET_CONFIG(value, T55X7_MASK_POR_DELAY, T55X7_SHIFT_POR_DELAY) ? "True" : "False"); UserMessage("\r\n PWD Block (7): %.8s ", password); printhexreadable(password, 4); UserMessage("%s", "\r\n"); return TRUE; }