v560.c

Go to the documentation of this file.
00001 /*********************************************************************
00002 
00003   Name:         v560.c
00004   Created by:   K.Olchanski
00005 
00006   Contents:     CAEN V560 16-channel 32-bit scaler
00007 
00008   $Id: v560.c 3747 2007-07-10 08:30:09Z amaudruz $
00009 *********************************************************************/
00010 #include <stdio.h>
00011 #include <stdint.h>
00012 #include <string.h>
00013 #include "v560.h"
00014 #include "mvmestd.h"
00015 
00016 /*****************************************************************/
00017 /*
00018 Read V560 register value
00019 */
00020 static uint16_t regRead(MVME_INTERFACE *mvme, DWORD base, int offset)
00021 {
00022   mvme_set_am(mvme, MVME_AM_A24);
00023   mvme_set_dmode(mvme, MVME_DMODE_D16);
00024   return mvme_read_value(mvme, base + offset);
00025 }
00026 
00027 /*****************************************************************/
00028 /*
00029 Write V560 register value
00030 */
00031 static void regWrite(MVME_INTERFACE *mvme, DWORD base, int offset, uint16_t value)
00032 {
00033   mvme_set_am(mvme, MVME_AM_A24);
00034   mvme_set_dmode(mvme, MVME_DMODE_D16);
00035   mvme_write_value(mvme, base + offset, value);
00036 }
00037 
00038 uint16_t v560_RegisterRead(MVME_INTERFACE *mvme, DWORD base, int offset)
00039 {
00040   return regRead(mvme,base,offset);
00041 }
00042 
00043 void     v560_RegisterWrite(MVME_INTERFACE *mvme, DWORD base, int offset, uint16_t value)
00044 {
00045   regWrite(mvme,base,offset,value);
00046 }
00047 
00048 void v560_Read(MVME_INTERFACE *mvme, DWORD base, uint32_t data[16])
00049 {
00050   mvme_set_am(mvme, MVME_AM_A24);
00051   mvme_set_dmode(mvme, MVME_DMODE_D32);
00052   mvme_read(mvme, data, base + 0x10, 16*4);
00053 }
00054 
00055 /*****************************************************************/
00056 void v560_Reset(MVME_INTERFACE *mvme, DWORD base)
00057 {
00058   regRead(mvme,base,0x54); // VME VETO reset
00059   regRead(mvme,base,0x50); // scalers clear, vme interrupt clear and disable
00060 }
00061 
00062 /*****************************************************************/
00063 void  v560_Status(MVME_INTERFACE *mvme, DWORD base)
00064 {
00065   printf("CAEN V560 at A24 0x%x: version 0x%x, type 0x%x, code 0x%x, scaler status: 0x%x\n", (int)base,regRead(mvme,base,0xFE),regRead(mvme,base,0xFC),regRead(mvme,base,0xFA),regRead(mvme,base,0x58));
00066 }
00067 
00068 //end

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