X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/cda2a4c0a5e9b9e2a373aeb822111237ff9ec710..b969713989de2ce3018c06fc86c4bf41a1297ddc:/armsrc/util.c?ds=inline diff --git a/armsrc/util.c b/armsrc/util.c index 9bea9e7e..dc18e5e3 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -11,6 +11,7 @@ #include "proxmark3.h" #include "util.h" #include "string.h" +#include "apps.h" size_t nbytes(size_t nbits) { return (nbits/8)+((nbits%8)>0); @@ -357,6 +358,14 @@ void StartCountMifare() AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN; // enable TC0 AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKEN; // enable TC1 AT91C_BASE_TC2->TC_CCR = AT91C_TC_CLKEN; // enable TC2 + + // activate the ISO14443 part of the FPGA. We need the clock and frame signals. + FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_TAGSIM_LISTEN); + + // synchronize the counter with the ssp_frame signal. + while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_FRAME); // wait for ssp_frame to be low + while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_FRAME)); // sync on rising edge of ssp_frame (= start of transfer) + AT91C_BASE_TCB->TCB_BCR = 1; // assert Sync (set all timers to 0 on next active clock edge) }