#include "dsc2Lib.h" int dsc_download(){ int kk, slot = -1; int Ndsc = 0; int chan; UINT16 selMask, bypMask; UINT16 defTDCChMask = 0xFFFF; dsc2Init(0x100000,0x80000,20,0); Ndsc = dsc2GetNdsc(); for(kk = 0; kk < Ndsc; kk++) { slot = dsc2Slot(kk); // dsc2SetChannelMask(slot, dsc[slot].TDCChMask, 1); dsc2SetChannelMask(slot, defTDCChMask , 1); dsc2SetChannelMask(slot, dsc[slot].TRGChMask, 2); dsc2SetChannelORMask(slot, dsc[slot].TDCORMask, 1); dsc2SetChannelORMask(slot, dsc[slot].TRGORMask, 2); dsc2SetPulseWidth(slot, dsc[slot].TDCWidth, 1); dsc2SetPulseWidth(slot, dsc[slot].TRGWidth, 2); for(chan = 0; chan < MAX_DSC2_CH; chan++) { dsc2SetThreshold(slot,chan,dsc[slot].TDCThreshold[chan],1); dsc2SetThreshold(slot,chan,dsc[slot].TRGThreshold[chan],2); } selMask = 0xFFFF; /* by default, trigger output will use TRG discriminator */ bypMask = 0xFFFF; /* by default, TRG discriminator output goes directly to trigger output */ for(chan = 0; chan < MAX_DSC2_CH; chan++) { dsc2SetTRGOut(slot, chan, dsc[slot].TRGDigitalWidth[chan], dsc[slot].TRGDigitalDelay[chan]); /* if TRGDigitalWidth>0, set trigger output to the digital */ if(dsc[slot].TRGDigitalWidth[chan]>0) { /*printf("[%2d][%2d] befor 0x%04x\n",slot,chan,bypMask);*/ bypMask = bypMask ^ (1<