#include "fadcLib.h" /* library of FADC250 routines */ unsigned int MAXFADCWORDS = 0; /* FADC Library Variables */ extern int nfadc; /* Number of FADC250s verified with the library */ extern int fadcID[FA_MAX_BOARDS]; /* Array of slot numbers, discovered by the library */ extern unsigned int fadcAddrList[FA_MAX_BOARDS]; /* Array of a24 addresses for FADCs */ unsigned int fadcSlotMask = 0; /* bit=slot (starting from 0) */ //extern int blockLevel; int fa250_download(){ int slot, ii; int Naddr = 0; memset(fadcAddrList, 0, sizeof(fadcAddrList)); for(slot = 3; slot < 21; slot++){ if(fa250[slot].group == 1){ fadcAddrList[Naddr] = (slot<<19); Naddr++; } } printf("\n"); printf(" NUMBER OF FADC250 boards found in config file = %d \n",Naddr); printf("\n"); NFADC = 0; /* Initially set block level, will be reseted when blockLevel is updated */ // MAXFADCWORDS = 15 * blockLevel * (1 + 2 + 100*16 + 1) + 2*32; MAXFADCWORDS = 15 * blockLevel * (1 + 2 + 100*16 + 1) + 2*32; /* Setup the iFlag.. flags for FADC initialization */ int iFlag; iFlag = 0; /* Sync Source */ iFlag |= (1<<0); /* VXS */ /* Trigger Source */ iFlag |= (1<<2); /* VXS */ /* Clock Source */ iFlag |= (0<<5); /* self*/ iFlag |= (1<<17); /* activate using fadcAddrList in faInit */ vmeSetQuietFlag(1); /* skip the errors associated with BUS Errors */ faInit(fadcAddrList[0], 0, Naddr, iFlag); if(nfadc != Naddr){ printf(BOLDRED " FATAL: faInit failed. Nfadc config = %d, Nfadc found = %d \n" RESET, Naddr, nfadc ); daLogMsg("FATAL", " Fail to initialize fadc250. Nfadc config = %d, Nfadc found = %d \n", Naddr, nfadc ); ROL_SET_ERROR; } vmeSetQuietFlag(0); /* Turn the error statements back on */ NFADC = nfadc; /* Redefine our NFADC with what was found from the driver */ printf("\n"); printf(BOLDBLUE " Number of boards found by faInit = %d \n" RESET, NFADC); printf("\n"); if(NFADC > 1) faEnableMultiBlock(1); for(slot = 0; slot < NFADC; slot++){ FA_SLOT = fadcID[slot]; fadcSlotMask |= (1<