Commit a00bfae8 authored by Alessandro Rubini's avatar Alessandro Rubini

tools/wrsw_version: offer tagged mode; change -g to be tagged

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 08623923
......@@ -47,31 +47,44 @@ void help(const char* pgrname)
" -g Gateware version\n"
" -c Compiling time\n"
" -v version (git)\n"
" -t tagged-output for other programs\n"
" -a All (default)\n"
"\n");
exit(1);
}
void print_gw_info()
static void print_gw_info(void)
{
struct gw_info info;
shw_fpga_mmap_init();
printf("Reading GW info\n");
if( shw_hwiu_gwver(&info) < 0 ) {
printf("Could not get GW version info\n");
return;
fprintf(stderr, "Could not get GW version info\n");
exit(1);
}
if( info.struct_ver != HWIU_STRUCT_VERSION )
printf("WARNING: dealing with unsupported info struct, sw:%u, gw:%u\n",
HWIU_STRUCT_VERSION, info.struct_ver);
fprintf(stderr, "WARNING: dealing with unsupported "
"info struct, sw:%u, gw:%u\n",
HWIU_STRUCT_VERSION, info.struct_ver);
printf("WRSW Gateware: version %u.%u\n", info.ver_major, info.ver_minor);
printf("WRSW Gateware: build %02u/%02u/%02u.%02u\n", info.build_day,
/* Use tagged format, this is a subset of the "-t" operation */
printf("gateware-version: %u.%u\n", info.ver_major, info.ver_minor);
printf("gateware-build: %02u/%02u/%02u.%02u\n", info.build_day,
info.build_month, info.build_year, info.build_no);
printf("WRSW Gateware: wr_switch_hdl commit: %x\n", info.switch_hdl_hash);
printf("WRSW Gateware: general-cores commit: %x\n", info.general_cores_hash);
printf("WRSW Gateware: wr-cores commit: %x\n", info.wr_cores_hash);
printf("wr_switch_hdl-commit: %07x\n", info.switch_hdl_hash);
printf("general-cores-commit: %07x\n", info.general_cores_hash);
printf("wr-cores-commit: %07x\n", info.wr_cores_hash);
}
/* Print everything in tagged format, for snmp parsing etc */
static void wrsw_tagged_versions(void)
{
printf("software-version: %s\n", __GIT_VER__); /* see Makefile */
printf("bult-by: %s\n", __GIT_USR__); /* see Makefile */
printf("build-date: %s %s\n", __DATE__, __TIME__);
printf("pcb-version: %s\n", get_shw_info('p'));
printf("fpga-type: %s\n", get_shw_info('f'));
print_gw_info(); /* This is already tagged */
}
int main(int argc, char **argv)
......@@ -89,9 +102,6 @@ int main(int argc, char **argv)
switch(func)
{
case 'p':
printf("%s\n",get_shw_info(func));
break;
case 'F':
/* When the linux has boot the status led
* is unpowered so we set it to yellow
......@@ -103,20 +113,30 @@ int main(int argc, char **argv)
shw_io_write(shw_io_led_state_g,1);
}
func='f';
/* fall through */
case 'p':
case 'f':
/* Warning: this -p and -f is used by the web interface */
printf("%s\n",get_shw_info(func));
break;
case 'g':
print_gw_info();
break;
case 'c':
/* Warning: this -c is used by the web interface */
printf("%s %s\n",__DATE__,__TIME__);
break;
break;
case 'v':
printf("%s %s\n",__GIT_VER__,__GIT_USR__);
break;
case 't':
wrsw_tagged_versions();
break;
case 'a':
/* Warning: this with "awk '{print $4}'" is ued by the web if */
printf("PCB:%s, FPGA:%s; version: %s (%s); compiled at %s %s\n",
get_shw_info('p'),get_shw_info('f'),__GIT_VER__,__GIT_USR__,__DATE__,__TIME__);
get_shw_info('p'), get_shw_info('f'),
__GIT_VER__, __GIT_USR__, __DATE__, __TIME__);
break;
case 'h':
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment