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 4457 2009-03-05 00:26:34Z 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 uint8_t v895_readReg8(MVME_INTERFACE *mvme,int base,int ireg)
00022 {
00023   mvme_set_am(mvme,MVME_AM_A24);
00024   mvme_set_dmode(mvme,MVME_DMODE_D8);
00025   return mvme_read_value(mvme,base + ireg);
00026 }
00027 
00028 void v895_writeReg8(MVME_INTERFACE *mvme,int base,int ireg,uint8_t value)
00029 {
00030   mvme_set_am(mvme,MVME_AM_A24);
00031   mvme_set_dmode(mvme,MVME_DMODE_D8);
00032   mvme_write_value(mvme,base + ireg,value);
00033 }
00034 
00035 uint16_t v895_readReg16(MVME_INTERFACE *mvme,int base,int ireg)
00036 {
00037   mvme_set_am(mvme,MVME_AM_A24);
00038   mvme_set_dmode(mvme,MVME_DMODE_D16);
00039   return mvme_read_value(mvme,base + ireg);
00040 }
00041 
00042 void v895_writeReg16(MVME_INTERFACE *mvme,int base,int ireg,uint16_t value)
00043 {
00044   mvme_set_am(mvme,MVME_AM_A24);
00045   mvme_set_dmode(mvme,MVME_DMODE_D16);
00046   mvme_write_value(mvme,base + ireg,value);
00047 }
00048 
00049 int v895_Status(MVME_INTERFACE *mvme,int base)
00050 {
00051   printf("V895 at VME A24 0x%x: fixed code (0xFAF5): 0x%x, module type: 0x%x, version: 0x%x\n",
00052          base,
00053          v895_readReg16(mvme,base,0xfa),
00054          v895_readReg16(mvme,base,0xfc),
00055          v895_readReg16(mvme,base,0xfe));
00056   return 0;
00057 }
00058 
00059 void v895_TestPulse(MVME_INTERFACE *mvme,int base)
00060 {
00061   v895_writeReg16(mvme,base,0x4C,1); // fire test pulse
00062 }
00063 
00064 #endif
00065 // end file

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