/************************************************************************* * * tdc1190_list.c - Library of routines for the user to write for * readout and buffering of events from CAEN 1190/1290 * using a Linux VME controller. * */ /* Event Buffer definitions */ #define MAX_EVENT_POOL 400 #define MAX_EVENT_LENGTH 1024*10 /* Size in Bytes */ /* Define Interrupt source and address */ #define TIR_SOURCE #define TIR_ADDR 0x0ed0 #define TIR_MODE TIR_EXT_INT #include "linuxvme_list.c" #include "c1190Lib.h" /* CAEN 1190/1290 specific definitions */ #define NUM_V1190 2 void rocDownload() { /* Put one-time (boot) module initialization here */ printf("rocDownload: User Download Executed\n"); } void rocPrestart() { unsigned short iflag; int itdc, stat; /* Setup Address and data modes for DMA transfers * * vmeDmaConfig(addrType, dataType, sstMode); * * addrType = 0 (A16) 1 (A24) 2 (A32) * dataType = 0 (D16) 1 (D32) 2 (BLK32) 3 (MBLK) 4 (2eVME) 5 (2eSST) * sstMode = 0 (SST160) 1 (SST267) 2 (SST320) */ vmeDmaConfig(2,5,2); printf("Done configuring dma\n"); /* Program/Init VME Modules Here */ /* INIT C1190/C1290 - Must be A32 for 2eSST */ UINT32 list[NUM_V1190] = {0x08270000,0x8280000}; tdc1190InitList(list,NUM_V1190,1); /* Another way to do the same thing */ /* tdc1190Init(list[0],0x10000,NUM_V1190,1); */ for(itdc=0; itdc0) { break; } } if(datascan>0) { /* Get the TDC data from all modules... rflag=2 for Linked List DMA "64" is ignored in Linux */ nwords = tdc1190ReadBlock(0,dma_dabufp,64,2); if(nwords < 0) { printf("ERROR: in transfer (event = %d), status = 0x%x\n", tirGetIntCount(),nwords); *dma_dabufp++ = LSWAP(0xda000bad); } else { dma_dabufp += nwords; } } else { printf("ERROR: Data not ready in event %d\n",tirGetIntCount()); *dma_dabufp++ = LSWAP(0xda000bad); } *dma_dabufp++ = LSWAP(0xd00dd00d); /* Event EOB */ tirIntOutput(0); }