FIX: Much of my added extra legic code is commented away now.

FIX: the gcc6.1.1 warning broke my gcc 4.8.4 build env..
This commit is contained in:
iceman1001 2016-09-26 20:21:31 +02:00
commit 62577a62ae
2 changed files with 29 additions and 39 deletions

View file

@ -815,7 +815,7 @@ void LegicRfInfo(void){
} }
cmd_send(CMD_ACK,1,card_sz,0,uid,sizeof(uid)); cmd_send(CMD_ACK,1,card_sz,0,uid,sizeof(uid));
out: OUT:
switch_off_tag_rwd(); switch_off_tag_rwd();
LEDsoff(); LEDsoff();
@ -1127,6 +1127,7 @@ void LegicRfSimulate(int phase, int frame, int reqresp)
// The software UART that receives commands from the reader, and its state // The software UART that receives commands from the reader, and its state
// variables. // variables.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/*
static struct { static struct {
enum { enum {
STATE_UNSYNCD, STATE_UNSYNCD,
@ -1141,7 +1142,7 @@ static struct {
int posCnt; int posCnt;
uint8_t *output; uint8_t *output;
} Uart; } Uart;
*/
/* Receive & handle a bit coming from the reader. /* Receive & handle a bit coming from the reader.
* *
* This function is called 4 times per bit (every 2 subcarrier cycles). * This function is called 4 times per bit (every 2 subcarrier cycles).
@ -1266,7 +1267,7 @@ static struct {
// return FALSE; // return FALSE;
// } // }
/*
static void UartReset() { static void UartReset() {
Uart.byteCntMax = 3; Uart.byteCntMax = 3;
@ -1276,7 +1277,7 @@ static void UartReset() {
Uart.posCnt = 0; Uart.posCnt = 0;
memset(Uart.output, 0x00, 3); memset(Uart.output, 0x00, 3);
} }
*/
// static void UartInit(uint8_t *data) { // static void UartInit(uint8_t *data) {
// Uart.output = data; // Uart.output = data;
// UartReset(); // UartReset();
@ -1288,7 +1289,7 @@ static void UartReset() {
// tag's response, which we leave in the buffer to be demodulated on the // tag's response, which we leave in the buffer to be demodulated on the
// PC side. // PC side.
//============================================================================= //=============================================================================
/*
static struct { static struct {
enum { enum {
DEMOD_UNSYNCD, DEMOD_UNSYNCD,
@ -1307,7 +1308,7 @@ static struct {
int sumI; int sumI;
int sumQ; int sumQ;
} Demod; } Demod;
*/
/* /*
* Handles reception of a bit from the tag * Handles reception of a bit from the tag
* *
@ -1323,31 +1324,7 @@ static struct {
* *
*/ */
#ifndef SUBCARRIER_DETECT_THRESHOLD /*
# define SUBCARRIER_DETECT_THRESHOLD 8
#endif
// Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by max(abs(ci),abs(cq)) + 1/2*min(abs(ci),abs(cq)))
#ifndef CHECK_FOR_SUBCARRIER
# define CHECK_FOR_SUBCARRIER() { v = MAX(ai, aq) + MIN(halfci, halfcq); }
#endif
// The soft decision on the bit uses an estimate of just the
// quadrant of the reference angle, not the exact angle.
// Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by max(abs(ci),abs(cq)) + 1/2*min(abs(ci),abs(cq)))
#define MAKE_SOFT_DECISION() { \
if(Demod.sumI > 0) \
v = ci; \
else \
v = -ci; \
\
if(Demod.sumQ > 0) \
v += cq; \
else \
v -= cq; \
\
}
static RAMFUNC int HandleLegicSamplesDemod(int ci, int cq) static RAMFUNC int HandleLegicSamplesDemod(int ci, int cq)
{ {
int v = 0; int v = 0;
@ -1502,7 +1479,8 @@ static RAMFUNC int HandleLegicSamplesDemod(int ci, int cq)
} }
return FALSE; return FALSE;
} }
*/
/*
// Clear out the state of the "UART" that receives from the tag. // Clear out the state of the "UART" that receives from the tag.
static void DemodReset() { static void DemodReset() {
Demod.len = 0; Demod.len = 0;
@ -1520,13 +1498,17 @@ static void DemodInit(uint8_t *data) {
Demod.output = data; Demod.output = data;
DemodReset(); DemodReset();
} }
*/
/* /*
* Demodulate the samples we received from the tag, also log to tracebuffer * Demodulate the samples we received from the tag, also log to tracebuffer
* quiet: set to 'TRUE' to disable debug output * quiet: set to 'TRUE' to disable debug output
*/ */
/*
#define LEGIC_DMA_BUFFER_SIZE 256 #define LEGIC_DMA_BUFFER_SIZE 256
static void GetSamplesForLegicDemod(int n, bool quiet)
static void GetSamplesForLegicDemod(int n, bool quiet)
{ {
int max = 0; int max = 0;
bool gotFrame = FALSE; bool gotFrame = FALSE;
@ -1601,9 +1583,13 @@ static void GetSamplesForLegicDemod(int n, bool quiet)
LogTrace(Demod.output, Demod.len, 0, 0, parity, FALSE); LogTrace(Demod.output, Demod.len, 0, 0, parity, FALSE);
} }
} }
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Transmit the command (to the tag) that was placed in ToSend[]. // Transmit the command (to the tag) that was placed in ToSend[].
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/*
static void TransmitForLegic(void) static void TransmitForLegic(void)
{ {
int c; int c;
@ -1650,12 +1636,13 @@ static void TransmitForLegic(void)
} }
LED_B_OFF(); LED_B_OFF();
} }
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Code a layer 2 command (string of octets, including CRC) into ToSend[], // Code a layer 2 command (string of octets, including CRC) into ToSend[],
// so that it is ready to transmit to the tag using TransmitForLegic(). // so that it is ready to transmit to the tag using TransmitForLegic().
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/*
static void CodeLegicBitsAsReader(const uint8_t *cmd, uint8_t cmdlen, int bits) static void CodeLegicBitsAsReader(const uint8_t *cmd, uint8_t cmdlen, int bits)
{ {
int i, j; int i, j;
@ -1687,11 +1674,12 @@ static void CodeLegicBitsAsReader(const uint8_t *cmd, uint8_t cmdlen, int bits)
// Convert from last character reference to length // Convert from last character reference to length
++ToSendMax; ++ToSendMax;
} }
*/
/** /**
Convenience function to encode, transmit and trace Legic comms Convenience function to encode, transmit and trace Legic comms
**/ **/
static void CodeAndTransmitLegicAsReader(const uint8_t *cmd, uint8_t cmdlen, int bits) /*
static void CodeAndTransmitLegicAsReader(const uint8_t *cmd, uint8_t cmdlen, int bits)
{ {
CodeLegicBitsAsReader(cmd, cmdlen, bits); CodeLegicBitsAsReader(cmd, cmdlen, bits);
TransmitForLegic(); TransmitForLegic();
@ -1701,8 +1689,9 @@ static void CodeAndTransmitLegicAsReader(const uint8_t *cmd, uint8_t cmdlen, int
} }
} }
*/
// Set up LEGIC communication // Set up LEGIC communication
/*
void ice_legic_setup() { void ice_legic_setup() {
// standard things. // standard things.
@ -1732,3 +1721,4 @@ void ice_legic_setup() {
// initalize prng // initalize prng
legic_prng_init(0); legic_prng_init(0);
} }
*/

View file

@ -65,7 +65,7 @@ VPATH = . ../common ../fpga ../zlib
INCLUDES = ../include/proxmark3.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/usb_cmd.h $(APP_INCLUDES) INCLUDES = ../include/proxmark3.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/usb_cmd.h $(APP_INCLUDES)
CFLAGS = -c $(INCLUDE) -Wall -Werror -Wno-error=misleading-indentation -pedantic -Wunused -std=c99 $(APP_CFLAGS) -Os CFLAGS = -c $(INCLUDE) -Wall -Werror -pedantic -Wunused -std=c99 $(APP_CFLAGS) -Os
LDFLAGS = -nostartfiles -nodefaultlibs -Wl,-gc-sections -n LDFLAGS = -nostartfiles -nodefaultlibs -Wl,-gc-sections -n
LIBS = -lgcc LIBS = -lgcc