mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
style
This commit is contained in:
parent
43608589e3
commit
83571f02a0
6 changed files with 23 additions and 24 deletions
|
@ -1457,9 +1457,9 @@ static void UsbPacketReceived(bool cmd_ng, uint8_t *packet) {
|
||||||
case CMD_PING:
|
case CMD_PING:
|
||||||
if (cmd_ng) {
|
if (cmd_ng) {
|
||||||
#ifdef WITH_FPC_HOST
|
#ifdef WITH_FPC_HOST
|
||||||
cmd_send(CMD_ACK, reply_via_fpc, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(datalen_ng-1)/4], 0, 0);
|
cmd_send(CMD_ACK, reply_via_fpc, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(datalen_ng - 1) / 4], 0, 0);
|
||||||
#else
|
#else
|
||||||
cmd_send(CMD_ACK, 0, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(c->arg[0]-1)/4], 0, 0);
|
cmd_send(CMD_ACK, 0, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(c->arg[0] - 1) / 4], 0, 0);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef WITH_FPC_HOST
|
#ifdef WITH_FPC_HOST
|
||||||
|
@ -1611,9 +1611,9 @@ void __attribute__((noreturn)) AppMain(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
#ifdef WITH_FPC_HOST
|
#ifdef WITH_FPC_HOST
|
||||||
reply_via_fpc = false;
|
reply_via_fpc = false;
|
||||||
#endif
|
#endif
|
||||||
UsbPacketReceived(true, rx);
|
UsbPacketReceived(true, rx);
|
||||||
}
|
}
|
||||||
} else { // Old style command
|
} else { // Old style command
|
||||||
|
@ -1623,9 +1623,9 @@ void __attribute__((noreturn)) AppMain(void) {
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
#ifdef WITH_FPC_HOST
|
#ifdef WITH_FPC_HOST
|
||||||
reply_via_fpc = false;
|
reply_via_fpc = false;
|
||||||
#endif
|
#endif
|
||||||
UsbPacketReceived(false, rx);
|
UsbPacketReceived(false, rx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,9 +448,9 @@ static int CmdPingNG(const char *Cmd) {
|
||||||
uint8_t data[USB_CMD_DATA_SIZE] = {0};
|
uint8_t data[USB_CMD_DATA_SIZE] = {0};
|
||||||
uint16_t cmd = CMD_PING;
|
uint16_t cmd = CMD_PING;
|
||||||
if (len >= 4)
|
if (len >= 4)
|
||||||
((uint32_t *)data)[0]=0xAABBCCDD;
|
((uint32_t *)data)[0] = 0xAABBCCDD;
|
||||||
if (len >= 8)
|
if (len >= 8)
|
||||||
((uint32_t *)data)[(len-1)/4] = 0xDDCCBBAA;
|
((uint32_t *)data)[(len - 1) / 4] = 0xDDCCBBAA;
|
||||||
SendCommandNG(cmd, data, len);
|
SendCommandNG(cmd, data, len);
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
||||||
PrintAndLogEx(NORMAL, "PingNG successful");
|
PrintAndLogEx(NORMAL, "PingNG successful");
|
||||||
|
@ -458,8 +458,7 @@ static int CmdPingNG(const char *Cmd) {
|
||||||
PrintAndLogEx(NORMAL, "%08x -> %08x", 0xAABBCCDD, resp.arg[1]);
|
PrintAndLogEx(NORMAL, "%08x -> %08x", 0xAABBCCDD, resp.arg[1]);
|
||||||
if (len >= 8)
|
if (len >= 8)
|
||||||
PrintAndLogEx(NORMAL, "%08x -> %08x", 0xDDCCBBAA, resp.arg[2]);
|
PrintAndLogEx(NORMAL, "%08x -> %08x", 0xDDCCBBAA, resp.arg[2]);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
PrintAndLogEx(NORMAL, "PingNG failed");
|
PrintAndLogEx(NORMAL, "PingNG failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ void SendCommand(UsbCommand *c) {
|
||||||
//__atomic_test_and_set(&txcmd_pending, __ATOMIC_SEQ_CST);
|
//__atomic_test_and_set(&txcmd_pending, __ATOMIC_SEQ_CST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendCommandNG(uint16_t cmd, uint8_t* data, size_t len) {
|
void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) {
|
||||||
|
|
||||||
#ifdef COMMS_DEBUG
|
#ifdef COMMS_DEBUG
|
||||||
PrintAndLogEx(NORMAL, "Sending %d bytes of payload | cmd %04x\n", len, cmd);
|
PrintAndLogEx(NORMAL, "Sending %d bytes of payload | cmd %04x\n", len, cmd);
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool IsOffline(void);
|
||||||
|
|
||||||
void *uart_receiver(void *targ);
|
void *uart_receiver(void *targ);
|
||||||
void SendCommand(UsbCommand *c);
|
void SendCommand(UsbCommand *c);
|
||||||
void SendCommandNG(uint16_t cmd, uint8_t* data, size_t len);
|
void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len);
|
||||||
void clearCommandBuffer(void);
|
void clearCommandBuffer(void);
|
||||||
|
|
||||||
#define FLASHMODE_SPEED 460800
|
#define FLASHMODE_SPEED 460800
|
||||||
|
|
|
@ -647,8 +647,8 @@ uint32_t usb_read(uint8_t *data, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t usb_read_ng_buffer[64];
|
static uint8_t usb_read_ng_buffer[64];
|
||||||
static size_t usb_read_ng_bufoff=0;
|
static size_t usb_read_ng_bufoff = 0;
|
||||||
static size_t usb_read_ng_buflen=0;
|
static size_t usb_read_ng_buflen = 0;
|
||||||
|
|
||||||
uint32_t usb_read_ng(uint8_t *data, size_t len) {
|
uint32_t usb_read_ng(uint8_t *data, size_t len) {
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ uint32_t usb_read_ng(uint8_t *data, size_t len) {
|
||||||
uint32_t time_out = 0;
|
uint32_t time_out = 0;
|
||||||
|
|
||||||
// take first from local buffer
|
// take first from local buffer
|
||||||
if ( len <= usb_read_ng_buflen ) {
|
if (len <= usb_read_ng_buflen) {
|
||||||
for (uint32_t i = 0; i < len; i++)
|
for (uint32_t i = 0; i < len; i++)
|
||||||
data[nbBytesRcv++] = usb_read_ng_buffer[usb_read_ng_bufoff + i];
|
data[nbBytesRcv++] = usb_read_ng_buffer[usb_read_ng_bufoff + i];
|
||||||
usb_read_ng_buflen -= len;
|
usb_read_ng_buflen -= len;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue