X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/42bc3be31c562fac31cbe5e451e4b48092f06e68..8a6aec16d8c21d3c57457e5ec00eb83f5242feba:/armsrc/util.c?ds=inline diff --git a/armsrc/util.c b/armsrc/util.c index a102bbb5..650ba22b 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -235,3 +235,37 @@ void SpinDelay(int ms) // convert to uS and call microsecond delay function SpinDelayUs(ms*1000); } + +/* Similar to FpgaGatherVersion this formats stored version information + * into a string representation. It takes a pointer to the struct version_information, + * verifies the magic properties, then stores a formatted string, prefixed by + * prefix in dst. + */ +void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_information) +{ + struct version_information *v = (struct version_information*)version_information; + dst[0] = 0; + strncat(dst, prefix, len); + if(v->magic != VERSION_INFORMATION_MAGIC) { + strncat(dst, "Missing/Invalid version information", len); + return; + } + if(v->versionversion != 1) { + strncat(dst, "Version information not understood", len); + return; + } + if(!v->present) { + strncat(dst, "Version information not available", len); + return; + } + + strncat(dst, v->svnversion, len); + if(v->clean == 0) { + strncat(dst, "-unclean", len); + } else if(v->clean == 2) { + strncat(dst, "-suspect", len); + } + + strncat(dst, " ", len); + strncat(dst, v->buildtime, len); +}