mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-07 13:41:18 -07:00
fix some ARM build fail
This commit is contained in:
parent
f11f5c2738
commit
1dea88f976
4 changed files with 44 additions and 44 deletions
|
@ -69,8 +69,8 @@ void DbpString(char *str)
|
||||||
|
|
||||||
UsbCommand c;
|
UsbCommand c;
|
||||||
c.cmd = CMD_DEBUG_PRINT_STRING;
|
c.cmd = CMD_DEBUG_PRINT_STRING;
|
||||||
c.ext1 = strlen(str);
|
c.arg[0] = strlen(str);
|
||||||
memcpy(c.d.asBytes, str, c.ext1);
|
memcpy(c.d.asBytes, str, c.arg[0]);
|
||||||
|
|
||||||
UsbSendPacket((BYTE *)&c, sizeof(c));
|
UsbSendPacket((BYTE *)&c, sizeof(c));
|
||||||
// TODO fix USB so stupid things like this aren't req'd
|
// TODO fix USB so stupid things like this aren't req'd
|
||||||
|
@ -85,9 +85,9 @@ void DbpIntegers(int x1, int x2, int x3)
|
||||||
|
|
||||||
UsbCommand c;
|
UsbCommand c;
|
||||||
c.cmd = CMD_DEBUG_PRINT_INTEGERS;
|
c.cmd = CMD_DEBUG_PRINT_INTEGERS;
|
||||||
c.ext1 = x1;
|
c.arg[0] = x1;
|
||||||
c.ext2 = x2;
|
c.arg[1] = x2;
|
||||||
c.ext3 = x3;
|
c.arg[2] = x3;
|
||||||
|
|
||||||
UsbSendPacket((BYTE *)&c, sizeof(c));
|
UsbSendPacket((BYTE *)&c, sizeof(c));
|
||||||
// XXX
|
// XXX
|
||||||
|
@ -176,9 +176,9 @@ void MeasureAntennaTuning(void)
|
||||||
vHf = (33000 * AvgAdc(ADC_CHAN_HF)) >> 10;
|
vHf = (33000 * AvgAdc(ADC_CHAN_HF)) >> 10;
|
||||||
|
|
||||||
c.cmd = CMD_MEASURED_ANTENNA_TUNING;
|
c.cmd = CMD_MEASURED_ANTENNA_TUNING;
|
||||||
c.ext1 = (vLf125 << 0) | (vLf134 << 16);
|
c.arg[0] = (vLf125 << 0) | (vLf134 << 16);
|
||||||
c.ext2 = vHf;
|
c.arg[1] = vHf;
|
||||||
c.ext3 = peakf | (peakv << 16);
|
c.arg[2] = peakf | (peakv << 16);
|
||||||
UsbSendPacket((BYTE *)&c, sizeof(c));
|
UsbSendPacket((BYTE *)&c, sizeof(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,13 +536,13 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
switch(c->cmd) {
|
switch(c->cmd) {
|
||||||
#ifdef WITH_LF
|
#ifdef WITH_LF
|
||||||
case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:
|
case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:
|
||||||
AcquireRawAdcSamples125k(c->ext1);
|
AcquireRawAdcSamples125k(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_LF
|
#ifdef WITH_LF
|
||||||
case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K:
|
case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K:
|
||||||
ModThenAcquireRawAdcSamples125k(c->ext1,c->ext2,c->ext3,c->d.asBytes);
|
ModThenAcquireRawAdcSamples125k(c->arg[0],c->arg[1],c->arg[2],c->d.asBytes);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
|
|
||||||
#ifdef WITH_ISO15693
|
#ifdef WITH_ISO15693
|
||||||
case CMD_READER_ISO_15693:
|
case CMD_READER_ISO_15693:
|
||||||
ReaderIso15693(c->ext1);
|
ReaderIso15693(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -568,28 +568,28 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
|
|
||||||
#ifdef WITH_ISO15693
|
#ifdef WITH_ISO15693
|
||||||
case CMD_SIMTAG_ISO_15693:
|
case CMD_SIMTAG_ISO_15693:
|
||||||
SimTagIso15693(c->ext1);
|
SimTagIso15693(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_ISO14443b
|
#ifdef WITH_ISO14443b
|
||||||
case CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443:
|
case CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443:
|
||||||
AcquireRawAdcSamplesIso14443(c->ext1);
|
AcquireRawAdcSamplesIso14443(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_ISO14443b
|
#ifdef WITH_ISO14443b
|
||||||
case CMD_READ_SRI512_TAG:
|
case CMD_READ_SRI512_TAG:
|
||||||
ReadSRI512Iso14443(c->ext1);
|
ReadSRI512Iso14443(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
case CMD_READ_SRIX4K_TAG:
|
case CMD_READ_SRIX4K_TAG:
|
||||||
ReadSRIX4KIso14443(c->ext1);
|
ReadSRIX4KIso14443(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_ISO14443a
|
#ifdef WITH_ISO14443a
|
||||||
case CMD_READER_ISO_14443a:
|
case CMD_READER_ISO_14443a:
|
||||||
ReaderIso14443a(c->ext1);
|
ReaderIso14443a(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
|
|
||||||
#ifdef WITH_ISO14443a
|
#ifdef WITH_ISO14443a
|
||||||
case CMD_SIMULATE_TAG_ISO_14443a:
|
case CMD_SIMULATE_TAG_ISO_14443a:
|
||||||
SimulateIso14443aTag(c->ext1, c->ext2); // ## Simulate iso14443a tag - pass tag type & UID
|
SimulateIso14443aTag(c->arg[0], c->arg[1]); // ## Simulate iso14443a tag - pass tag type & UID
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_LISTEN_READER_FIELD:
|
case CMD_LISTEN_READER_FIELD:
|
||||||
ListenReaderField(c->ext1);
|
ListenReaderField(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef WITH_LF
|
#ifdef WITH_LF
|
||||||
|
@ -641,7 +641,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
|
|
||||||
#ifdef WITH_LF
|
#ifdef WITH_LF
|
||||||
case CMD_HID_SIM_TAG:
|
case CMD_HID_SIM_TAG:
|
||||||
CmdHIDsimTAG(c->ext1, c->ext2, 1); // Simulate HID tag by ID
|
CmdHIDsimTAG(c->arg[0], c->arg[1], 1); // Simulate HID tag by ID
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
|
|
||||||
#ifdef WITH_LF
|
#ifdef WITH_LF
|
||||||
case CMD_WRITE_TI_TYPE:
|
case CMD_WRITE_TI_TYPE:
|
||||||
WriteTItag(c->ext1,c->ext2,c->ext3);
|
WriteTItag(c->arg[0],c->arg[1],c->arg[2]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -670,36 +670,36 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
} else {
|
} else {
|
||||||
n.cmd = CMD_DOWNLOADED_RAW_BITS_TI_TYPE;
|
n.cmd = CMD_DOWNLOADED_RAW_BITS_TI_TYPE;
|
||||||
}
|
}
|
||||||
n.ext1 = c->ext1;
|
n.arg[0] = c->arg[0];
|
||||||
memcpy(n.d.asDwords, BigBuf+c->ext1, 12*sizeof(DWORD));
|
memcpy(n.d.asDwords, BigBuf+c->arg[0], 12*sizeof(DWORD));
|
||||||
UsbSendPacket((BYTE *)&n, sizeof(n));
|
UsbSendPacket((BYTE *)&n, sizeof(n));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CMD_DOWNLOADED_SIM_SAMPLES_125K: {
|
case CMD_DOWNLOADED_SIM_SAMPLES_125K: {
|
||||||
BYTE *b = (BYTE *)BigBuf;
|
BYTE *b = (BYTE *)BigBuf;
|
||||||
memcpy(b+c->ext1, c->d.asBytes, 48);
|
memcpy(b+c->arg[0], c->d.asBytes, 48);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_LF
|
#ifdef WITH_LF
|
||||||
case CMD_SIMULATE_TAG_125K:
|
case CMD_SIMULATE_TAG_125K:
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
SimulateTagLowFrequency(c->ext1, 1);
|
SimulateTagLowFrequency(c->arg[0], 1);
|
||||||
LED_A_OFF();
|
LED_A_OFF();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case CMD_READ_MEM:
|
case CMD_READ_MEM:
|
||||||
ReadMem(c->ext1);
|
ReadMem(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SET_LF_DIVISOR:
|
case CMD_SET_LF_DIVISOR:
|
||||||
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, c->ext1);
|
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, c->arg[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SET_ADC_MUX:
|
case CMD_SET_ADC_MUX:
|
||||||
switch(c->ext1) {
|
switch(c->arg[0]) {
|
||||||
case 0: SetAdcMuxFor(GPIO_MUXSEL_LOPKD); break;
|
case 0: SetAdcMuxFor(GPIO_MUXSEL_LOPKD); break;
|
||||||
case 1: SetAdcMuxFor(GPIO_MUXSEL_LORAW); break;
|
case 1: SetAdcMuxFor(GPIO_MUXSEL_LORAW); break;
|
||||||
case 2: SetAdcMuxFor(GPIO_MUXSEL_HIPKD); break;
|
case 2: SetAdcMuxFor(GPIO_MUXSEL_HIPKD); break;
|
||||||
|
@ -713,7 +713,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
|
|
||||||
#ifdef WITH_LF
|
#ifdef WITH_LF
|
||||||
case CMD_LF_SIMULATE_BIDIR:
|
case CMD_LF_SIMULATE_BIDIR:
|
||||||
SimulateTagLowFrequencyBidir(c->ext1, c->ext2);
|
SimulateTagLowFrequencyBidir(c->arg[0], c->arg[1]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
LCDReset();
|
LCDReset();
|
||||||
break;
|
break;
|
||||||
case CMD_LCD:
|
case CMD_LCD:
|
||||||
LCDSend(c->ext1);
|
LCDSend(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case CMD_SETUP_WRITE:
|
case CMD_SETUP_WRITE:
|
||||||
|
@ -749,8 +749,8 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
case CMD_DEVICE_INFO: {
|
case CMD_DEVICE_INFO: {
|
||||||
UsbCommand c;
|
UsbCommand c;
|
||||||
c.cmd = CMD_DEVICE_INFO;
|
c.cmd = CMD_DEVICE_INFO;
|
||||||
c.ext1 = DEVICE_INFO_FLAG_OSIMAGE_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_OS;
|
c.arg[0] = DEVICE_INFO_FLAG_OSIMAGE_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_OS;
|
||||||
if(common_area.flags.bootrom_present) c.ext1 |= DEVICE_INFO_FLAG_BOOTROM_PRESENT;
|
if(common_area.flags.bootrom_present) c.arg[0] |= DEVICE_INFO_FLAG_BOOTROM_PRESENT;
|
||||||
UsbSendPacket((BYTE*)&c, sizeof(c));
|
UsbSendPacket((BYTE*)&c, sizeof(c));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -185,8 +185,8 @@ static void frame_receive_rwd(struct legic_frame * const f, int bits)
|
||||||
static void frame_respond_tag(struct legic_frame const * const f)
|
static void frame_respond_tag(struct legic_frame const * const f)
|
||||||
{
|
{
|
||||||
LED_D_ON();
|
LED_D_ON();
|
||||||
int i, r_size;
|
int i, r_size=0;
|
||||||
uint16_t r_data;
|
uint16_t r_data=0;
|
||||||
|
|
||||||
for(i=0; i<sizeof(queries)/sizeof(queries[0]); i++) {
|
for(i=0; i<sizeof(queries)/sizeof(queries[0]); i++) {
|
||||||
if(f->bits == queries[i].bits && f->data == queries[i].data) {
|
if(f->bits == queries[i].bits && f->data == queries[i].data) {
|
||||||
|
|
|
@ -83,9 +83,9 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
case CMD_DEVICE_INFO:
|
case CMD_DEVICE_INFO:
|
||||||
dont_ack = 1;
|
dont_ack = 1;
|
||||||
c->cmd = CMD_DEVICE_INFO;
|
c->cmd = CMD_DEVICE_INFO;
|
||||||
c->ext1 = DEVICE_INFO_FLAG_BOOTROM_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM |
|
c->arg[0] = DEVICE_INFO_FLAG_BOOTROM_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM |
|
||||||
DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH;
|
DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH;
|
||||||
if(common_area.flags.osimage_present) c->ext1 |= DEVICE_INFO_FLAG_OSIMAGE_PRESENT;
|
if(common_area.flags.osimage_present) c->arg[0] |= DEVICE_INFO_FLAG_OSIMAGE_PRESENT;
|
||||||
UsbSendPacket(packet, len);
|
UsbSendPacket(packet, len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
*/
|
*/
|
||||||
p = (volatile DWORD *)&_flash_start;
|
p = (volatile DWORD *)&_flash_start;
|
||||||
for(i = 0; i < 12; i++) {
|
for(i = 0; i < 12; i++) {
|
||||||
p[i+c->ext1] = c->d.asDwords[i];
|
p[i+c->arg[0]] = c->d.asDwords[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that the address that we are supposed to write to is within our allowed region */
|
/* Check that the address that we are supposed to write to is within our allowed region */
|
||||||
if( ((c->ext1+AT91C_IFLASH_PAGE_SIZE-1) >= end_addr) || (c->ext1 < start_addr) ) {
|
if( ((c->arg[0]+AT91C_IFLASH_PAGE_SIZE-1) >= end_addr) || (c->arg[0] < start_addr) ) {
|
||||||
/* Disallow write */
|
/* Disallow write */
|
||||||
dont_ack = 1;
|
dont_ack = 1;
|
||||||
c->cmd = CMD_NACK;
|
c->cmd = CMD_NACK;
|
||||||
|
@ -114,7 +114,7 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
} else {
|
} else {
|
||||||
/* Translate address to flash page and do flash, update here for the 512k part */
|
/* Translate address to flash page and do flash, update here for the 512k part */
|
||||||
AT91C_BASE_EFC0->EFC_FCR = MC_FLASH_COMMAND_KEY |
|
AT91C_BASE_EFC0->EFC_FCR = MC_FLASH_COMMAND_KEY |
|
||||||
MC_FLASH_COMMAND_PAGEN((c->ext1-(int)&_flash_start)/AT91C_IFLASH_PAGE_SIZE) |
|
MC_FLASH_COMMAND_PAGEN((c->arg[0]-(int)&_flash_start)/AT91C_IFLASH_PAGE_SIZE) |
|
||||||
AT91C_MC_FCMD_START_PROG;
|
AT91C_MC_FCMD_START_PROG;
|
||||||
}
|
}
|
||||||
while(!(AT91C_BASE_EFC0->EFC_FSR & MC_FLASH_STATUS_READY))
|
while(!(AT91C_BASE_EFC0->EFC_FSR & MC_FLASH_STATUS_READY))
|
||||||
|
@ -127,15 +127,15 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_START_FLASH:
|
case CMD_START_FLASH:
|
||||||
if(c->ext3 == START_FLASH_MAGIC) bootrom_unlocked = 1;
|
if(c->arg[2] == START_FLASH_MAGIC) bootrom_unlocked = 1;
|
||||||
else bootrom_unlocked = 0;
|
else bootrom_unlocked = 0;
|
||||||
{
|
{
|
||||||
int prot_start = (int)&_bootrom_start;
|
int prot_start = (int)&_bootrom_start;
|
||||||
int prot_end = (int)&_bootrom_end;
|
int prot_end = (int)&_bootrom_end;
|
||||||
int allow_start = (int)&_flash_start;
|
int allow_start = (int)&_flash_start;
|
||||||
int allow_end = (int)&_flash_end;
|
int allow_end = (int)&_flash_end;
|
||||||
int cmd_start = c->ext1;
|
int cmd_start = c->arg[0];
|
||||||
int cmd_end = c->ext2;
|
int cmd_end = c->arg[1];
|
||||||
|
|
||||||
/* Only allow command if the bootrom is unlocked, or the parameters are outside of the protected
|
/* Only allow command if the bootrom is unlocked, or the parameters are outside of the protected
|
||||||
* bootrom area. In any case they must be within the flash area.
|
* bootrom area. In any case they must be within the flash area.
|
||||||
|
|
|
@ -78,7 +78,7 @@ typedef signed short SWORD;
|
||||||
|
|
||||||
#include <usb_cmd.h>
|
#include <usb_cmd.h>
|
||||||
|
|
||||||
#define PACKED __attribute__((__packed__))
|
//#define PACKED __attribute__((__packed__))
|
||||||
|
|
||||||
#define USB_D_PLUS_PULLUP_ON() { \
|
#define USB_D_PLUS_PULLUP_ON() { \
|
||||||
HIGH(GPIO_USB_PU); \
|
HIGH(GPIO_USB_PU); \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue