Пример #1
0
BOOL q5_config_block_show(BYTE *config)
{
    uint32_t    value= hextoulong(config);

    UserMessage("  Config Block: %.8s\r\n", config);
    UserMessageNum("   Page Select: %d  = ", GET_CONFIG(value, Q5_MASK_PAGE_SELECT, Q5_SHIFT_PAGE_SELECT));
    UserMessage("%s\r\n", GET_CONFIG(value, Q5_MASK_PAGE_SELECT, Q5_SHIFT_PAGE_SELECT) ? "True" : "False");
    UserMessageNum("    Fast Write: %d  = ", GET_CONFIG(value, Q5_MASK_FAST_WRITE, Q5_SHIFT_FAST_WRITE));
    UserMessage("%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);
    UserMessageNum("       Use AOR: %d  = ", GET_CONFIG(value, Q5_MASK_USE_AOR, Q5_SHIFT_USE_AOR));
    UserMessage("%s\r\n", GET_CONFIG(value, Q5_MASK_USE_AOR, Q5_SHIFT_USE_AOR) ? "True" : "False");
    UserMessageNum("       Use PWD: %d  = ", GET_CONFIG(value, Q5_MASK_USE_PWD, Q5_SHIFT_USE_PWD));
    UserMessage("%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)]);
    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));
    UserMessageNum("            ST: %d  = ", GET_CONFIG(value, Q5_MASK_ST, Q5_SHIFT_ST));
    UserMessage("%s\r\n", GET_CONFIG(value, Q5_MASK_ST, Q5_SHIFT_ST) ? "True" : "False");
    return TRUE;
}
Пример #2
0
// create a config block based on current tag settings
BOOL q5_create_config_block(BYTE *config)
{
    uint32_t    value= hextoulong(config);
    BYTE        tmp;

    // data rate
    value= SET_CONFIG(value, Q5_MASK_DATA_BIT_RATE, Q5_SHIFT_DATA_BIT_RATE, (RFIDlerConfig.DataRate - 2) / 2);

    // psk sub-carrier
    if((tmp= RFIDlerConfig.DataRateSub0))
    {
        if(tmp == 2)
            tmp= 0;
        else if (tmp == 4)
            tmp= 1;
        else
            tmp= 2;
        value= SET_CONFIG(value, Q5_MASK_PSK_CARRIER_FREQ, Q5_SHIFT_PSK_CARRIER_FREQ, tmp);
    }

    // modulation
    if(RFIDlerConfig.Manchester && RFIDlerConfig.Modulation == MOD_MODE_ASK_OOK)
        tmp= Q5_MOD_MANCHESTER;
    else
    {
        if(RFIDlerConfig.BiPhase && RFIDlerConfig.Modulation == MOD_MODE_ASK_OOK)
            tmp= Q5_MOD_BIPHASE;
        else
            switch(RFIDlerConfig.Modulation)
            {
            case MOD_MODE_ASK_OOK:
                tmp= Q5_MOD_DIRECT;
                break;
            case MOD_MODE_FSK1:
                tmp= Q5_MOD_FSK1;
                break;
            case MOD_MODE_FSK2:
                tmp= Q5_MOD_FSK2;
                break;
            case MOD_MODE_PSK1:
                tmp= Q5_MOD_PSK1;
                break;
            case MOD_MODE_PSK2:
                tmp= Q5_MOD_PSK2;
                break;
            case MOD_MODE_PSK3:
                tmp= Q5_MOD_PSK3;
                break;
            default:
                return FALSE;
            }
    }
    value= SET_CONFIG(value, Q5_MASK_MODULATION, Q5_SHIFT_MODULATION, tmp);

    // data blocks
    value= SET_CONFIG(value, Q5_MASK_MAX_BLOCK, Q5_SHIFT_MAX_BLOCK, RFIDlerConfig.DataBits / Q5_BLOCKSIZE);

    ulongtohex(config, value);

    return TRUE;
}
Пример #3
0
//// create a config block based on current tag settings
BOOL t55x7_create_config_block(BYTE *config)
{
    uint32_t    value= hextoulong(config);
    BYTE        i, tmp, xmode= FALSE;

    // first decide if we need to be in extended mode or not

    // invert is only supported in x-mode
    if(RFIDlerConfig.Invert)
        xmode= TRUE;

    // is data rate supported by compat mode?
    for(i= 0, tmp= FALSE ; i < sizeof(T55x7_Compat_Data_Rates) ; ++i)
        if(RFIDlerConfig.DataRate == T55x7_Compat_Data_Rates[i])
        {
            tmp= TRUE;
            break;
        }
    if(!tmp)
        xmode= TRUE;

    // data rate
    if(xmode)
    {
       value= SET_CONFIG(value, T55X7_MASK_MASTER_KEY, T55X7_SHIFT_MASTER_KEY, T55X7_XMODE_MODE);
       value= SET_CONFIG(value, T55X7_MASK_XMODE, T55X7_SHIFT_XMODE, TRUE);
       value= SET_CONFIG(value, T55X7_XMODE_MASK_DATA_BIT_RATE, T55X7_SHIFT_DATA_BIT_RATE, (RFIDlerConfig.DataRate - 2) / 2);
    }
    else
       value= SET_CONFIG(value, T55X7_COMPAT_MASK_DATA_BIT_RATE, T55X7_SHIFT_DATA_BIT_RATE, i);

    // psk sub-carrier
    if(RFIDlerConfig.DataRateSub0)
        value= SET_CONFIG(value, T55X7_MASK_PSK_CARRIER_FREQ, T55X7_SHIFT_PSK_CARRIER_FREQ, RFIDlerConfig.DataRateSub0 / 4);

    // modulation
    if(RFIDlerConfig.Manchester && RFIDlerConfig.Modulation == MOD_MODE_ASK_OOK)
        tmp= T55X7_MOD_MANCHESTER;
    else
    {
        // todo - add general support for biphase 57 (but this is just biphase 50 with inversion)
        if(RFIDlerConfig.BiPhase && RFIDlerConfig.Modulation == MOD_MODE_ASK_OOK)
            tmp= T55X7_MOD_BIPHASE_50;
        else
            switch(RFIDlerConfig.Modulation)
            {
                case MOD_MODE_ASK_OOK:
                    tmp= T55X7_MOD_DIRECT;
                    break;
                case MOD_MODE_FSK1:
                    tmp= T55X7_MOD_FSK1;
                    break;
                case MOD_MODE_FSK2:
                    tmp= T55X7_MOD_FSK2;
                    break;
                case MOD_MODE_PSK1:
                    tmp= T55X7_MOD_PSK1;
                    break;
                case MOD_MODE_PSK2:
                    tmp= T55X7_MOD_PSK2;
                    break;
                case MOD_MODE_PSK3:
                    tmp= T55X7_MOD_PSK3;
                    break;
                default:
                    return FALSE;
            }
    }
    value= SET_CONFIG(value, T55X7_MASK_MODULATION, T55X7_SHIFT_MODULATION, tmp);

    // data blocks
    value= SET_CONFIG(value, T55X7_MASK_MAX_BLOCK, T55X7_SHIFT_MAX_BLOCK, RFIDlerConfig.DataBits / T55X7_BLOCKSIZE);

    ulongtohex(config, value);

    return TRUE;
}
Пример #4
0
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;
}