Subversion Repositories f9daq

Compare Revisions

No changes between revisions

Ignore whitespace Rev 185 → Rev 186

/cvi/instr/CAENV814/CAENV814.c
0,0 → 1,84
#include <ansi_c.h>
//#include <stdlib.h>
//#include <stdio.h>
#include "CAENV814.h"
#include "CAENV814_DEF.h"
#include "wienvme_dll.h"
 
static unsigned int ModuleAddress[10];
 
static unsigned short m_OutputMaskEcl;
static unsigned short m_OutputMaskLevel;
static unsigned short m_InputMaskLevel;
int V814_map (int ModuleNumber,
unsigned long ModuleOffset, int print)
{
unsigned short vsr, mmt, fix;
ModuleAddress[ModuleNumber] = ModuleOffset;
VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV814_FIX, &fix);
VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV814_MMT, &mmt);
VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV814_VSR, &vsr);
if (print) {
printf("CAEN V814 fixed code = 0x%04x\n", fix);
printf("CAEN V814 manufacturer number = %i\n", MANUFACTURER(mmt));
printf("CAEN V814 module type = %i\n", MODULE_TYPE(mmt));
printf("CAEN V814 version = %i\n", VERSION(vsr));
printf("CAEN V814 serial no. = %i\n", SERIAL(vsr));
}
if ((fix != CAEN_FIX_CODE) || (mmt != CAENV814_MMT_VALUE)) return -1;
return 0;
}
 
int V814_init (int ModuleNumber, unsigned int threshold, unsigned int width, unsigned int mask)
{
int ch;
V814_SetWidth( ModuleNumber, width);
for ( ch=0;ch<16;ch++) V814_SetThreshold(ModuleNumber, ch, threshold);
V814_SetEnable( ModuleNumber, mask);
V814_SetMajority( ModuleNumber, 0);
//printf("V814_init : value of threshold =%d\n", threshold);
//printf("V814_init : value of output width=%d\n", width);
//printf("V814_init : channels enabled mask=%04x\n", mask);
return 0;
}
 
 
 
int V814_SetThreshold(int ModuleNumber, unsigned long channel, unsigned short threshold)
{
VME_A24D16_W(ModuleAddress[ModuleNumber] + channel* 0x2,&threshold);
return 0;
}
 
int V814_SetEnable(int ModuleNumber, unsigned short mask)
{
VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV814_INH,&mask);
return 0;
}
 
 
int V814_SetWidth(int ModuleNumber, unsigned short wdt)
{
VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV814_WDT0,&wdt);
VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV814_WDT1,&wdt);
return 0;
}
 
int V814_SetMajority(int ModuleNumber, unsigned short majlev)
{
unsigned short maj=(int)((majlev*50.-25.)/4.);
VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV814_MAJ,&maj);
return 0;
}
 
int V814_TestPulse(int ModuleNumber)
{
unsigned short maj=0;
VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV814_TST,&maj);
return 0;
}
 
 
/cvi/instr/CAENV814/CAENV814.fp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/instr/CAENV814/CAENV814.h
0,0 → 1,20
#ifndef _CAENV814_H
#define _CAENV814_H
 
int V814_map (int moduleNumber,
unsigned long moduleOffset, int print);
 
int V814_init (int ModuleNumber, unsigned int threshold, unsigned int width, unsigned int mask);
 
int V814_SetThreshold(int ModuleNumber, unsigned long channel, unsigned short threshold);
 
int V814_SetEnable(int ModuleNumber, unsigned short mask);
 
int V814_SetWidth(int ModuleNumber, unsigned short mask);
 
int V814_SetMajority(int ModuleNumber, unsigned short majlev);
 
int V814_TestPulse(int ModuleNumber);
 
 
#endif
/cvi/instr/CAENV814/CAENV814_DEF.h
0,0 → 1,21
#define CAENV814_WDT0 0x40
#define CAENV814_WDT1 0x42
#define CAENV814_MAJ 0x48
#define CAENV814_INH 0x4A
#define CAENV814_TST 0x4C
 
 
#define CAENV814_FIX 0xFA
#define CAENV814_MMT 0xFC
#define CAENV814_VSR 0xFE
 
#define CAEN_FIX_CODE 0xFAF5
#define CAENV814_MMT_VALUE 0x092D
 
#define VERSION(x) (((x)>>12) & 0xf)
#define SERIAL(x) ((x) & 0xfff)
#define MANUFACTURER(x) (((x)>>10) & 0x3f)
#define MODULE_TYPE(x) ((x) & 0x3ff)
 
 
 
/cvi/instr/CAENV814/CAEN_V814.pdf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property