X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/95e635947bc4628b713fa00d7a533a881bca7fc4..c5f8c67ab472defdab1331e2baffb3ab8049867f:/armsrc/util.c diff --git a/armsrc/util.c b/armsrc/util.c index b1ef6ea0..8576ddce 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -8,10 +8,11 @@ // Utility functions used in many places, not specific to any piece of code. //----------------------------------------------------------------------------- -#include "../include/proxmark3.h" +#include "proxmark3.h" #include "util.h" #include "string.h" #include "apps.h" +#include "BigBuf.h" @@ -34,7 +35,7 @@ void print_result(char *name, uint8_t *buf, size_t len) { } size_t nbytes(size_t nbits) { - return (nbits/8)+((nbits%8)>0); + return (nbits >> 3)+((nbits % 8) > 0); } uint32_t SwapBits(uint32_t value, int nrbits) { @@ -85,15 +86,6 @@ int32_t le24toh (uint8_t data[3]) return (data[2] << 16) | (data[1] << 8) | data[0]; } -//added here for parity calulations -uint8_t oddparity(uint8_t bt) -{ - uint16_t v = bt; - v ^= v >> 4; - v &= 0xF; - return ((0x9669 >> v) & 1); -} - void LEDsoff() { LED_A_OFF(); @@ -276,15 +268,15 @@ void FormatVersionInformation(char *dst, int len, const char *prefix, void *vers dst[0] = 0; strncat(dst, prefix, len-1); if(v->magic != VERSION_INFORMATION_MAGIC) { - strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1); + strncat(dst, "Missing/Invalid version information\n", len - strlen(dst) - 1); return; } if(v->versionversion != 1) { - strncat(dst, "Version information not understood", len - strlen(dst) - 1); + strncat(dst, "Version information not understood\n", len - strlen(dst) - 1); return; } if(!v->present) { - strncat(dst, "Version information not available", len - strlen(dst) - 1); + strncat(dst, "Version information not available\n", len - strlen(dst) - 1); return; } @@ -297,6 +289,7 @@ void FormatVersionInformation(char *dst, int len, const char *prefix, void *vers strncat(dst, " ", len - strlen(dst) - 1); strncat(dst, v->buildtime, len - strlen(dst) - 1); + strncat(dst, "\n", len - strlen(dst) - 1); } // ------------------------------------------------------------------------- @@ -437,4 +430,3 @@ uint32_t RAMFUNC GetCountSspClk(){ } } -