X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/ada339a10f1dbe7694ae92393271a9e156fe9ec4..2e7e107c821e129a57ef1d40d9a5b3208deec2e4:/armsrc/lfops.c diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 468f5830..2a5573d1 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -16,6 +16,7 @@ #include "string.h" #include "lfdemod.h" #include "lfsampling.h" +#include "usb_cdc.h" /** @@ -401,7 +402,7 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol) for(;;) { //wait until SSC_CLK goes HIGH while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) { - if(BUTTON_PRESS()) { + if(BUTTON_PRESS() || usb_poll()) { DbpString("Stopped"); return; } @@ -621,7 +622,7 @@ static void askSimBit(uint8_t c, int *n, uint8_t clock, uint8_t manchester) uint8_t *dest = BigBuf_get_addr(); uint8_t halfClk = clock/2; // c = current bit 1 or 0 - if (manchester){ + if (manchester==1){ memset(dest+(*n), c, halfClk); memset(dest+(*n) + halfClk, c^1, halfClk); } else { @@ -630,26 +631,54 @@ static void askSimBit(uint8_t c, int *n, uint8_t clock, uint8_t manchester) *n += clock; } +static void biphaseSimBit(uint8_t c, int *n, uint8_t clock, uint8_t *phase) +{ + uint8_t *dest = BigBuf_get_addr(); + uint8_t halfClk = clock/2; + if (c){ + memset(dest+(*n), c ^ 1 ^ *phase, halfClk); + memset(dest+(*n) + halfClk, c ^ *phase, halfClk); + } else { + memset(dest+(*n), c ^ *phase, clock); + *phase ^= 1; + } + +} + // args clock, ask/man or askraw, invert, transmission separator void CmdASKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream) { int ledcontrol = 1; int n=0, i=0; uint8_t clk = (arg1 >> 8) & 0xFF; - uint8_t manchester = arg1 & 1; + uint8_t encoding = arg1 & 1; uint8_t separator = arg2 & 1; uint8_t invert = (arg2 >> 8) & 1; - for (i=0; i=0){ - lo = Em410xDecode(dest, &size, &idx); + errCnt = Em410xDecode(dest, &size, &idx, &hi, &lo); //Dbprintf("DEBUG: EM GOT"); - if (lo>0){ - Dbprintf("EM TAG ID: %02x%08x - (%05d_%03d_%08d)", - (uint32_t)(lo>>32), - (uint32_t)lo, - (uint32_t)(lo&0xFFFF), - (uint32_t)((lo>>16LL) & 0xFF), - (uint32_t)(lo & 0xFFFFFF)); + if (errCnt){ + if (size>64){ + Dbprintf("EM XL TAG ID: %06x%08x%08x - (%05d_%03d_%08d)", + hi, + (uint32_t)(lo>>32), + (uint32_t)lo, + (uint32_t)(lo&0xFFFF), + (uint32_t)((lo>>16LL) & 0xFF), + (uint32_t)(lo & 0xFFFFFF)); + } else { + Dbprintf("EM TAG ID: %02x%08x - (%05d_%03d_%08d)", + (uint32_t)(lo>>32), + (uint32_t)lo, + (uint32_t)(lo&0xFFFF), + (uint32_t)((lo>>16LL) & 0xFF), + (uint32_t)(lo & 0xFFFFFF)); + } } if (findone){ if (ledcontrol) LED_A_OFF();