caenv792.c File Reference

Go to the source code of this file.

Functions

int v792_EventRead (DWORD *pbase, DWORD *pdest, int *nentry)
int v792_DataRead (DWORD *pbase, DWORD *pdest, int *nentry)
int v792_ThresholdWrite (WORD *pbase, WORD *threshold, int *nitems)
void v792_EvtCntRead (WORD *pbase, DWORD *evtcnt)
void v792_SingleShotReset (WORD *pbase)
int v792_DataReady (WORD *pbase)
void v792_Status (WORD *pbase)
int v792_GeoWrite (WORD *pbase, int geo)


Function Documentation

int v792_DataRead ( DWORD pbase,
DWORD pdest,
int *  nentry 
)

Definition at line 41 of file caenv792.c.

00042 {
00043   int k;
00044 
00045   *nentry = 0;
00046   if (v792_DataReady((WORD *)pbase)) {
00047     for (k=0 ; k<32 ; k++) {
00048       pdest[k] = pbase[k];
00049       *nentry += 1;
00050     }
00051   }
00052   return *nentry;
00053 }

int v792_DataReady ( WORD pbase  ) 

Definition at line 85 of file caenv792.c.

Referenced by v792_DataRead(), and v792_EventRead().

00086 {
00087   //printf("data ready: 0x%08x\n",pbase[V792_CSR1_RO]);
00088   return (pbase[V792_CSR1_RO] & 0x1);
00089 }

int v792_EventRead ( DWORD pbase,
DWORD pdest,
int *  nentry 
)

Definition at line 19 of file caenv792.c.

00020 {
00021   DWORD hdata;
00022   
00023   *nentry = 0;
00024   if (v792_DataReady((WORD *)pbase)) {
00025     do {
00026       hdata = *pbase;
00027     } while (!(hdata & 0x02000000)); // skip up to the header
00028     pdest[*nentry] = hdata;
00029     *nentry += 1;
00030     do {
00031       pdest[*nentry] = *pbase;
00032       *nentry += 1;
00033     } while (!(pdest[*nentry-1] & 0x04000000)); // copy until the trailer
00034 
00035     nentry--;
00036   }
00037   return *nentry;
00038 }

void v792_EvtCntRead ( WORD pbase,
DWORD evtcnt 
)

Definition at line 72 of file caenv792.c.

Referenced by v792_Status().

00073 {
00074   *evtcnt = (pbase[V792_EVT_CNT_L_RO]
00075              + (DWORD) (0x10000 * pbase[V792_EVT_CNT_H_RO]));
00076 }

int v792_GeoWrite ( WORD pbase,
int  geo 
)

Definition at line 112 of file caenv792.c.

00113 {
00114   pbase[V792_GEO_ADDR_RW] = (geo & 0x1F);
00115   return (int) (pbase[V792_GEO_ADDR_RW] & 0x1F); 
00116 }

void v792_SingleShotReset ( WORD pbase  ) 

Definition at line 79 of file caenv792.c.

00080 {
00081   pbase[V792_SINGLE_RST_WO] = 1;
00082 }

void v792_Status ( WORD pbase  ) 

Definition at line 92 of file caenv792.c.

00093 {
00094   int status;
00095   
00096   printf("v792 Status for %p\n", pbase);
00097   status = pbase[V792_CSR1_RO];
00098   printf("Amnesia: %s, ", status & 0x10 ? "Y" : "N");
00099   printf("Term ON: %s, ", status & 0x40 ? "Y" : "N");
00100   printf("TermOFF: %s\n", status & 0x80 ? "Y" : "N");
00101   status = pbase[V792_FIRM_REV];
00102   printf("Firmware: 0x%x\n",status);
00103 
00104   if (pbase[V792_FIRM_REV] == 0xFFFF)
00105     {
00106       printf("v792 at %p: Invalid firmware revision: 0x%x\n",pbase,pbase[V792_FIRM_REV]);
00107       abort();
00108     }
00109 }

int v792_ThresholdWrite ( WORD pbase,
WORD threshold,
int *  nitems 
)

Definition at line 56 of file caenv792.c.

00057 {
00058   int k;
00059   
00060   for (k=0; k<V792_MAX_CHANNELS ; k++) {
00061     pbase[V792_THRES_BASE+k] = threshold[k] & 0x1FF;
00062   }
00063   
00064   for (k=0; k<V792_MAX_CHANNELS ; k++) {
00065     threshold[k] = pbase[V792_THRES_BASE+k] & 0x1FF;
00066   }
00067   *nitems = V792_MAX_CHANNELS;
00068   return *nitems;
00069 }


Midas DOC Version 3.0.0 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Exaos Lee - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk