first draft half duplex simulation

This commit is contained in:
tharexde
2021-01-03 22:50:27 +01:00
parent 9b3bc55136
commit eea63a6cb7
6 changed files with 511 additions and 50 deletions
+1 -1
View File
@@ -1136,7 +1136,7 @@ static void PacketReceived(PacketCommandNG *packet) {
// destroy the Emulator Memory.
//-----------------------------------------------------------------------------
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
em4x50_sim((uint8_t *)packet->data.asBytes);
em4x50_sim();
break;
}
case CMD_LF_EM4X50_READER: {
+478 -45
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -19,7 +19,7 @@ void em4x50_writepwd(em4x50_data_t *etd);
void em4x50_read(em4x50_data_t *etd);
void em4x50_brute(em4x50_data_t *etd);
void em4x50_login(uint32_t *password);
void em4x50_sim(uint8_t *filename);
void em4x50_sim(void);
void em4x50_reader(void);
void em4x50_chk(uint8_t *filename);
void em4x50_test(em4x50_test_t *ett);
+27 -2
View File
@@ -78,6 +78,31 @@ static void get_samples(void) {
write_gnuplot_config_file(gHigh, gLow);
}
/*
static void get_time_samples(void) {
const char *fn = "../data/data.dat";
FILE *fp = NULL;
// download from BigBuf memory
uint32_t data[EM4X50_MAX_TIME_SAMPLES] = {0x0};
if (GetFromDevice(BIG_BUF, (uint8_t *)data, EM4X50_MAX_TIME_SAMPLES, 0, NULL, 0, NULL, 2500, false) == false) {
PrintAndLogEx(WARNING, "Fail, transfer from device time-out");
}
if ((fp = fopen(fn, "w+")) == false) {
PrintAndLogEx(WARNING, "Fail, open file %s", fn);
}
for (int i = 0; i < EM4X50_MAX_TIME_SAMPLES; i++) {
PrintAndLogEx(INFO, "%i %"PRIu32"", i, data[i]);
fprintf(fp, "%i %"PRIu32"\n", i, data[i]);
}
fclose(fp);
}
*/
static void prepare_result(const uint8_t *data, int fwr, int lwr, em4x50_word_t *words) {
// restructure received result in "em4x50_word_t" structure
@@ -398,6 +423,8 @@ int CmdEM4x50Login(const char *Cmd) {
else
PrintAndLogEx(FAILED, "Login " _RED_("failed"));
get_samples();
return resp.status;
}
@@ -667,8 +694,6 @@ int CmdEM4x50Read(const char *Cmd) {
}
}
get_samples();
return em4x50_read(&etd, NULL);
}
+1 -1
View File
@@ -12,7 +12,7 @@
#define CMDLFEM4X70_H__
#include "common.h"
#include "em4x50.h"
#include "em4x70.h"
#define TIMEOUT 2000
+3
View File
@@ -37,6 +37,9 @@
#define TIMEOUT 2000
#define DUMP_FILESIZE 136
#define EM4X50_MAX_NO_SAMPLES 1000
#define EM4X50_MAX_TIME_SAMPLES 1000
#define BYTES2UINT32(x) ((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | (x[3]))
typedef struct {
bool addr_given;