00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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
00058
00059 #ifdef PPCxxx
00060 #define A32D24 0xfa000000
00061 #else
00062 #define A32D24 0xf0000000
00063 #endif
00064
00065 #define CSR_READ 0x0
00066 #define CSR_FULL 0xffffffff
00067 #define CSR_WRITE 0x0
00068 #define GET_MODE 0x0000000C
00069
00070 #define IS_REF1 0x00002000
00071
00072 #define IS_LED 0x00000001
00073 #define IS_IRQ_EN_BS0 0x00100000
00074 #define IS_IRQ_EN_BS1 0x00200000
00075 #define IS_IRQ_EN_BS2 0x00400000
00076 #define IS_IRQ_BS0 0x10000000
00077 #define IS_IRQ_BS1 0x20000000
00078 #define IS_IRQ_BS2 0x40000000
00079 #define IS_GBL_ENABLE 0x00008000
00080 #define IS_GBL_OVFL 0x00004000
00081 #define ENABLE_TEST_PULSE 0x00000030
00082 #define DISABLE_TEST_PULSE 0x00003000
00083 #define ENABLE_IRQ_EN_BS0 0x00100000
00084 #define ENABLE_IRQ_EN_BS1 0x00200000
00085 #define ENABLE_IRQ_EN_BS2 0x00400000
00086 #define DISABLE_IRQ_DI_BS0 0x10000000
00087 #define DISABLE_IRQ_DI_BS1 0x20000000
00088 #define DISABLE_IRQ_DI_BS2 0x40000000
00089 #define VME_IRQ_ENABLE 0x00000800
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