-* Does the sample acquisition. If threshold is specified, the actual sampling
-* is not commenced until the threshold has been reached.
+* Does the sample acquisition. If threshold is specified, the actual sampling
+* is not commenced until the threshold has been reached.
* @param trigger_threshold - the threshold
* @param silent - is true, now outputs are made. If false, dbprints the status
*/
void DoAcquisition125k_internal(int trigger_threshold,bool silent)
{
* @param trigger_threshold - the threshold
* @param silent - is true, now outputs are made. If false, dbprints the status
*/
void DoAcquisition125k_internal(int trigger_threshold,bool silent)
{
-* Setup the FPGA to listen for samples. This method downloads the FPGA bitstream
-* if not already loaded, sets divisor and starts up the antenna.
+* Setup the FPGA to listen for samples. This method downloads the FPGA bitstream
+* if not already loaded, sets divisor and starts up the antenna.
// when we read a TI tag we sample the zerocross line at 2Mhz
// TI tags modulate a 1 as 16 cycles of 123.2Khz
// TI tags modulate a 0 as 16 cycles of 134.2Khz
// when we read a TI tag we sample the zerocross line at 2Mhz
// TI tags modulate a 1 as 16 cycles of 123.2Khz
// TI tags modulate a 0 as 16 cycles of 134.2Khz
-#define FSAMPLE 2000000
-#define FREQLO 123200
-#define FREQHI 134200
-
- signed char *dest = (signed char *)BigBuf;
- int n = sizeof(BigBuf);
- // int *dest = GraphBuffer;
- // int n = GraphTraceLen;
+ #define FSAMPLE 2000000
+ #define FREQLO 123200
+ #define FREQHI 134200
// 128 bit shift register [shift3:shift2:shift1:shift0]
uint32_t shift3 = 0, shift2 = 0, shift1 = 0, shift0 = 0;
// 128 bit shift register [shift3:shift2:shift1:shift0]
uint32_t shift3 = 0, shift2 = 0, shift1 = 0, shift0 = 0;
shift2 = ((shift2>>24) | (shift3 << 8)) & 0x0ffff;
// if r/w tag, check ident match
shift2 = ((shift2>>24) | (shift3 << 8)) & 0x0ffff;
// if r/w tag, check ident match
DbpString("Info: TI tag is rewriteable");
// only 15 bits compare, last bit of ident is not valid
DbpString("Info: TI tag is rewriteable");
// only 15 bits compare, last bit of ident is not valid
int i, j, n;
// tag transmission is <20ms, sampling at 2M gives us 40K samples max
// each sample is 1 bit stuffed into a uint32_t so we need 1250 uint32_t
int i, j, n;
// tag transmission is <20ms, sampling at 2M gives us 40K samples max
// each sample is 1 bit stuffed into a uint32_t so we need 1250 uint32_t
- memset(BigBuf,0,sizeof(BigBuf));
+ uint32_t *BigBuf = (uint32_t *)BigBuf_get_addr();
+ memset(BigBuf,0,BigBuf_max_traceLen()/sizeof(uint32_t));
// compose fc/8 fc/10 waveform
static void fc(int c, int *n) {
// compose fc/8 fc/10 waveform
static void fc(int c, int *n) {
// loop to get raw HID waveform then FSK demodulate the TAG ID from it
void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol)
{
// loop to get raw HID waveform then FSK demodulate the TAG ID from it
void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol)
{
- uint8_t *dest = (uint8_t *)BigBuf;
-
- size_t size=0; //, found=0;
+ uint8_t *dest = BigBuf_get_addr();
+ const size_t sizeOfBigBuff = BigBuf_max_traceLen();
+ size_t size = 0;
// Configure to go in 125Khz listen mode
LFSetupFPGAForADC(95, true);
// Configure to go in 125Khz listen mode
LFSetupFPGAForADC(95, true);
if (ledcontrol) LED_A_ON();
DoAcquisition125k_internal(-1,true);
if (ledcontrol) LED_A_ON();
DoAcquisition125k_internal(-1,true);
-
- int bitLen = HIDdemodFSK(dest,size,&hi2,&hi,&lo);
-
- WDT_HIT();
-
- if (bitLen>0 && lo>0){
+ size = sizeOfBigBuff; //variable size will change after demod so re initialize it before use
+ idx = HIDdemodFSK(dest, &size, &hi2, &hi, &lo);
+
+ if (idx>0 && lo>0){
// final loop, go over previously decoded manchester data and decode into usable tag ID
// 111000 bit pattern represent start of frame, 01 pattern represents a 1 and 10 represents a 0
if (hi2 != 0){ //extra large HID tags
// final loop, go over previously decoded manchester data and decode into usable tag ID
// 111000 bit pattern represent start of frame, 01 pattern represents a 1 and 10 represents a 0
if (hi2 != 0){ //extra large HID tags
void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol)
{
void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol)
{
int clk=0, invert=0, errCnt=0;
uint64_t lo=0;
// Configure to go in 125Khz listen mode
int clk=0, invert=0, errCnt=0;
uint64_t lo=0;
// Configure to go in 125Khz listen mode
if (ledcontrol) LED_A_ON();
DoAcquisition125k_internal(-1,true);
if (ledcontrol) LED_A_ON();
DoAcquisition125k_internal(-1,true);
- size = sizeof(BigBuf);
- if (size < 2000) continue;
- // FSK demodulator
- //int askmandemod(uint8_t *BinStream,uint32_t *BitLen,int *clk, int *invert);
- bitLen=size;
+ size = BigBuf_max_traceLen();
- errCnt = askmandemod(dest,&bitLen,&clk,&invert); //HIDdemodFSK(dest,size,&hi2,&hi,&lo);
+ //askdemod and manchester decode
+ errCnt = askmandemod(dest, &size, &clk, &invert);
- 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));
+ 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));
void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol)
{
void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol)
{
DoAcquisition125k_internal(-1,true);
//fskdemod and get start index
WDT_HIT();
DoAcquisition125k_internal(-1,true);
//fskdemod and get start index
WDT_HIT();
// Read one card block in page 0
void T55xxReadBlock(uint32_t Block, uint32_t Pwd, uint8_t PwdMode)
{
// Read one card block in page 0
void T55xxReadBlock(uint32_t Block, uint32_t Pwd, uint8_t PwdMode)
{
//int m=0, i=0; //enio adjustment 12/10/14
uint32_t m=0, i=0;
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
//int m=0, i=0; //enio adjustment 12/10/14
uint32_t m=0, i=0;
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
// Clear destination buffer before sending the command
memset(dest, 128, m);
// Connect the A/D to the peak-detected low-frequency path.
// Clear destination buffer before sending the command
memset(dest, 128, m);
// Connect the A/D to the peak-detected low-frequency path.
// Clear destination buffer before sending the command
memset(dest, 128, m);
// Connect the A/D to the peak-detected low-frequency path.
// Clear destination buffer before sending the command
memset(dest, 128, m);
// Connect the A/D to the peak-detected low-frequency path.
void CopyIndala224toT55x7(int uid1, int uid2, int uid3, int uid4, int uid5, int uid6, int uid7)
{
void CopyIndala224toT55x7(int uid1, int uid2, int uid3, int uid4, int uid5, int uid6, int uid7)
{
int i, j, lastval, bitidx, half_switch;
int clock = 64;
int tolerance = clock / 8;
int i, j, lastval, bitidx, half_switch;
int clock = 64;
int tolerance = clock / 8;
// Clear destination buffer before sending the command
memset(dest, 128, m);
// Connect the A/D to the peak-detected low-frequency path.
// Clear destination buffer before sending the command
memset(dest, 128, m);
// Connect the A/D to the peak-detected low-frequency path.