mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-13 10:07:25 -07:00
Merge branch 'master' of https://github.com/RfidResearchGroup/proxmark3
This commit is contained in:
commit
d739edd13e
66 changed files with 360 additions and 276 deletions
armsrc
Standalone
hf_14asniff.chf_bog.chf_colin.chf_legic.chf_mattyrun.chf_msdsal.chf_young.clf_em4100emul.clf_em4100rwc.clf_hidbrute.clf_icehid.clf_proxbrute.clf_samyrun.clf_skeleton.cplaceholder.cstandalone.h
appmain.cappmain.hdbprint.cdbprint.hdesfire_crypto.hepa.cepa.hfelica.cfelica.hflashmem.cflashmem.hhitag2.chitagS.ci2c.ciclass.ciso14443a.ciso14443b.ciso14443b.hiso15693.clegicrf.clegicrfsim.clfadc.clfadc.hlfops.clfsampling.clfsampling.hmifarecmd.cmifarecmd.hmifaredesfire.cmifaredesfire.hmifaresniff_disabled.cmifareutil.cmifareutil.hpcf7931.cpcf7931.hspiffs.cspiffs.hspiffs_config.hstart.cstring.hthinfilm.cticks.hutil.cbootrom
client
common/crapto1
common_arm
|
@ -68,7 +68,7 @@
|
|||
|
||||
#define HF_14ASNIFF_LOGFILE "hf_14asniff.trc"
|
||||
|
||||
void DownloadTraceInstructions() {
|
||||
static void DownloadTraceInstructions(void) {
|
||||
Dbprintf("");
|
||||
Dbprintf("To get the trace from flash and display it:");
|
||||
Dbprintf("1. mem spiffs dump o "HF_14ASNIFF_LOGFILE" f trace.trc");
|
||||
|
@ -81,7 +81,7 @@ void ModInfo(void) {
|
|||
DownloadTraceInstructions();
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
|
||||
Dbprintf("Starting standalone mode: hf_14asniff");
|
||||
|
|
|
@ -41,7 +41,7 @@ from the client to view the stored quadlets.
|
|||
#define HF_BOG_LOGFILE "hf_bog.log"
|
||||
|
||||
// This is actually copied from SniffIso14443a
|
||||
void RAMFUNC SniffAndStore(uint8_t param) {
|
||||
static void RAMFUNC SniffAndStore(uint8_t param) {
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_SNIFFER);
|
||||
|
||||
|
@ -235,7 +235,7 @@ void ModInfo(void) {
|
|||
DbpString(" HF 14a sniff standalone with ULC/ULEV1/NTAG auth storing in flashmem - aka BogitoRun (Bogito)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
|
||||
StandAloneMode();
|
||||
|
||||
|
|
|
@ -104,7 +104,12 @@ static const uint8_t is_hex[] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
// Note: inlining this function would fail with -Os
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
static uint64_t hex2i(const char *s) {
|
||||
#else
|
||||
static inline uint64_t hex2i(const char *s) {
|
||||
#endif
|
||||
uint64_t val = 0;
|
||||
if (s == NULL || s[0] == 0)
|
||||
return 0;
|
||||
|
@ -198,14 +203,14 @@ MFC1KSchema InfiHexact = {.name = "Infineon/Hexact",
|
|||
|
||||
int total_schemas = 0;
|
||||
|
||||
void add_schema(MFC1KSchema *p, MFC1KSchema a, int *schemas_counter) {
|
||||
static void add_schema(MFC1KSchema *p, MFC1KSchema a, int *schemas_counter) {
|
||||
if (*schemas_counter < MAX_SCHEMAS) {
|
||||
p[*schemas_counter] = a;
|
||||
*schemas_counter += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void delete_schema(MFC1KSchema *p, int *schemas_counter, int index) {
|
||||
/*
|
||||
static void delete_schema(MFC1KSchema *p, int *schemas_counter, int index) {
|
||||
if (*schemas_counter > 0 && index < *schemas_counter && index > -1) {
|
||||
int last_index = *schemas_counter - 1;
|
||||
for (int i = index; i < last_index; i++) {
|
||||
|
@ -214,23 +219,23 @@ void delete_schema(MFC1KSchema *p, int *schemas_counter, int index) {
|
|||
*schemas_counter -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void cjSetCursFRight() {
|
||||
*/
|
||||
static void cjSetCursFRight(void) {
|
||||
vtsend_cursor_position(NULL, 98, (currfline));
|
||||
currfline++;
|
||||
}
|
||||
|
||||
void cjSetCursRight() {
|
||||
static void cjSetCursRight(void) {
|
||||
vtsend_cursor_position(NULL, 59, (currline));
|
||||
currline++;
|
||||
}
|
||||
|
||||
void cjSetCursLeft() {
|
||||
static void cjSetCursLeft(void) {
|
||||
vtsend_cursor_position(NULL, 0, (curlline));
|
||||
curlline++;
|
||||
}
|
||||
|
||||
void cjTabulize() { DbprintfEx(FLAG_RAWPRINT, "\t\t\t"); }
|
||||
static void cjTabulize(void) { DbprintfEx(FLAG_RAWPRINT, "\t\t\t"); }
|
||||
|
||||
/*
|
||||
void cjPrintKey(uint64_t key, uint8_t *foundKey, uint16_t sectorNo, uint8_t type) {
|
||||
|
@ -240,7 +245,7 @@ foundKey[5]); cjSetCursRight(); DbprintfEx(FLAG_NEWLINE, "SEC: %02x | KEY : %s |
|
|||
}
|
||||
*/
|
||||
|
||||
char *ReadSchemasFromSPIFFS(char *filename) {
|
||||
static char *ReadSchemasFromSPIFFS(char *filename) {
|
||||
SpinOff(0);
|
||||
|
||||
int changed = rdv40_spiffs_lazy_mount();
|
||||
|
@ -255,7 +260,7 @@ char *ReadSchemasFromSPIFFS(char *filename) {
|
|||
return (char *)mem;
|
||||
}
|
||||
|
||||
void add_schemas_from_json_in_spiffs(char *filename) {
|
||||
static void add_schemas_from_json_in_spiffs(char *filename) {
|
||||
|
||||
char *jsonfile = ReadSchemasFromSPIFFS((char *)filename);
|
||||
|
||||
|
@ -275,7 +280,7 @@ void add_schemas_from_json_in_spiffs(char *filename) {
|
|||
}
|
||||
}
|
||||
|
||||
void ReadLastTagFromFlash() {
|
||||
static void ReadLastTagFromFlash(void) {
|
||||
SpinOff(0);
|
||||
LED_A_ON();
|
||||
LED_B_ON();
|
||||
|
@ -332,7 +337,7 @@ void WriteTagToFlash(uint32_t uid, size_t size) {
|
|||
|
||||
void ModInfo(void) { DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); }
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
|
||||
// add_schema(Schemas, Noralsy, &total_schemas);
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
void DownloadLogInstructions() {
|
||||
static void DownloadLogInstructions(void) {
|
||||
Dbprintf("");
|
||||
Dbprintf("[=] List all dumps from flash:");
|
||||
Dbprintf("[=] " _YELLOW_("-") " mem spiffs tree");
|
||||
|
@ -53,7 +53,7 @@ void DownloadLogInstructions() {
|
|||
Dbprintf("[=] " _YELLOW_("-") " mem spiffs dump o hf-legic-UID-dump.bin f hf-legic-UID-dump.bin");
|
||||
}
|
||||
|
||||
void save_dump_to_file(legic_card_select_t *p_card) {
|
||||
static void save_dump_to_file(legic_card_select_t *p_card) {
|
||||
|
||||
#ifdef WITH_FLASH
|
||||
|
||||
|
@ -99,7 +99,7 @@ void ModInfo(void) {
|
|||
// A, B, C = Reading
|
||||
// A, D = Simulating
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
Dbprintf("[=] >> HF Legic Prime Read/Simulate Started <<");
|
||||
|
|
|
@ -210,7 +210,7 @@ void ModInfo(void) {
|
|||
DbpString(" HF Mifare sniff/clone - aka MattyRun (Matías A. Ré Medina)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> Matty mifare chk/dump/sim a.k.a MattyRun Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
|
|
@ -54,7 +54,7 @@ void ModInfo(void) {
|
|||
|
||||
uint8_t ppdol [255] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00}; // Default GET PROCESSING
|
||||
|
||||
uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCESSING
|
||||
static uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCESSING
|
||||
uint8_t plen = 7;
|
||||
//PDOL Format: 80 A8 00 00 + (PDOL Length+2) + 83 + PDOL Length + PDOL + 00
|
||||
for (uint8_t i = 1; i <= apdu[0]; i++) { //Magic stuff, the generation order is important
|
||||
|
@ -117,7 +117,7 @@ uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCESSING
|
|||
return plen;
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(_YELLOW_(">>") "Reading Visa cards & Emulating a Visa MSD Transaction a.k.a. MSDSal Started<<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
|
|
@ -37,7 +37,7 @@ void ModInfo(void) {
|
|||
DbpString(" HF Mifare sniff/simulation - (Craig Young)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> Craig Young Mifare sniff UID/clone uid 2 magic/sim a.k.a YoungRun Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "ticks.h"
|
||||
#include "string.h"
|
||||
#include "BigBuf.h"
|
||||
#include "commonutil.h"
|
||||
|
||||
#define MAX_IND 16 // 4 LEDs - 2^4 combinations
|
||||
#define CLOCK 64 //for 125kHz
|
||||
|
@ -34,7 +35,7 @@ void ModInfo(void) {
|
|||
DbpString(" LF EM4100 simulator standalone mode");
|
||||
}
|
||||
|
||||
uint64_t ReversQuads(uint64_t bits) {
|
||||
static uint64_t ReversQuads(uint64_t bits) {
|
||||
uint64_t result = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
result += ((bits >> (60 - 4 * i)) & 0xf) << (4 * i);
|
||||
|
@ -42,14 +43,14 @@ uint64_t ReversQuads(uint64_t bits) {
|
|||
return result >> 24;
|
||||
}
|
||||
|
||||
void FillBuff(uint8_t bit) {
|
||||
static void FillBuff(uint8_t bit) {
|
||||
memset(bba + buflen, bit, CLOCK / 2);
|
||||
buflen += (CLOCK / 2);
|
||||
memset(bba + buflen, bit ^ 1, CLOCK / 2);
|
||||
buflen += (CLOCK / 2);
|
||||
}
|
||||
|
||||
void ConstructEM410xEmulBuf(uint64_t id) {
|
||||
static void ConstructEM410xEmulBuf(uint64_t id) {
|
||||
|
||||
int i, j, binary[4], parity[4];
|
||||
buflen = 0;
|
||||
|
@ -70,7 +71,7 @@ void ConstructEM410xEmulBuf(uint64_t id) {
|
|||
FillBuff(0);
|
||||
}
|
||||
|
||||
void LED_Slot(int i) {
|
||||
static void LED_Slot(int i) {
|
||||
LEDsoff();
|
||||
if (slots_count > 4) {
|
||||
LED(i % MAX_IND, 0); //binary indication for slots_count > 4
|
||||
|
@ -79,7 +80,7 @@ void LED_Slot(int i) {
|
|||
}
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf("[=] >> LF EM4100 simulator started <<");
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "string.h"
|
||||
#include "BigBuf.h"
|
||||
#include "spiffs.h"
|
||||
#include "commonutil.h"
|
||||
|
||||
#ifdef WITH_FLASH
|
||||
#include "flashmem.h"
|
||||
|
@ -47,7 +48,7 @@ void ModInfo(void) {
|
|||
DbpString(" LF EM4100 read/write/clone mode");
|
||||
}
|
||||
|
||||
uint64_t ReversQuads(uint64_t bits) {
|
||||
static uint64_t ReversQuads(uint64_t bits) {
|
||||
uint64_t result = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
result += ((bits >> (60 - 4 * i)) & 0xf) << (4 * i);
|
||||
|
@ -55,14 +56,14 @@ uint64_t ReversQuads(uint64_t bits) {
|
|||
return result >> 24;
|
||||
}
|
||||
|
||||
void FillBuff(uint8_t bit) {
|
||||
static void FillBuff(uint8_t bit) {
|
||||
memset(bba + buflen, bit, CLOCK / 2);
|
||||
buflen += (CLOCK / 2);
|
||||
memset(bba + buflen, bit ^ 1, CLOCK / 2);
|
||||
buflen += (CLOCK / 2);
|
||||
}
|
||||
|
||||
void ConstructEM410xEmulBuf(uint64_t id) {
|
||||
static void ConstructEM410xEmulBuf(uint64_t id) {
|
||||
|
||||
int i, j, binary[4], parity[4];
|
||||
buflen = 0;
|
||||
|
@ -83,7 +84,7 @@ void ConstructEM410xEmulBuf(uint64_t id) {
|
|||
FillBuff(0);
|
||||
}
|
||||
|
||||
void LED_Slot(int i) {
|
||||
static void LED_Slot(int i) {
|
||||
LEDsoff();
|
||||
if (slots_count > 4) {
|
||||
LED(i % MAX_IND, 0); //binary indication, usefully for slots_count > 4
|
||||
|
@ -92,7 +93,7 @@ void LED_Slot(int i) {
|
|||
}
|
||||
}
|
||||
|
||||
void FlashLEDs(uint32_t speed, uint8_t times) {
|
||||
static void FlashLEDs(uint32_t speed, uint8_t times) {
|
||||
for (int i = 0; i < times * 2; i++) {
|
||||
LED_A_INV();
|
||||
LED_B_INV();
|
||||
|
@ -103,9 +104,9 @@ void FlashLEDs(uint32_t speed, uint8_t times) {
|
|||
}
|
||||
|
||||
#ifdef WITH_FLASH
|
||||
void SaveIDtoFlash(int addr, uint64_t id) {
|
||||
static void SaveIDtoFlash(int addr, uint64_t id) {
|
||||
uint8_t bt[5];
|
||||
char *filename = "emdump";
|
||||
const char *filename = "emdump";
|
||||
rdv40_spiffs_mount();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
bt[4 - i] = (uint8_t)(id >> 8 * i & 0xff);
|
||||
|
@ -118,7 +119,7 @@ void SaveIDtoFlash(int addr, uint64_t id) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf("[=] >> LF EM4100 read/write/clone started <<");
|
||||
|
|
|
@ -42,7 +42,7 @@ void ModInfo(void) {
|
|||
}
|
||||
|
||||
// samy's sniff and repeat routine for LF
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> LF HID corporate bruteforce a.k.a CorporateBrute Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define LF_HIDCOLLECT_LOGFILE "lf_hidcollect.log"
|
||||
|
||||
|
||||
void DownloadLogInstructions() {
|
||||
static void DownloadLogInstructions(void) {
|
||||
Dbprintf("");
|
||||
Dbprintf("[=] To get the logfile from flash and display it:");
|
||||
Dbprintf("[=] " _YELLOW_("1.") " mem spiffs dump o "LF_HIDCOLLECT_LOGFILE" f "LF_HIDCOLLECT_LOGFILE);
|
||||
|
@ -64,7 +64,7 @@ void DownloadLogInstructions() {
|
|||
|
||||
bool log_exists;
|
||||
|
||||
void append(uint8_t *entry, size_t entry_len) {
|
||||
static void append(uint8_t *entry, size_t entry_len) {
|
||||
|
||||
LED_B_ON();
|
||||
if (log_exists == false) {
|
||||
|
@ -76,7 +76,7 @@ void append(uint8_t *entry, size_t entry_len) {
|
|||
LED_B_OFF();
|
||||
}
|
||||
|
||||
uint32_t IceEM410xdemod() {
|
||||
static uint32_t IceEM410xdemod(void) {
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
size_t idx = 0;
|
||||
|
@ -128,7 +128,7 @@ uint32_t IceEM410xdemod() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t IceAWIDdemod() {
|
||||
static uint32_t IceAWIDdemod(void) {
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
size_t size = MIN(12800, BigBuf_max_traceLen());
|
||||
|
@ -180,7 +180,7 @@ uint32_t IceAWIDdemod() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t IceIOdemod() {
|
||||
static uint32_t IceIOdemod(void) {
|
||||
|
||||
int dummyIdx = 0;
|
||||
uint8_t version = 0, facilitycode = 0;
|
||||
|
@ -224,7 +224,7 @@ uint32_t IceIOdemod() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t IceHIDDemod() {
|
||||
static uint32_t IceHIDDemod(void) {
|
||||
|
||||
int dummyIdx = 0;
|
||||
|
||||
|
@ -320,7 +320,7 @@ void ModInfo(void) {
|
|||
DbpString(_YELLOW_(" LF HID / IOprox / AWID / EM4100 collector mode") " - a.k.a IceHID (Iceman)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
LFSetupFPGAForADC(LF_DIVISOR_125, true);
|
||||
|
|
|
@ -23,7 +23,7 @@ void ModInfo(void) {
|
|||
}
|
||||
|
||||
// samy's sniff and repeat routine for LF
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> LF HID proxII bruteforce a.k.a ProxBrute Started (Brad Antoniewicz) <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
|
|
@ -31,7 +31,7 @@ void ModInfo(void) {
|
|||
// C = playing bank A
|
||||
// D = playing bank B
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf(">> LF HID Read/Clone/Sim a.k.a SamyRun Started <<");
|
||||
|
|
|
@ -18,7 +18,7 @@ void ModInfo(void) {
|
|||
DbpString(" LF skeleton mode - aka Skeleton (iceman)");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf("[=] LF skeleton code a.k.a Skeleton started");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
|
|
|
@ -6,5 +6,5 @@ void ModInfo(void) {
|
|||
DbpString(" No standalone mode present");
|
||||
}
|
||||
|
||||
void RunMod() {
|
||||
void RunMod(void) {
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef __STANDALONE_H
|
||||
#define __STANDALONE_H
|
||||
|
||||
void RunMod();
|
||||
void ModInfo();
|
||||
void RunMod(void);
|
||||
void ModInfo(void);
|
||||
|
||||
#endif /* __STANDALONE_H */
|
||||
|
|
|
@ -144,7 +144,7 @@ uint16_t AvgAdc(int ch) {
|
|||
return (a + 15) >> 5;
|
||||
}
|
||||
|
||||
void MeasureAntennaTuning(void) {
|
||||
static void MeasureAntennaTuning(void) {
|
||||
|
||||
uint32_t peak = 0;
|
||||
|
||||
|
@ -221,7 +221,7 @@ void MeasureAntennaTuning(void) {
|
|||
}
|
||||
|
||||
// Measure HF in milliVolt
|
||||
uint16_t MeasureAntennaTuningHfData(void) {
|
||||
static uint16_t MeasureAntennaTuningHfData(void) {
|
||||
|
||||
#if defined RDV4
|
||||
return (MAX_ADC_HF_VOLTAGE_RDV40 * AvgAdc(ADC_CHAN_HF_RDV40)) >> 10;
|
||||
|
@ -232,7 +232,7 @@ uint16_t MeasureAntennaTuningHfData(void) {
|
|||
}
|
||||
|
||||
// Measure LF in milliVolt
|
||||
uint32_t MeasureAntennaTuningLfData(void) {
|
||||
static uint32_t MeasureAntennaTuningLfData(void) {
|
||||
return (MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ void ReadMem(int addr) {
|
|||
extern struct version_information version_information;
|
||||
/* bootrom version information is pointed to from _bootphase1_version_pointer */
|
||||
extern char *_bootphase1_version_pointer, _flash_start, _flash_end, __data_src_start__;
|
||||
void SendVersion(void) {
|
||||
static void SendVersion(void) {
|
||||
char temp[PM3_CMD_DATA_SIZE - 12]; /* Limited data payload in USB packets */
|
||||
char VersionString[PM3_CMD_DATA_SIZE - 12] = { '\0' };
|
||||
|
||||
|
@ -302,7 +302,7 @@ void SendVersion(void) {
|
|||
reply_ng(CMD_VERSION, PM3_SUCCESS, (uint8_t *)&payload, 12 + payload.versionstr_len);
|
||||
}
|
||||
|
||||
void TimingIntervalAcquisition(void) {
|
||||
static void TimingIntervalAcquisition(void) {
|
||||
// trigger new acquisition by turning main oscillator off and on
|
||||
mck_from_pll_to_slck();
|
||||
mck_from_slck_to_pll();
|
||||
|
@ -312,7 +312,7 @@ void TimingIntervalAcquisition(void) {
|
|||
|
||||
// measure the Connection Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
|
||||
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandNG structure included.
|
||||
void printConnSpeed(void) {
|
||||
static void printConnSpeed(void) {
|
||||
DbpString(_BLUE_("Transfer Speed"));
|
||||
Dbprintf(" Sending packets to client...");
|
||||
|
||||
|
@ -339,7 +339,7 @@ void printConnSpeed(void) {
|
|||
/**
|
||||
* Prints runtime information about the PM3.
|
||||
**/
|
||||
void SendStatus(void) {
|
||||
static void SendStatus(void) {
|
||||
BigBuf_print_status();
|
||||
Fpga_print_status();
|
||||
#ifdef WITH_FLASH
|
||||
|
@ -382,7 +382,7 @@ void SendStatus(void) {
|
|||
reply_ng(CMD_STATUS, PM3_SUCCESS, NULL, 0);
|
||||
}
|
||||
|
||||
void SendCapabilities(void) {
|
||||
static void SendCapabilities(void) {
|
||||
capabilities_t capabilities;
|
||||
capabilities.version = CAPABILITIES_VERSION;
|
||||
capabilities.via_fpc = reply_via_fpc;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
extern const uint8_t OddByteParity[256];
|
||||
extern int rsamples; // = 0;
|
||||
extern uint8_t trigger;
|
||||
extern bool allow_send_wtx;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// Debug print functions, to go out over USB, to the usual PC-side client.
|
||||
//=============================================================================
|
||||
|
||||
void DbpStringEx(uint32_t flags, char *src, size_t srclen) {
|
||||
void DbpStringEx(uint32_t flags, const char *src, size_t srclen) {
|
||||
#if DEBUG
|
||||
struct {
|
||||
uint16_t flag;
|
||||
|
@ -35,7 +35,7 @@ void DbpStringEx(uint32_t flags, char *src, size_t srclen) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void DbpString(char *str) {
|
||||
void DbpString(const char *str) {
|
||||
#if DEBUG
|
||||
DbpStringEx(FLAG_LOG, str, strlen(str));
|
||||
#endif
|
||||
|
@ -98,7 +98,7 @@ void Dbhexdump(int len, uint8_t *d, bool bAsci) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void print_result(char *name, uint8_t *buf, size_t len) {
|
||||
void print_result(const char *name, uint8_t *buf, size_t len) {
|
||||
|
||||
uint8_t *p = buf;
|
||||
uint16_t tmp = len & 0xFFF0;
|
||||
|
|
|
@ -42,12 +42,12 @@
|
|||
reply_via_usb = tmpusb;}
|
||||
|
||||
|
||||
void DbpString(char *str);
|
||||
void DbpStringEx(uint32_t flags, char *src, size_t srclen);
|
||||
void DbpString(const char *str);
|
||||
void DbpStringEx(uint32_t flags, const char *src, size_t srclen);
|
||||
void Dbprintf(const char *fmt, ...);
|
||||
void DbprintfEx(uint32_t flags, const char *fmt, ...);
|
||||
void Dbhexdump(int len, uint8_t *d, bool bAsci);
|
||||
void print_result(char *name, uint8_t *buf, size_t len);
|
||||
void print_result(const char *name, uint8_t *buf, size_t len);
|
||||
//void PrintToSendBuffer(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -99,8 +99,6 @@ struct desfire_tag {
|
|||
uint32_t selected_application;
|
||||
};
|
||||
typedef struct desfire_tag *desfiretag_t;
|
||||
void crc32_ex(const uint8_t *data, const size_t len, uint8_t *crc);
|
||||
void crc32_append(uint8_t *data, const size_t len);
|
||||
void des_encrypt(void *out, const void *in, const void *key);
|
||||
void des_decrypt(void *out, const void *in, const void *key);
|
||||
void tdes_nxp_receive(const void *in, void *out, size_t length, const void *key, unsigned char iv[8], int keymode);
|
||||
|
|
|
@ -113,7 +113,7 @@ static char iso_type = 0;
|
|||
//-----------------------------------------------------------------------------
|
||||
// Wrapper for sending APDUs to type A and B cards
|
||||
//-----------------------------------------------------------------------------
|
||||
int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response) {
|
||||
static int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response) {
|
||||
switch (iso_type) {
|
||||
case 'a':
|
||||
return iso14_apdu(apdu, (uint16_t) length, false, response, NULL);
|
||||
|
@ -130,7 +130,7 @@ int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response) {
|
|||
//-----------------------------------------------------------------------------
|
||||
// Closes the communication channel and turns off the field
|
||||
//-----------------------------------------------------------------------------
|
||||
void EPA_Finish() {
|
||||
void EPA_Finish(void) {
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
iso_type = 0;
|
||||
|
@ -501,7 +501,7 @@ void EPA_PACE_Replay(PacketCommandNG *c) {
|
|||
// Set up a communication channel (Card Select, PPS)
|
||||
// Returns 0 on success or a non-zero error code on failure
|
||||
//-----------------------------------------------------------------------------
|
||||
int EPA_Setup() {
|
||||
int EPA_Setup(void) {
|
||||
|
||||
// first, look for type A cards
|
||||
// power up the field
|
||||
|
|
|
@ -23,12 +23,12 @@ typedef struct {
|
|||
} pace_version_info_t;
|
||||
|
||||
// general functions
|
||||
void EPA_Finish();
|
||||
void EPA_Finish(void);
|
||||
size_t EPA_Parse_CardAccess(uint8_t *data,
|
||||
size_t length,
|
||||
pace_version_info_t *pace_info);
|
||||
int EPA_Read_CardAccess(uint8_t *buffer, size_t max_length);
|
||||
int EPA_Setup();
|
||||
int EPA_Setup(void);
|
||||
|
||||
// PACE related functions
|
||||
int EPA_PACE_MSE_Set_AT(pace_version_info_t pace_version_info, uint8_t password);
|
||||
|
|
|
@ -37,11 +37,11 @@ static uint8_t felica_select_card(felica_card_select_t *card);
|
|||
static void TransmitFor18092_AsReader(uint8_t *frame, int len, uint32_t *timing, uint8_t power, uint8_t highspeed);
|
||||
bool WaitForFelicaReply(uint16_t maxbytes);
|
||||
|
||||
void iso18092_set_timeout(uint32_t timeout) {
|
||||
static void iso18092_set_timeout(uint32_t timeout) {
|
||||
felica_timeout = timeout + (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER) / (16 * 8) + 2;
|
||||
}
|
||||
|
||||
uint32_t iso18092_get_timeout(void) {
|
||||
static uint32_t iso18092_get_timeout(void) {
|
||||
return felica_timeout - (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER) / (16 * 8) - 2;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ static struct {
|
|||
# define SYNC_16BIT 0xB24D
|
||||
#endif
|
||||
|
||||
static void FelicaFrameReset() {
|
||||
static void FelicaFrameReset(void) {
|
||||
FelicaFrame.state = STATE_UNSYNCD;
|
||||
FelicaFrame.posCnt = 0;
|
||||
FelicaFrame.crc_ok = false;
|
||||
|
@ -481,7 +481,7 @@ static void iso18092_setup(uint8_t fpga_minor_mode) {
|
|||
LED_D_ON();
|
||||
}
|
||||
|
||||
void felica_reset_frame_mode() {
|
||||
static void felica_reset_frame_mode(void) {
|
||||
switch_off();
|
||||
//Resetting Frame mode (First set in fpgaloader.c)
|
||||
AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(8) | AT91C_SSC_MSBF | SSC_FRAME_MODE_WORDS_PER_TRANSFER(0);
|
||||
|
@ -738,7 +738,7 @@ void felica_sim_lite(uint64_t uid) {
|
|||
|
||||
#define RES_SVC_LEN 11 + 3
|
||||
|
||||
void felica_dump_lite_s() {
|
||||
void felica_dump_lite_s(void) {
|
||||
uint8_t ndef[8];
|
||||
uint8_t poll[10] = { 0xb2, 0x4d, 0x06, FELICA_POLL_REQ, 0xff, 0xff, 0x00, 0x00, 0x09, 0x21};
|
||||
uint16_t liteblks[28] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x90, 0x91, 0x92, 0xa0};
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
void felica_sendraw(PacketCommandNG *c);
|
||||
void felica_sniff(uint32_t samplesToSkip, uint32_t triggersToSkip);
|
||||
void felica_sim_lite(uint64_t uid);
|
||||
void felica_dump_lite_s();
|
||||
void felica_dump_lite_s(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@ void FlashmemSetSpiBaudrate(uint32_t baudrate) {
|
|||
}
|
||||
|
||||
// initialize
|
||||
bool FlashInit() {
|
||||
bool FlashInit(void) {
|
||||
FlashSetup(FLASHMEM_SPIBAUDRATE);
|
||||
|
||||
StartTicks();
|
||||
|
@ -435,7 +435,7 @@ bool Flash_WipeMemoryPage(uint8_t page) {
|
|||
return true;
|
||||
}
|
||||
// Wipes flash memory completely, fills with 0xFF
|
||||
bool Flash_WipeMemory() {
|
||||
bool Flash_WipeMemory(void) {
|
||||
if (!FlashInit()) {
|
||||
if (DBGLEVEL > 3) Dbprintf("Flash_WriteData init fail");
|
||||
return false;
|
||||
|
@ -462,7 +462,7 @@ bool Flash_WipeMemory() {
|
|||
}
|
||||
|
||||
// enable the flash write
|
||||
void Flash_WriteEnable() {
|
||||
void Flash_WriteEnable(void) {
|
||||
FlashSendLastByte(WRITEENABLE);
|
||||
if (DBGLEVEL > 3) Dbprintf("Flash Write enabled");
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
void FlashmemSetSpiBaudrate(uint32_t baudrate);
|
||||
bool FlashInit();
|
||||
bool FlashInit(void);
|
||||
void FlashSetup(uint32_t baudrate);
|
||||
void FlashStop(void);
|
||||
bool Flash_WaitIdle(void);
|
||||
|
@ -122,9 +122,9 @@ void Flash_TransferAdresse(uint32_t address);
|
|||
|
||||
bool Flash_CheckBusy(uint32_t timeout);
|
||||
|
||||
void Flash_WriteEnable();
|
||||
void Flash_WriteEnable(void);
|
||||
bool Flash_WipeMemoryPage(uint8_t page);
|
||||
bool Flash_WipeMemory();
|
||||
bool Flash_WipeMemory(void);
|
||||
bool Flash_Erase4k(uint8_t block, uint8_t sector);
|
||||
//bool Flash_Erase32k(uint32_t address);
|
||||
bool Flash_Erase64k(uint8_t block);
|
||||
|
|
|
@ -373,7 +373,7 @@ static uint32_t hitag_reader_send_frame(const uint8_t *frame, size_t frame_len)
|
|||
return wait;
|
||||
}
|
||||
|
||||
uint8_t hitag_crc(uint8_t *data, size_t length) {
|
||||
static uint8_t hitag_crc(uint8_t *data, size_t length) {
|
||||
uint8_t crc = 0xff;
|
||||
unsigned int byte, bit;
|
||||
for (byte = 0; byte < ((length + 7) / 8); byte++) {
|
||||
|
@ -411,7 +411,7 @@ void fix_ac_decoding(uint8_t *input, size_t len) {
|
|||
// looks at number of received bits.
|
||||
// 0 = collision?
|
||||
// 32 = good response
|
||||
bool hitag_plain(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen, bool hitag_s) {
|
||||
static bool hitag_plain(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen, bool hitag_s) {
|
||||
uint8_t crc;
|
||||
*txlen = 0;
|
||||
switch (rxlen) {
|
||||
|
@ -480,7 +480,7 @@ bool hitag_plain(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen, bo
|
|||
}
|
||||
|
||||
|
||||
bool hitag1_authenticate(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen) {
|
||||
static bool hitag1_authenticate(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen) {
|
||||
uint8_t crc;
|
||||
*txlen = 0;
|
||||
switch (rxlen) {
|
||||
|
|
|
@ -110,7 +110,7 @@ bool end = false;
|
|||
* Implementation of the crc8 calculation from Hitag S
|
||||
* from http://www.proxmark.org/files/Documents/125%20kHz%20-%20Hitag/HitagS.V11.pdf
|
||||
*/
|
||||
void calc_crc(unsigned char *crc, unsigned char data, unsigned char Bitcount) {
|
||||
static void calc_crc(unsigned char *crc, unsigned char data, unsigned char Bitcount) {
|
||||
*crc ^= data; // crc = crc (exor) data
|
||||
do {
|
||||
if (*crc & 0x80) { // if (MSB-CRC == 1)
|
||||
|
@ -333,7 +333,7 @@ static int check_select(uint8_t *rx, uint32_t uid) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void hitagS_set_frame_modulation() {
|
||||
static void hitagS_set_frame_modulation(void) {
|
||||
switch (tag.mode) {
|
||||
case HT_STANDARD:
|
||||
sof_bits = 1;
|
||||
|
@ -1075,7 +1075,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
|||
DbpString("Sim Stopped");
|
||||
}
|
||||
|
||||
void hitagS_receive_frame(uint8_t *rx, size_t *rxlen, int *response) {
|
||||
static void hitagS_receive_frame(uint8_t *rx, size_t *rxlen, int *response) {
|
||||
|
||||
// Reset values for receiving frames
|
||||
memset(rx, 0x00, HITAG_FRAME_LEN * sizeof(uint8_t));
|
||||
|
|
30
armsrc/i2c.c
30
armsrc/i2c.c
|
@ -39,7 +39,7 @@ volatile unsigned long c;
|
|||
// timer.
|
||||
// I2CSpinDelayClk(4) = 12.31us
|
||||
// I2CSpinDelayClk(1) = 3.07us
|
||||
void __attribute__((optimize("O0"))) I2CSpinDelayClk(uint16_t delay) {
|
||||
static void __attribute__((optimize("O0"))) I2CSpinDelayClk(uint16_t delay) {
|
||||
for (c = delay * 2; c; c--) {};
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ void I2C_Reset_EnterBootloader(void) {
|
|||
}
|
||||
|
||||
// Wait for the clock to go High.
|
||||
bool WaitSCL_H_delay(uint32_t delay) {
|
||||
static bool WaitSCL_H_delay(uint32_t delay) {
|
||||
while (delay--) {
|
||||
if (SCL_read) {
|
||||
return true;
|
||||
|
@ -158,11 +158,11 @@ bool WaitSCL_H_delay(uint32_t delay) {
|
|||
|
||||
// 5000 * 3.07us = 15350us. 15.35ms
|
||||
// 15000 * 3.07us = 46050us. 46.05ms
|
||||
bool WaitSCL_H(void) {
|
||||
static bool WaitSCL_H(void) {
|
||||
return WaitSCL_H_delay(15000);
|
||||
}
|
||||
|
||||
bool WaitSCL_L_delay(uint32_t delay) {
|
||||
static bool WaitSCL_L_delay(uint32_t delay) {
|
||||
while (delay--) {
|
||||
if (!SCL_read) {
|
||||
return true;
|
||||
|
@ -172,14 +172,14 @@ bool WaitSCL_L_delay(uint32_t delay) {
|
|||
return false;
|
||||
}
|
||||
// 5000 * 3.07us = 15350us. 15.35ms
|
||||
bool WaitSCL_L(void) {
|
||||
static bool WaitSCL_L(void) {
|
||||
return WaitSCL_L_delay(15000);
|
||||
}
|
||||
|
||||
// Wait max 1800ms or until SCL goes LOW.
|
||||
// It timeout reading response from card
|
||||
// Which ever comes first
|
||||
bool WaitSCL_L_timeout(void) {
|
||||
static bool WaitSCL_L_timeout(void) {
|
||||
volatile uint16_t delay = 1800;
|
||||
while (delay--) {
|
||||
// exit on SCL LOW
|
||||
|
@ -191,7 +191,7 @@ bool WaitSCL_L_timeout(void) {
|
|||
return (delay == 0);
|
||||
}
|
||||
|
||||
bool I2C_Start(void) {
|
||||
static bool I2C_Start(void) {
|
||||
|
||||
I2C_DELAY_XCLK(4);
|
||||
SDA_H;
|
||||
|
@ -209,7 +209,7 @@ bool I2C_Start(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool I2C_WaitForSim() {
|
||||
static bool I2C_WaitForSim(void) {
|
||||
|
||||
// wait for data from card
|
||||
if (!WaitSCL_L_timeout())
|
||||
|
@ -225,7 +225,7 @@ bool I2C_WaitForSim() {
|
|||
}
|
||||
|
||||
// send i2c STOP
|
||||
void I2C_Stop(void) {
|
||||
static void I2C_Stop(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_2CLK;
|
||||
SDA_L;
|
||||
|
@ -238,7 +238,7 @@ void I2C_Stop(void) {
|
|||
}
|
||||
|
||||
// Send i2c ACK
|
||||
void I2C_Ack(void) {
|
||||
static void I2C_Ack(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_2CLK;
|
||||
SDA_L;
|
||||
|
@ -251,7 +251,7 @@ void I2C_Ack(void) {
|
|||
}
|
||||
|
||||
// Send i2c NACK
|
||||
void I2C_NoAck(void) {
|
||||
static void I2C_NoAck(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_2CLK;
|
||||
SDA_H;
|
||||
|
@ -263,7 +263,7 @@ void I2C_NoAck(void) {
|
|||
I2C_DELAY_2CLK;
|
||||
}
|
||||
|
||||
bool I2C_WaitAck(void) {
|
||||
static bool I2C_WaitAck(void) {
|
||||
SCL_L;
|
||||
I2C_DELAY_1CLK;
|
||||
SDA_H;
|
||||
|
@ -282,7 +282,7 @@ bool I2C_WaitAck(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void I2C_SendByte(uint8_t data) {
|
||||
static void I2C_SendByte(uint8_t data) {
|
||||
uint8_t bits = 8;
|
||||
|
||||
while (bits--) {
|
||||
|
@ -308,7 +308,7 @@ void I2C_SendByte(uint8_t data) {
|
|||
SCL_L;
|
||||
}
|
||||
|
||||
int16_t I2C_ReadByte(void) {
|
||||
static int16_t I2C_ReadByte(void) {
|
||||
uint8_t bits = 8, b = 0;
|
||||
|
||||
SDA_H;
|
||||
|
@ -623,7 +623,7 @@ int I2C_get_version(uint8_t *maj, uint8_t *min) {
|
|||
}
|
||||
|
||||
// Will read response from smart card module, retries 3 times to get the data.
|
||||
bool sc_rx_bytes(uint8_t *dest, uint8_t *destlen) {
|
||||
static bool sc_rx_bytes(uint8_t *dest, uint8_t *destlen) {
|
||||
|
||||
uint8_t i = 3;
|
||||
int16_t len = 0;
|
||||
|
|
|
@ -520,7 +520,7 @@ static RAMFUNC int OutOfNDecoding(int bit) {
|
|||
// Manchester
|
||||
//=============================================================================
|
||||
static tDemodIc Demod;
|
||||
static void DemodIcReset() {
|
||||
static void DemodIcReset(void) {
|
||||
Demod.bitCount = 0;
|
||||
Demod.posCount = 0;
|
||||
Demod.syncBit = 0;
|
||||
|
@ -985,7 +985,7 @@ void RAMFUNC SniffIClass(void) {
|
|||
switch_off();
|
||||
}
|
||||
|
||||
void rotateCSN(uint8_t *originalCSN, uint8_t *rotatedCSN) {
|
||||
static void rotateCSN(uint8_t *originalCSN, uint8_t *rotatedCSN) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
rotatedCSN[i] = (originalCSN[i] >> 3) | (originalCSN[(i + 1) % 8] << 5);
|
||||
|
@ -1146,7 +1146,7 @@ static void CodeIClassTagAnswer(const uint8_t *cmd, int len) {
|
|||
}
|
||||
|
||||
// Only SOF
|
||||
static void CodeIClassTagSOF() {
|
||||
static void CodeIClassTagSOF(void) {
|
||||
//So far a dummy implementation, not used
|
||||
//int lastProxToAirDuration =0;
|
||||
|
||||
|
@ -1757,7 +1757,7 @@ static void TransmitIClassCommand(const uint8_t *cmd, int len, int *wait) {
|
|||
//-----------------------------------------------------------------------------
|
||||
// Prepare iClass reader command to send to FPGA
|
||||
//-----------------------------------------------------------------------------
|
||||
void CodeIClassCommand(const uint8_t *cmd, int len) {
|
||||
static void CodeIClassCommand(const uint8_t *cmd, int len) {
|
||||
int i, j, k;
|
||||
|
||||
ToSendReset();
|
||||
|
@ -1793,7 +1793,7 @@ void CodeIClassCommand(const uint8_t *cmd, int len) {
|
|||
ToSendMax++;
|
||||
}
|
||||
|
||||
void ReaderTransmitIClass_ext(uint8_t *frame, int len, int wait) {
|
||||
static void ReaderTransmitIClass_ext(uint8_t *frame, int len, int wait) {
|
||||
|
||||
// This is tied to other size changes
|
||||
CodeIClassCommand(frame, len);
|
||||
|
@ -1804,7 +1804,7 @@ void ReaderTransmitIClass_ext(uint8_t *frame, int len, int wait) {
|
|||
|
||||
LogTrace(frame, len, rsamples, rsamples, NULL, true);
|
||||
}
|
||||
void ReaderTransmitIClass(uint8_t *frame, int len) {
|
||||
static void ReaderTransmitIClass(uint8_t *frame, int len) {
|
||||
ReaderTransmitIClass_ext(frame, len, 330);
|
||||
}
|
||||
|
||||
|
@ -1862,7 +1862,7 @@ static int GetIClassAnswer(uint8_t *receivedResponse, int maxLen, int *wait) {
|
|||
return false;
|
||||
}
|
||||
|
||||
int ReaderReceiveIClass(uint8_t *receivedAnswer) {
|
||||
static int ReaderReceiveIClass(uint8_t *receivedAnswer) {
|
||||
|
||||
if (GetIClassAnswer(receivedAnswer, 0, NULL) == false)
|
||||
return 0;
|
||||
|
@ -1871,7 +1871,7 @@ int ReaderReceiveIClass(uint8_t *receivedAnswer) {
|
|||
return Demod.len;
|
||||
}
|
||||
|
||||
void setupIclassReader() {
|
||||
static void setupIclassReader(void) {
|
||||
|
||||
LEDsoff();
|
||||
|
||||
|
@ -1898,7 +1898,7 @@ void setupIclassReader() {
|
|||
LED_A_ON();
|
||||
}
|
||||
|
||||
bool sendCmdGetResponseWithRetries(uint8_t *command, size_t cmdsize, uint8_t *resp, uint8_t expected_size, int8_t retries) {
|
||||
static bool sendCmdGetResponseWithRetries(uint8_t *command, size_t cmdsize, uint8_t *resp, uint8_t expected_size, int8_t retries) {
|
||||
while (retries-- > 0) {
|
||||
|
||||
ReaderTransmitIClass(command, cmdsize);
|
||||
|
@ -1935,7 +1935,7 @@ bool sendCmdGetResponseWithRetries(uint8_t *command, size_t cmdsize, uint8_t *re
|
|||
* 1 = Got CSN
|
||||
* 2 = Got CSN and CC
|
||||
*/
|
||||
uint8_t handshakeIclassTag_ext(uint8_t *card_data, bool use_credit_key) {
|
||||
static uint8_t handshakeIclassTag_ext(uint8_t *card_data, bool use_credit_key) {
|
||||
|
||||
// act_all...
|
||||
static uint8_t act_all[] = { ICLASS_CMD_ACTALL };
|
||||
|
@ -2000,7 +2000,7 @@ uint8_t handshakeIclassTag_ext(uint8_t *card_data, bool use_credit_key) {
|
|||
// we got all data;
|
||||
return 2;
|
||||
}
|
||||
uint8_t handshakeIclassTag(uint8_t *card_data) {
|
||||
static uint8_t handshakeIclassTag(uint8_t *card_data) {
|
||||
return handshakeIclassTag_ext(card_data, false);
|
||||
}
|
||||
|
||||
|
@ -2458,7 +2458,7 @@ void iClass_Dump(uint8_t blockno, uint8_t numblks) {
|
|||
BigBuf_free();
|
||||
}
|
||||
|
||||
bool iClass_WriteBlock_ext(uint8_t blockno, uint8_t *data) {
|
||||
static bool iClass_WriteBlock_ext(uint8_t blockno, uint8_t *data) {
|
||||
uint8_t resp[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t write[] = { 0x80 | ICLASS_CMD_UPDATE, blockno, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
memcpy(write + 2, data, 12); // data + mac
|
||||
|
|
|
@ -191,7 +191,7 @@ const bool Mod_Miller_LUT[] = {
|
|||
#define IsMillerModulationNibble1(b) (Mod_Miller_LUT[(b & 0x000000F0) >> 4])
|
||||
#define IsMillerModulationNibble2(b) (Mod_Miller_LUT[(b & 0x0000000F)])
|
||||
|
||||
tUart14a *GetUart14a() {
|
||||
tUart14a *GetUart14a(void) {
|
||||
return &Uart;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ const bool Mod_Manchester_LUT[] = {
|
|||
#define IsManchesterModulationNibble1(b) (Mod_Manchester_LUT[(b & 0x00F0) >> 4])
|
||||
#define IsManchesterModulationNibble2(b) (Mod_Manchester_LUT[(b & 0x000F)])
|
||||
|
||||
tDemod14a *GetDemod14a() {
|
||||
tDemod14a *GetDemod14a(void) {
|
||||
return &Demod;
|
||||
}
|
||||
void Demod14aReset(void) {
|
||||
|
@ -480,7 +480,7 @@ RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non_real_t
|
|||
|
||||
|
||||
// Thinfilm, Kovio mangels ISO14443A in the way that they don't use start bit nor parity bits.
|
||||
RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) {
|
||||
static RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) {
|
||||
Demod.twoBits = (Demod.twoBits << 8) | bit;
|
||||
|
||||
if (Demod.state == DEMOD_14A_UNSYNCD) {
|
||||
|
@ -1613,7 +1613,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) {
|
|||
|
||||
// prepare a delayed transfer. This simply shifts ToSend[] by a number
|
||||
// of bits specified in the delay parameter.
|
||||
void PrepareDelayedTransfer(uint16_t delay) {
|
||||
static void PrepareDelayedTransfer(uint16_t delay) {
|
||||
delay &= 0x07;
|
||||
if (!delay) return;
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ static void TransmitFor14443a(const uint8_t *cmd, uint16_t len, uint32_t *timing
|
|||
//-----------------------------------------------------------------------------
|
||||
// Prepare reader command (in bits, support short frames) to send to FPGA
|
||||
//-----------------------------------------------------------------------------
|
||||
void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8_t *par) {
|
||||
static void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8_t *par) {
|
||||
int last = 0;
|
||||
|
||||
ToSendReset();
|
||||
|
@ -1759,10 +1759,11 @@ void CodeIso14443aBitsAsReaderPar(const uint8_t *cmd, uint16_t bits, const uint8
|
|||
//-----------------------------------------------------------------------------
|
||||
// Prepare reader command to send to FPGA
|
||||
//-----------------------------------------------------------------------------
|
||||
void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *par) {
|
||||
/*
|
||||
static void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *par) {
|
||||
CodeIso14443aBitsAsReaderPar(cmd, len * 8, par);
|
||||
}
|
||||
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
// Wait for commands from reader
|
||||
// Stop when button is pressed (return 1) or field was gone (return 2)
|
||||
|
@ -2153,7 +2154,7 @@ void ReaderTransmitPar(uint8_t *frame, uint16_t len, uint8_t *par, uint32_t *tim
|
|||
ReaderTransmitBitsPar(frame, len * 8, par, timing);
|
||||
}
|
||||
|
||||
void ReaderTransmitBits(uint8_t *frame, uint16_t len, uint32_t *timing) {
|
||||
static void ReaderTransmitBits(uint8_t *frame, uint16_t len, uint32_t *timing) {
|
||||
// Generate parity and redirect
|
||||
uint8_t par[MAX_PARITY_SIZE] = {0x00};
|
||||
GetParity(frame, len / 8, par);
|
||||
|
@ -2167,7 +2168,7 @@ void ReaderTransmit(uint8_t *frame, uint16_t len, uint32_t *timing) {
|
|||
ReaderTransmitBitsPar(frame, len * 8, par, timing);
|
||||
}
|
||||
|
||||
int ReaderReceiveOffset(uint8_t *receivedAnswer, uint16_t offset, uint8_t *par) {
|
||||
static int ReaderReceiveOffset(uint8_t *receivedAnswer, uint16_t offset, uint8_t *par) {
|
||||
if (!GetIso14443aAnswerFromTag(receivedAnswer, par, offset))
|
||||
return false;
|
||||
LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, par, false);
|
||||
|
@ -2769,7 +2770,7 @@ OUT:
|
|||
// Determine the distance between two nonces.
|
||||
// Assume that the difference is small, but we don't know which is first.
|
||||
// Therefore try in alternating directions.
|
||||
int32_t dist_nt(uint32_t nt1, uint32_t nt2) {
|
||||
static int32_t dist_nt(uint32_t nt1, uint32_t nt2) {
|
||||
|
||||
if (nt1 == nt2) return 0;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static struct {
|
|||
uint8_t *output;
|
||||
} Uart;
|
||||
|
||||
static void Uart14bReset() {
|
||||
static void Uart14bReset(void) {
|
||||
Uart.state = STATE_14B_UNSYNCD;
|
||||
Uart.shiftReg = 0;
|
||||
Uart.bitCnt = 0;
|
||||
|
@ -134,7 +134,7 @@ static struct {
|
|||
} Demod;
|
||||
|
||||
// Clear out the state of the "UART" that receives from the tag.
|
||||
static void Demod14bReset() {
|
||||
static void Demod14bReset(void) {
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
Demod.bitCount = 0;
|
||||
Demod.posCount = 0;
|
||||
|
@ -765,7 +765,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
|
||||
// The soft decision on the bit uses an estimate of just the
|
||||
// quadrant of the reference angle, not the exact angle.
|
||||
#define MAKE_SOFT_DECISION() { \
|
||||
#define MAKE_SOFT_DECISION(void) { \
|
||||
if (Demod.sumI > 0) { \
|
||||
v = ci; \
|
||||
} else { \
|
||||
|
@ -780,7 +780,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
|
||||
// Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by abs(ci) + abs(cq)
|
||||
// Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by max(abs(ci),abs(cq)) + 1/2*min(abs(ci),abs(cq)))
|
||||
#define CHECK_FOR_SUBCARRIER_old() { \
|
||||
#define CHECK_FOR_SUBCARRIER_old(void) { \
|
||||
if (ci < 0) { \
|
||||
if (cq < 0) { /* ci < 0, cq < 0 */ \
|
||||
if (cq < ci) { \
|
||||
|
@ -813,7 +813,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
}
|
||||
|
||||
//note: couldn't we just use MAX(ABS(ci),ABS(cq)) + (MIN(ABS(ci),ABS(cq))/2) from common.h - marshmellow
|
||||
#define CHECK_FOR_SUBCARRIER() { v = MAX(myI, myQ) + (MIN(myI, myQ) >> 1); }
|
||||
#define CHECK_FOR_SUBCARRIER(void) { v = MAX(myI, myQ) + (MIN(myI, myQ) >> 1); }
|
||||
|
||||
switch (Demod.state) {
|
||||
case DEMOD_UNSYNCD:
|
||||
|
@ -964,7 +964,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
|
|||
* Demodulate the samples we received from the tag, also log to tracebuffer
|
||||
* quiet: set to 'TRUE' to disable debug output
|
||||
*/
|
||||
static void GetTagSamplesFor14443bDemod() {
|
||||
static void GetTagSamplesFor14443bDemod(void) {
|
||||
bool finished = false;
|
||||
// int lastRxCounter = ISO14443B_DMA_BUFFER_SIZE;
|
||||
uint32_t time_0 = 0, time_stop = 0;
|
||||
|
@ -1195,7 +1195,7 @@ uint8_t iso14443b_apdu(uint8_t const *message, size_t message_length, uint8_t *r
|
|||
/**
|
||||
* SRx Initialise.
|
||||
*/
|
||||
uint8_t iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||
static uint8_t iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||
// INITIATE command: wake up the tag using the INITIATE
|
||||
static const uint8_t init_srx[] = { ISO14443B_INITIATE, 0x00, 0x97, 0x5b };
|
||||
// SELECT command (with space for CRC)
|
||||
|
@ -1332,7 +1332,7 @@ uint8_t iso14443b_select_card(iso14b_card_select_t *card) {
|
|||
|
||||
// Set up ISO 14443 Type B communication (similar to iso14443a_setup)
|
||||
// field is setup for "Sending as Reader"
|
||||
void iso14443b_setup() {
|
||||
void iso14443b_setup(void) {
|
||||
LEDsoff();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
||||
|
@ -1577,7 +1577,7 @@ void RAMFUNC SniffIso14443b(void) {
|
|||
switch_off();
|
||||
}
|
||||
|
||||
void iso14b_set_trigger(bool enable) {
|
||||
static void iso14b_set_trigger(bool enable) {
|
||||
trigger = enable;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
# define AddCrc14B(data, len) compute_crc(CRC_14443_B, (data), (len), (data)+(len), (data)+(len)+1)
|
||||
#endif
|
||||
|
||||
void iso14443b_setup();
|
||||
void iso14443b_setup(void);
|
||||
uint8_t iso14443b_apdu(uint8_t const *message, size_t message_length, uint8_t *response);
|
||||
uint8_t iso14443b_select_card(iso14b_card_select_t *card);
|
||||
uint8_t iso14443b_select_card_srx(iso14b_card_select_t *card);
|
||||
|
|
|
@ -703,7 +703,7 @@ static void BuildInventoryResponse(uint8_t *cmdout, uint8_t *uid) {
|
|||
// If you do not need the answer use NULL for *recv[]
|
||||
// return: length of received data
|
||||
// logging enabled
|
||||
int SendDataTag(uint8_t *send, int sendlen, bool init, int speed, uint8_t *outdata) {
|
||||
static int SendDataTag(uint8_t *send, int sendlen, bool init, int speed, uint8_t *outdata) {
|
||||
|
||||
int t_samples = 0, wait = 0, elapsed = 0, answer_len = 0;
|
||||
|
||||
|
@ -741,7 +741,7 @@ int SendDataTag(uint8_t *send, int sendlen, bool init, int speed, uint8_t *outda
|
|||
|
||||
// Decodes a message from a tag and displays its metadata and content
|
||||
#define DBD15STATLEN 48
|
||||
void DbdecodeIso15693Answer(int len, uint8_t *d) {
|
||||
static void DbdecodeIso15693Answer(int len, uint8_t *d) {
|
||||
|
||||
if (len > 3) {
|
||||
char status[DBD15STATLEN + 1] = {0};
|
||||
|
|
|
@ -65,7 +65,7 @@ static uint32_t last_frame_end; /* ts of last bit of previews rx or tx frame */
|
|||
// I/O interface abstraction (FPGA -> ARM)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static inline uint8_t rx_byte_from_fpga() {
|
||||
static inline uint8_t rx_byte_from_fpga(void) {
|
||||
for (;;) {
|
||||
WDT_HIT();
|
||||
|
||||
|
@ -92,7 +92,12 @@ static inline uint8_t rx_byte_from_fpga() {
|
|||
//
|
||||
// Note: The SSC receiver is never synchronized the calculation may be performed
|
||||
// on a i/q pair from two subsequent correlations, but does not matter.
|
||||
static inline int32_t sample_power() {
|
||||
// Note: inlining this function would fail with -Os
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
static int32_t sample_power(void) {
|
||||
#else
|
||||
static inline int32_t sample_power(void) {
|
||||
#endif
|
||||
int32_t q = (int8_t)rx_byte_from_fpga();
|
||||
q = ABS(q);
|
||||
int32_t i = (int8_t)rx_byte_from_fpga();
|
||||
|
@ -108,7 +113,7 @@ static inline int32_t sample_power() {
|
|||
//
|
||||
// Note: The demodulator would be drifting (18.9us * 5 != 100us), rx_frame
|
||||
// has a delay loop that aligns rx_bit calls to the TAG tx timeslots.
|
||||
static inline bool rx_bit() {
|
||||
static inline bool rx_bit(void) {
|
||||
int32_t power;
|
||||
|
||||
for (size_t i = 0; i < 5; ++i) {
|
||||
|
@ -206,7 +211,7 @@ static uint32_t rx_frame(uint8_t len) {
|
|||
return frame;
|
||||
}
|
||||
|
||||
static bool rx_ack() {
|
||||
static bool rx_ack(void) {
|
||||
// change fpga into rx mode
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR
|
||||
| FPGA_HF_READER_RX_XCORR_848_KHZ
|
||||
|
@ -382,7 +387,7 @@ static int16_t read_byte(uint16_t index, uint8_t cmd_sz) {
|
|||
|
||||
// Transmit write command, wait until (3.6ms) the tag sends back an unencrypted
|
||||
// ACK ('1' bit) and forward the prng time based.
|
||||
bool write_byte(uint16_t index, uint8_t byte, uint8_t addr_sz) {
|
||||
static bool write_byte(uint16_t index, uint8_t byte, uint8_t addr_sz) {
|
||||
uint32_t cmd = index << 1 | LEGIC_WRITE; // prepare command
|
||||
uint8_t crc = calc_crc4(cmd, addr_sz + 1, byte); // calculate crc
|
||||
cmd |= byte << (addr_sz + 1); // append value
|
||||
|
|
|
@ -65,7 +65,12 @@ static uint32_t last_frame_end; /* ts of last bit of previews rx or tx frame */
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Returns true if a pulse/pause is received within timeout
|
||||
// Note: inlining this function would fail with -Os
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
static bool wait_for(bool value, const uint32_t timeout) {
|
||||
#else
|
||||
static inline bool wait_for(bool value, const uint32_t timeout) {
|
||||
#endif
|
||||
while ((bool)(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_DIN) != value) {
|
||||
if (GetCountSspClk() > timeout) {
|
||||
return false;
|
||||
|
@ -83,7 +88,7 @@ static inline bool wait_for(bool value, const uint32_t timeout) {
|
|||
// - A bit length >80.2us is a 1
|
||||
// - A bit length <80.2us is a 0
|
||||
// - A bit length >148.6us is a code violation
|
||||
static inline int8_t rx_bit() {
|
||||
static inline int8_t rx_bit(void) {
|
||||
// backup ts for threshold calculation
|
||||
uint32_t bit_start = last_frame_end;
|
||||
|
||||
|
@ -126,7 +131,12 @@ static inline int8_t rx_bit() {
|
|||
// Note: The Subcarrier is not disabled during bits to prevent glitches. This is
|
||||
// not mandatory but results in a cleaner signal. tx_frame will disable
|
||||
// the subcarrier when the frame is done.
|
||||
// Note: inlining this function would fail with -Os
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
static void tx_bit(bool bit) {
|
||||
#else
|
||||
static inline void tx_bit(bool bit) {
|
||||
#endif
|
||||
LED_C_ON();
|
||||
|
||||
if (bit) {
|
||||
|
@ -177,7 +187,7 @@ static void tx_frame(uint32_t frame, uint8_t len) {
|
|||
LogTrace(cmdbytes, sizeof(cmdbytes), last_frame_start, last_frame_end, NULL, false);
|
||||
}
|
||||
|
||||
static void tx_ack() {
|
||||
static void tx_ack(void) {
|
||||
// wait for ack timeslot
|
||||
last_frame_end += TAG_ACK_WAIT;
|
||||
legic_prng_forward(TAG_ACK_WAIT / TAG_BIT_PERIOD - 1);
|
||||
|
@ -298,7 +308,7 @@ static int32_t init_card(uint8_t cardtype, legic_card_select_t *p_card) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void init_tag() {
|
||||
static void init_tag(void) {
|
||||
// configure FPGA
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR
|
||||
|
|
|
@ -65,7 +65,7 @@ void lf_sample_mean(void) {
|
|||
Dbprintf("LF ADC average %u", adc_avg);
|
||||
}
|
||||
|
||||
size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) {
|
||||
static size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) {
|
||||
size_t periods = 0;
|
||||
volatile uint8_t adc_val;
|
||||
uint8_t avg_peak = adc_avg + 3, avg_through = adc_avg - 3;
|
||||
|
@ -132,7 +132,7 @@ size_t lf_detect_gap(size_t max) {
|
|||
return lf_count_edge_periods_ex(max, false, true);
|
||||
}
|
||||
|
||||
void lf_reset_counter() {
|
||||
void lf_reset_counter(void) {
|
||||
|
||||
// TODO: find out the correct reset settings for tag and reader mode
|
||||
// if (reader_mode) {
|
||||
|
@ -147,11 +147,11 @@ void lf_reset_counter() {
|
|||
// }
|
||||
}
|
||||
|
||||
bool lf_get_tag_modulation() {
|
||||
bool lf_get_tag_modulation(void) {
|
||||
return (rising_edge == false);
|
||||
}
|
||||
|
||||
bool lf_get_reader_modulation() {
|
||||
bool lf_get_reader_modulation(void) {
|
||||
return rising_edge;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ void lf_init(bool reader, bool simulate) {
|
|||
lf_sample_mean();
|
||||
}
|
||||
|
||||
void lf_finalize() {
|
||||
void lf_finalize(void) {
|
||||
// Disable timers
|
||||
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
|
||||
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS;
|
||||
|
|
|
@ -21,15 +21,15 @@ void lf_sample_mean(void);
|
|||
bool lf_test_periods(size_t expected, size_t count);
|
||||
size_t lf_count_edge_periods(size_t max);
|
||||
size_t lf_detect_gap(size_t max);
|
||||
void lf_reset_counter();
|
||||
void lf_reset_counter(void);
|
||||
|
||||
bool lf_get_tag_modulation();
|
||||
bool lf_get_reader_modulation();
|
||||
bool lf_get_tag_modulation(void);
|
||||
bool lf_get_reader_modulation(void);
|
||||
|
||||
void lf_wait_periods(size_t periods);
|
||||
//void lf_init(bool reader);
|
||||
void lf_init(bool reader, bool simulate);
|
||||
void lf_finalize();
|
||||
void lf_finalize(void);
|
||||
size_t lf_detect_field_drop(size_t max);
|
||||
bool lf_manchester_send_bytes(const uint8_t *frame, size_t frame_len);
|
||||
void lf_modulation(bool modulation);
|
||||
|
|
|
@ -622,7 +622,7 @@ void ReadTItag(void) {
|
|||
StopTicks();
|
||||
}
|
||||
|
||||
void WriteTIbyte(uint8_t b) {
|
||||
static void WriteTIbyte(uint8_t b) {
|
||||
int i = 0;
|
||||
|
||||
// modulate 8 bits out to the antenna
|
||||
|
@ -1535,7 +1535,7 @@ void CmdIOdemodFSK(int findone, uint32_t *high, uint32_t *low, int ledcontrol) {
|
|||
calccrc &= 0xff;
|
||||
calccrc = 0xff - calccrc;
|
||||
|
||||
char *crcStr = (crc == calccrc) ? "ok" : "!crc";
|
||||
const char *crcStr = (crc == calccrc) ? "ok" : "!crc";
|
||||
|
||||
Dbprintf("IO Prox XSF(%02d)%02x:%05d (%08x%08x) [%02x %s]", version, facilitycode, number, code, code2, crc, crcStr);
|
||||
// if we're only looking for one tag
|
||||
|
@ -1574,7 +1574,7 @@ void TurnReadLFOn(uint32_t delay) {
|
|||
//int adcval = ((MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10);
|
||||
WaitUS(delay);
|
||||
}
|
||||
void TurnReadLF_off(uint32_t delay) {
|
||||
static void TurnReadLF_off(uint32_t delay) {
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
WaitUS(delay);
|
||||
}
|
||||
|
@ -1586,7 +1586,7 @@ void TurnReadLF_off(uint32_t delay) {
|
|||
#define T55_LLR_REF (136 * 8)
|
||||
|
||||
// Write one bit to chip
|
||||
void T55xxWriteBit(uint8_t bit, uint8_t downlink_idx) {
|
||||
static void T55xxWriteBit(uint8_t bit, uint8_t downlink_idx) {
|
||||
|
||||
switch (bit) {
|
||||
case 0 :
|
||||
|
@ -1622,7 +1622,7 @@ void T55xxWriteBit(uint8_t bit, uint8_t downlink_idx) {
|
|||
// num_bits - how many bits (low x bits of data) Max 32 bits at a time
|
||||
// max_len - how many bytes can the bit_array hold (ensure no buffer overflow)
|
||||
// returns "Next" bit offset / bits stored (for next store)
|
||||
uint8_t T55xx_SetBits(uint8_t *bs, uint8_t start_offset, uint32_t data, uint8_t num_bits, uint8_t max_len) {
|
||||
static uint8_t T55xx_SetBits(uint8_t *bs, uint8_t start_offset, uint32_t data, uint8_t num_bits, uint8_t max_len) {
|
||||
int8_t next_offset = start_offset;
|
||||
|
||||
// Check if data will fit.
|
||||
|
@ -1646,7 +1646,7 @@ uint8_t T55xx_SetBits(uint8_t *bs, uint8_t start_offset, uint32_t data, uint8_t
|
|||
}
|
||||
|
||||
// Send one downlink command to the card
|
||||
void T55xx_SendCMD(uint32_t data, uint32_t pwd, uint16_t arg) {
|
||||
static void T55xx_SendCMD(uint32_t data, uint32_t pwd, uint16_t arg) {
|
||||
|
||||
/*
|
||||
arg bits
|
||||
|
@ -2108,7 +2108,7 @@ void T55xxWakeUp(uint32_t pwd, uint8_t flags) {
|
|||
|
||||
|
||||
/*-------------- Cloning routines -----------*/
|
||||
void WriteT55xx(uint32_t *blockdata, uint8_t startblock, uint8_t numblocks) {
|
||||
static void WriteT55xx(uint32_t *blockdata, uint8_t startblock, uint8_t numblocks) {
|
||||
|
||||
t55xx_write_block_t cmd;
|
||||
cmd.pwd = 0;
|
||||
|
@ -2300,7 +2300,7 @@ uint8_t *fwd_write_ptr; //forwardlink bit pointer
|
|||
// These timings work for 4469/4269/4305 (with the 55*8 above)
|
||||
// WRITE_0 = 23*8 , 9*8
|
||||
|
||||
uint8_t Prepare_Cmd(uint8_t cmd) {
|
||||
static uint8_t Prepare_Cmd(uint8_t cmd) {
|
||||
|
||||
*forward_ptr++ = 0; //start bit
|
||||
*forward_ptr++ = 0; //second pause for 4050 code
|
||||
|
@ -2320,7 +2320,7 @@ uint8_t Prepare_Cmd(uint8_t cmd) {
|
|||
// prepares address bits
|
||||
// see EM4469 spec
|
||||
//====================================================================
|
||||
uint8_t Prepare_Addr(uint8_t addr) {
|
||||
static uint8_t Prepare_Addr(uint8_t addr) {
|
||||
|
||||
register uint8_t line_parity;
|
||||
|
||||
|
@ -2341,7 +2341,7 @@ uint8_t Prepare_Addr(uint8_t addr) {
|
|||
// prepares data bits intreleaved with parity bits
|
||||
// see EM4469 spec
|
||||
//====================================================================
|
||||
uint8_t Prepare_Data(uint16_t data_low, uint16_t data_hi) {
|
||||
static uint8_t Prepare_Data(uint16_t data_low, uint16_t data_hi) {
|
||||
|
||||
register uint8_t column_parity;
|
||||
register uint8_t i, j;
|
||||
|
@ -2377,7 +2377,7 @@ uint8_t Prepare_Data(uint16_t data_low, uint16_t data_hi) {
|
|||
// Requires: forwarLink_data filled with valid bits (1 bit per byte)
|
||||
// fwd_bit_count set with number of bits to be sent
|
||||
//====================================================================
|
||||
void SendForward(uint8_t fwd_bit_count) {
|
||||
static void SendForward(uint8_t fwd_bit_count) {
|
||||
|
||||
// iceman, 21.3us increments for the USclock verification.
|
||||
// 55FC * 8us == 440us / 21.3 === 20.65 steps. could be too short. Go for 56FC instead
|
||||
|
@ -2411,7 +2411,7 @@ void SendForward(uint8_t fwd_bit_count) {
|
|||
}
|
||||
}
|
||||
|
||||
void EM4xLogin(uint32_t pwd) {
|
||||
static void EM4xLogin(uint32_t pwd) {
|
||||
uint8_t len;
|
||||
forward_ptr = forwardLink_data;
|
||||
len = Prepare_Cmd(FWD_CMD_LOGIN);
|
||||
|
|
|
@ -29,7 +29,7 @@ Default LF config is set to:
|
|||
*/
|
||||
sample_config config = { 1, 8, 1, LF_DIVISOR_125, 0, 0, 1} ;
|
||||
|
||||
void printConfig() {
|
||||
void printConfig(void) {
|
||||
uint32_t d = config.divisor;
|
||||
DbpString(_BLUE_("LF Sampling config"));
|
||||
Dbprintf(" [q] divisor.............%d ( "_GREEN_("%d.%02d kHz")")", d, 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100));
|
||||
|
@ -90,7 +90,7 @@ sample_config *getSamplingConfig(void) {
|
|||
* @param stream
|
||||
* @param bit
|
||||
*/
|
||||
void pushBit(BitstreamOut *stream, uint8_t bit) {
|
||||
static void pushBit(BitstreamOut *stream, uint8_t bit) {
|
||||
int bytepos = stream->position >> 3; // divide by 8
|
||||
int bitpos = stream->position & 7;
|
||||
*(stream->buffer + bytepos) &= ~(1 << (7 - bitpos));
|
||||
|
@ -143,7 +143,7 @@ void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) {
|
|||
samples.total_saved = 0;
|
||||
}
|
||||
|
||||
uint32_t getSampleCounter() {
|
||||
uint32_t getSampleCounter(void) {
|
||||
return samples.total_saved;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ uint32_t DoPartialAcquisition(int trigger_threshold, bool verbose, uint32_t samp
|
|||
return DoAcquisition(1, 8, 0, trigger_threshold, verbose, sample_size, cancel_after, 0);
|
||||
}
|
||||
|
||||
uint32_t ReadLF(bool reader_field, bool verbose, uint32_t sample_size) {
|
||||
static uint32_t ReadLF(bool reader_field, bool verbose, uint32_t sample_size) {
|
||||
if (verbose)
|
||||
printConfig();
|
||||
|
||||
|
@ -368,7 +368,7 @@ uint32_t SampleLF(bool verbose, uint32_t sample_size) {
|
|||
* Initializes the FPGA for sniffer-mode (field off), and acquires the samples.
|
||||
* @return number of bits sampled
|
||||
**/
|
||||
uint32_t SniffLF() {
|
||||
uint32_t SniffLF(void) {
|
||||
BigBuf_Clear_ext(false);
|
||||
return ReadLF(false, true, 0);
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ void doCotagAcquisition(size_t sample_size) {
|
|||
computeSignalProperties(dest, bufsize);
|
||||
}
|
||||
|
||||
uint32_t doCotagAcquisitionManchester() {
|
||||
uint32_t doCotagAcquisitionManchester(void) {
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
uint16_t bufsize = BigBuf_max_traceLen();
|
||||
|
|
|
@ -40,7 +40,7 @@ uint32_t SampleLF(bool verbose, uint32_t sample_size);
|
|||
* Initializes the FPGA for sniff-mode (field off), and acquires the samples.
|
||||
* @return number of bits sampled
|
||||
**/
|
||||
uint32_t SniffLF();
|
||||
uint32_t SniffLF(void);
|
||||
|
||||
uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, int16_t trigger_threshold,
|
||||
bool verbose, uint32_t sample_size, uint32_t cancel_after, int32_t samples_to_skip);
|
||||
|
@ -73,7 +73,7 @@ void initSampleBuffer(uint32_t *sample_size);
|
|||
void initSampleBufferEx(uint32_t *sample_size, bool use_malloc);
|
||||
void logSampleSimple(uint8_t sample);
|
||||
void logSample(uint8_t sample, uint8_t decimation, uint8_t bits_per_sample, bool avg);
|
||||
uint32_t getSampleCounter();
|
||||
uint32_t getSampleCounter(void);
|
||||
|
||||
/**
|
||||
* Setup the FPGA to listen for samples. This method downloads the FPGA bitstream
|
||||
|
@ -97,8 +97,8 @@ void LFSetupFPGAForADC(int divisor, bool reader_field);
|
|||
*/
|
||||
void setSamplingConfig(sample_config *sc);
|
||||
|
||||
sample_config *getSamplingConfig();
|
||||
sample_config *getSamplingConfig(void);
|
||||
|
||||
void printConfig();
|
||||
void printConfig(void);
|
||||
|
||||
#endif // __LFSAMPLING_H
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
// send an incomplete dummy response in order to trigger the card's authentication failure timeout
|
||||
#ifndef CHK_TIMEOUT
|
||||
# define CHK_TIMEOUT() { \
|
||||
# define CHK_TIMEOUT(void) { \
|
||||
ReaderTransmit(&dummy_answer, 1, NULL); \
|
||||
uint32_t timeout = GetCountSspClk() + HARDNESTED_AUTHENTICATION_TIMEOUT; \
|
||||
while (GetCountSspClk() < timeout) {}; \
|
||||
|
@ -627,7 +627,7 @@ void MifareUSetPwd(uint8_t arg0, uint8_t *datain) {
|
|||
}
|
||||
|
||||
// Return 1 if the nonce is invalid else return 0
|
||||
int valid_nonce(uint32_t Nt, uint32_t NtEnc, uint32_t Ks1, uint8_t *parity) {
|
||||
static int valid_nonce(uint32_t Nt, uint32_t NtEnc, uint32_t Ks1, uint8_t *parity) {
|
||||
return ((oddparity8((Nt >> 24) & 0xFF) == ((parity[0]) ^ oddparity8((NtEnc >> 24) & 0xFF) ^ BIT(Ks1, 16))) & \
|
||||
(oddparity8((Nt >> 16) & 0xFF) == ((parity[1]) ^ oddparity8((NtEnc >> 16) & 0xFF) ^ BIT(Ks1, 8))) & \
|
||||
(oddparity8((Nt >> 8) & 0xFF) == ((parity[2]) ^ oddparity8((NtEnc >> 8) & 0xFF) ^ BIT(Ks1, 0)))) ? 1 : 0;
|
||||
|
@ -1229,7 +1229,7 @@ typedef struct chk_t {
|
|||
// 2 = failed to select.
|
||||
// 1 = wrong key
|
||||
// 0 = correct key
|
||||
uint8_t chkKey(struct chk_t *c) {
|
||||
static uint8_t chkKey(struct chk_t *c) {
|
||||
uint8_t i = 0, res = 2;
|
||||
while (i < 5) {
|
||||
// this part is from Piwi's faster nonce collecting part in Hardnested.
|
||||
|
@ -1250,7 +1250,7 @@ uint8_t chkKey(struct chk_t *c) {
|
|||
return res;
|
||||
}
|
||||
|
||||
uint8_t chkKey_readb(struct chk_t *c, uint8_t *keyb) {
|
||||
static uint8_t chkKey_readb(struct chk_t *c, uint8_t *keyb) {
|
||||
|
||||
if (!iso14443a_fast_select_card(c->uid, c->cl))
|
||||
return 2;
|
||||
|
@ -1275,7 +1275,7 @@ uint8_t chkKey_readb(struct chk_t *c, uint8_t *keyb) {
|
|||
return res;
|
||||
}
|
||||
|
||||
void chkKey_scanA(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
static void chkKey_scanA(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
for (uint8_t s = 0; s < *sectorcnt; s++) {
|
||||
|
||||
// skip already found A keys
|
||||
|
@ -1293,7 +1293,7 @@ void chkKey_scanA(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, ui
|
|||
}
|
||||
}
|
||||
|
||||
void chkKey_scanB(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
static void chkKey_scanB(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
for (uint8_t s = 0; s < *sectorcnt; s++) {
|
||||
|
||||
// skip already found B keys
|
||||
|
@ -1313,7 +1313,7 @@ void chkKey_scanB(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, ui
|
|||
|
||||
// loop all A keys,
|
||||
// when A is found but not B, try to read B.
|
||||
void chkKey_loopBonly(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
static void chkKey_loopBonly(struct chk_t *c, struct sector_t *k_sector, uint8_t *found, uint8_t *sectorcnt, uint8_t *foundkeys) {
|
||||
|
||||
// read Block B, if A is found.
|
||||
for (uint8_t s = 0; s < *sectorcnt; ++s) {
|
||||
|
@ -2190,7 +2190,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) {
|
|||
OnSuccessMagic();
|
||||
}
|
||||
|
||||
void MifareCIdent() {
|
||||
void MifareCIdent(void) {
|
||||
// variables
|
||||
uint8_t isGen = 0;
|
||||
uint8_t rec[1] = {0x00};
|
||||
|
@ -2248,7 +2248,7 @@ OUT:
|
|||
BigBuf_free();
|
||||
}
|
||||
|
||||
void MifareHasStaticNonce() {
|
||||
void MifareHasStaticNonce(void) {
|
||||
|
||||
// variables
|
||||
int retval = PM3_SUCCESS, len;
|
||||
|
@ -2297,7 +2297,7 @@ OUT:
|
|||
crypto1_deinit(pcs);
|
||||
}
|
||||
|
||||
void OnSuccessMagic() {
|
||||
void OnSuccessMagic(void) {
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
set_tracing(false);
|
||||
|
|
|
@ -41,18 +41,17 @@ int MifareECardLoadExt(uint8_t sectorcnt, uint8_t keytype);
|
|||
|
||||
void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain); // Work with "magic Chinese" card
|
||||
void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain);
|
||||
void MifareCIdent(); // is "magic chinese" card?
|
||||
void MifareHasStaticNonce(); // Has the tag a static nonce?
|
||||
void MifareCIdent(void); // is "magic chinese" card?
|
||||
void MifareHasStaticNonce(void); // Has the tag a static nonce?
|
||||
|
||||
void MifareSetMod(uint8_t *datain);
|
||||
void MifarePersonalizeUID(uint8_t keyType, uint8_t perso_option, uint64_t key);
|
||||
|
||||
void MifareUSetPwd(uint8_t arg0, uint8_t *datain);
|
||||
void OnSuccessMagic();
|
||||
void OnSuccessMagic(void);
|
||||
void OnErrorMagic(uint8_t reason);
|
||||
|
||||
int32_t dist_nt(uint32_t nt1, uint32_t nt2);
|
||||
void ReaderMifare(bool first_try, uint8_t block, uint8_t keytype);
|
||||
//void RAMFUNC SniffMifare(uint8_t param);
|
||||
|
||||
void Mifare_DES_Auth1(uint8_t arg0, uint8_t *datain);
|
||||
|
|
|
@ -36,7 +36,7 @@ static uint8_t deselect_cmd[] = {0xc2, 0xe0, 0xb4};
|
|||
struct desfire_key skey = {0};
|
||||
static desfirekey_t sessionkey = &skey;
|
||||
|
||||
bool InitDesfireCard() {
|
||||
bool InitDesfireCard(void) {
|
||||
|
||||
pcb_blocknum = 0;
|
||||
|
||||
|
@ -107,7 +107,7 @@ void MifareSendCommand(uint8_t *datain) {
|
|||
LED_B_OFF();
|
||||
}
|
||||
|
||||
void MifareDesfireGetInformation() {
|
||||
void MifareDesfireGetInformation(void) {
|
||||
|
||||
LEDsoff();
|
||||
|
||||
|
@ -683,7 +683,7 @@ size_t CreateAPDU(uint8_t *datain, size_t len, uint8_t *dataout) {
|
|||
// crc_update(&desfire_crc32, byte, 8);
|
||||
// uint32_t crc = crc_finish(&desfire_crc32);
|
||||
|
||||
void OnSuccess() {
|
||||
void OnSuccess(void) {
|
||||
pcb_blocknum = 0;
|
||||
ReaderTransmit(deselect_cmd, 3, NULL);
|
||||
if (mifare_ultra_halt()) {
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
bool InitDesfireCard();
|
||||
bool InitDesfireCard(void);
|
||||
void MifareSendCommand(uint8_t *datain);
|
||||
void MifareDesfireGetInformation();
|
||||
void MifareDesfireGetInformation(void);
|
||||
void MifareDES_Auth1(uint8_t *datain);
|
||||
void ReaderMifareDES(uint32_t param, uint32_t param2, uint8_t *datain);
|
||||
int DesfireAPDU(uint8_t *cmd, size_t cmd_len, uint8_t *dataout);
|
||||
size_t CreateAPDU(uint8_t *datain, size_t len, uint8_t *dataout);
|
||||
void OnSuccess();
|
||||
void OnSuccess(void);
|
||||
void OnError(uint8_t reason);
|
||||
void OnErrorNG(uint16_t cmd, uint8_t reason);
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ bool RAMFUNC MfSniffLogic(const uint8_t *data, uint16_t len, uint8_t *parity, ui
|
|||
}
|
||||
*/
|
||||
|
||||
void RAMFUNC MfSniffSend() {
|
||||
void RAMFUNC MfSniffSend(void) {
|
||||
uint16_t tracelen = BigBuf_get_traceLen();
|
||||
int packlen = tracelen; // total number of bytes to send
|
||||
uint8_t *data = BigBuf_get_addr();
|
||||
|
|
|
@ -355,7 +355,7 @@ int mifare_ultra_auth(uint8_t *keybytes) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int mifare_ultra_readblockEx(uint8_t blockNo, uint8_t *blockData) {
|
||||
static int mifare_ultra_readblockEx(uint8_t blockNo, uint8_t *blockData) {
|
||||
uint16_t len = 0;
|
||||
uint8_t bt[2] = {0x00, 0x00};
|
||||
uint8_t receivedAnswer[MAX_FRAME_SIZE] = {0x00};
|
||||
|
@ -509,7 +509,7 @@ int mifare_classic_halt(struct Crypto1State *pcs, uint32_t uid) {
|
|||
return mifare_classic_halt_ex(pcs);
|
||||
}
|
||||
|
||||
int mifare_ultra_halt() {
|
||||
int mifare_ultra_halt(void) {
|
||||
uint16_t len = 0;
|
||||
uint8_t receivedAnswer[4] = {0x00, 0x00, 0x00, 0x00};
|
||||
len = mifare_sendcmd_short(NULL, CRYPT_NONE, ISO14443A_CMD_HALT, 0x00, receivedAnswer, NULL, NULL);
|
||||
|
|
|
@ -75,7 +75,7 @@ int mifare_ultra_auth(uint8_t *keybytes);
|
|||
int mifare_ultra_readblock(uint8_t blockNo, uint8_t *blockData);
|
||||
//int mifare_ultra_writeblock_compat(uint8_t blockNo, uint8_t *blockData);
|
||||
int mifare_ultra_writeblock(uint8_t blockNo, uint8_t *blockData);
|
||||
int mifare_ultra_halt();
|
||||
int mifare_ultra_halt(void);
|
||||
|
||||
// desfire
|
||||
int mifare_sendcmd_special(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t *data, uint8_t *answer, uint8_t *answer_parity, uint32_t *timing);
|
||||
|
|
|
@ -173,7 +173,7 @@ bool IsBlock1PCF7931(uint8_t *block) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ReadPCF7931() {
|
||||
void ReadPCF7931(void) {
|
||||
int found_blocks = 0; // successfully read blocks
|
||||
int max_blocks = 8; // readable blocks
|
||||
uint8_t memory_blocks[8][17]; // PCF content
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
size_t DemodPCF7931(uint8_t **outBlocks);
|
||||
bool IsBlock0PCF7931(uint8_t *block);
|
||||
bool IsBlock1PCF7931(uint8_t *block);
|
||||
void ReadPCF7931();
|
||||
void ReadPCF7931(void);
|
||||
void SendCmdPCF7931(uint32_t *tab);
|
||||
bool AddBytePCF7931(uint8_t byte, uint32_t *tab, int32_t l, int32_t p);
|
||||
bool AddBitPCF7931(bool b, uint32_t *tab, int32_t l, int32_t p);
|
||||
|
|
|
@ -108,7 +108,7 @@ static enum spiffs_mount_status {
|
|||
RDV40_SPIFFS_UNKNOWN
|
||||
} RDV40_SPIFFS_MOUNT_STATUS;
|
||||
|
||||
int rdv40_spiffs_mounted() {
|
||||
static int rdv40_spiffs_mounted(void) {
|
||||
int ret = 0;
|
||||
|
||||
switch (RDV40_SPIFFS_MOUNT_STATUS) {
|
||||
|
@ -124,7 +124,7 @@ int rdv40_spiffs_mounted() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int rdv40_spiffs_mount() {
|
||||
int rdv40_spiffs_mount(void) {
|
||||
if (rdv40_spiffs_mounted()) {
|
||||
Dbprintf("ERR: SPIFFS already mounted !");
|
||||
return SPIFFS_ERR_MOUNTED;
|
||||
|
@ -146,7 +146,7 @@ int rdv40_spiffs_mount() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int rdv40_spiffs_unmount() {
|
||||
int rdv40_spiffs_unmount(void) {
|
||||
if (!rdv40_spiffs_mounted()) {
|
||||
Dbprintf("ERR: SPIFFS not mounted !");
|
||||
return SPIFFS_ERR_NOT_MOUNTED;
|
||||
|
@ -162,7 +162,7 @@ int rdv40_spiffs_unmount() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int rdv40_spiffs_check() {
|
||||
int rdv40_spiffs_check(void) {
|
||||
rdv40_spiffs_lazy_mount();
|
||||
SPIFFS_check(&fs);
|
||||
SPIFFS_gc_quick(&fs, 0);
|
||||
|
@ -195,17 +195,17 @@ void read_from_spiffs(const char *filename, uint8_t *dst, uint32_t size) {
|
|||
SPIFFS_close(&fs, fd);
|
||||
}
|
||||
|
||||
void rename_in_spiffs(const char *old_filename, const char *new_filename) {
|
||||
static void rename_in_spiffs(const char *old_filename, const char *new_filename) {
|
||||
if (SPIFFS_rename(&fs, old_filename, new_filename) < 0)
|
||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||
}
|
||||
|
||||
void remove_from_spiffs(const char *filename) {
|
||||
static void remove_from_spiffs(const char *filename) {
|
||||
if (SPIFFS_remove(&fs, filename) < 0)
|
||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||
}
|
||||
|
||||
spiffs_stat stat_in_spiffs(const char *filename) {
|
||||
static spiffs_stat stat_in_spiffs(const char *filename) {
|
||||
spiffs_stat s;
|
||||
if (SPIFFS_stat(&fs, filename, &s) < 0)
|
||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||
|
@ -217,7 +217,7 @@ uint32_t size_in_spiffs(const char *filename) {
|
|||
return s.size;
|
||||
}
|
||||
|
||||
rdv40_spiffs_fsinfo info_of_spiffs() {
|
||||
static rdv40_spiffs_fsinfo info_of_spiffs(void) {
|
||||
rdv40_spiffs_fsinfo fsinfo;
|
||||
fsinfo.blockSize = SPIFFS_CFG_LOG_BLOCK_SZ;
|
||||
fsinfo.pageSize = LOG_PAGE_SIZE;
|
||||
|
@ -238,7 +238,7 @@ int exists_in_spiffs(const char *filename) {
|
|||
return rc == SPIFFS_OK;
|
||||
}
|
||||
|
||||
RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
||||
static RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
||||
RDV40SpiFFSFileType filetype = RDV40_SPIFFS_FILETYPE_UNKNOWN;
|
||||
char symlinked[SPIFFS_OBJ_NAME_LEN];
|
||||
sprintf(symlinked, "%s.lnk", filename);
|
||||
|
@ -270,16 +270,16 @@ RDV40SpiFFSFileType filetype_in_spiffs(const char *filename) {
|
|||
}
|
||||
return filetype;
|
||||
}
|
||||
|
||||
int is_valid_filename(const char *filename) {
|
||||
/*
|
||||
static int is_valid_filename(const char *filename) {
|
||||
if (filename == NULL) {
|
||||
return false;
|
||||
}
|
||||
uint32_t len = strlen(filename);
|
||||
return len > 0 && len < SPIFFS_OBJ_NAME_LEN;
|
||||
}
|
||||
|
||||
void copy_in_spiffs(const char *src, const char *dst) {
|
||||
*/
|
||||
static void copy_in_spiffs(const char *src, const char *dst) {
|
||||
uint32_t size = size_in_spiffs((char *)src);
|
||||
uint8_t *mem = BigBuf_malloc(size);
|
||||
read_from_spiffs((char *)src, (uint8_t *)mem, size);
|
||||
|
@ -297,7 +297,7 @@ void copy_in_spiffs(const char *src, const char *dst) {
|
|||
// 1 if the mount status actually changed
|
||||
// so you know what to do IN CASE you wished to set things "back to previous
|
||||
// state"
|
||||
int rdv40_spiffs_lazy_mount() {
|
||||
int rdv40_spiffs_lazy_mount(void) {
|
||||
int changed = 0;
|
||||
if (!rdv40_spiffs_mounted()) {
|
||||
changed = rdv40_spiffs_mount();
|
||||
|
@ -309,7 +309,7 @@ int rdv40_spiffs_lazy_mount() {
|
|||
}
|
||||
|
||||
// unmount if not already
|
||||
int rdv40_spiffs_lazy_unmount() {
|
||||
int rdv40_spiffs_lazy_unmount(void) {
|
||||
int changed = 0;
|
||||
if (rdv40_spiffs_mounted()) {
|
||||
changed = rdv40_spiffs_unmount();
|
||||
|
@ -362,7 +362,7 @@ void my_lazy_spiffs_act(){
|
|||
// this lazy_mount since needed and can also report back the change on
|
||||
state implied by eventual mount, if needed rdv40_spiffs_lazy_read((const char
|
||||
*)".SHOULDRESET",(uint8_t *)resetret,4); if( resetret == "YESS" ) { uint8_t
|
||||
changed = rdv40_spiffs_lazy_format(); // this will imply change only if we where
|
||||
changed = rdv40_spiffs_lazy_format(void); // this will imply change only if we where
|
||||
already mounted beforehand, was the case after our reading without further
|
||||
rollback rdv40_spiffs_lazy_mount_rollback(changed); // so if we were mounted
|
||||
just get back to this state. If not, just don't.
|
||||
|
@ -400,20 +400,20 @@ int rdv40_spiffs_lazy_mount_rollback(int changed) {
|
|||
// statement or some function taking function parameters
|
||||
// TODO : forbid writing to a filename which already exists as lnk !
|
||||
// TODO : forbid writing to a filename.lnk which already exists without lnk !
|
||||
int rdv40_spiffs_write(char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
||||
int rdv40_spiffs_write(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
||||
RDV40_SPIFFS_SAFE_FUNCTION(
|
||||
write_to_spiffs(filename, src, size);
|
||||
)
|
||||
}
|
||||
|
||||
int rdv40_spiffs_append(char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
||||
int rdv40_spiffs_append(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
||||
RDV40_SPIFFS_SAFE_FUNCTION(
|
||||
append_to_spiffs(filename, src, size);
|
||||
)
|
||||
}
|
||||
|
||||
// todo integrate reading symlinks transparently
|
||||
int rdv40_spiffs_read(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
||||
int rdv40_spiffs_read(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
||||
RDV40_SPIFFS_SAFE_FUNCTION(
|
||||
read_from_spiffs(filename, dst, size);
|
||||
)
|
||||
|
@ -444,7 +444,7 @@ int rdv40_spiffs_stat(char *filename, uint32_t *buf, RDV40SpiFFSSafetyLevel leve
|
|||
)
|
||||
}
|
||||
|
||||
int rdv40_spiffs_getfsinfo(rdv40_spiffs_fsinfo *fsinfo, RDV40SpiFFSSafetyLevel level) {
|
||||
static int rdv40_spiffs_getfsinfo(rdv40_spiffs_fsinfo *fsinfo, RDV40SpiFFSSafetyLevel level) {
|
||||
RDV40_SPIFFS_SAFE_FUNCTION( //
|
||||
*fsinfo = info_of_spiffs(); //
|
||||
)
|
||||
|
@ -538,7 +538,7 @@ int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, R
|
|||
///////// MISC HIGH LEVEL FUNCTIONS ////////////////////////////////////////////
|
||||
#define SPIFFS_BANNER DbpString(_BLUE_("Flash Memory FileSystem tree (SPIFFS)"));
|
||||
|
||||
void rdv40_spiffs_safe_print_fsinfo() {
|
||||
void rdv40_spiffs_safe_print_fsinfo(void) {
|
||||
rdv40_spiffs_fsinfo fsinfo;
|
||||
rdv40_spiffs_getfsinfo(&fsinfo, RDV40_SPIFFS_SAFETY_SAFE);
|
||||
|
||||
|
@ -603,7 +603,7 @@ void rdv40_spiffs_safe_print_tree(uint8_t banner) {
|
|||
|
||||
|
||||
// Selftest function
|
||||
void test_spiffs() {
|
||||
void test_spiffs(void) {
|
||||
Dbprintf("----------------------------------------------");
|
||||
Dbprintf("Testing SPIFFS operations");
|
||||
Dbprintf("----------------------------------------------");
|
||||
|
|
|
@ -33,27 +33,27 @@ typedef struct rdv40_spiffs_fsinfo {
|
|||
|
||||
int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
|
||||
int rdv40_spiffs_check();
|
||||
int rdv40_spiffs_lazy_unmount();
|
||||
int rdv40_spiffs_lazy_mount();
|
||||
int rdv40_spiffs_check(void);
|
||||
int rdv40_spiffs_lazy_unmount(void);
|
||||
int rdv40_spiffs_lazy_mount(void);
|
||||
int rdv40_spiffs_lazy_mount_rollback(int changed);
|
||||
int rdv40_spiffs_write(char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_read(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_write(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_read(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_rename(char *old_filename, char *new_filename, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_remove(char *filename, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
void write_to_spiffs(const char *filename, uint8_t *src, uint32_t size);
|
||||
void read_from_spiffs(const char *filename, uint8_t *dst, uint32_t size);
|
||||
void test_spiffs();
|
||||
void test_spiffs(void);
|
||||
void rdv40_spiffs_safe_print_tree(uint8_t banner);
|
||||
int rdv40_spiffs_unmount();
|
||||
int rdv40_spiffs_mount();
|
||||
int rdv40_spiffs_unmount(void);
|
||||
int rdv40_spiffs_mount(void);
|
||||
int rdv40_spiffs_is_symlink(const char *s);
|
||||
void rdv40_spiffs_safe_print_fsinfo();
|
||||
void rdv40_spiffs_safe_print_fsinfo(void);
|
||||
int rdv40_spiffs_make_symlink(char *linkdest, char *filename, RDV40SpiFFSSafetyLevel level);
|
||||
void append_to_spiffs(const char *filename, uint8_t *src, uint32_t size);
|
||||
int rdv40_spiffs_copy(char *src, char *dst, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_append(char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_append(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level);
|
||||
int rdv40_spiffs_stat(char *filename, uint32_t *buf, RDV40SpiFFSSafetyLevel level);
|
||||
uint32_t size_in_spiffs(const char *filename);
|
||||
int exists_in_spiffs(const char *filename);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include "string.h"
|
||||
#include "flashmem.h"
|
||||
|
||||
void Dbprintf(const char *fmt, ...);
|
||||
|
||||
//#include <stddef.h>
|
||||
//#include <unistd.h>
|
||||
// ----------- >8 ------------
|
||||
|
|
|
@ -59,7 +59,8 @@ static void uncompress_data_section(void) {
|
|||
common_area.arg1 = data_section.total_in;
|
||||
}
|
||||
|
||||
void __attribute__((section(".startos"))) Vector(void) {
|
||||
void __attribute__((section(".startos"))) Vector(void);
|
||||
void Vector(void) {
|
||||
/* Stack should have been set up by the bootloader */
|
||||
// char *src;
|
||||
char *dst, *end;
|
||||
|
|
|
@ -33,6 +33,8 @@ char *strrchr(const char *s, int c);
|
|||
size_t strcspn(const char *s1, const char *s2);
|
||||
char *strpbrk(const char *s1, const char *s2);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
unsigned long strtoul(const char *p, char **out_p, int base);
|
||||
long strtol(const char *p, char **out_p, int base);
|
||||
char c_tolower(int c);
|
||||
char c_isprint(unsigned char c);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void ReadThinFilm(void) {
|
|||
#define SEC_F 0x00
|
||||
uint16_t FpgaSendQueueDelay;
|
||||
|
||||
uint16_t ReadReaderField(void) {
|
||||
static uint16_t ReadReaderField(void) {
|
||||
#if defined RDV4
|
||||
return AvgAdc(ADC_CHAN_HF_RDV40);
|
||||
#else
|
||||
|
@ -71,7 +71,7 @@ static void CodeThinfilmAsTag(const uint8_t *cmd, uint16_t len) {
|
|||
ToSendMax++;
|
||||
}
|
||||
|
||||
int EmSendCmdThinfilmRaw(uint8_t *resp, uint16_t respLen) {
|
||||
static int EmSendCmdThinfilmRaw(uint8_t *resp, uint16_t respLen) {
|
||||
volatile uint8_t b;
|
||||
uint16_t i = 0;
|
||||
uint32_t ThisTransferTime;
|
||||
|
|
|
@ -30,10 +30,10 @@ uint32_t RAMFUNC GetCountUS(void);
|
|||
void ResetUSClock(void);
|
||||
void SpinDelayCountUs(uint32_t us);
|
||||
|
||||
void StartCountSspClk();
|
||||
void StartCountSspClk(void);
|
||||
void ResetSspClk(void);
|
||||
uint32_t RAMFUNC GetCountSspClk();
|
||||
uint32_t RAMFUNC GetCountSspClkDelta();
|
||||
uint32_t RAMFUNC GetCountSspClk(void);
|
||||
uint32_t RAMFUNC GetCountSspClkDelta(uint32_t start);
|
||||
|
||||
void StartTicks(void);
|
||||
uint32_t GetTicks(void);
|
||||
|
|
|
@ -83,7 +83,7 @@ uint8_t hex2int(char hexchar) {
|
|||
}
|
||||
}
|
||||
|
||||
void LEDsoff() {
|
||||
void LEDsoff(void) {
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "usb_cdc.h"
|
||||
|
||||
#include "proxmark3_arm.h"
|
||||
#define DEBUG 0
|
||||
|
||||
struct common_area common_area __attribute__((section(".commonarea")));
|
||||
unsigned int start_addr, end_addr, bootrom_unlocked;
|
||||
|
@ -45,13 +46,15 @@ static int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2,
|
|||
return result;
|
||||
}
|
||||
|
||||
void DbpString(char *str) {
|
||||
#if DEBUG
|
||||
static void DbpString(char *str) {
|
||||
uint8_t len = 0;
|
||||
while (str[len] != 0x00)
|
||||
len++;
|
||||
|
||||
reply_old(CMD_DEBUG_PRINT_STRING, len, 0, 0, (uint8_t *)str, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ConfigClocks(void) {
|
||||
// we are using a 16 MHz crystal as the basis for everything
|
||||
|
@ -76,7 +79,7 @@ static void Fatal(void) {
|
|||
for (;;) {};
|
||||
}
|
||||
|
||||
void UsbPacketReceived(uint8_t *packet, int len) {
|
||||
static void UsbPacketReceived(uint8_t *packet) {
|
||||
int i, dont_ack = 0;
|
||||
PacketCommandOLD *c = (PacketCommandOLD *)packet;
|
||||
|
||||
|
@ -217,7 +220,7 @@ static void flash_mode(void) {
|
|||
// Check if there is a usb packet available
|
||||
if (usb_poll_validate_length()) {
|
||||
if (usb_read(rx, sizeof(rx))) {
|
||||
UsbPacketReceived(rx, sizeof(rx));
|
||||
UsbPacketReceived(rx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,6 +238,7 @@ static void flash_mode(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void BootROM(void);
|
||||
void BootROM(void) {
|
||||
//------------
|
||||
// First set up all the I/O pins; GPIOs configured directly, other ones
|
||||
|
@ -312,7 +316,7 @@ void BootROM(void) {
|
|||
|
||||
if (!common_area_present) {
|
||||
/* Common area not ok, initialize it */
|
||||
int i;
|
||||
size_t i;
|
||||
/* Makeshift memset, no need to drag util.c into this */
|
||||
for (i = 0; i < sizeof(common_area); i++)
|
||||
((char *)&common_area)[i] = 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
MYSRCPATHS =
|
||||
MYINCLUDES =
|
||||
# Strange errors on Mingw when compiling with C99
|
||||
MYCFLAGS = -Wno-bad-function-cast -Wno-incompatible-pointer-types-discards-qualifiers
|
||||
MYCFLAGS = -Wno-bad-function-cast -Wno-redundant-decls -Wno-incompatible-pointer-types-discards-qualifiers -Wno-discarded-qualifiers -Wno-unknown-warning-option -Wno-maybe-uninitialized
|
||||
MYDEFS =
|
||||
MYSRCS = \
|
||||
cborencoder.c \
|
||||
|
@ -18,7 +18,4 @@ LIB_A = tinycbor.a
|
|||
# Transition: remove old directories and objects
|
||||
MYCLEANOLDPATH = ../../tinycbor
|
||||
|
||||
# Strange errors on Mingw when compiling with -O3
|
||||
CFLAGS ?= -Wall -Werror -O2
|
||||
|
||||
include ../../../Makefile.host
|
||||
|
|
|
@ -2538,7 +2538,7 @@ bool AcquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password, u
|
|||
}
|
||||
|
||||
char *GetPskCfStr(uint32_t id, bool q5) {
|
||||
static char buf[25];
|
||||
static char buf[40];
|
||||
char *retStr = buf;
|
||||
switch (id) {
|
||||
case 0:
|
||||
|
|
|
@ -66,6 +66,9 @@ bool validate_prng_nonce(uint32_t nonce);
|
|||
#define LF_POLY_EVEN (0x870804)
|
||||
#define BIT(x, n) ((x) >> (n) & 1)
|
||||
#define BEBIT(x, n) BIT(x, (n) ^ 24)
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
int filter(uint32_t const x);
|
||||
#else
|
||||
static inline int filter(uint32_t const x) {
|
||||
uint32_t f;
|
||||
|
||||
|
@ -77,3 +80,4 @@ static inline int filter(uint32_t const x) {
|
|||
return BIT(0xEC57E80A, f);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,19 @@
|
|||
#include "crapto1.h"
|
||||
#include "parity.h"
|
||||
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
int filter(uint32_t const x) {
|
||||
uint32_t f;
|
||||
|
||||
f = 0xf22c0 >> (x & 0xf) & 16;
|
||||
f |= 0x6c9c0 >> (x >> 4 & 0xf) & 8;
|
||||
f |= 0x3c8b0 >> (x >> 8 & 0xf) & 4;
|
||||
f |= 0x1e458 >> (x >> 12 & 0xf) & 2;
|
||||
f |= 0x0d938 >> (x >> 16 & 0xf) & 1;
|
||||
return BIT(0xEC57E80A, f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SWAPENDIAN(x)\
|
||||
(x = (x >> 8 & 0xff00ff) | (x & 0xff00ff) << 8, x = x >> 16 | x << 16)
|
||||
|
||||
|
|
|
@ -39,8 +39,54 @@ VPATH = . ../common_arm ../common ../common/crapto1 ../common/mbedtls ../common/
|
|||
|
||||
INCLUDES = ../include/proxmark3_arm.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/pm3_cmd.h
|
||||
|
||||
CFLAGS ?= -Wall -Werror -pedantic -Wunused -Os -mthumb-interwork
|
||||
CFLAGS += -c $(INCLUDE) -std=c99 $(APP_CFLAGS)
|
||||
ARMCFLAGS = -mthumb-interwork
|
||||
DEFCFLAGS = -Wall -Werror -Os -pedantic -fstrict-aliasing -pipe
|
||||
|
||||
# Some more warnings we want as errors:
|
||||
DEFCFLAGS += -Wbad-function-cast -Wchar-subscripts -Wundef -Wunused -Wuninitialized -Wpointer-arith -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wtype-limits
|
||||
|
||||
# Some more warnings we need first to eliminate, so temporarely tolerated:
|
||||
DEFCFLAGS += -Wshadow -Wno-error=shadow
|
||||
DEFCFLAGS += -Winline -Wno-error=inline
|
||||
DEFCFLAGS += -Wmissing-prototypes -Wno-error=missing-prototypes
|
||||
DEFCFLAGS += -Wmissing-declarations -Wno-error=missing-declarations
|
||||
DEFCFLAGS += -Wstrict-prototypes -Wno-error=strict-prototypes
|
||||
# still vsnprintf etc to sort out...
|
||||
#DEFCFLAGS += -Wredundant-decls -Wno-error=redundant-decls
|
||||
#DEFCFLAGS += -Wcast-align -Wno-error=cast-align
|
||||
|
||||
# Next ones are activated only if GCCEXTRA=1
|
||||
EXTRACFLAGS =
|
||||
EXTRACFLAGS += -Wunused-parameter -Wno-error=unused-parameter
|
||||
EXTRACFLAGS += -Wswitch-enum -Wno-error=switch-enum
|
||||
EXTRACFLAGS += -Wsign-compare -Wno-error=sign-compare
|
||||
EXTRACFLAGS += -Wold-style-definition -Wno-error=old-style-definition
|
||||
|
||||
# unknown to clang or old gcc:
|
||||
# First we activate Wextra then we explicitly list those we know about
|
||||
# Those without -Wno-error are supposed to be completely solved
|
||||
GCCEXTRACFLAGS = -Wextra
|
||||
# unknown to arm-none-eabi/4.9.3
|
||||
GCCEXTRACFLAGS += -Wwrite-strings -Wno-error=discarded-qualifiers
|
||||
|
||||
GCCEXTRACFLAGS += -Wold-style-declaration -Wno-error=old-style-declaration
|
||||
GCCEXTRACFLAGS += -Wimplicit-fallthrough=3 -Wno-error=implicit-fallthrough
|
||||
GCCEXTRACFLAGS += -Wclobbered
|
||||
GCCEXTRACFLAGS += -Wcast-function-type
|
||||
GCCEXTRACFLAGS += -Wmissing-parameter-type
|
||||
GCCEXTRACFLAGS += -Woverride-init
|
||||
GCCEXTRACFLAGS += -Wshift-negative-value
|
||||
GCCEXTRACFLAGS += -Wunused-but-set-parameter
|
||||
# Not yet enabled in DEFCFLAGS:
|
||||
GCCEXTRACFLAGS += -Wredundant-decls -Wno-error=redundant-decls
|
||||
GCCEXTRACFLAGS += -Wcast-align -Wno-error=cast-align
|
||||
|
||||
ifeq ($(GCCEXTRA),1)
|
||||
DEFCFLAGS += $(GCCEXTRACFLAGS) $(EXTRACFLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS ?= $(DEFCFLAGS)
|
||||
CFLAGS += $(ARMCFLAGS) -c $(INCLUDE) -std=c99 $(APP_CFLAGS)
|
||||
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs -Wl,-gc-sections -Wl,--build-id=none -n
|
||||
LIBS = -lgcc
|
||||
|
|
|
@ -394,7 +394,7 @@ static const char StrMS_OSDescriptor[] = {
|
|||
'M', 0, 'S', 0, 'F', 0, 'T', 0, '1', 0, '0', 0, '0', 0, MS_VENDOR_CODE, 0
|
||||
};
|
||||
|
||||
const char *getStringDescriptor(uint8_t idx) {
|
||||
static const char *getStringDescriptor(uint8_t idx) {
|
||||
switch (idx) {
|
||||
case 0:
|
||||
return StrLanguageCodes;
|
||||
|
@ -479,7 +479,7 @@ static void SpinDelayUs(int us) {
|
|||
* \brief This function deactivates the USB device
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
void usb_disable() {
|
||||
void usb_disable(void) {
|
||||
// Disconnect the USB device
|
||||
AT91C_BASE_PIOA->PIO_ODR = GPIO_USB_PU;
|
||||
|
||||
|
@ -495,7 +495,7 @@ void usb_disable() {
|
|||
* \brief This function Activates the USB device
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
void usb_enable() {
|
||||
void usb_enable(void) {
|
||||
// Set the PLL USB Divider
|
||||
AT91C_BASE_CKGR->CKGR_PLLR |= AT91C_CKGR_USBDIV_1 ;
|
||||
|
||||
|
@ -548,7 +548,7 @@ int GetUSBconfigured(void) {
|
|||
return usb_configured;
|
||||
}
|
||||
|
||||
bool usb_check() {
|
||||
bool usb_check(void) {
|
||||
|
||||
/*
|
||||
// reconnected ONCE and
|
||||
|
@ -599,7 +599,7 @@ bool usb_check() {
|
|||
return (btConfiguration) ? true : false;
|
||||
}
|
||||
|
||||
bool usb_poll() {
|
||||
bool usb_poll(void) {
|
||||
if (!usb_check()) return false;
|
||||
return (pUdp->UDP_CSR[AT91C_EP_OUT] & btReceiveBank);
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ bool usb_poll() {
|
|||
that the length available to read is non-zero, thus hopefully fixes the
|
||||
bug.
|
||||
**/
|
||||
bool usb_poll_validate_length() {
|
||||
bool usb_poll_validate_length(void) {
|
||||
if (!usb_check()) return false;
|
||||
if (!(pUdp->UDP_CSR[AT91C_EP_OUT] & btReceiveBank)) return false;
|
||||
return ((pUdp->UDP_CSR[AT91C_EP_OUT] & AT91C_UDP_RXBYTECNT) >> 16) > 0;
|
||||
|
@ -793,7 +793,7 @@ int usb_write(const uint8_t *data, const size_t len) {
|
|||
* \brief Send Data through the control endpoint
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
void AT91F_USB_SendData(AT91PS_UDP pUdp, const char *pData, uint32_t length) {
|
||||
void AT91F_USB_SendData(AT91PS_UDP pudp, const char *pData, uint32_t length) {
|
||||
AT91_REG csr;
|
||||
|
||||
do {
|
||||
|
@ -801,17 +801,17 @@ void AT91F_USB_SendData(AT91PS_UDP pUdp, const char *pData, uint32_t length) {
|
|||
length -= cpt;
|
||||
|
||||
while (cpt--)
|
||||
pUdp->UDP_FDR[AT91C_EP_CONTROL] = *pData++;
|
||||
pudp->UDP_FDR[AT91C_EP_CONTROL] = *pData++;
|
||||
|
||||
if (pUdp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {
|
||||
if (pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {
|
||||
UDP_CLEAR_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXCOMP);
|
||||
while (pUdp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP);
|
||||
while (pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP);
|
||||
}
|
||||
|
||||
UDP_SET_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXPKTRDY);
|
||||
|
||||
do {
|
||||
csr = pUdp->UDP_CSR[AT91C_EP_CONTROL];
|
||||
csr = pudp->UDP_CSR[AT91C_EP_CONTROL];
|
||||
// Data IN stage has been stopped by a status OUT
|
||||
if (csr & AT91C_UDP_RX_DATA_BK0) {
|
||||
|
||||
|
@ -822,9 +822,9 @@ void AT91F_USB_SendData(AT91PS_UDP pUdp, const char *pData, uint32_t length) {
|
|||
|
||||
} while (length);
|
||||
|
||||
if (pUdp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {
|
||||
if (pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {
|
||||
UDP_CLEAR_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXCOMP);
|
||||
while (pUdp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP);
|
||||
while (pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -833,22 +833,22 @@ void AT91F_USB_SendData(AT91PS_UDP pUdp, const char *pData, uint32_t length) {
|
|||
//* \fn AT91F_USB_SendZlp
|
||||
//* \brief Send zero length packet through the control endpoint
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_USB_SendZlp(AT91PS_UDP pUdp) {
|
||||
void AT91F_USB_SendZlp(AT91PS_UDP pudp) {
|
||||
UDP_SET_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXPKTRDY);
|
||||
while (!(pUdp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP)) {};
|
||||
while (!(pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP)) {};
|
||||
UDP_CLEAR_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXCOMP);
|
||||
while (pUdp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {};
|
||||
while (pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {};
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
//* \fn AT91F_USB_SendStall
|
||||
//* \brief Stall the control endpoint
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_USB_SendStall(AT91PS_UDP pUdp) {
|
||||
void AT91F_USB_SendStall(AT91PS_UDP pudp) {
|
||||
UDP_SET_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_FORCESTALL);
|
||||
while (!(pUdp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_ISOERROR)) {};
|
||||
while (!(pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_ISOERROR)) {};
|
||||
UDP_CLEAR_EP_FLAGS(AT91C_EP_CONTROL, (AT91C_UDP_FORCESTALL | AT91C_UDP_ISOERROR));
|
||||
while (pUdp->UDP_CSR[AT91C_EP_CONTROL] & (AT91C_UDP_FORCESTALL | AT91C_UDP_ISOERROR)) {};
|
||||
while (pudp->UDP_CSR[AT91C_EP_CONTROL] & (AT91C_UDP_FORCESTALL | AT91C_UDP_ISOERROR)) {};
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
|
@ -858,7 +858,7 @@ void AT91F_USB_SendStall(AT91PS_UDP pUdp) {
|
|||
//* 1. this is for USB endpoint0. the control endpoint.
|
||||
//* 2. mixed with CDC ACM endpoint3 , interrupt, control endpoint
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_CDC_Enumerate() {
|
||||
void AT91F_CDC_Enumerate(void) {
|
||||
uint8_t bmRequestType, bRequest;
|
||||
uint16_t wValue, wIndex, wLength, wStatus;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue