Low-Energy Muon (LEM) Experiment  0.5.2
sis3820.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include "dev/pci/sis1100_var.h"
#include "sis3100_vme_calls.h"
#include "sis3820.h"
Include dependency graph for sis3820.c:

Go to the source code of this file.

Functions

int sis3820_key_reset (int device, u_int32_t sis3820_base)
 
int sis3820_key_enable (int device, u_int32_t sis3820_base)
 
int sis3820_key_disable (int device, u_int32_t sis3820_base)
 
int sis3820_operation_mode_read (int device, u_int32_t sis3820_base, u_int32_t *mode)
 
int sis3820_operation_mode_write (int device, u_int32_t sis3820_base, u_int32_t mode)
 
int sis3820_modid_read (int device, u_int32_t sis3820_base, u_int32_t *modid)
 
int sis3820_control_read (int device, u_int32_t sis3820_base, u_int32_t *control_status)
 
int sis3820_control_write (int device, u_int32_t sis3820_base, u_int32_t control_status)
 
int sis3820_copy_disable_channel (int device, u_int32_t sis3820_base, u_int32_t channel_disable)
 
int sis3820_scaler_read (int device, u_int32_t sis3820_base, int mode, int nwords, u_int32_t *data)
 

Function Documentation

int sis3820_control_read ( int  device,
u_int32_t  sis3820_base,
u_int32_t *  control_status 
)

Definition at line 191 of file sis3820.c.

References SIS3820_CONTROL_STATUS.

Referenced by init_sis3820(), and scaler_mode().

int sis3820_control_write ( int  device,
u_int32_t  sis3820_base,
u_int32_t  control_status 
)

Defines the operation mode by writing to Control status register SIS3820_CONTROL_STATUS = 0x0.

Return:

  • 0 if everything went smooth
  • error flag from ioctl
Parameters
deviceis the is the handle to the VME-PCI device
sis3820_baseis the SIS3820 VME address
control_statuscan be

CTRL_USER_LED_OFF 0x10000
CTRL_USER_LED_ON 0x1
CTRL_COUNTER_TEST_25MHZ_DISABLE 0x100000
CTRL_COUNTER_TEST_25MHZ_ENABLE 0x10
CTRL_COUNTER_TEST_MODE_DISABLE 0x200000
CTRL_COUNTER_TEST_MODE_ENABLE 0x20
CTRL_REFERENCE_CH1_DISABLE 0x400000
CTRL_REFERENCE_CH1_ENABLE 0x40


Definition at line 229 of file sis3820.c.

References SIS3820_CONTROL_STATUS.

Referenced by scaler_mode().

int sis3820_copy_disable_channel ( int  device,
u_int32_t  sis3820_base,
u_int32_t  channel_disable 
)

Disables channels in the SIS3820 multi-scaler in MCS mode.

Return:

  • 0 if everything went smooth
  • error flag from ioctl
    Parameters
    deviceis the is the handle to the VME-PCI device
    sis3820_baseis the SIS3820 VME address
    channel_disablespecifies the channels to be disabled, for example, channel_disable=0xFFFFFFF0 disables channels 5-32.

Definition at line 253 of file sis3820.c.

References SIS3820_COPY_DISABLE.

int sis3820_key_disable ( int  device,
u_int32_t  sis3820_base 
)

Disables the SIS3820 for counting.

Return:

  • 0 if everything went smooth
  • error flag from ioctl
    Parameters
    deviceis the is the handle to the VME-PCI device
    sis3820_baseis the SIS3820 VME address

Definition at line 84 of file sis3820.c.

References SIS3820_KEY_OPERATION_DISABLE.

Referenced by begin_of_run(), and resume_run().

int sis3820_key_enable ( int  device,
u_int32_t  sis3820_base 
)

Enables the SIS3820 for counting. Without Key enable the scaler channels will not count.

Return:

  • 0 if everything went smooth
  • error flag from ioctl
    Parameters
    deviceis the is the handle to the VME-PCI device
    sis3820_baseis the SIS3820 VME address

Definition at line 62 of file sis3820.c.

References SIS3820_KEY_OPERATION_ENABLE.

Referenced by begin_of_run(), init_sis3820(), and resume_run().

int sis3820_key_reset ( int  device,
u_int32_t  sis3820_base 
)

Resets the SIS3820 to its power up default settings.

Return:

  • 0 if everything went smooth
  • error flag from ioctl
    Parameters
    deviceis the is the handle to the VME-PCI device
    sis3820_baseis the SIS3820 VME address

Definition at line 39 of file sis3820.c.

References SIS3820_KEY_RESET.

Referenced by begin_of_run(), frontend_exit(), init_sis3820(), and resume_run().

int sis3820_modid_read ( int  device,
u_int32_t  sis3820_base,
u_int32_t *  modid 
)

Definition at line 178 of file sis3820.c.

References SIS3820_MODID.

Referenced by init_sis3820().

int sis3820_operation_mode_read ( int  device,
u_int32_t  sis3820_base,
u_int32_t *  mode 
)

Definition at line 97 of file sis3820.c.

References SIS3820_OPERATION_MODE.

Referenced by init_sis3820(), and scaler_mode().

int sis3820_operation_mode_write ( int  device,
u_int32_t  sis3820_base,
u_int32_t  mode 
)

Defines the operation mode by writing to register SIS3820_OPERATION_MODE = 0x100.

The user front panel input can be accessed by choosing SIS3820_SCALER_DATA_FORMAT_24BIT and, for example, SIS3820_CONTROL_MODE3. The channel number and input bit information is in the upper 8 bits, scaler data are truncated to 24 bit.

Return:

  • 0 if everything went smooth
  • error flag from ioctl
Parameters
deviceis the is the handle to the VME-PCI device
sis3820_baseis the SIS3820 VME address
modecan be

SIS3820_CLEARING_MODE 0x0
SIS3820_NON_CLEARING_MODE 0x1
SIS3820_MCS_DATA_FORMAT_32BIT 0x0
SIS3820_MCS_DATA_FORMAT_24BIT 0x4
SIS3820_MCS_DATA_FORMAT_16BIT 0x8
SIS3820_MCS_DATA_FORMAT_8BIT 0xC
SIS3820_SCALER_DATA_FORMAT_32BIT 0x0
SIS3820_SCALER_DATA_FORMAT_24BIT 0x4
SIS3820_LNE_SOURCE_VME 0x0
SIS3820_LNE_SOURCE_CONTROL_SIGNAL 0x10
SIS3820_LNE_SOURCE_INTERNAL_10MHZ 0x20
SIS3820_LNE_SOURCE_CHANNEL_N 0x30
SIS3820_LNE_SOURCE_PRESET 0x40
SIS3820_ARM_ENABLE_CONTROL_SIGNAL 0x000
SIS3820_ARM_ENABLE_CHANNEL_N 0x100
SIS3820_FIFO_MODE 0x0000
SIS3820_SDRAM_MODE 0x1000
SIS3820_SDRAM_ADD_MODE 0x2000
SIS3820_HISCAL_START_SOURCE_VME 0x0000
SIS3820_HISCAL_START_SOURCE_EXTERN 0x4000
SIS3820_CONTROL_INPUT_MODE0 0x00000
SIS3820_CONTROL_INPUT_MODE1 0x10000
SIS3820_CONTROL_INPUT_MODE2 0x20000
SIS3820_CONTROL_INPUT_MODE3 0x30000
SIS3820_CONTROL_INPUT_MODE4 0x40000
SIS3820_CONTROL_INPUT_MODE5 0x50000
SIS3820_CONTROL_INPUTS_INVERT 0x80000
SIS3820_CONTROL_OUTPUT_MODE0 0x000000
SIS3820_CONTROL_OUTPUT_MODE1 0x100000
SIS3820_CONTROL_OUTPUTS_INVERT 0x800000
SIS3820_OP_MODE_SCALER 0x00000000
SIS3820_OP_MODE_MULTI_CHANNEL_SCALER 0x20000000
SIS3820_OP_MODE_VME_FIFO_WRITE 0x70000000

Definition at line 165 of file sis3820.c.

References SIS3820_OPERATION_MODE.

Referenced by scaler_mode().

int sis3820_scaler_read ( int  device,
u_int32_t  sis3820_base,
int  mode,
int  nwords,
u_int32_t *  data 
)

Readout of SIS3820 in different modes. Scaler counts are automatically cleared after each read operation if non-clearing mode in SIS3820_OPERATION_MODE is set to 0 (default value).

Return:

  • 0 if everything went smooth
  • error flag from ioctl or -1 if number of requested words is different to number of words read
    Parameters
    deviceis the is the handle to the VME-PCI device
    sis3820_baseis the SIS3820 VME address
    modedefines read out mode: possible values are A32BLT32 and for MCS operation: A32MBLT64 or A32_2eVME; a A32BLT32
    nwordsnumber of words to be read
    dataarray where scaler data are written

Definition at line 281 of file sis3820.c.

References A32_2eVME, A32BLT32, A32MBLT64, SIS3820_COUNTER_CH1, and SIS3820_SDRAM_BASE.

Referenced by read_scaler_event().