X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/e73e717239300d6b47d5f5d81256d8feb493299f..e3ae0257834f7d134c7f80db6fa23668b5a5fa6d:/armsrc/fpgaloader.c diff --git a/armsrc/fpgaloader.c b/armsrc/fpgaloader.c index e07c2542..58385588 100644 --- a/armsrc/fpgaloader.c +++ b/armsrc/fpgaloader.c @@ -275,14 +275,45 @@ void FpgaDownloadAndGo(void) } /* Fallback for the old flash image format: Check for the magic marker 0xFFFFFFFF - * 0xAA995566 at address 0x2000. This is raw bitstream with a size of 336,768 bits + * 0xAA995566 at address 0x102000. This is raw bitstream with a size of 336,768 bits * = 10,524 DWORDs, stored as DWORDS e.g. little-endian in memory, but each DWORD * is still to be transmitted in MSBit first order. Set the invert flag to indicate * that the DownloadFPGA function should invert every 4 byte sequence when doing * the bytewise download. */ - if( *(DWORD*)0x2000 == 0xFFFFFFFF && *(DWORD*)0x2004 == 0xAA995566 ) - DownloadFPGA((DWORD *)0x2000, 10524, 1); + if( *(DWORD*)0x102000 == 0xFFFFFFFF && *(DWORD*)0x102004 == 0xAA995566 ) + DownloadFPGA((DWORD *)0x102000, 10524, 1); +} + +void FpgaGatherVersion(char *dst, int len) +{ + char *fpga_info; + unsigned int fpga_info_len; + dst[0] = 0; + if(!bitparse_find_section('e', (void**)&fpga_info, &fpga_info_len)) { + strncat(dst, "FPGA image: legacy image without version information", len-1); + } else { + strncat(dst, "FPGA image built", len-1); + /* USB packets only have 48 bytes data payload, so be terse */ +#if 0 + if(bitparse_find_section('a', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) { + strncat(dst, " from ", len-1); + strncat(dst, fpga_info, len-1); + } + if(bitparse_find_section('b', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) { + strncat(dst, " for ", len-1); + strncat(dst, fpga_info, len-1); + } +#endif + if(bitparse_find_section('c', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) { + strncat(dst, " on ", len-1); + strncat(dst, fpga_info, len-1); + } + if(bitparse_find_section('d', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) { + strncat(dst, " at ", len-1); + strncat(dst, fpga_info, len-1); + } + } } //-----------------------------------------------------------------------------