chg: lf fsksim - uses NG
This commit is contained in:
@@ -754,8 +754,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
uint8_t silent;
|
||||
uint32_t samples;
|
||||
} PACKED;
|
||||
struct p *payload;
|
||||
payload = (struct p*)packet->data.asBytes;
|
||||
struct p *payload = (struct p*)packet->data.asBytes;
|
||||
uint32_t bits = SampleLF(payload->silent, payload->samples);
|
||||
reply_ng(CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, PM3_SUCCESS, (uint8_t *)&bits, sizeof(bits));
|
||||
break;
|
||||
@@ -766,8 +765,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
uint16_t ones;
|
||||
uint16_t zeros;
|
||||
} PACKED;
|
||||
struct p *payload;
|
||||
payload = (struct p*)packet->data.asBytes;
|
||||
struct p *payload = (struct p*)packet->data.asBytes;
|
||||
ModThenAcquireRawAdcSamples125k(payload->delay, payload->zeros, payload->ones, packet->data.asBytes+8);
|
||||
break;
|
||||
}
|
||||
@@ -784,9 +782,19 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
case CMD_HID_SIM_TAG:
|
||||
CmdHIDsimTAG(packet->oldarg[0], packet->oldarg[1], 1);
|
||||
break;
|
||||
case CMD_FSK_SIM_TAG:
|
||||
CmdFSKsimTAG(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2], packet->data.asBytes, 1);
|
||||
case CMD_FSK_SIM_TAG: {
|
||||
struct p {
|
||||
uint8_t fchigh;
|
||||
uint8_t fclow;
|
||||
uint8_t separator;
|
||||
uint8_t clock;
|
||||
uint16_t datalen;
|
||||
} PACKED;
|
||||
struct p *payload = (struct p*)packet->data.asBytes;
|
||||
|
||||
CmdFSKsimTAG(payload->fchigh, payload->fclow, payload->separator, payload->clock, payload->datalen, packet->data.asBytes + 6, 1);
|
||||
break;
|
||||
}
|
||||
case CMD_ASK_SIM_TAG:
|
||||
CmdASKsimTag(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2], packet->data.asBytes, 1);
|
||||
break;
|
||||
|
||||
@@ -86,7 +86,9 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol);
|
||||
void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
|
||||
void CmdHIDsimTAGEx(uint32_t hi, uint32_t lo, int ledcontrol, int numcycles);
|
||||
void CmdHIDsimTAG(uint32_t hi, uint32_t lo, int ledcontrol);
|
||||
void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int ledcontrol);
|
||||
|
||||
void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clock, uint16_t bitslen, uint8_t *bits, int ledcontrol);
|
||||
|
||||
void CmdASKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int ledcontrol);
|
||||
void CmdPSKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int ledcontrol);
|
||||
void CmdHIDdemodFSK(int findone, uint32_t *high, uint32_t *low, int ledcontrol);
|
||||
|
||||
@@ -828,7 +828,8 @@ void CmdHIDsimTAG(uint32_t hi, uint32_t lo, int ledcontrol) {
|
||||
// prepare a waveform pattern in the buffer based on the ID given then
|
||||
// simulate a FSK tag until the button is pressed
|
||||
// arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock
|
||||
void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int ledcontrol) {
|
||||
void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clock, uint16_t bitslen, uint8_t *bits, int ledcontrol) {
|
||||
//void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int ledcontrol) {
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
||||
// free eventually allocated BigBuf memory
|
||||
@@ -838,27 +839,23 @@ void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *bits, int
|
||||
set_tracing(false);
|
||||
|
||||
int n = 0, i = 0;
|
||||
uint8_t fcHigh = arg1 >> 8;
|
||||
uint8_t fcLow = arg1 & 0xFF;
|
||||
uint16_t modCnt = 0;
|
||||
uint8_t clk = arg2 & 0xFF;
|
||||
uint8_t stt = (arg2 >> 8) & 1;
|
||||
|
||||
if (stt) {
|
||||
//int fsktype = ( fcHigh == 8 && fcLow == 5) ? 1 : 2;
|
||||
if (separator) {
|
||||
//int fsktype = ( fchigh == 8 && fclow == 5) ? 1 : 2;
|
||||
//fcSTT(&n);
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
for (i = 0; i < bitslen; i++) {
|
||||
if (bits[i])
|
||||
fcAll(fcLow, &n, clk, &modCnt);
|
||||
fcAll(fclow, &n, clock, &modCnt);
|
||||
else
|
||||
fcAll(fcHigh, &n, clk, &modCnt);
|
||||
fcAll(fchigh, &n, clock, &modCnt);
|
||||
}
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
Dbprintf("Simulating with fcHigh: %d, fcLow: %d, clk: %d, STT: %d, n: %d", fcHigh, fcLow, clk, stt, n);
|
||||
Dbprintf("Simulating with fcHigh: %d, fcLow: %d, clk: %d, STT: %d, n: %d", fchigh, fclow, clock, separator, n);
|
||||
|
||||
if (ledcontrol) LED_A_ON();
|
||||
SimulateTagLowFrequency(n, 0, ledcontrol);
|
||||
|
||||
Reference in New Issue
Block a user