]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/lfops.c
ADD: AWID 50bit demod
[proxmark3-svn] / armsrc / lfops.c
index 5c074c3a9f2e1576ed3213903c32697aae8bbdc3..69b76d1215ab624ad0baf27575841d4ad6fb11a5 100644 (file)
@@ -270,7 +270,7 @@ void AcquireTiType(void)
        AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(32) | AT91C_SSC_MSBF;
        AT91C_BASE_SSC->SSC_TCMR = 0;
        AT91C_BASE_SSC->SSC_TFMR = 0;
        AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(32) | AT91C_SSC_MSBF;
        AT91C_BASE_SSC->SSC_TCMR = 0;
        AT91C_BASE_SSC->SSC_TFMR = 0;
-
+       // iceman, FpgaSetupSsc() ?? the code above? can it be replaced?
        LED_D_ON();
 
        // modulate antenna
        LED_D_ON();
 
        // modulate antenna
@@ -870,7 +870,6 @@ void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol)
 
                size = removeParity(dest, idx+8, 4, 1, 88);
                if (size != 66) continue;
 
                size = removeParity(dest, idx+8, 4, 1, 88);
                if (size != 66) continue;
-               // ok valid card found!
 
                // Index map
                // 0           10         20        30          40        50        60
 
                // Index map
                // 0           10         20        30          40        50        60
@@ -880,37 +879,51 @@ void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol)
                // 00011010 1 01110101 0000000010001110 1 000000000000000000000000000000000
                // bbbbbbbb w ffffffff cccccccccccccccc w xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                // |26 bit|   |-117--| |-----142------|
                // 00011010 1 01110101 0000000010001110 1 000000000000000000000000000000000
                // bbbbbbbb w ffffffff cccccccccccccccc w xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                // |26 bit|   |-117--| |-----142------|
+                       //
+                       // 00110010 0 0000011111010000000000000001000100101000100001111 0 00000000 
+                       // bbbbbbbb w ffffffffffffffffccccccccccccccccccccccccccccccccc w xxxxxxxx
+                       // |50 bit|   |----4000------||-----------2248975-------------|                         
+                       //
                // b = format bit len, o = odd parity of last 3 bits
                // f = facility code, c = card number
                // w = wiegand parity
                // b = format bit len, o = odd parity of last 3 bits
                // f = facility code, c = card number
                // w = wiegand parity
-               // (26 bit format shown)
 
                uint32_t fc = 0;
                uint32_t cardnum = 0;
                uint32_t code1 = 0;
                uint32_t code2 = 0;
                uint8_t fmtLen = bytebits_to_byte(dest,8);
 
                uint32_t fc = 0;
                uint32_t cardnum = 0;
                uint32_t code1 = 0;
                uint32_t code2 = 0;
                uint8_t fmtLen = bytebits_to_byte(dest,8);
-               if (fmtLen==26){
-                       fc = bytebits_to_byte(dest+9, 8);
-                       cardnum = bytebits_to_byte(dest+17, 16);
-                       code1 = bytebits_to_byte(dest+8,fmtLen);
-                       Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo);
-               } else {
-                       cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16);
-                       if (fmtLen>32){
-                        code1 = bytebits_to_byte(dest+8,fmtLen-32);
-                        code2 = bytebits_to_byte(dest+8+(fmtLen-32),32);
-                        Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo);
-                } else{
-                        code1 = bytebits_to_byte(dest+8,fmtLen);
-                        Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo);
-                }
+                       switch(fmtLen) {
+                               case 26: 
+                                       fc = bytebits_to_byte(dest + 9, 8);
+                                       cardnum = bytebits_to_byte(dest + 17, 16);
+                                       code1 = bytebits_to_byte(dest + 8,fmtLen);
+                                       Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo);
+                                       break;
+                               case 50:
+                                       fc = bytebits_to_byte(dest + 9, 16);
+                                       cardnum = bytebits_to_byte(dest + 25, 32);
+                                       code1 = bytebits_to_byte(dest + 8, (fmtLen-32) );
+                                       code2 = bytebits_to_byte(dest + 8 + (fmtLen-32), 32);
+                                       Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo);
+                                       break;
+                               default:
+                                       if (fmtLen > 32 ) {
+                                               cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16);
+                                               code1 = bytebits_to_byte(dest+8,fmtLen-32);
+                                               code2 = bytebits_to_byte(dest+8+(fmtLen-32),32);
+                                               Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo);
+                                       } else {
+                                               cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16);
+                                               code1 = bytebits_to_byte(dest+8,fmtLen);
+                                               Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo);
+                                       }
+                                       break;          
                        }
                        if (findone){
                                if (ledcontrol) LED_A_OFF();
                                return;
                        }
                        }
                        if (findone){
                                if (ledcontrol) LED_A_OFF();
                                return;
                        }
-                       // reset
                idx = 0;
                WDT_HIT();
        }
                idx = 0;
                WDT_HIT();
        }
Impressum, Datenschutz