FIX: lf sim, seems like "lf sim" call SimulateTagLowFrequency direct from appmain.c and I removed the LF bitstream call thinking SimulateTagLowFrequency was only called from the sub FSK;ASK;PSK commands.

This commit is contained in:
iceman1001 2016-10-20 00:39:15 +02:00
parent bd46dec63b
commit 49065576ad

View file

@ -395,32 +395,31 @@ void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc)
void SimulateTagLowFrequency(int period, int gap, int ledcontrol) void SimulateTagLowFrequency(int period, int gap, int ledcontrol)
{ {
int i = 0; int i = 0;
uint8_t *tab = BigBuf_get_addr(); uint8_t *buf = BigBuf_get_addr();
StartTicks();
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT | FPGA_LF_EDGE_DETECT_READER_FIELD); FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT | FPGA_LF_EDGE_DETECT_READER_FIELD);
AT91C_BASE_PIOA->PIO_PER = GPIO_SSC_DOUT | GPIO_SSC_CLK; AT91C_BASE_PIOA->PIO_PER = GPIO_SSC_DOUT | GPIO_SSC_CLK;
AT91C_BASE_PIOA->PIO_OER = GPIO_SSC_DOUT; AT91C_BASE_PIOA->PIO_OER = GPIO_SSC_DOUT;
AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK; AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK;
StartTicks();
for(;;) { for(;;) {
WDT_HIT(); WDT_HIT();
if (ledcontrol) LED_D_ON(); if (ledcontrol) LED_D_ON();
//wait until SSC_CLK goes HIGH // wait until SSC_CLK goes HIGH
// used as a simple detection of a reader field?
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) { while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) {
WDT_HIT(); WDT_HIT();
if ( usb_poll_validate_length() || BUTTON_PRESS() ) { if ( usb_poll_validate_length() || BUTTON_PRESS() )
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); goto OUT;
LED_D_OFF();
return;
}
} }
if(tab[i]) if(buf[i])
OPEN_COIL(); OPEN_COIL();
else else
SHORT_COIL(); SHORT_COIL();
@ -430,11 +429,8 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol)
//wait until SSC_CLK goes LOW //wait until SSC_CLK goes LOW
while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK) { while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK) {
WDT_HIT(); WDT_HIT();
if ( usb_poll_validate_length() || BUTTON_PRESS() ) { if ( usb_poll_validate_length() || BUTTON_PRESS() )
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); goto OUT;
LED_D_OFF();
return;
}
} }
i++; i++;
@ -447,7 +443,11 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol)
} }
} }
} }
OUT:
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
StopTicks(); StopTicks();
LED_D_OFF();
return;
} }
#define DEBUG_FRAME_CONTENTS 1 #define DEBUG_FRAME_CONTENTS 1