int main(int argc,char* argv[]) { char *txt = "/usr/clas12/release/0.2/parms/trigger/clasdev.cnf"; if (argc>1) sprintf(txt,"%s",argv[1]); printf(stderr,txt);//"\nReading %s ....\n\n",txt); fadc250Config(txt); tdc1190Config(txt); tiConfig(txt); dsc2Config(txt); sspConfig(txt); /*gtpConfig(txt); NIOS only*/ exit(0); }
int main(int argc, char *argv[]) { GEF_STATUS status; char *filename; int inputchar=10; int ch, ifa=0; unsigned int cfw=0; FILE *f; fa250Ped ped; printf("\nJLAB fadc pedestal measurement\n"); printf("----------------------------\n"); progName = argv[0]; if(argc != 2) { printf(" ERROR: Must specify one arguments\n"); Usage(); exit(-1); } else filename = argv[1]; status = vmeOpenDefaultWindows(); fadcA32Base=0x09000000; int iFlag = (DIST_ADDR)<<10; /* Sync Source */ iFlag |= (1<<0); /* P2 */ /* Trigger Source */ iFlag |= (1<<2); // VXS Input Trigger /* Clock Source */ iFlag |= (0<<5); // Internal Clock Source iFlag |= (1<<18); // Skip firmware check /* iFlag |= (1<<16); // Skip initialization */ #ifdef SKIPSS faInit((unsigned int)(FADC_ADDR),(1<<19),NFADC+2,iFlag); #else faInit((unsigned int)(FADC_ADDR),(1<<19),NFADC,iFlag); #endif fadc250Config(""); if(nfadc==0) { printf(" Unable to initialize any FADCs.\n"); goto CLOSE; } f = fopen(filename, "wt"); #ifdef NEWFORMAT for(ifa=0; ifa<nfadc; ifa++) { if(f) fprintf(f, "FADC250_SLOT %d\nFADC250_ALLCH_PED", faSlot(ifa)); for(ch=0; ch<16; ch++) { if(faMeasureChannelPedestal(faSlot(ifa), ch, &ped) != OK) { printf(" Unabled to measure pedestal on slot %d, ch %d...\n", faSlot(ifa), ch); fclose(f); goto CLOSE; } if(f) fprintf(f, " %8.3f", ped.avg); } if(f) fprintf(f, "\n"); } #else for(ifa=0; ifa<nfadc; ifa++) { for(ch=0; ch<16; ch++) { if(faMeasureChannelPedestal(faSlot(ifa), ch, &ped) != OK) { printf(" Unabled to measure pedestal on slot %d, ch %d...\n", faSlot(ifa), ch); fclose(f); goto CLOSE; } if(f) fprintf(f, "%3d %3d %8.3f %8.3f\n", faSlot(ifa),ch,ped.avg,ped.rms); } } #endif if(f) fclose(f); else printf(" Unable to open pedestal file %s\n", filename); CLOSE: status = vmeCloseDefaultWindows(); if (status != GEF_SUCCESS) { printf("vmeCloseDefaultWindows failed: code 0x%08x\n",status); return -1; } exit(0); }