mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
namespace-protect static vars in standalone modes to avoid conflits when merged with dankarmulti
This commit is contained in:
parent
0b96ed9865
commit
ce2148b22c
6 changed files with 142 additions and 142 deletions
|
@ -23,11 +23,10 @@
|
|||
#define MAX_IND 16 // 4 LEDs - 2^4 combinations
|
||||
#define LF_CLOCK 64 // for 125kHz
|
||||
|
||||
// low & high - array for storage IDs. Its length must be equal.
|
||||
// Predefined IDs must be stored in low[].
|
||||
static uint64_t low[] = {0x565A1140BE, 0x365A398149, 0x5555555555, 0xFFFFFFFFFF};
|
||||
static uint8_t slots_count;
|
||||
static int buflen;
|
||||
// Predefined IDs must be stored in em4100emul_low[].
|
||||
static uint64_t em4100emul_low[] = {0x565A1140BE, 0x365A398149, 0x5555555555, 0xFFFFFFFFFF};
|
||||
static uint8_t em4100emul_slots_count;
|
||||
static int em4100emul_buflen;
|
||||
|
||||
void ModInfo(void) {
|
||||
DbpString(" LF EM4100 simulator standalone mode");
|
||||
|
@ -43,10 +42,10 @@ static uint64_t rev_quads(uint64_t bits) {
|
|||
|
||||
static void fill_buff(uint8_t bit) {
|
||||
uint8_t *bba = BigBuf_get_addr();
|
||||
memset(bba + buflen, bit, LF_CLOCK / 2);
|
||||
buflen += (LF_CLOCK / 2);
|
||||
memset(bba + buflen, bit ^ 1, LF_CLOCK / 2);
|
||||
buflen += (LF_CLOCK / 2);
|
||||
memset(bba + em4100emul_buflen, bit, LF_CLOCK / 2);
|
||||
em4100emul_buflen += (LF_CLOCK / 2);
|
||||
memset(bba + em4100emul_buflen, bit ^ 1, LF_CLOCK / 2);
|
||||
em4100emul_buflen += (LF_CLOCK / 2);
|
||||
}
|
||||
|
||||
static void construct_EM410x_emul(uint64_t id) {
|
||||
|
@ -54,7 +53,7 @@ static void construct_EM410x_emul(uint64_t id) {
|
|||
int i, j;
|
||||
int binary[4] = {0, 0, 0, 0};
|
||||
int parity[4] = {0, 0, 0, 0};
|
||||
buflen = 0;
|
||||
em4100emul_buflen = 0;
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
fill_buff(1);
|
||||
|
@ -79,10 +78,10 @@ static void construct_EM410x_emul(uint64_t id) {
|
|||
|
||||
static void LED_Slot(int i) {
|
||||
LEDsoff();
|
||||
if (slots_count > 4) {
|
||||
LED(i % MAX_IND, 0); //binary indication for slots_count > 4
|
||||
if (em4100emul_slots_count > 4) {
|
||||
LED(i % MAX_IND, 0); //binary indication for em4100emul_slots_count > 4
|
||||
} else {
|
||||
LED(1 << i, 0); //simple indication for slots_count <=4
|
||||
LED(1 << i, 0); //simple indication for em4100emul_slots_count <=4
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +91,7 @@ void RunMod(void) {
|
|||
Dbprintf("[=] >> LF EM4100 simulator started <<");
|
||||
|
||||
int selected = 0; //selected slot after start
|
||||
slots_count = ARRAYLEN(low);
|
||||
em4100emul_slots_count = ARRAYLEN(em4100emul_low);
|
||||
for (;;) {
|
||||
WDT_HIT();
|
||||
if (data_available()) break;
|
||||
|
@ -100,8 +99,8 @@ void RunMod(void) {
|
|||
SpinDelay(100);
|
||||
SpinUp(100);
|
||||
LED_Slot(selected);
|
||||
construct_EM410x_emul(rev_quads(low[selected]));
|
||||
SimulateTagLowFrequency(buflen, 0, true);
|
||||
selected = (selected + 1) % slots_count;
|
||||
construct_EM410x_emul(rev_quads(em4100emul_low[selected]));
|
||||
SimulateTagLowFrequency(em4100emul_buflen, 0, true);
|
||||
selected = (selected + 1) % em4100emul_slots_count;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue