#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) */ int fa250_download(){ int slot, ii; int Naddr = 0; 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 = 16 * 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 useing fadcAddrList in faInit */ vmeSetQuietFlag(1); /* skip the errors associated with BUS Errors */ faInit(fadcAddrList[0],0,Naddr,iFlag); 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"); for(slot = 0; slot < NFADC; slot++){ FA_SLOT = fadcID[slot]; fadcSlotMask |= (1<