v895.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 
00003   Name:         v895.h
00004   Created by:   Konstantin Olchanski
00005 
00006   Contents:     V895 16ch. VME discriminator include
00007 
00008   $Id: v895.h 3785 2007-07-31 21:25:10Z olchanski $
00009 
00010 *********************************************************************/
00011 
00012 #ifndef  __V895_INCLUDE_H__
00013 #define  __V895_INCLUDE_H__
00014 
00015 #include <stdio.h>
00016 #include <string.h>
00017 #include <stdio.h>
00018 
00019 #include "mvmestd.h"
00020 
00021 class v895
00022 {
00023  public:
00024   MVME_INTERFACE* fVme;
00025   uint32_t fVmeA24;
00026 
00027   v895(MVME_INTERFACE* vme,  uint32_t vmeA24) // ctor
00028     {
00029       fVme = vme;
00030       fVmeA24 = vmeA24;
00031     }
00032 
00033   uint8_t readReg8(int ireg)
00034   {
00035     mvme_set_dmode(fVme, MVME_DMODE_D8);
00036     return mvme_read_value(fVme, fVmeA24 + ireg);
00037   }
00038 
00039   void writeReg8(int ireg, uint8_t value)
00040   {
00041     mvme_set_dmode(fVme, MVME_DMODE_D8);
00042     mvme_write_value(fVme, fVmeA24 + ireg, value);
00043   }
00044 
00045   uint16_t readReg16(int ireg)
00046   {
00047     mvme_set_dmode(fVme, MVME_DMODE_D16);
00048     return mvme_read_value(fVme, fVmeA24 + ireg);
00049   }
00050   
00051   void writeReg16(int ireg, uint16_t value)
00052   {
00053     mvme_set_dmode(fVme, MVME_DMODE_D16);
00054     mvme_write_value(fVme, fVmeA24 + ireg, value);
00055   }
00056   
00057   int Status()
00058   {
00059     printf("V895 at VME A24 0x%x: fixed code (0xFAF5): 0x%x, module type: 0x%x, version: 0x%x\n",
00060            fVmeA24,
00061            readReg16(0xfa),
00062            readReg16(0xfc),
00063            readReg16(0xfe));
00064     return 0;
00065   }
00066   
00067   void TestPulse()
00068   {
00069     writeReg16(0x4C,1); // fire test pulse
00070   }
00071 };
00072 
00073 #endif
00074 // end file

Midas DOC Version 2.0.2 ---- 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