mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
Reduce duplicate payload structure for lf read/sniff
This commit is contained in:
parent
cd167b4632
commit
9e8b1ceda7
3 changed files with 15 additions and 20 deletions
|
@ -851,11 +851,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_LF_ACQ_RAW_ADC: {
|
case CMD_LF_ACQ_RAW_ADC: {
|
||||||
struct p {
|
lf_sample_payload_t *payload = (lf_sample_payload_t *)packet->data.asBytes;
|
||||||
uint32_t samples : 31;
|
|
||||||
bool verbose : 1;
|
|
||||||
} PACKED;
|
|
||||||
struct p *payload = (struct p *)packet->data.asBytes;
|
|
||||||
uint32_t bits = SampleLF(payload->verbose, payload->samples, true);
|
uint32_t bits = SampleLF(payload->verbose, payload->samples, true);
|
||||||
reply_ng(CMD_LF_ACQ_RAW_ADC, PM3_SUCCESS, (uint8_t *)&bits, sizeof(bits));
|
reply_ng(CMD_LF_ACQ_RAW_ADC, PM3_SUCCESS, (uint8_t *)&bits, sizeof(bits));
|
||||||
break;
|
break;
|
||||||
|
@ -880,11 +876,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_LF_SNIFF_RAW_ADC: {
|
case CMD_LF_SNIFF_RAW_ADC: {
|
||||||
struct p {
|
lf_sample_payload_t *payload = (lf_sample_payload_t *)packet->data.asBytes;
|
||||||
uint32_t samples : 31;
|
|
||||||
bool verbose : 1;
|
|
||||||
} PACKED;
|
|
||||||
struct p *payload = (struct p *)packet->data.asBytes;
|
|
||||||
|
|
||||||
uint32_t bits = SniffLF(payload->verbose, payload->samples, true);
|
uint32_t bits = SniffLF(payload->verbose, payload->samples, true);
|
||||||
reply_ng(CMD_LF_SNIFF_RAW_ADC, PM3_SUCCESS, (uint8_t *)&bits, sizeof(bits));
|
reply_ng(CMD_LF_SNIFF_RAW_ADC, PM3_SUCCESS, (uint8_t *)&bits, sizeof(bits));
|
||||||
|
|
|
@ -699,12 +699,7 @@ int CmdLFConfig(const char *Cmd) {
|
||||||
int lf_read(bool verbose, uint32_t samples) {
|
int lf_read(bool verbose, uint32_t samples) {
|
||||||
if (!g_session.pm3_present) return PM3_ENOTTY;
|
if (!g_session.pm3_present) return PM3_ENOTTY;
|
||||||
|
|
||||||
struct p {
|
lf_sample_payload_t payload;
|
||||||
uint32_t samples : 31;
|
|
||||||
bool verbose : 1;
|
|
||||||
} PACKED;
|
|
||||||
|
|
||||||
struct p payload;
|
|
||||||
payload.verbose = verbose;
|
payload.verbose = verbose;
|
||||||
payload.samples = samples;
|
payload.samples = samples;
|
||||||
|
|
||||||
|
@ -765,10 +760,7 @@ int CmdLFRead(const char *Cmd) {
|
||||||
int lf_sniff(bool verbose, uint32_t samples) {
|
int lf_sniff(bool verbose, uint32_t samples) {
|
||||||
if (!g_session.pm3_present) return PM3_ENOTTY;
|
if (!g_session.pm3_present) return PM3_ENOTTY;
|
||||||
|
|
||||||
struct p {
|
lf_sample_payload_t payload;
|
||||||
uint32_t samples : 31;
|
|
||||||
bool verbose : 1;
|
|
||||||
} PACKED payload;
|
|
||||||
|
|
||||||
payload.samples = (samples & 0xFFFF);
|
payload.samples = (samples & 0xFFFF);
|
||||||
payload.verbose = verbose;
|
payload.verbose = verbose;
|
||||||
|
|
|
@ -274,6 +274,17 @@ typedef struct {
|
||||||
uint8_t data[];
|
uint8_t data[];
|
||||||
} PACKED lf_hitag_t;
|
} PACKED lf_hitag_t;
|
||||||
|
|
||||||
|
// For CMD_LF_SNIFF_RAW_ADC and CMD_LF_ACQ_RAW_ADC
|
||||||
|
#define LF_SAMPLES_BITS 30
|
||||||
|
#define MAX_LF_SAMPLES ((((uint32_t)1u) << LF_SAMPLES_BITS) - 1)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
// 64KB SRAM -> 524288 bits(max sample num) < 2^30
|
||||||
|
uint32_t samples : LF_SAMPLES_BITS;
|
||||||
|
bool realtime : 1;
|
||||||
|
bool verbose : 1;
|
||||||
|
} PACKED lf_sample_payload_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t blockno;
|
uint8_t blockno;
|
||||||
uint8_t keytype;
|
uint8_t keytype;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue