FPGA: Change the WITH_HF_15_LOWSIGNAL macro toggle to a runtime check.
This commit is contained in:
1 parent
2b0514923d
commit
416201a535
2 files changed
+27
-8
No files matched your search
+5
-1
@@ -59,18 +59,22 @@ PAR_OPTIONS = -t 1
|
||||
# To enable these modules WITH_LF _MUST_NOT_ be defined
|
||||
# WITH_HF0 enable HF reader (see also WITH_HF_15 below)
|
||||
# WITH_HF_15 select "iso15 2sc mode" extensions instead of original
|
||||
# (the iso15 low-signal reader detection thresholds are selected at runtime
|
||||
# in hi_reader.v, based on subcarrier/minor mode -- no separate define)
|
||||
# WITH_HF1 enable HF simulated tag
|
||||
# WITH_HF2 enable HF ISO14443-A
|
||||
# WITH_HF3 enable sniff
|
||||
# WITH_HF4 enable HF ISO18092 FeliCa
|
||||
# WITH_HF5 enable HF get trace
|
||||
|
||||
# WITH_TIMODE enable TI mode (for SPI_SSC. PM5 only currently)
|
||||
|
||||
# RDV40/Generic - Enable LF and all the LF modules
|
||||
TARGET1_OPTIONS = -define \{WITH_LF WITH_LF0 WITH_LF1 WITH_LF2 WITH_LF3\}
|
||||
# RDV40/Generic - Enable all HF modules except Felica
|
||||
TARGET2_OPTIONS = -define \{WITH_HF0 WITH_HF1 WITH_HF2 WITH_HF3 WITH_HF5\}
|
||||
# RDV40/Generic - Enable all HF modules except Felica and ISO14443, select HF_15 instead of HF
|
||||
TARGET3_OPTIONS = -define \{WITH_HF0 WITH_HF1 WITH_HF3 WITH_HF5 WITH_HF_15 WITH_HF_15_LOWSIGNAL\}
|
||||
TARGET3_OPTIONS = -define \{WITH_HF0 WITH_HF1 WITH_HF3 WITH_HF5 WITH_HF_15\}
|
||||
# RDV40/Generic - Enable all HF modules except ISO14443
|
||||
TARGET4_OPTIONS = -define \{WITH_HF0 WITH_HF1 WITH_HF3 WITH_HF4 WITH_HF5\}
|
||||
# ICOPYX
|
||||
|
||||
+22
-7
@@ -42,15 +42,30 @@ assign adc_clk = ck_1356meg; // sample frequency is 13,56 MHz
|
||||
// using AM. Do this the same way that we do it for the simulated tag.
|
||||
reg after_hysteresis, after_hysteresis_prev, after_hysteresis_prev_prev;
|
||||
reg [11:0] has_been_low_for;
|
||||
|
||||
// Reader-carrier detection thresholds, selected at runtime by the configured mode.
|
||||
// The lower thresholds (240 / 63 instead of 255 / 0) allow the reader signal to still be recovered
|
||||
// when the received level is weak. They are meant for ISO15693: the 2-subcarrier modes, plus the
|
||||
// amplitude sniffer that "hf 15 sniff" uses -- including the plain SNIFF_AMPLITUDE that its jam
|
||||
// sequence switches to and keeps for the rest of the command.
|
||||
// This module is shared with other protocols (ISO14443B sniff reads the very same
|
||||
// after_hysteresis bits) and must keep the rail-to-rail thresholds there, so the selection is done
|
||||
// at runtime instead of with a compile-time switch.
|
||||
wire low_signal_mode = (subcarrier_frequency == `FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ)
|
||||
|| (minor_mode == `FPGA_HF_READER_MODE_SNIFF_AMPLITUDE);
|
||||
|
||||
always @(negedge adc_clk)
|
||||
begin
|
||||
`ifdef WITH_HF_15_LOWSIGNAL
|
||||
if (& adc_d[7:4]) after_hysteresis <= 1'b1;
|
||||
else if (~(| adc_d[7:6])) after_hysteresis <= 1'b0;
|
||||
`else
|
||||
if (& adc_d[7:0]) after_hysteresis <= 1'b1;
|
||||
else if (~(| adc_d[7:0])) after_hysteresis <= 1'b0;
|
||||
`endif
|
||||
if (low_signal_mode)
|
||||
begin
|
||||
if (& adc_d[7:4]) after_hysteresis <= 1'b1;
|
||||
else if (~(| adc_d[7:6])) after_hysteresis <= 1'b0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (& adc_d[7:0]) after_hysteresis <= 1'b1;
|
||||
else if (~(| adc_d[7:0])) after_hysteresis <= 1'b0;
|
||||
end
|
||||
|
||||
if (after_hysteresis)
|
||||
begin
|
||||
|
||||
Reference in new issue
Block a user