sis3803.h

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------------
00002  * Copyright (c) 1996      TRIUMF Data Acquistion Group
00003  * Please leave this header in any reproduction of that distribution
00004  * 
00005  * TRIUMF Data Acquisition Group, 4004 Wesbrook Mall, Vancouver, B.C. V6T 2A3
00006  * Email: online@triumf.ca           Tel: (604) 222-1047  Fax: (604) 222-1074
00007  *        amaudruz@triumf.ca
00008  * ----------------------------------------------------------------------------
00009  *  
00010  * Description  : Header file for SIS3803 Standard 200MHz 16 channels scaler
00011  *
00012  * Author:  Pierre-Andre Amaudruz Data Acquisition Group
00013   $Id: sis3803.h 3767 2007-07-23 21:45:52Z olchanski $
00014 
00015  *---------------------------------------------------------------------------*/
00016 #ifndef SIS3803_INCLUDE
00017 #define SIS3803_INCLUDE
00018 
00019 #include "stdio.h"
00020 #include "string.h"
00021 
00022 #ifdef OS_VXWORKS
00023 #include "vme.h"
00024 #include "vxWorks.h"
00025 #include "intLib.h"
00026 #include "sys/fcntlcom.h"
00027 #ifdef PPCxxx
00028 #include "arch/ppc/ivPpc.h"
00029 #else
00030 #include "arch/mc68k/ivMc68k.h"
00031 #endif
00032 #include "taskLib.h"
00033 #endif
00034 
00035 #if defined( _MSC_VER )
00036 #define INLINE __inline
00037 #elif defined(__GNUC__)
00038 #define INLINE __inline__
00039 #else
00040 #define INLINE
00041 #endif
00042 
00043 #define EXTERNAL extern
00044 
00045 #ifndef MIDAS_TYPE_DEFINED
00046 #define MIDAS_TYPE_DEFINED
00047 
00048 typedef unsigned short int WORD;
00049 typedef long int INT;
00050 
00051 #ifdef __alpha
00052 typedef unsigned int DWORD;
00053 #else
00054 typedef unsigned long int DWORD;
00055 #endif
00056 
00057 #endif                          /* MIDAS_TYPE_DEFINED */
00058 
00059 #ifdef PPCxxx
00060 #define A32D24         0xfa000000       /* A32D24 camac base address */
00061 #else
00062 #define A32D24         0xf0000000       /* A32D24 camac base address */
00063 #endif
00064 
00065 #define CSR_READ         0x0
00066 #define CSR_FULL         0xffffffff     /* CSR Read */
00067 #define CSR_WRITE        0x0
00068 #define GET_MODE         0x0000000C     /* CSR read */
00069 
00070 #define IS_REF1                0x00002000       /* CSR read */
00071 
00072 #define IS_LED                 0x00000001       /* CSR read */
00073 #define IS_IRQ_EN_BS0          0x00100000       /* CSR read */
00074 #define IS_IRQ_EN_BS1          0x00200000       /* CSR read */
00075 #define IS_IRQ_EN_BS2          0x00400000       /* CSR read */
00076 #define IS_IRQ_BS0             0x10000000       /* CSR read */
00077 #define IS_IRQ_BS1             0x20000000       /* CSR read */
00078 #define IS_IRQ_BS2             0x40000000       /* CSR read */
00079 #define IS_GBL_ENABLE          0x00008000       /* CSR read */
00080 #define IS_GBL_OVFL            0x00004000       /* CSR read */
00081 #define ENABLE_TEST_PULSE      0x00000030       /* CSR write */
00082 #define DISABLE_TEST_PULSE     0x00003000       /* CSR write */
00083 #define ENABLE_IRQ_EN_BS0      0x00100000       /* CSR write */
00084 #define ENABLE_IRQ_EN_BS1      0x00200000       /* CSR write */
00085 #define ENABLE_IRQ_EN_BS2      0x00400000       /* CSR write */
00086 #define DISABLE_IRQ_DI_BS0     0x10000000       /* CSR write */
00087 #define DISABLE_IRQ_DI_BS1     0x20000000       /* CSR write */
00088 #define DISABLE_IRQ_DI_BS2     0x40000000       /* CSR write */
00089 #define VME_IRQ_ENABLE         0x00000800       /* CSR write */
00090 
00091 #define MODULE_ID             0x004
00092 #define IRQ_REG               0x004
00093 #define SELECT_COUNT_DIS_REG  0x00C
00094 #define ALL_CLEAR             0x020
00095 #define SHADOW_CLK_REG        0x024
00096 #define ENABLE_GBL_COUNT      0x028
00097 #define DISABLE_GBL_COUNT     0x02C
00098 #define COUNTER_GRP1_CLEAR    0x040
00099 #define COUNTER_GRP2_CLEAR    0x044
00100 #define ENABLE_REF_CH1        0x050
00101 #define DISABLE_REF_CH1       0x054
00102 #define MODULE_RESET          0x060
00103 #define SINGLE_TST_PULSE      0x068
00104 #define PRESCALE_REG          0x080
00105 #define COUNTER_CLEAR         0x100
00106 #define OVERFLOW_CLEAR        0x180
00107 #define SHADOW_READ           0x200
00108 #define COUNTER_READ          0x280
00109 #define COUNTER_GRP2_READ     0x2A0
00110 #define COUNTER_READ_CLEAR    0x300
00111 #define OVERFLOW_REG1_8       0x380
00112 #define OVERFLOW_REG9_16      0x3A0
00113 
00114 #define SOURCE_CIP           0
00115 #define SOURCE_FIFO_FULL     1
00116 #define SOURCE_FIFO_HFULL    2
00117 #define SOURCE_FIFO_ALFULL   3
00118 
00119 #define SIS3803_VECT_BASE 0x6f
00120 
00121 INLINE DWORD sis3803_module_ID(const DWORD b);
00122 INLINE void sis3803_module_reset(const DWORD b);
00123 INLINE DWORD sis3803_IRQ_REG_read(const DWORD base_adr);
00124 INLINE DWORD sis3803_IRQ_REG_write(const DWORD base_adr, DWORD irq);
00125 INLINE DWORD sis3803_input_mode(const DWORD base_adr, DWORD mode);
00126 INLINE DWORD sis3803_ref1(const DWORD b, DWORD endis);
00127 INLINE void sis3803_channel_enable(const DWORD b, DWORD pat);
00128 INLINE void sis3803_channel_disable(const DWORD b, DWORD pat);
00129 INLINE DWORD sis3803_CSR_read(const DWORD b, const DWORD what);
00130 INLINE DWORD sis3803_CSR_write(const DWORD b, const DWORD what);
00131 INLINE void sis3803_test_enable(const DWORD b);
00132 INLINE void sis3803_test_disable(const DWORD b);
00133 INLINE void sis3803_all_clear(const DWORD b);
00134 INLINE void sis3803_all_enable(const DWORD b);
00135 INLINE void sis3803_all_disable(const DWORD b);
00136 INLINE void sis3803_grp1_clear(const DWORD b);
00137 INLINE void sis3803_grp2_clear(const DWORD b);
00138 INLINE void sis3803_single_clear(const DWORD b, const INT ch);
00139 INLINE void sis3803_single_OVFL_clear(const DWORD b, const INT ch);
00140 INLINE void sis3803_counter_read(const DWORD b, INT ch, DWORD * p);
00141 INLINE void sis3803_all_read(const DWORD b, DWORD * p);
00142 INLINE void sis3803_grp1_read(const DWORD base_adr, DWORD * pvalue);
00143 INLINE void sis3803_grp2_read(const DWORD base_adr, DWORD * pvalue);
00144 INLINE void sis3803_all_read_clear(const DWORD b, DWORD * p);
00145 INLINE void sis3803_OVFL_grp1_read(const DWORD b, DWORD * p);
00146 INLINE void sis3803_OVFL_grp2_read(const DWORD b, DWORD * p);
00147 INLINE void sis3803_int_source(const DWORD base_adr, DWORD int_source);
00148 INLINE void sis3803_int_source_enable(const DWORD base_adr, const int intnum);
00149 INLINE void sis3803_int_source_disable(const DWORD base_adr, const int intnum);
00150 INLINE void sis3803_int_clear(const DWORD base_adr, const int intnum);
00151 INLINE void sis3803_int_attach(const DWORD base_adr, DWORD base_vect, int level,
00152                                void (*isr) (void));
00153 INLINE void sis3803_int_detach(const DWORD base_adr, DWORD base_vect, int level);
00154 void sis3803_setup(const DWORD base_adr, int mode, int dsp);
00155 void myStub_sis3803(void);
00156 
00157 void SIS3803_setup(const DWORD base_adr, int mode);
00158 void SIS3803_CSR_read(const DWORD base_adr);
00159 
00160 #endif

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