sis3320.c

Go to the documentation of this file.
00001 /*********************************************************************
00002 
00003   Name:         sis3320.c
00004   Created by:   K.Olchanski
00005 
00006   Contents:     SIS3320 32-channel 32-bit multiscaler
00007                 
00008   $Log$
00009   Revision 1.1  2006/05/25 05:53:42  alpha
00010   First commit
00011 
00012 *********************************************************************/
00013 #include <stdio.h>
00014 #include <stdint.h>
00015 #include <string.h>
00016 #include "sis3320drv.h"
00017 #include "sis3320.h"
00018 #include "mvmestd.h"
00019 
00020 /*****************************************************************/
00021 /*
00022 Read sis3320 register value
00023 */
00024 static uint32_t regRead(MVME_INTERFACE *mvme, uint32_t base, int offset)
00025 {
00026   mvme_set_am(mvme, MVME_AM_A32);
00027   mvme_set_dmode(mvme, MVME_DMODE_D32);
00028   return mvme_read_value(mvme, base + offset);
00029 }
00030 
00031 /*****************************************************************/
00032 /*
00033 Write sis3320 register value
00034 */
00035 static void regWrite(MVME_INTERFACE *mvme, uint32_t base, int offset, uint32_t value)
00036 {
00037   mvme_set_am(mvme, MVME_AM_A32);
00038   mvme_set_dmode(mvme, MVME_DMODE_D32);
00039   mvme_write_value(mvme, base + offset, value);
00040 }
00041 
00042 uint32_t sis3320_RegisterRead(MVME_INTERFACE *mvme, uint32_t base, int offset)
00043 {
00044   return regRead(mvme,base,offset);
00045 }
00046 
00047 void     sis3320_RegisterWrite(MVME_INTERFACE *mvme, uint32_t base, int offset, uint32_t value)
00048 {
00049   regWrite(mvme,base,offset,value);
00050 }
00051 
00052 /*****************************************************************/
00053 void sis3320_Reset(MVME_INTERFACE *mvme, uint32_t base)
00054 {
00055   regWrite(mvme,base,SIS3320_KEY_RESET,0);
00056 }
00057 
00058 /*****************************************************************/
00059 void  sis3320_Status(MVME_INTERFACE *mvme, uint32_t base)
00060 {
00061   printf("SIS3320 at A32 0x%x\n", (int)base);
00062   printf("CSR: 0x%x\n", regRead(mvme,base,SIS3320_CONTROL_STATUS));
00063   printf("ModuleID and Firmware: 0x%x\n", regRead(mvme,base,SIS3320_MODID));
00064   //printf("Operation mode: 0x%x\n", regRead(mvme,base,SIS3320_OPERATION_MODE));
00065 }
00066 
00067 //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