/* * File: * f1GFirmwareUpdate.c * * Description: * JLab f1TDC firmware updating program for all found modules in crate. * * */ #include #include #include #include "jvme.h" #include "f1tdcLib.h" char *progName; void Usage(); extern int nf1tdc; int main(int argc, char *argv[]) { int iflag=0, stat=0; int inputchar=10; unsigned int f1_address=(3<<19); char *rbf_filename; printf("\nJLAB f1TDC Firmware Update\n"); printf("----------------------------\n"); progName = argv[0]; if(argc<2) { printf(" ERROR: Must specify one argument\n"); Usage(); exit(-1); } else { rbf_filename = argv[1]; } stat = f1FirmwareReadFile(rbf_filename); if(stat != OK) exit(-1); vmeSetQuietFlag(1); stat = vmeOpenDefaultWindows(); if(stat != OK) goto CLOSE; iflag |= F1_SRSRC_SOFT; iflag |= F1_TRIGSRC_SOFT; iflag |= F1_CLKSRC_INT; iflag |= F1_IFLAG_NOINIT; iflag |= F1_IFLAG_NOFWCHECK; f1Init(f1_address,(1<<19),18,iflag); if(nf1tdc < 1) { printf(" ERROR: No f1TDCs found\n"); goto CLOSE; } int if1=0; unsigned int cfw=0; extern int nf1tdc; for(if1=0; if1 to continue... or q and to quit without update.\n"); inputchar = getchar(); if((inputchar == 113) || (inputchar == 81)) { printf(" Quitting without update.\n"); goto CLOSE; } stat = f1FirmwareGEraseEPROM(); if(stat != OK) goto CLOSE; stat = f1FirmwareGDownloadConfigData(); if(stat != OK) goto CLOSE; stat = f1FirmwareGVerifyDownload(); if(stat != OK) goto CLOSE; CLOSE: vmeCloseDefaultWindows(); return OK; } void Usage() { printf("\n"); printf("%s \n",progName); printf("\n"); }