mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
style
This commit is contained in:
parent
ed67936892
commit
6fa188062c
6 changed files with 22 additions and 22 deletions
|
@ -25,7 +25,7 @@
|
||||||
Communication between ARM / FPGA is done inside armsrc/fpgaloader.c (function FpgaSendCommand)
|
Communication between ARM / FPGA is done inside armsrc/fpgaloader.c (function FpgaSendCommand)
|
||||||
Send 16 bit command / data pair to FPGA
|
Send 16 bit command / data pair to FPGA
|
||||||
The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
|
The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
|
||||||
where
|
where
|
||||||
C is 4bit command
|
C is 4bit command
|
||||||
D is 12bit data
|
D is 12bit data
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||||
-----+-------------------------------------------
|
-----+-------------------------------------------
|
||||||
cmd | x x x x
|
cmd | x x x x
|
||||||
major| x x x
|
major| x x x
|
||||||
opt | x x
|
opt | x x
|
||||||
divi | x x x x x x x x
|
divi | x x x x x x x x
|
||||||
thres| x x x x x x x x
|
thres| x x x x x x x x
|
||||||
|
@ -71,7 +71,7 @@ thres| x x x x x x x x
|
||||||
#define FPGA_MAJOR_MODE_OFF (7<<5) // D
|
#define FPGA_MAJOR_MODE_OFF (7<<5) // D
|
||||||
|
|
||||||
// Options for LF_READER
|
// Options for LF_READER
|
||||||
#define FPGA_LF_ADC_READER_FIELD 0x1
|
#define FPGA_LF_ADC_READER_FIELD 0x1
|
||||||
|
|
||||||
// Options for LF_EDGE_DETECT
|
// Options for LF_EDGE_DETECT
|
||||||
#define FPGA_CMD_SET_EDGE_DETECT_THRESHOLD FPGA_CMD_SET_USER_BYTE1
|
#define FPGA_CMD_SET_EDGE_DETECT_THRESHOLD FPGA_CMD_SET_USER_BYTE1
|
||||||
|
|
|
@ -54,26 +54,26 @@ void printConfig() {
|
||||||
void setSamplingConfig(sample_config *sc) {
|
void setSamplingConfig(sample_config *sc) {
|
||||||
|
|
||||||
// decimation (1-8) how many bits of adc sample value to save
|
// decimation (1-8) how many bits of adc sample value to save
|
||||||
if (sc->decimation > 0 && sc->decimation < 8)
|
if (sc->decimation > 0 && sc->decimation < 8)
|
||||||
config.decimation = sc->decimation;
|
config.decimation = sc->decimation;
|
||||||
|
|
||||||
// bits per sample (1-8)
|
// bits per sample (1-8)
|
||||||
if (sc->bits_per_sample > 0 && sc->bits_per_sample < 8)
|
if (sc->bits_per_sample > 0 && sc->bits_per_sample < 8)
|
||||||
config.bits_per_sample = sc->bits_per_sample;
|
config.bits_per_sample = sc->bits_per_sample;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (sc->averaging > -1)
|
if (sc->averaging > -1)
|
||||||
config.averaging = (sc->averaging > 0) ? 1 : 0;
|
config.averaging = (sc->averaging > 0) ? 1 : 0;
|
||||||
|
|
||||||
// Frequency divisor (19 - 255)
|
// Frequency divisor (19 - 255)
|
||||||
if (sc->divisor > 18 && sc->divisor < 256)
|
if (sc->divisor > 18 && sc->divisor < 256)
|
||||||
config.divisor = sc->divisor;
|
config.divisor = sc->divisor;
|
||||||
|
|
||||||
// Start saving samples when adc value larger than trigger_threshold
|
// Start saving samples when adc value larger than trigger_threshold
|
||||||
if (sc->trigger_threshold > -1)
|
if (sc->trigger_threshold > -1)
|
||||||
config.trigger_threshold = sc->trigger_threshold;
|
config.trigger_threshold = sc->trigger_threshold;
|
||||||
|
|
||||||
// Skip n adc samples before saving
|
// Skip n adc samples before saving
|
||||||
if (sc->samples_to_skip > -1)
|
if (sc->samples_to_skip > -1)
|
||||||
config.samples_to_skip = sc->samples_to_skip;
|
config.samples_to_skip = sc->samples_to_skip;
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ static int CmdPacSim(const char *Cmd) {
|
||||||
rawBlocks[i] = bytes_to_num(rawBytes + (i * sizeof(uint32_t)), sizeof(uint32_t));
|
rawBlocks[i] = bytes_to_num(rawBytes + (i * sizeof(uint32_t)), sizeof(uint32_t));
|
||||||
num_to_bytebits(rawBlocks[i], sizeof(uint32_t) * 8, bs + (i * sizeof(uint32_t) * 8));
|
num_to_bytebits(rawBlocks[i], sizeof(uint32_t) * 8, bs + (i * sizeof(uint32_t) * 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "Simulating PAC/Stanley - ID " _YELLOW_("%s")" raw "_YELLOW_("%08X%08X%08X%08X"), cardid, rawBlocks[0], rawBlocks[1], rawBlocks[2], rawBlocks[3]);
|
PrintAndLogEx(SUCCESS, "Simulating PAC/Stanley - ID " _YELLOW_("%s")" raw "_YELLOW_("%08X%08X%08X%08X"), cardid, rawBlocks[0], rawBlocks[1], rawBlocks[2], rawBlocks[3]);
|
||||||
|
|
||||||
lf_nrzsim_t *payload = calloc(1, sizeof(lf_nrzsim_t) + sizeof(bs));
|
lf_nrzsim_t *payload = calloc(1, sizeof(lf_nrzsim_t) + sizeof(bs));
|
||||||
|
|
|
@ -93,7 +93,7 @@ module fpga_hf(
|
||||||
Communication between ARM / FPGA is done inside armsrc/fpgaloader.c see: function FpgaSendCommand()
|
Communication between ARM / FPGA is done inside armsrc/fpgaloader.c see: function FpgaSendCommand()
|
||||||
Send 16 bit command / data pair to FPGA
|
Send 16 bit command / data pair to FPGA
|
||||||
The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
|
The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
|
||||||
where
|
where
|
||||||
C is 4bit command
|
C is 4bit command
|
||||||
D is 12bit data
|
D is 12bit data
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ module fpga_hf(
|
||||||
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||||
-----+-------------------------------------------
|
-----+-------------------------------------------
|
||||||
cmd | x x x x
|
cmd | x x x x
|
||||||
major| x x x
|
major| x x x
|
||||||
opt | x x
|
opt | x x
|
||||||
divi | x x x x x x x x
|
divi | x x x x x x x x
|
||||||
thres| x x x x x x x x
|
thres| x x x x x x x x
|
||||||
|
|
|
@ -56,7 +56,7 @@ module fpga_lf(
|
||||||
Communication between ARM / FPGA is done inside armsrc/fpgaloader.c see: function FpgaSendCommand()
|
Communication between ARM / FPGA is done inside armsrc/fpgaloader.c see: function FpgaSendCommand()
|
||||||
Send 16 bit command / data pair to FPGA
|
Send 16 bit command / data pair to FPGA
|
||||||
The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
|
The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
|
||||||
where
|
where
|
||||||
C is 4bit command
|
C is 4bit command
|
||||||
D is 12bit data
|
D is 12bit data
|
||||||
|
|
||||||
|
@ -83,11 +83,11 @@ module fpga_lf(
|
||||||
Each one of this major modes can have options. Currently these two major modes uses options.
|
Each one of this major modes can have options. Currently these two major modes uses options.
|
||||||
- FPGA_MAJOR_MODE_LF_READER
|
- FPGA_MAJOR_MODE_LF_READER
|
||||||
- FPGA_MAJOR_MODE_LF_EDGE_DETECT
|
- FPGA_MAJOR_MODE_LF_EDGE_DETECT
|
||||||
|
|
||||||
FPGA_MAJOR_MODE_LF_READER
|
FPGA_MAJOR_MODE_LF_READER
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
lf_field = 1bit (FPGA_LF_ADC_READER_FIELD)
|
lf_field = 1bit (FPGA_LF_ADC_READER_FIELD)
|
||||||
|
|
||||||
You can send FPGA_CMD_SET_DIVISOR to set with FREQUENCY the fpga should sample at
|
You can send FPGA_CMD_SET_DIVISOR to set with FREQUENCY the fpga should sample at
|
||||||
divisor = 8bits shift_reg[7:0]
|
divisor = 8bits shift_reg[7:0]
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ module fpga_lf(
|
||||||
|
|
||||||
conf_word 12bits
|
conf_word 12bits
|
||||||
conf_word[7:5] = 3bit major mode.
|
conf_word[7:5] = 3bit major mode.
|
||||||
conf_word[0] = 1bit lf_field
|
conf_word[0] = 1bit lf_field
|
||||||
conf_word[1] = 1bit lf_ed_toggle_mode
|
conf_word[1] = 1bit lf_ed_toggle_mode
|
||||||
conf_word[7:0] = 8bit divisor
|
conf_word[7:0] = 8bit divisor
|
||||||
conf_word[7:0] = 8bit threshold
|
conf_word[7:0] = 8bit threshold
|
||||||
|
@ -110,7 +110,7 @@ module fpga_lf(
|
||||||
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||||
-----+-------------------------------------------
|
-----+-------------------------------------------
|
||||||
cmd | x x x x
|
cmd | x x x x
|
||||||
major| x x x
|
major| x x x
|
||||||
opt | x x
|
opt | x x
|
||||||
divi | x x x x x x x x
|
divi | x x x x x x x x
|
||||||
thres| x x x x x x x x
|
thres| x x x x x x x x
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/*
|
/*
|
||||||
This code demodulates and modulates signal as described in ISO/IEC 18092.
|
This code demodulates and modulates signal as described in ISO/IEC 18092.
|
||||||
That includes packets used for Felica, NFC Tag 3, etc. (which do overlap)
|
That includes packets used for Felica, NFC Tag 3, etc. (which do overlap)
|
||||||
simple envelope following algorithm is used (modification of fail0verflow LF one)
|
simple envelope following algorithm is used (modification of fail0verflow LF one)
|
||||||
is used to combat some nasty aliasing effect with testing phone (envelope looked like sine wave)
|
is used to combat some nasty aliasing effect with testing phone (envelope looked like sine wave)
|
||||||
|
|
||||||
Speeds supported: only 212 kbps (fc/64) for now. Todo: 414 kbps
|
Speeds supported: only 212 kbps (fc/64) for now. Todo: 414 kbps
|
||||||
though for reader, the selection has to come from ARM. modulation waits for market sprocket -doesn't really mean anything
|
though for reader, the selection has to come from ARM. modulation waits for market sprocket -doesn't really mean anything
|
||||||
|
|
||||||
mod_type: bits 210:
|
mod_type: bits 210:
|
||||||
bit 2 : reader drive/power on/off
|
bit 2 : reader drive/power on/off
|
||||||
bit 1 : speed bit, 0 : 212, 1 :424
|
bit 1 : speed bit, 0 : 212, 1 :424
|
||||||
bit 0 : listen or modulate
|
bit 0 : listen or modulate
|
||||||
|
@ -130,7 +130,7 @@ reg ssp_din;
|
||||||
reg prv = 1'b1;
|
reg prv = 1'b1;
|
||||||
|
|
||||||
// for simple error correction in mod/demod detection, use maximum of modded/demodded in given interval. Maybe 1 bit is extra? but better safe than sorry.
|
// for simple error correction in mod/demod detection, use maximum of modded/demodded in given interval. Maybe 1 bit is extra? but better safe than sorry.
|
||||||
reg[7:0] mid = 8'd128;
|
reg[7:0] mid = 8'd128;
|
||||||
|
|
||||||
// set TAGSIM__MODULATE on ARM if we want to write... (frame would get lost if done mid-frame...)
|
// set TAGSIM__MODULATE on ARM if we want to write... (frame would get lost if done mid-frame...)
|
||||||
// start sending over 1s on ssp->arm when we start sending preamble
|
// start sending over 1s on ssp->arm when we start sending preamble
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue