sis3803.h File Reference

Go to the source code of this file.

Defines

#define INLINE
#define EXTERNAL   extern
#define A32D24   0xf0000000
#define CSR_READ   0x0
#define CSR_FULL   0xffffffff
#define CSR_WRITE   0x0
#define GET_MODE   0x0000000C
#define IS_REF1   0x00002000
#define IS_LED   0x00000001
#define IS_IRQ_EN_BS0   0x00100000
#define IS_IRQ_EN_BS1   0x00200000
#define IS_IRQ_EN_BS2   0x00400000
#define IS_IRQ_BS0   0x10000000
#define IS_IRQ_BS1   0x20000000
#define IS_IRQ_BS2   0x40000000
#define IS_GBL_ENABLE   0x00008000
#define IS_GBL_OVFL   0x00004000
#define ENABLE_TEST_PULSE   0x00000030
#define DISABLE_TEST_PULSE   0x00003000
#define ENABLE_IRQ_EN_BS0   0x00100000
#define ENABLE_IRQ_EN_BS1   0x00200000
#define ENABLE_IRQ_EN_BS2   0x00400000
#define DISABLE_IRQ_DI_BS0   0x10000000
#define DISABLE_IRQ_DI_BS1   0x20000000
#define DISABLE_IRQ_DI_BS2   0x40000000
#define VME_IRQ_ENABLE   0x00000800
#define MODULE_ID   0x004
#define IRQ_REG   0x004
#define SELECT_COUNT_DIS_REG   0x00C
#define ALL_CLEAR   0x020
#define SHADOW_CLK_REG   0x024
#define ENABLE_GBL_COUNT   0x028
#define DISABLE_GBL_COUNT   0x02C
#define COUNTER_GRP1_CLEAR   0x040
#define COUNTER_GRP2_CLEAR   0x044
#define ENABLE_REF_CH1   0x050
#define DISABLE_REF_CH1   0x054
#define MODULE_RESET   0x060
#define SINGLE_TST_PULSE   0x068
#define PRESCALE_REG   0x080
#define COUNTER_CLEAR   0x100
#define OVERFLOW_CLEAR   0x180
#define SHADOW_READ   0x200
#define COUNTER_READ   0x280
#define COUNTER_GRP2_READ   0x2A0
#define COUNTER_READ_CLEAR   0x300
#define OVERFLOW_REG1_8   0x380
#define OVERFLOW_REG9_16   0x3A0
#define SOURCE_CIP   0
#define SOURCE_FIFO_FULL   1
#define SOURCE_FIFO_HFULL   2
#define SOURCE_FIFO_ALFULL   3
#define SIS3803_VECT_BASE   0x6f

Typedefs

typedef unsigned short int WORD
typedef long int INT
typedef unsigned long int DWORD

Functions

INLINE DWORD sis3803_module_ID (const DWORD b)
INLINE void sis3803_module_reset (const DWORD b)
INLINE DWORD sis3803_IRQ_REG_read (const DWORD base_adr)
INLINE DWORD sis3803_IRQ_REG_write (const DWORD base_adr, DWORD irq)
INLINE DWORD sis3803_input_mode (const DWORD base_adr, DWORD mode)
INLINE DWORD sis3803_ref1 (const DWORD b, DWORD endis)
INLINE void sis3803_channel_enable (const DWORD b, DWORD pat)
INLINE void sis3803_channel_disable (const DWORD b, DWORD pat)
INLINE DWORD sis3803_CSR_read (const DWORD b, const DWORD what)
INLINE DWORD sis3803_CSR_write (const DWORD b, const DWORD what)
INLINE void sis3803_test_enable (const DWORD b)
INLINE void sis3803_test_disable (const DWORD b)
INLINE void sis3803_all_clear (const DWORD b)
INLINE void sis3803_all_enable (const DWORD b)
INLINE void sis3803_all_disable (const DWORD b)
INLINE void sis3803_grp1_clear (const DWORD b)
INLINE void sis3803_grp2_clear (const DWORD b)
INLINE void sis3803_single_clear (const DWORD b, const INT ch)
INLINE void sis3803_single_OVFL_clear (const DWORD b, const INT ch)
INLINE void sis3803_counter_read (const DWORD b, INT ch, DWORD *p)
INLINE void sis3803_all_read (const DWORD b, DWORD *p)
INLINE void sis3803_grp1_read (const DWORD base_adr, DWORD *pvalue)
INLINE void sis3803_grp2_read (const DWORD base_adr, DWORD *pvalue)
INLINE void sis3803_all_read_clear (const DWORD b, DWORD *p)
INLINE void sis3803_OVFL_grp1_read (const DWORD b, DWORD *p)
INLINE void sis3803_OVFL_grp2_read (const DWORD b, DWORD *p)
INLINE void sis3803_int_source (const DWORD base_adr, DWORD int_source)
INLINE void sis3803_int_source_enable (const DWORD base_adr, const int intnum)
INLINE void sis3803_int_source_disable (const DWORD base_adr, const int intnum)
INLINE void sis3803_int_clear (const DWORD base_adr, const int intnum)
INLINE void sis3803_int_attach (const DWORD base_adr, DWORD base_vect, int level, void(*isr)(void))
INLINE void sis3803_int_detach (const DWORD base_adr, DWORD base_vect, int level)
void sis3803_setup (const DWORD base_adr, int mode, int dsp)
void myStub_sis3803 (void)
void SIS3803_setup (const DWORD base_adr, int mode)
void SIS3803_CSR_read (const DWORD base_adr)


Define Documentation

#define A32D24   0xf0000000

Definition at line 62 of file sis3803.h.

#define ALL_CLEAR   0x020

Definition at line 94 of file sis3803.h.

Referenced by sis3803_all_clear().

#define COUNTER_CLEAR   0x100

Definition at line 105 of file sis3803.h.

Referenced by sis3803_single_clear().

#define COUNTER_GRP1_CLEAR   0x040

Definition at line 98 of file sis3803.h.

Referenced by sis3803_grp1_clear().

#define COUNTER_GRP2_CLEAR   0x044

Definition at line 99 of file sis3803.h.

Referenced by sis3803_grp2_clear().

#define COUNTER_GRP2_READ   0x2A0

Definition at line 109 of file sis3803.h.

Referenced by sis3803_grp2_read().

#define COUNTER_READ   0x280

Definition at line 108 of file sis3803.h.

Referenced by sis3803_all_read(), sis3803_counter_read(), and sis3803_grp1_read().

#define COUNTER_READ_CLEAR   0x300

Definition at line 110 of file sis3803.h.

Referenced by sis3803_all_read_clear().

#define CSR_FULL   0xffffffff

Definition at line 66 of file sis3803.h.

#define CSR_READ   0x0

Definition at line 65 of file sis3803.h.

#define CSR_WRITE   0x0

Definition at line 67 of file sis3803.h.

#define DISABLE_GBL_COUNT   0x02C

Definition at line 97 of file sis3803.h.

Referenced by sis3803_all_disable().

#define DISABLE_IRQ_DI_BS0   0x10000000

Definition at line 86 of file sis3803.h.

Referenced by sis3803_int_clear(), sis3803_int_source(), and sis3803_int_source_disable().

#define DISABLE_IRQ_DI_BS1   0x20000000

Definition at line 87 of file sis3803.h.

Referenced by sis3803_int_clear(), sis3803_int_source(), and sis3803_int_source_disable().

#define DISABLE_IRQ_DI_BS2   0x40000000

Definition at line 88 of file sis3803.h.

Referenced by sis3803_int_clear(), sis3803_int_source(), and sis3803_int_source_disable().

#define DISABLE_REF_CH1   0x054

Definition at line 101 of file sis3803.h.

Referenced by sis3803_ref1().

#define DISABLE_TEST_PULSE   0x00003000

Definition at line 82 of file sis3803.h.

Referenced by sis3803_test_disable().

#define ENABLE_GBL_COUNT   0x028

Definition at line 96 of file sis3803.h.

Referenced by sis3803_all_enable().

#define ENABLE_IRQ_EN_BS0   0x00100000

Definition at line 83 of file sis3803.h.

Referenced by sis3803_int_clear(), sis3803_int_source(), and sis3803_int_source_enable().

#define ENABLE_IRQ_EN_BS1   0x00200000

Definition at line 84 of file sis3803.h.

Referenced by sis3803_int_clear(), sis3803_int_source(), and sis3803_int_source_enable().

#define ENABLE_IRQ_EN_BS2   0x00400000

Definition at line 85 of file sis3803.h.

Referenced by sis3803_int_clear(), sis3803_int_source(), and sis3803_int_source_enable().

#define ENABLE_REF_CH1   0x050

Definition at line 100 of file sis3803.h.

Referenced by sis3803_ref1().

#define ENABLE_TEST_PULSE   0x00000030

Definition at line 81 of file sis3803.h.

Referenced by sis3803_test_enable().

#define EXTERNAL   extern

Definition at line 43 of file sis3803.h.

#define GET_MODE   0x0000000C

Definition at line 68 of file sis3803.h.

#define INLINE

Definition at line 40 of file sis3803.h.

#define IRQ_REG   0x004

Definition at line 92 of file sis3803.h.

Referenced by sis3803_int_attach(), sis3803_IRQ_REG_read(), and sis3803_IRQ_REG_write().

#define IS_GBL_ENABLE   0x00008000

Definition at line 79 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_GBL_OVFL   0x00004000

Definition at line 80 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_IRQ_BS0   0x10000000

Definition at line 76 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_IRQ_BS1   0x20000000

Definition at line 77 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_IRQ_BS2   0x40000000

Definition at line 78 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_IRQ_EN_BS0   0x00100000

Definition at line 73 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_IRQ_EN_BS1   0x00200000

Definition at line 74 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_IRQ_EN_BS2   0x00400000

Definition at line 75 of file sis3803.h.

Referenced by SIS3803_CSR_read().

#define IS_LED   0x00000001

Definition at line 72 of file sis3803.h.

#define IS_REF1   0x00002000

Definition at line 70 of file sis3803.h.

#define MODULE_ID   0x004

Definition at line 91 of file sis3803.h.

Referenced by sis3803_module_ID().

#define MODULE_RESET   0x060

Definition at line 102 of file sis3803.h.

Referenced by sis3803_module_reset().

#define OVERFLOW_CLEAR   0x180

Definition at line 106 of file sis3803.h.

Referenced by sis3803_single_OVFL_clear().

#define OVERFLOW_REG1_8   0x380

Definition at line 111 of file sis3803.h.

Referenced by sis3803_OVFL_grp1_read().

#define OVERFLOW_REG9_16   0x3A0

Definition at line 112 of file sis3803.h.

Referenced by sis3803_OVFL_grp2_read().

#define PRESCALE_REG   0x080

Definition at line 104 of file sis3803.h.

#define SELECT_COUNT_DIS_REG   0x00C

Definition at line 93 of file sis3803.h.

Referenced by sis3803_channel_disable(), and sis3803_channel_enable().

#define SHADOW_CLK_REG   0x024

Definition at line 95 of file sis3803.h.

#define SHADOW_READ   0x200

Definition at line 107 of file sis3803.h.

#define SINGLE_TST_PULSE   0x068

Definition at line 103 of file sis3803.h.

#define SIS3803_VECT_BASE   0x6f

Definition at line 119 of file sis3803.h.

#define SOURCE_CIP   0

Definition at line 114 of file sis3803.h.

#define SOURCE_FIFO_ALFULL   3

Definition at line 117 of file sis3803.h.

#define SOURCE_FIFO_FULL   1

Definition at line 115 of file sis3803.h.

#define SOURCE_FIFO_HFULL   2

Definition at line 116 of file sis3803.h.

#define VME_IRQ_ENABLE   0x00000800

Definition at line 89 of file sis3803.h.


Typedef Documentation

typedef unsigned long int DWORD

Definition at line 54 of file sis3803.h.

typedef long int INT

Definition at line 49 of file sis3803.h.

typedef unsigned short int WORD

Definition at line 48 of file sis3803.h.


Function Documentation

void myStub_sis3803 ( void   ) 

Definition at line 21 of file sis3803.c.

Referenced by sis3803_int_detach().

00022 {
00023    static int sis3803_private_counter = 0;
00024 #ifdef OS_VXWORKS
00025    sis3803_int_source_disable(0, 0);
00026    logMsg("sis3803 IRQ#%i served\n", sis3803_private_counter++, 0, 0, 0, 0, 0);
00027    sis3803_int_source_enable(0, 0);
00028 #endif
00029 }

INLINE void sis3803_all_clear ( const DWORD  b  ) 

Definition at line 242 of file sis3803.c.

00244         : Clear all module + overflow bits
00245  Input:
00246   DWORD base_addr     : base address of the SIS3803
00247  Output:
00248     none
00249  Function value:
00250  none
00251 \**************************************************************/
00252 {
00253    volatile DWORD *spec_adr;
00254 
00255    spec_adr = (DWORD *) (A32D24 + base_adr + ALL_CLEAR);
00256    *spec_adr = 0x0;
00257 }

INLINE void sis3803_all_disable ( const DWORD  b  ) 

Definition at line 314 of file sis3803.c.

00316         : Disable global counting
00317  Input:
00318   DWORD base_addr     : base address of the SIS3803
00319  Output:
00320     none
00321  Function value:
00322  none
00323 \**************************************************************/
00324 {
00325    volatile DWORD *spec_adr;
00326 
00327    spec_adr = (DWORD *) (A32D24 + base_adr + DISABLE_GBL_COUNT);
00328    *spec_adr = 0x0;
00329 }

INLINE void sis3803_all_enable ( const DWORD  b  ) 

Definition at line 296 of file sis3803.c.

Referenced by sis3803_setup().

00298         : Enable global counting
00299  Input:
00300   DWORD base_addr     : base address of the SIS3803
00301  Output:
00302     none
00303  Function value:
00304  none
00305 \**************************************************************/
00306 {
00307    volatile DWORD *spec_adr;
00308 
00309    spec_adr = (DWORD *) (A32D24 + base_adr + ENABLE_GBL_COUNT);
00310    *spec_adr = 0x0;
00311 }

INLINE void sis3803_all_read ( const DWORD  b,
DWORD p 
)

Definition at line 430 of file sis3803.c.

Referenced by SIS3803_all_bread().

00432         : Reads all 16 channels scaler
00433  Input:
00434   DWORD base_addr     : base address of the SIS3803
00435   DWORD *pvalue       : destination pointer
00436  Output:
00437     none
00438  Function value:
00439     none
00440 \**************************************************************/
00441 {
00442    INT i;
00443    volatile DWORD *spec_adr;
00444 
00445    spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_READ);
00446    for (i = 0; i < 16; i++) {
00447       *pvalue++ = *spec_adr++;
00448    }
00449 }

INLINE void sis3803_all_read_clear ( const DWORD  b,
DWORD p 
)

Definition at line 496 of file sis3803.c.

Referenced by SIS3803_all_bcread().

00498         : Reads & clear all 16 channels scaler
00499  Input:
00500   DWORD base_addr     : base address of the SIS3803
00501   DWORD *pvalue       : destination pointer
00502  Output:
00503     none
00504  Function value:
00505     none
00506 \**************************************************************/
00507 {
00508    INT i;
00509    volatile DWORD *spec_adr;
00510 
00511    spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_READ_CLEAR);
00512    for (i = 0; i < 16; i++) {
00513       *pvalue++ = *spec_adr++;
00514    }
00515 }

INLINE void sis3803_channel_disable ( const DWORD  b,
DWORD  pat 
)

Definition at line 179 of file sis3803.c.

00181         : Disable pat channel for acquistion.
00182           blind command! 0x0..0xffff
00183  Input: 
00184   DWORD base_addr     : base address of the SIS3803
00185   DWORD pat           : channel pattern
00186  Output:
00187     none
00188  Function value:
00189     none
00190 \**************************************************************/
00191 {
00192    volatile DWORD *spec_adr;
00193 
00194    spec_adr = (DWORD *) (A32D24 + base_adr + SELECT_COUNT_DIS_REG);
00195    *spec_adr = pat & 0xffff;
00196 }

INLINE void sis3803_channel_enable ( const DWORD  b,
DWORD  pat 
)

Definition at line 158 of file sis3803.c.

Referenced by sis3803_setup().

00160         : Enable pat channel for acquistion.
00161           blind command! 0x0..0xffff
00162  Input: 
00163   DWORD base_addr     : base address of the SIS3803
00164   DWORD pat           : channel pattern
00165  Output:
00166     none
00167  Function value:
00168     none
00169 \**************************************************************/
00170 {
00171    volatile DWORD *spec_adr;
00172 
00173    spec_adr = (DWORD *) (A32D24 + base_adr + SELECT_COUNT_DIS_REG);
00174    *spec_adr = (~pat & 0xffff);
00175 }

INLINE void sis3803_counter_read ( const DWORD  b,
INT  ch,
DWORD p 
)

Definition at line 408 of file sis3803.c.

Referenced by SIS3803_all_read(), and SIS3803_all_read_clear().

00410         : Reads one individual scaler
00411  Input:
00412   DWORD base_addr     : base address of the SIS3803
00413   INT   ch            : Channel to be read
00414   DWORD *pvalue       : destination pointer
00415  Output:
00416     none
00417  Function value:
00418     none
00419 \**************************************************************/
00420 {
00421    volatile DWORD *spec_adr;
00422 
00423    if (ch < 16) {
00424       spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_READ + (ch << 2));
00425       *pvalue = *spec_adr;
00426    }
00427 }

void SIS3803_CSR_read ( const DWORD  base_adr  ) 

Definition at line 848 of file sis3803.c.

Referenced by sis3803_setup().

00849 {
00850    DWORD csr;
00851 
00852    csr = sis3803_CSR_read(base_adr, CSR_FULL);
00853 
00854    printf("Module Version   : %d\t", ((sis3803_module_ID(base_adr) & 0xf000) >> 12));
00855    printf("Module ID        : %4.4x\n", (sis3803_module_ID(base_adr) >> 16));
00856    printf("LED              : %s \t", (csr & IS_LED) ? "Y" : "N");
00857    printf("Input mode       : %d \n", sis3803_input_mode(base_adr, 1));
00858    printf("Reference pulse 1: %s \t", (csr & IS_REF1) ? "Y" : "N");
00859    printf("Global Enable    : %s \t", (csr & IS_GBL_ENABLE) ? "Y" : "N");
00860    printf("Global OVFL bit  : %s \n", (csr & IS_GBL_OVFL) ? "Y" : "N");
00861    printf("IRQ enable BS0   : %s \t", (csr & IS_IRQ_EN_BS0) ? "Y" : "N");
00862    printf("IRQ enable BS1   : %s \t", (csr & IS_IRQ_EN_BS1) ? "Y" : "N");
00863    printf("IRQ enable BS2   : %s \n", (csr & IS_IRQ_EN_BS2) ? "Y" : "N");
00864    printf("IRQ Bit Source 0 : %s \t", (csr & IS_IRQ_BS0) ? "Y" : "N");
00865    printf("IRQ Bit Source 1 : %s \t", (csr & IS_IRQ_BS1) ? "Y" : "N");
00866    printf("IRQ Bit Source 2 : %s \n", (csr & IS_IRQ_BS2) ? "Y" : "N");
00867    printf("internal VME IRQ : %s \t", (csr & 0x4000000) ? "Y" : "N");
00868    printf("VME IRQ          : %s \n", (csr & 0x8000000) ? "Y" : "N");
00869 }

INLINE DWORD sis3803_CSR_read ( const DWORD  b,
const DWORD  what 
)

Definition at line 199 of file sis3803.c.

Referenced by SIS3803_CSR_read(), and sis3803_CSR_write().

00201         : Read the CSR and return 1/0 based on what.
00202           except for what == CSR_FULL where it returns current CSR
00203  Input: 
00204   DWORD base_addr     : base address of the SIS3803
00205   DWORD what          : bitwise field (see sis3803.h)
00206  Output:
00207     none
00208  Function value:
00209  DWORD             : CSR 32bit current content
00210 \**************************************************************/
00211 {
00212    volatile DWORD *spec_adr;
00213 
00214    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_READ);
00215    if (what == CSR_FULL)
00216       return *spec_adr;
00217    else
00218       return ((*spec_adr & what) ? 1 : 0);
00219 }

INLINE DWORD sis3803_CSR_write ( const DWORD  b,
const DWORD  what 
)

Definition at line 222 of file sis3803.c.

00224         : Write to the CSR and return CSR_FULL.
00225  Input: 
00226   DWORD base_addr     : base address of the SIS3803
00227   DWORD what          : bitwise field 
00228  Output:
00229     none
00230  Function value:
00231  DWORD             : CSR 32bit current content
00232 \**************************************************************/
00233 {
00234    volatile DWORD *spec_adr;
00235 
00236    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00237    *spec_adr = what;
00238    return sis3803_CSR_read(base_adr, CSR_FULL);
00239 }

INLINE void sis3803_grp1_clear ( const DWORD  b  ) 

Definition at line 332 of file sis3803.c.

00334         : Clear group 1 (1-8) channels + overflow bits
00335  Input:
00336   DWORD base_addr     : base address of the SIS3803
00337  Output:
00338     none
00339  Function value:
00340  none
00341 \**************************************************************/
00342 {
00343    volatile DWORD *spec_adr;
00344 
00345    spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_GRP1_CLEAR);
00346    *spec_adr = 0x0;
00347 }

INLINE void sis3803_grp1_read ( const DWORD  base_adr,
DWORD pvalue 
)

Definition at line 452 of file sis3803.c.

00454         : Reads group 1 (1..8) channels scaler
00455  Input:
00456   DWORD base_addr     : base address of the SIS3803
00457   DWORD *pvalue       : destination pointer
00458  Output:
00459     none
00460  Function value:
00461     none
00462 \**************************************************************/
00463 {
00464    INT i;
00465    volatile DWORD *spec_adr;
00466 
00467    spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_READ);
00468    for (i = 0; i < 8; i++) {
00469       *pvalue++ = *spec_adr++;
00470    }
00471 }

INLINE void sis3803_grp2_clear ( const DWORD  b  ) 

Definition at line 350 of file sis3803.c.

00352         : Clear group 2 (9-16) channels + overflow bits
00353  Input:
00354   DWORD base_addr     : base address of the SIS3803
00355  Output:
00356     none
00357  Function value:
00358  none
00359 \**************************************************************/
00360 {
00361    volatile DWORD *spec_adr;
00362 
00363    spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_GRP2_CLEAR);
00364    *spec_adr = 0x0;
00365 }

INLINE void sis3803_grp2_read ( const DWORD  base_adr,
DWORD pvalue 
)

Definition at line 474 of file sis3803.c.

00476         : Reads group 1 (1..8) channels scaler
00477  Input:
00478   DWORD base_addr     : base address of the SIS3803
00479   DWORD *pvalue       : destination pointer
00480  Output:
00481     none
00482  Function value:
00483     none
00484 \**************************************************************/
00485 {
00486    INT i;
00487    volatile DWORD *spec_adr;
00488 
00489    spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_GRP2_READ);
00490    for (i = 0; i < 8; i++) {
00491       *pvalue++ = *spec_adr++;
00492    }
00493 }

INLINE DWORD sis3803_input_mode ( const DWORD  base_adr,
DWORD  mode 
)

Definition at line 108 of file sis3803.c.

Referenced by SIS3803_CSR_read(), and sis3803_setup().

00110         : Set input configuration mode (only mode 1 available)
00111  Input: 
00112   DWORD base_addr     : base address of the SIS3803
00113   DWORD mode          : Mode 0-3
00114  Output:
00115     none
00116  Function value:
00117     DWORD             : current mode
00118 \**************************************************************/
00119 {
00120    volatile DWORD *spec_adr;
00121 
00122    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00123    if (mode < 4)
00124       mode <<= 2;
00125    *spec_adr = mode;
00126    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_READ);
00127    return ((*spec_adr & GET_MODE) >> 2);
00128 }

INLINE void sis3803_int_attach ( const DWORD  base_adr,
DWORD  base_vect,
int  level,
void(*)(void)  isr 
)

Definition at line 649 of file sis3803.c.

00652         : Book an ISR for a bitwise set of interrupt input (0xff).
00653           The interrupt vector is then the VECTOR_BASE+intnum
00654  Input:
00655   DWORD * base_addr      : base address of the sis3803
00656   DWORD base_vect        : base vector of the module
00657   int   level            : IRQ level (1..7)
00658   DWORD isr_routine      : interrupt routine pointer
00659  Output:
00660     none
00661  Function value:
00662     none
00663 \**************************************************************/
00664 {
00665    volatile DWORD *spec_adr;
00666 
00667    /* disable all IRQ sources */
00668 /*  Should be done but not in attach 
00669   sis3803_int_source(base_adr
00670                              , DISABLE_IRQ_DI_BS0
00671                              | DISABLE_IRQ_DI_BS1
00672                              | DISABLE_IRQ_DI_BS2);
00673 */
00674 
00675 #ifdef OS_VXWORKS
00676    if ((level < 8) && (level > 0) && (base_vect < 0x100)) {
00677       spec_adr = (DWORD *) (A32D24 + base_adr + IRQ_REG);
00678       *spec_adr = (level << 8) | VME_IRQ_ENABLE | base_vect;
00679       sysIntEnable(level);      /* interrupt level */
00680    }
00681    intConnect(INUM_TO_IVEC(base_vect), (VOIDFUNCPTR) isr, 0);
00682 #else
00683    printf("Not implemented for this OS\n");
00684 #endif
00685 }

INLINE void sis3803_int_clear ( const DWORD  base_adr,
const int  intnum 
)

Definition at line 723 of file sis3803.c.

00725         : Disable the interrupt for the bitwise input intnum (0xff).
00726           The interrupt vector is then the VECTOR_BASE+intnum
00727  Input:
00728   DWORD * base_addr       : base address of the sis3803
00729   int   * intnum          : interrupt number (input 0..3)
00730  Output:
00731     none
00732  Function value:
00733     none
00734 \**************************************************************/
00735 {
00736    volatile DWORD *spec_adr;
00737    DWORD int_source;
00738 
00739    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00740    switch (intnum) {
00741    case 0:
00742       int_source = DISABLE_IRQ_DI_BS0;
00743       *spec_adr = int_source;
00744       int_source = ENABLE_IRQ_EN_BS0;
00745       *spec_adr = int_source;
00746       break;
00747    case 1:
00748       int_source = DISABLE_IRQ_DI_BS1;
00749       *spec_adr = int_source;
00750       int_source = ENABLE_IRQ_EN_BS1;
00751       *spec_adr = int_source;
00752       break;
00753    case 2:
00754       int_source = DISABLE_IRQ_DI_BS2;
00755       *spec_adr = int_source;
00756       int_source = ENABLE_IRQ_EN_BS2;
00757       *spec_adr = int_source;
00758       break;
00759    default:
00760       logMsg("Unknown interrupt source (%d)\n", int_source, 0, 0, 0, 0, 0);
00761    }
00762 }

INLINE void sis3803_int_detach ( const DWORD  base_adr,
DWORD  base_vect,
int  level 
)

Definition at line 688 of file sis3803.c.

00690         : Unbook an ISR for a bitwise set of interrupt input (0xff).
00691           The interrupt vector is then the VECTOR_BASE+intnum
00692  Input:
00693   DWORD * base_addr       : base address of the sis3803
00694   DWORD base_vect        : base vector of the module
00695   int   level            : IRQ level (1..7)
00696  Output:
00697     none
00698  Function value:
00699     none
00700 \**************************************************************/
00701 {
00702 
00703    /* disable all IRQ sources */
00704 /*  Should be done but not in detach 
00705   sis3803_int_source(base_adr   , DISABLE_IRQ_DI_BS0
00706                     | DISABLE_IRQ_DI_BS1
00707                     | DISABLE_IRQ_DI_BS2);
00708 */
00709 
00710 #ifdef OS_VXWORKS
00711 /* Suppose to save the default isr before attach but would
00712  * required isr table in case of multiple IRQ
00713  * for now restore with myStub()
00714  */
00715    intConnect(INUM_TO_IVEC(base_vect), (VOIDFUNCPTR) myStub_sis3803, 0);
00716    sysIntDisable(level);        /* interrupt level */
00717 #else
00718    printf("vector : 0x%x\n", base_vect + intnum);
00719 #endif
00720 }

INLINE void sis3803_int_source ( const DWORD  base_adr,
DWORD  int_source 
)

Definition at line 625 of file sis3803.c.

00627         : Enable the one of the 4 interrupt using the
00628           predefined parameters (see sis3803.h)
00629  Input:
00630   DWORD * base_addr       : base address of the sis3803
00631   DWORD * intnum          : interrupt number (input 0..3)
00632  Output:
00633     none
00634  Function value:
00635     none
00636 \**************************************************************/
00637 {
00638    volatile DWORD *spec_adr;
00639 
00640    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00641 
00642    int_source &= (ENABLE_IRQ_EN_BS0 | ENABLE_IRQ_EN_BS1
00643                   | ENABLE_IRQ_EN_BS2
00644                   | DISABLE_IRQ_DI_BS0 | DISABLE_IRQ_DI_BS1 | DISABLE_IRQ_DI_BS2);
00645    *spec_adr = int_source;
00646 }

INLINE void sis3803_int_source_disable ( const DWORD  base_adr,
const int  intnum 
)

Definition at line 590 of file sis3803.c.

Referenced by myStub_sis3803().

00592         : Disable the interrupt for the bitwise input intnum (0xff).
00593           The interrupt vector is then the VECTOR_BASE+intnum
00594  Input:
00595   DWORD * base_addr       : base address of the sis3803
00596   int     level           : IRQ level (1..7)
00597   int   * intnum          : interrupt number (input 0..3)
00598  Output:
00599     none
00600  Function value:
00601     none
00602 \**************************************************************/
00603 {
00604    volatile DWORD *spec_adr;
00605    DWORD int_source;
00606 
00607    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00608    switch (intnum) {
00609    case 0:
00610       int_source = DISABLE_IRQ_DI_BS0;
00611       break;
00612    case 1:
00613       int_source = DISABLE_IRQ_DI_BS1;
00614       break;
00615    case 2:
00616       int_source = DISABLE_IRQ_DI_BS2;
00617       break;
00618    default:
00619       logMsg("Unknown interrupt source (%d)\n", int_source, 0, 0, 0, 0, 0);
00620    }
00621    *spec_adr = int_source;
00622 }

INLINE void sis3803_int_source_enable ( const DWORD  base_adr,
const int  intnum 
)

Definition at line 556 of file sis3803.c.

Referenced by myStub_sis3803().

00558         : Enable the interrupt for the bitwise input intnum (0xff).
00559           The interrupt vector is then the VECTOR_BASE
00560  Input:
00561   DWORD * base_addr       : base address of the sis3803
00562   DWORD * intnum          : interrupt number (input 0:7)
00563  Output:
00564     none
00565  Function value:
00566     none
00567 \**************************************************************/
00568 {
00569    volatile DWORD *spec_adr;
00570    DWORD int_source;
00571 
00572    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00573    switch (intnum) {
00574    case 0:
00575       int_source = ENABLE_IRQ_EN_BS0;
00576       break;
00577    case 1:
00578       int_source = ENABLE_IRQ_EN_BS1;
00579       break;
00580    case 2:
00581       int_source = ENABLE_IRQ_EN_BS2;
00582       break;
00583    default:
00584       logMsg("Unknown interrupt source (%d)\n", int_source, 0, 0, 0, 0, 0);
00585    }
00586    *spec_adr = int_source;
00587 }

INLINE DWORD sis3803_IRQ_REG_read ( const DWORD  base_adr  ) 

Definition at line 69 of file sis3803.c.

00071         : return the lower 12 bits corresponding to
00072           VME IRQ enable, levels, vector(lower 8bits)
00073  Input: 
00074   DWORD base_addr     : base address of the SIS3803
00075  Output:
00076     none
00077  Function value:
00078  DWORD                : 0xE(1)L(3)V(8)
00079 \**************************************************************/
00080 {
00081    volatile DWORD *spec_adr;
00082 
00083    spec_adr = (DWORD *) (A32D24 + base_adr + IRQ_REG);
00084    return (*spec_adr & 0xFFF);
00085 }

INLINE DWORD sis3803_IRQ_REG_write ( const DWORD  base_adr,
DWORD  irq 
)

Definition at line 88 of file sis3803.c.

00090         : write irq (ELV) to the register and read back 
00091  Input: 
00092   DWORD base_addr     : base address of the SIS3803
00093   DWORD irq           : reg 
00094  Output:
00095     none
00096  Function value:
00097  DWORD                : 0xE(1)L(3)V(8)
00098 \**************************************************************/
00099 {
00100    volatile DWORD *spec_adr;
00101 
00102    spec_adr = (DWORD *) (A32D24 + base_adr + IRQ_REG);
00103    *spec_adr = irq;
00104    return (*spec_adr & 0xFFF);
00105 }

INLINE DWORD sis3803_module_ID ( const DWORD  b  ) 

Definition at line 32 of file sis3803.c.

Referenced by SIS3803_CSR_read().

00034         : return the Module ID number (I) version (V)
00035           IRQ level (L) IRQ vector# (BB)
00036  Input: 
00037   DWORD base_addr     : base address of the SIS3803
00038  Output:
00039     none
00040  Function value:
00041  DWORD                : 0xIIIIVLBB
00042 \**************************************************************/
00043 {
00044    volatile DWORD *spec_adr;
00045 
00046    spec_adr = (DWORD *) (A32D24 + base_adr + MODULE_ID);
00047    return *spec_adr;
00048 }

INLINE void sis3803_module_reset ( const DWORD  b  ) 

Definition at line 51 of file sis3803.c.

Referenced by sis3803_setup().

00053         : General Module reset
00054  Input: 
00055   DWORD base_addr     : base address of the SIS3803
00056  Output:
00057     none
00058  Function value:
00059  none
00060 \**************************************************************/
00061 {
00062    volatile DWORD *spec_adr;
00063 
00064    spec_adr = (DWORD *) (A32D24 + base_adr + MODULE_RESET);
00065    *spec_adr = 0x0;
00066 }

INLINE void sis3803_OVFL_grp1_read ( const DWORD  b,
DWORD p 
)

Definition at line 518 of file sis3803.c.

00520         : Read Overflow reg for group 1 (1-8) 
00521  Input:
00522   DWORD base_addr     : base address of the SIS3803
00523  Output:
00524     reg               : pointer to overflow reg 
00525  Function value:
00526  none
00527 \**************************************************************/
00528 {
00529    volatile DWORD *spec_adr;
00530 
00531    spec_adr = (DWORD *) (A32D24 + base_adr + OVERFLOW_REG1_8);
00532    *reg = *spec_adr;
00533    *reg >>= 24;
00534 }

INLINE void sis3803_OVFL_grp2_read ( const DWORD  b,
DWORD p 
)

Definition at line 537 of file sis3803.c.

