mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-22 00:06:13 +08:00
CHG: now with enums :)
This commit is contained in:
parent
710208245b
commit
8a13121435
|
@ -26,8 +26,6 @@
|
||||||
#define LF_TRACE_BUFF_SIZE 20000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..)
|
#define LF_TRACE_BUFF_SIZE 20000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..)
|
||||||
#define LF_BITSSTREAM_LEN 1000 // more then 1000 bits shouldn't happend.. 8block * 4 bytes * 8bits =
|
#define LF_BITSSTREAM_LEN 1000 // more then 1000 bits shouldn't happend.. 8block * 4 bytes * 8bits =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Default configuration: ASK, not inversed.
|
// Default configuration: ASK, not inversed.
|
||||||
t55xx_conf_block_t config = { .modulation = 2, .inversed = FALSE, .block0 = 0x00};
|
t55xx_conf_block_t config = { .modulation = 2, .inversed = FALSE, .block0 = 0x00};
|
||||||
|
|
||||||
|
@ -219,6 +217,9 @@ void DecodeT55xxBlock(){
|
||||||
char buf[6] = {0x00};
|
char buf[6] = {0x00};
|
||||||
char *cmdStr = buf;
|
char *cmdStr = buf;
|
||||||
|
|
||||||
|
// clearing the DemodBuffer.
|
||||||
|
DemodBufferLen = 0x00;
|
||||||
|
|
||||||
// use the configuration
|
// use the configuration
|
||||||
switch( config.modulation ){
|
switch( config.modulation ){
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -285,59 +286,59 @@ bool tryDetectModulation(){
|
||||||
|
|
||||||
if (GetFskClock("", FALSE, FALSE)){
|
if (GetFskClock("", FALSE, FALSE)){
|
||||||
if ( FSKrawDemod("0 0", FALSE) && test()){
|
if ( FSKrawDemod("0 0", FALSE) && test()){
|
||||||
tests[hits].modulation = 1;
|
tests[hits].modulation = DEMOD_FSK;
|
||||||
tests[hits].inversed = 0;
|
tests[hits].inversed = FALSE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
if ( FSKrawDemod("0 1", FALSE) && test()) {
|
if ( FSKrawDemod("0 1", FALSE) && test()) {
|
||||||
tests[hits].modulation = 1;
|
tests[hits].modulation = DEMOD_FSK;
|
||||||
tests[hits].inversed = 1;
|
tests[hits].inversed = TRUE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( ASKmanDemod("0 0 1", FALSE, FALSE) && test()) {
|
if ( ASKmanDemod("0 0 1", FALSE, FALSE) && test()) {
|
||||||
tests[hits].modulation = 2;
|
tests[hits].modulation = DEMOD_ASK;
|
||||||
tests[hits].inversed = 0;
|
tests[hits].inversed = FALSE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ASKmanDemod("0 1 1", FALSE, FALSE) && test()) {
|
if ( ASKmanDemod("0 1 1", FALSE, FALSE) && test()) {
|
||||||
tests[hits].modulation = 2;
|
tests[hits].modulation = DEMOD_ASK;
|
||||||
tests[hits].inversed = 1;
|
tests[hits].inversed = TRUE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( NRZrawDemod("0 0 1", FALSE) && test()) {
|
if ( NRZrawDemod("0 0 1", FALSE) && test()) {
|
||||||
tests[hits].modulation = 3;
|
tests[hits].modulation = DEMOD_NZR;
|
||||||
tests[hits].inversed = 0;
|
tests[hits].inversed = FALSE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( NRZrawDemod("0 1 1", FALSE) && test()) {
|
if ( NRZrawDemod("0 1 1", FALSE) && test()) {
|
||||||
tests[hits].modulation = 3;
|
tests[hits].modulation = DEMOD_NZR;
|
||||||
tests[hits].inversed = 1;
|
tests[hits].inversed = TRUE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( PSKDemod("0 0 1", FALSE) && test()) {
|
if ( PSKDemod("0 0 1", FALSE) && test()) {
|
||||||
tests[hits].modulation = 4;
|
tests[hits].modulation = DEMOD_PSK;
|
||||||
tests[hits].inversed = 0;
|
tests[hits].inversed = FALSE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( PSKDemod("0 1 1", FALSE) && test()) {
|
if ( PSKDemod("0 1 1", FALSE) && test()) {
|
||||||
tests[++hits].modulation = 4;
|
tests[++hits].modulation = DEMOD_PSK;
|
||||||
tests[hits].inversed = 1;
|
tests[hits].inversed = TRUE;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
//PSK2?
|
//PSK2?
|
||||||
// if (!BiphaseRawDecode("0",FALSE) && test()) {
|
// if (!BiphaseRawDecode("0",FALSE) && test()) {
|
||||||
// tests[++hits].modulation = 5;
|
// tests[++hits].modulation = DEMOD_BI;
|
||||||
// tests[hits].inversed = 0;
|
// tests[hits].inversed = FALSE;
|
||||||
//}
|
//}
|
||||||
// if (!BiphaseRawDecode("1",FALSE) && test()) {
|
// if (!BiphaseRawDecode("1",FALSE) && test()) {
|
||||||
// tests[++hits].modulation = 5;
|
// tests[++hits].modulation = DEMOD_BI;
|
||||||
// tests[hits].inversed = 1;
|
// tests[hits].inversed = TRUE;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
if ( hits == 1) {
|
if ( hits == 1) {
|
||||||
|
@ -402,20 +403,6 @@ void printConfiguration( t55xx_conf_block_t b){
|
||||||
PrintAndLog("");
|
PrintAndLog("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
FSK1 / FSK1a
|
|
||||||
size = fskdemod(dest, size, 32, 0, 8, 10); // fsk1 RF/32
|
|
||||||
size = fskdemod(dest, size, 32, 1, 8, 10); // fsk1a RF/32
|
|
||||||
|
|
||||||
FSK2 / FSK2a
|
|
||||||
size = fskdemod(dest, size, 32, 0, 10, 8); // fsk2 RF/32
|
|
||||||
size = fskdemod(dest, size, 32, 1, 10, 8); // fsk2a RF/32
|
|
||||||
size = fskdemod(dest, size, 50, 1, 10, 8); // fsk2a RF/50
|
|
||||||
size = fskdemod(dest, size, 64, 1, 10, 8); // FSK2a RF/64
|
|
||||||
|
|
||||||
PSK1
|
|
||||||
errCnt = pskRawDemod(bits, &bitlen, 32, 0);
|
|
||||||
*/
|
|
||||||
int CmdT55xxWriteBlock(const char *Cmd)
|
int CmdT55xxWriteBlock(const char *Cmd)
|
||||||
{
|
{
|
||||||
int block = 8; //default to invalid block
|
int block = 8; //default to invalid block
|
||||||
|
@ -517,7 +504,7 @@ int CmdT55xxReadTrace(const char *Cmd)
|
||||||
PrintAndLog("-------------------------------------------------------------");
|
PrintAndLog("-------------------------------------------------------------");
|
||||||
PrintAndLog(" Raw Data - Page 1");
|
PrintAndLog(" Raw Data - Page 1");
|
||||||
PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(DemodBuffer+5,32) );
|
PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(DemodBuffer+5,32) );
|
||||||
PrintAndLog(" Block 0 : 0x%08X %s", bl1, sprint_bin(DemodBuffer+37,32) );
|
PrintAndLog(" Block 1 : 0x%08X %s", bl1, sprint_bin(DemodBuffer+37,32) );
|
||||||
PrintAndLog("-------------------------------------------------------------");
|
PrintAndLog("-------------------------------------------------------------");
|
||||||
/*
|
/*
|
||||||
TRACE - BLOCK O
|
TRACE - BLOCK O
|
||||||
|
@ -755,19 +742,19 @@ char * GetSelectedModulationStr( uint8_t id){
|
||||||
char *retStr = buf;
|
char *retStr = buf;
|
||||||
|
|
||||||
switch (id){
|
switch (id){
|
||||||
case 1:
|
case DEMOD_FSK:
|
||||||
sprintf(retStr,"FSK (%d)",id);
|
sprintf(retStr,"FSK (%d)",id);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case DEMOD_ASK:
|
||||||
sprintf(retStr,"ASK (%d)",id);
|
sprintf(retStr,"ASK (%d)",id);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case DEMOD_NZR:
|
||||||
sprintf(retStr,"DIRECT/NRZ (%d)",id);
|
sprintf(retStr,"DIRECT/NRZ (%d)",id);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case DEMOD_PSK:
|
||||||
sprintf(retStr,"PSK (%d)",id);
|
sprintf(retStr,"PSK (%d)",id);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case DEMOD_BI:
|
||||||
sprintf(retStr,"BIPHASE (%d)",id);
|
sprintf(retStr,"BIPHASE (%d)",id);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -11,7 +11,13 @@
|
||||||
#define CMDLFT55XX_H__
|
#define CMDLFT55XX_H__
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t modulation;
|
enum {
|
||||||
|
DEMOD_FSK = 0x01,
|
||||||
|
DEMOD_ASK = 0x02,
|
||||||
|
DEMOD_NZR = 0x03,
|
||||||
|
DEMOD_PSK = 0x04,
|
||||||
|
DEMOD_BI = 0x05,
|
||||||
|
} modulation;
|
||||||
bool inversed;
|
bool inversed;
|
||||||
uint32_t block0;
|
uint32_t block0;
|
||||||
} t55xx_conf_block_t;
|
} t55xx_conf_block_t;
|
||||||
|
|
Loading…
Reference in a new issue