#include #include #include #include #include #include #include #include #include #include "abi_functions.h" #include "rcu2_functions.h" //========================================================================================== // Used by main to communicate with ARGP parse_opt struct args { int verbose, reset; }; //========================================================================================== void print_usage() { printf("Usage: fecerr_dump [OPTIONS]\n"); printf("Purpose: Dump content of FECERR registers on RCU2\n"); printf("Options: \n"); printf("-r: Reset FECERR registers.\n"); } //========================================================================================== //========================================================================================== //========================================================================================== int main(int argc, char ** argv) { struct args args; // Default values args.verbose = 1; args.reset = 0; int branch; while ( 1 ) { int result = getopt(argc, argv, "v:"); if (result == -1) break; /* end of list */ switch (result) { case '?': /* unknown parameter */ fprintf(stderr, "ERROR: Unknown parameter\n"); exit(EXIT_FAILURE); case ':': /* missing argument of a parameter */ fprintf(stderr, "ERROR: Missing argument\n"); exit(EXIT_FAILURE); case 'h': print_usage(); exit(EXIT_SUCCESS); case 'r': args.reset = 1; break; case 'v': args.verbose = atoi(optarg); // break; } } if (optind < argc) { //if (args.verbose) printf("Using file <%s>\n", argv[optind]); //sprintf(filename, argv[optind++]); } ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// unsigned int address; unsigned int data, value; unsigned int result; if (args.verbose > 1) printf("Initializing bus ...\n"); rbm_init( args.verbose ); // Init bus (command mode) if ( args.reset && (args.verbose>1) ) printf("Resetting and reading FECERR registers ...\n"); for (branch=0; branch<4; branch++) { //rbm_write(get_Address_ABI_SEL(branch), 0x1, args.verbose); if (args.reset) rbm_write(get_Address_ABI_FECERR(branch), 0x0, args.verbose); Dump_FECERR(branch, args.verbose); //rbm_write(get_Address_ABI_SEL(branch), 0, args.verbose); } // Set RBM back to direct mode (for feeserver and buspoke) rbm_direct( args.verbose ); return 0; }