00539         : Read Overflow reg for group 2 (9-16) 
00540  Input:
00541   DWORD base_addr     : base address of the SIS3803
00542  Output:
00543     reg               : pointer to overflow reg 
00544  Function value:
00545  none
00546 \**************************************************************/
00547 {
00548    volatile DWORD *spec_adr;
00549 
00550    spec_adr = (DWORD *) (A32D24 + base_adr + OVERFLOW_REG9_16);
00551    *reg = *spec_adr;
00552    *reg >>= 24;
00553 }

INLINE DWORD sis3803_ref1 ( const DWORD  b,
DWORD  endis 
)

Definition at line 131 of file sis3803.c.

00133         : Enable/Disable Reference on Channel 1
00134  Input: 
00135   DWORD base_addr     : base address of the SIS3803
00136   DWORD endis         : action either ENABLE_REF_CH1
00137                                       DISABLE_REF_CH1
00138  Output:
00139     none
00140  Function value:
00141                : status of the ref1 1=enable, 0=disable
00142 \**************************************************************/
00143 {
00144    volatile DWORD *spec_adr;
00145 
00146    if ((endis == ENABLE_REF_CH1) || (endis == DISABLE_REF_CH1)) {
00147       spec_adr = (DWORD *) (A32D24 + base_adr + endis);
00148       *spec_adr = 0x0;
00149    } else
00150       printf("sis3803_ref1: unknown command %d\n", endis);
00151 
00152    /* read back the status */
00153    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_READ);
00154    return ((*spec_adr & IS_REF1) ? 1 : 0);
00155 }

void SIS3803_setup ( const DWORD  base_adr,
int  mode 
)

Definition at line 843 of file sis3803.c.

00844 {
00845    sis3803_setup(base_adr, mode, 1);
00846 }

void sis3803_setup ( const DWORD  base_adr,
int  mode,
int  dsp 
)

Definition at line 765 of file sis3803.c.

Referenced by SIS3803_setup().

00766 {
00767    switch (mode) {
00768    case 1:
00769       /* */
00770       if (dsp) {
00771          printf("Setting          : %d \t", mode);
00772          printf("Info             : PAA/June 2000\n");
00773       }
00774       sis3803_module_reset(base_adr);
00775       sis3803_input_mode(base_adr, 1);  /* mode 1 ONLY */
00776       sis3803_all_enable(base_adr);
00777       sis3803_channel_enable(base_adr, 0xf);    /* 4 channels */
00778       if (dsp)
00779          SIS3803_CSR_read(base_adr);
00780       if (dsp)
00781          printf("# of active ch.  : 4\n");
00782       break;
00783    default:
00784       printf("Undefined mode %d (known mode :1, 2, 3, 4, 5)\n", mode);
00785       break;
00786    }
00787 }

INLINE void sis3803_single_clear ( const DWORD  b,
const INT  ch 
)

Definition at line 368 of file sis3803.c.

Referenced by SIS3803_all_read_clear().

00370         : Clear single scaler channels + overflow bits
00371  Input:
00372   DWORD base_addr     : base address of the SIS3803
00373  Output:
00374     none
00375  Function value:
00376  none
00377 \**************************************************************/
00378 {
00379    volatile DWORD *spec_adr;
00380 
00381    if (ch < 16) {
00382       spec_adr = (DWORD *) (A32D24 + base_adr + COUNTER_CLEAR + (ch << 2));
00383       *spec_adr = 0x0;
00384    }
00385 }

INLINE void sis3803_single_OVFL_clear ( const DWORD  b,
const INT  ch 
)

Definition at line 388 of file sis3803.c.

00390         : Clear single scaler channels + overflow bits
00391  Input:
00392   DWORD base_addr     : base address of the SIS3803
00393  Output:
00394     none
00395  Function value:
00396  none
00397 \**************************************************************/
00398 {
00399    volatile DWORD *spec_adr;
00400 
00401    if (ch < 16) {
00402       spec_adr = (DWORD *) (A32D24 + base_adr + OVERFLOW_CLEAR + (ch << 2));
00403       *spec_adr = 0x0;
00404    }
00405 }

INLINE void sis3803_test_disable ( const DWORD  b  ) 

Definition at line 278 of file sis3803.c.

00280         : Disable test pulse and input test
00281  Input:
00282   DWORD base_addr     : base address of the SIS3803
00283  Output:
00284     none
00285  Function value:
00286  none
00287 \**************************************************************/
00288 {
00289    volatile DWORD *spec_adr;
00290 
00291    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00292    *spec_adr = DISABLE_TEST_PULSE;
00293 }

INLINE void sis3803_test_enable ( const DWORD  b  ) 

Definition at line 260 of file sis3803.c.

00262         : Enable test pulse and input test
00263  Input:
00264   DWORD base_addr     : base address of the SIS3803
00265  Output:
00266     none
00267  Function value:
00268  none
00269 \**************************************************************/
00270 {
00271    volatile DWORD *spec_adr;
00272 
00273    spec_adr = (DWORD *) (A32D24 + base_adr + CSR_WRITE);
00274    *spec_adr = ENABLE_TEST_PULSE;
00275 }


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