AlcapDAQ  1
Macros | Enumerations | Functions
v1290.h File Reference
#include "mvmestd.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define V1290_AM   MVME_AM_A32_ND
 
#define V1290_BUFF_DW   MVME_DMODE_D32
 
#define V1290_REG_DW   MVME_DMODE_D16
 
#define V1190_NUM_TDC_A   4
 
#define V1290_NUM_TDC_B   2
 
#define V1190_NUM_TDC_A   4
 
#define V1290_NUM_TDC_N   2
 
#define V1290_OUT_BUFFER   0x0000
 
#define V1290_CONTROL   0x1000
 
#define V1290_STATUS   0x1002
 
#define V1290_INT_LEVEL   0x100A
 
#define V1290_INT_VECTOR   0x100C
 
#define V1290_GEORESS   0x100E
 
#define V1290_MCST_CBLTRESS   0x1010
 
#define V1290_MCST_CBLT_CTRL   0x1012
 
#define V1290_MOD_RESET   0x1014
 
#define V1290_SW_CLEAR   0x1016
 
#define V1290_SW_EVENT_RESET   0x1018
 
#define V1290_SW_TRIGGER   0x101A
 
#define V1290_EVENT_COUNTER   0x101C
 
#define V1290_EVENT_STORED   0x1020
 
#define V1290_ALMOST_FULL_LVL   0x1022
 
#define V1290_BLT_EVENT_NUM   0x1024
 
#define V1290_FW_REV   0x1026
 
#define V1290_TESTREG   0x1028
 
#define V1290_OUT_PROG_CTRL   0x102C
 
#define V1290_MICRO   0x102E
 
#define V1290_MICRO_HND   0x1030
 
#define V1290_SEL_FLASH   0x1032
 
#define V1290_FLASH   0x1034
 
#define V1290_COMP_SRAM_PAGE   0x1036
 
#define V1290_EVENT_FIFO   0x1038
 
#define V1290_EVENT_FIFO_STORED   0x103C
 
#define V1290_EVENT_FIFO_STATUS   0x103E
 
#define V1290_DUMMY32   0x1200
 
#define V1290_DUMMY16   0x1204
 
#define V1290_ROM_OUI_2   0x4024
 
#define V1290_ROM_OUI_1   0x4028
 
#define V1290_ROM_OUI_0   0x402C
 
#define V1290_ROM_VERSION   0x4030
 
#define V1290_ROM_BOARD_ID_2   0x4034
 
#define V1290_ROM_BOARD_ID_1   0x4038
 
#define V1290_ROM_BOARD_ID_0   0x403C
 
#define V1290_ROM_REVISION_3   0x4040
 
#define V1290_ROM_REVISION_2   0x4044
 
#define V1290_ROM_REVISION_1   0x4048
 
#define V1290_ROM_REVISION_0   0x404C
 
#define V1290_ROM_SERIAL_1   0x4080
 
#define V1290_ROM_SERIAL_0   0x4084
 
#define V1290_MICRO_WR_OK   0x0001
 
#define V1290_MICRO_RD_OK   0x0002
 
#define V1290_TRG_MATCH_OPCODE   0x0000
 
#define V1290_CONT_STORE_OPCODE   0x0100
 
#define V1290_READ_ACQ_MOD_OPCODE   0x0200
 
#define V1290_SET_KEEP_TOKEN_OPCODE   0x0300
 
#define V1290_CLEAR_KEEP_TOKEN_OPCODE   0x0400
 
#define V1290_LOAD_DEF_CONFIG_OPCODE   0x0500
 
#define V1290_SAVE_USER_CONFIG_OPCODE   0x0600
 
#define V1290_LOAD_USER_CONFIG_OPCODE   0x0700
 
#define V1290_AUTOLOAD_USER_CONFIG_OPCODE   0x0800
 
#define V1290_AUTOLOAD_DEF_CONFIG_OPCODE   0x0900
 
#define V1290_SET_WIN_WIDTH_OPCODE   0x1000
 
#define V1290_SET_WIN_OFFSET_OPCODE   0x1100
 
#define V1290_SET_SW_MARGIN_OPCODE   0x1200
 
#define V1290_SET_REJ_MARGIN_OPCODE   0x1300
 
#define V1290_EN_SUB_TRG_OPCODE   0x1400
 
#define V1290_DIS_SUB_TRG_OPCODE   0x1500
 
#define V1290_READ_TRG_CONF_OPCODE   0x1600
 
#define V1290_SET_DETECTION_OPCODE   0x2200
 
#define V1290_READ_DETECTION_OPCODE   0x2300
 
#define V1290_SET_TR_LEAD_LSB_OPCODE   0x2400
 
#define V1290_SET_PAIR_RES_OPCODE   0x2500
 
#define V1290_READ_RES_OPCODE   0x2600
 
#define V1290_SET_DEAD_TIME_OPCODE   0x2800
 
#define V1290_READ_DEAD_TIME_OPCODE   0x2900
 
#define V1290_EN_HEAD_TRAILER_OPCODE   0x3000
 
#define V1290_DIS_HEAD_TRAILER_OPCODE   0x3100
 
#define V1290_READ_HEAD_TRAILER_OPCODE   0x3200
 
#define V1290_SET_EVENT_SIZE_OPCODE   0x3300
 
#define V1290_READ_EVENT_SIZE_OPCODE   0x3400
 
#define V1290_EN_ERROR_MARK_OPCODE   0x3500
 
#define V1290_DIS_ERROR_MARK_OPCODE   0x3600
 
#define V1290_EN_ERROR_BYPASS_OPCODE   0x3700
 
#define V1290_DIS_ERROR_BYPASS_OPCODE   0x3800
 
#define V1290_SET_ERROR_TYPES_OPCODE   0x3900
 
#define V1290_READ_ERROR_TYPES_OPCODE   0x3A00
 
#define V1290_SET_FIFO_SIZE_OPCODE   0x3B00
 
#define V1290_READ_FIFO_SIZE_OPCODE   0x3C00
 
#define V1290_EN_CHANNEL_OPCODE   0x4000
 
#define V1290_DIS_CHANNEL_OPCODE   0x4100
 
#define V1290_EN_ALL_CH_OPCODE   0x4200
 
#define V1290_DIS_ALL_CH_OPCODE   0x4300
 
#define V1290_WRITE_EN_PATTERN_OPCODE   0x4400
 
#define V1290_READ_EN_PATTERN_OPCODE   0x4500
 
#define V1290_WRITE_EN_PATTERN32_OPCODE   0x4600
 
#define V1290_READ_EN_PATTERN32_OPCODE   0x4700
 
#define V1290_SET_GLOB_OFFSET_OPCODE   0x5000
 
#define V1290_READ_GLOB_OFFSET_OPCODE   0x5100
 
#define V1290_SET_ADJUST_CH_OPCODE   0x5200
 
#define V1290_READ_ADJUST_CH_OPCODE   0x5300
 
#define V1290_SET_RC_ADJ_OPCODE   0x5400
 
#define V1290_READ_RC_ADJ_OPCODE   0x5500
 
#define V1290_SAVE_RC_ADJ_OPCODE   0x5600
 
#define V1290_READ_TDC_ID_OPCODE   0x6000
 
#define V1290_READ_MICRO_REV_OPCODE   0x6100
 
#define V1290_RESET_DLL_PLL_OPCODE   0x6200
 
#define V1290_WRITE_SETUP_REG_OPCODE   0x7000
 
#define V1290_READ_SETUP_REG_OPCODE   0x7100
 
#define V1290_UPDATE_SETUP_REG_OPCODE   0x7200
 
#define V1290_DEFAULT_SETUP_REG_OPCODE   0x7300
 
#define V1290_READ_ERROR_STATUS_OPCODE   0x7400
 
#define V1290_READ_DLL_LOCK_OPCODE   0x7500
 
#define V1290_READ_STATUS_STREAM_OPCODE   0x7600
 
#define V1290_UPDATE_SETUP_TDC_OPCODE   0x7700
 
#define V1290_WRITE_EEPROM_OPCODE   0xC000
 
#define V1290_READ_EEPROM_OPCODE   0xC100
 
#define V1290_MICROCONTROLLER_FW_OPCODE   0xC200
 
#define V1290_WRITE_SPARE_OPCODE   0xC300
 
#define V1290_READ_SPARE_OPCODE   0xC400
 
#define V1290_EN_TEST_MODE_OPCODE   0xC500
 
#define V1290_DIS_TEST_MODE_OPCODE   0xC600
 
#define V1290_SET_TDC_TEST_OUTPUT_OPCODE   0xC700
 
#define V1290_SET_DLL_CLOCK_OPCODE   0xC800
 
#define V1290_READ_TDC_SETUP_SCAN_PATH_OPCODE   0xC800
 
#define V1290_DATA_TYPE_MASK   0xf8000000
 
#define V1290_DATA_MASK   0x1fffff
 
#define V1290_CH_MASK   0x03e00000
 
#define V1290_GLOBAL_HEADER   0x40000000
 
#define V1290_GLOBAL_TRAILER   0x80000000
 
#define V1290_TDC_HEADER   0x08000000
 
#define V1290_TDC_MEASURE   0x00000000
 
#define V1290_TDC_ERROR   0x20000000
 
#define V1290_TDC_TRAILER   0x18000000
 
#define V1290_GLOBAL_TRIGGER_TIME   0x88000000
 
#define V1290_FILLER   0xc0000000
 
#define V1290_GLB_HDR_MAX_EVENT_COUNT   (0x003fffff+ 1)
 
#define V1290_GLB_HDR_EVENT_COUNT_MSK   0x07ffffe0
 
#define V1290_GLB_HDR_GEO_MSK   0x0000001f
 
#define V1290_GLB_TRG_TIME_TAG_MSK   0x07ffffff
 
#define V1290_GLB_TRL_STATUS_MSK   0x07000000
 
#define V1290_GLB_TRL_WCOUNT_MSK   0x001fffe0
 
#define V1290_GLB_TRL_GEO_MSK   0x0000001f
 
#define V1290_TDC_HDR_TDC_MSK   0x03000000
 
#define V1290_TDC_HDR_EVENT_ID_MSK   0x00fff000
 
#define V1290_TDC_HDR_BUNCH_ID_MSK   0x00000fff
 
#define V1290_TDC_MSR_TRAILING_MSK   0x04000000
 
#define V1290_TDC_MSR_CHANNEL_MSK   0x03f80000
 
#define V1290_TDC_MSR_MEASURE_MSK   0x0007ffff
 
#define V1290_TDC_TRL_TDC_MSK   0x03000000
 
#define V1290_TDC_TRL_EVENT_ID_MSK   0x00fff000
 
#define V1290_TDC_TRL_WCOUNT_MSK   0x00000fff
 
#define V1290_TDC_ERR_TDC_MSK   0x03000000
 
#define V1290_TDC_ERR_ERR_FLAGS_MSK   0x00003fff
 
#define V1290_IS_GLOBAL_HEADER(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_GLOBAL_HEADER)
 
#define V1290_IS_GLOBAL_TRAILER(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_GLOBAL_TRAILER)
 
#define V1290_IS_TDC_HEADER(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_HEADER)
 
#define V1290_IS_TDC_MEASURE(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_MEASURE)
 
#define V1290_IS_TDC_ERROR(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_ERROR)
 
#define V1290_IS_TDC_TRAILER(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_TRAILER)
 
#define V1290_IS_GLOBAL_TRIGGER_TIME(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_GLOBAL_TRIGGER_TIME)
 
#define V1290_IS_FILLER(data)   ((data& V1290_DATA_TYPE_MASK)== V1290_FILLER)
 
#define V1290_GET_TDC_MSR_CHANNEL(data)   ((uint32_t)((((uint32_t)data)& V1290_TDC_MSR_CHANNEL_MSK)>>21))
 
#define V1290_GET_TDC_MSR_MEASURE(data)   ((uint32_t)(((uint32_t)data)& V1290_TDC_MSR_MEASURE_MSK))
 

Enumerations

enum  V1X90_CH_PER_TDC { V1190_CH_PER_TDC = 32, V1290_CH_PER_TDC = 8 }
 

Functions

uint16_t v1290_Read16 (MVME_INTERFACE *mvme, uint32_t base, int offset)
 
uint32_t v1290_Read32 (MVME_INTERFACE *mvme, uint32_t base, int offset)
 
void v1290_Write16 (MVME_INTERFACE *mvme, uint32_t base, int offset, uint16_t value)
 
int v1290_EventRead (MVME_INTERFACE *mvme, uint32_t base, uint32_t *pdest, int *nentry)
 
int v1290_DataRead (MVME_INTERFACE *mvme, uint32_t base, uint32_t *pdest, int nentry)
 
int v1290_MicroWrite (MVME_INTERFACE *mvme, uint32_t base, uint16_t data)
 
void v1290_WriteMicro (MVME_INTERFACE *mvme, uint32_t base, uint16_t opcode, uint16_t data)
 
int v1290_MicroRead (MVME_INTERFACE *mvme, const uint32_t base)
 
uint16_t v1290_ReadMicro (MVME_INTERFACE *mvme, const uint32_t base, uint16_t opcode)
 
void v1290_TriggerMatchingSet (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_ContinuousSet (MVME_INTERFACE *mvme, uint32_t base)
 
int v1290_AcqModeRead (MVME_INTERFACE *mvme, uint32_t base)
 
int v1290_TriggerConfRead (MVME_INTERFACE *mvme, uint32_t base, uint16_t *conf)
 
void v1290_SetWindowWidth (MVME_INTERFACE *mvme, uint32_t base, uint16_t width)
 
void v1290_SetWindowOffset (MVME_INTERFACE *mvme, uint32_t base, int16_t offset)
 
void v1290_SetExtraMargin (MVME_INTERFACE *mvme, uint32_t base, uint16_t margin)
 
void v1290_SetRejectMargin (MVME_INTERFACE *mvme, uint32_t base, uint16_t margin)
 
void v1290_EnableTriggerSubtraction (MVME_INTERFACE *mvme, uint32_t base, bool en)
 
void v1290_SetEdgeDetection (MVME_INTERFACE *mvme, uint32_t base, uint16_t edge)
 
uint16_t v1290_ReadEdgeDetection (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_SetEdgeResolution (MVME_INTERFACE *mvme, uint32_t base, uint16_t res)
 
uint16_t v1290_ReadEdgeResolution (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_SetDeadtime (MVME_INTERFACE *mvme, uint32_t base, uint16_t deadtime)
 
uint16_t v1290_ReadDeadtime (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_EnableHeader (MVME_INTERFACE *mvme, uint32_t base, bool en)
 
bool v1290_HeaderIsEnabled (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_SetMaxHits (MVME_INTERFACE *mvme, uint32_t base, uint16_t max)
 
uint16_t v1290_ReadMaxHits (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_EnableTDCErrorMark (MVME_INTERFACE *mvme, uint32_t base, bool en)
 
void v1290_EnableBypassTDC (MVME_INTERFACE *mvme, uint32_t base, bool en)
 
void v1290_SetFIFOSize (MVME_INTERFACE *mvme, uint32_t base, uint16_t size)
 
uint16_t v1290_ReadFIFOSize (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_EnableChannel (MVME_INTERFACE *mvme, uint32_t base, uint16_t chn, bool en)
 
void v1290_EnableAllChannels (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_DisableAllChannels (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_WriteEnablePattern (MVME_INTERFACE *mvme, uint32_t base, uint16_t pattern)
 
uint16_t v1290_ReadEnablePattern (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_ReadControlRegister (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_EnableBusError (MVME_INTERFACE *mvme, uint32_t base, bool en)
 
void v1290_EnableEmptyEvent (MVME_INTERFACE *mvme, uint32_t base, bool en)
 
void v1290_EnableEventFIFO (MVME_INTERFACE *mvme, uint32_t base, bool en)
 
void v1290_ReadStatusRegister (MVME_INTERFACE *mvme, uint32_t base)
 
bool v1290_IsDataReady (MVME_INTERFACE *mvme, uint32_t base_addr)
 
bool v1290_IsAlmostFull (MVME_INTERFACE *mvme, uint32_t base_addr)
 
bool v1290_IsFull (MVME_INTERFACE *mvme, uint32_t base_addr)
 
void v1290_ModuleReset (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_SoftClear (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_EventReset (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_SoftTrigger (MVME_INTERFACE *mvme, uint32_t base)
 
uint32_t v1290_ReadEventCounter (MVME_INTERFACE *mvme, uint32_t base)
 
uint16_t v1290_ReadEventStored (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_SetAlmostFullLevel (MVME_INTERFACE *mvme, uint32_t base, uint16_t level)
 
uint16_t v1290_ReadAlmostFullLevel (MVME_INTERFACE *mvme, uint32_t base, uint16_t level)
 
void v1290_FWRev (MVME_INTERFACE *mvme, uint32_t base)
 
void v1290_ReadEventFIFO (MVME_INTERFACE *mvme, uint32_t base, uint16_t *dest)
 
uint16_t v1290_ReadEventFIFOStored (MVME_INTERFACE *mvme, uint32_t base)
 
uint16_t v1290_ReadEventFIFOStatus (MVME_INTERFACE *mvme, uint32_t base)
 

Macro Definition Documentation

#define V1190_NUM_TDC_A   4

Definition at line 25 of file v1290.h.

#define V1190_NUM_TDC_A   4

Definition at line 25 of file v1290.h.

#define V1290_ALMOST_FULL_LVL   0x1022

Definition at line 43 of file v1290.h.

Referenced by v1290_ReadAlmostFullLevel(), and v1290_SetAlmostFullLevel().

#define V1290_AM   MVME_AM_A32_ND
#define V1290_AUTOLOAD_DEF_CONFIG_OPCODE   0x0900

Definition at line 84 of file v1290.h.

#define V1290_AUTOLOAD_USER_CONFIG_OPCODE   0x0800

Definition at line 83 of file v1290.h.

#define V1290_BLT_EVENT_NUM   0x1024

Definition at line 44 of file v1290.h.

#define V1290_BUFF_DW   MVME_DMODE_D32

Definition at line 14 of file v1290.h.

Referenced by v1290_DataRead(), and v1290_Read32().

#define V1290_CH_MASK   0x03e00000

Definition at line 160 of file v1290.h.

#define V1290_CLEAR_KEEP_TOKEN_OPCODE   0x0400

Definition at line 79 of file v1290.h.

#define V1290_COMP_SRAM_PAGE   0x1036

Definition at line 52 of file v1290.h.

#define V1290_CONT_STORE_OPCODE   0x0100

Definition at line 76 of file v1290.h.

Referenced by v1290_ContinuousSet().

#define V1290_CONTROL   0x1000
#define V1290_DATA_MASK   0x1fffff

Definition at line 159 of file v1290.h.

#define V1290_DATA_TYPE_MASK   0xf8000000

Definition at line 158 of file v1290.h.

#define V1290_DEFAULT_SETUP_REG_OPCODE   0x7300

Definition at line 140 of file v1290.h.

#define V1290_DIS_ALL_CH_OPCODE   0x4300

Definition at line 119 of file v1290.h.

Referenced by v1290_DisableAllChannels().

#define V1290_DIS_CHANNEL_OPCODE   0x4100

Definition at line 117 of file v1290.h.

Referenced by v1290_EnableChannel().

#define V1290_DIS_ERROR_BYPASS_OPCODE   0x3800

Definition at line 110 of file v1290.h.

Referenced by v1290_EnableBypassTDC().

#define V1290_DIS_ERROR_MARK_OPCODE   0x3600

Definition at line 108 of file v1290.h.

Referenced by v1290_EnableTDCErrorMark().

#define V1290_DIS_HEAD_TRAILER_OPCODE   0x3100

Definition at line 103 of file v1290.h.

Referenced by v1290_EnableHeader().

#define V1290_DIS_SUB_TRG_OPCODE   0x1500

Definition at line 91 of file v1290.h.

Referenced by v1290_EnableTriggerSubtraction().

#define V1290_DIS_TEST_MODE_OPCODE   0xC600

Definition at line 152 of file v1290.h.

#define V1290_DUMMY16   0x1204

Definition at line 57 of file v1290.h.

#define V1290_DUMMY32   0x1200

Definition at line 56 of file v1290.h.

#define V1290_EN_ALL_CH_OPCODE   0x4200

Definition at line 118 of file v1290.h.

Referenced by v1290_EnableAllChannels().

#define V1290_EN_CHANNEL_OPCODE   0x4000

Definition at line 116 of file v1290.h.

Referenced by v1290_EnableChannel().

#define V1290_EN_ERROR_BYPASS_OPCODE   0x3700

Definition at line 109 of file v1290.h.

Referenced by v1290_EnableBypassTDC().

#define V1290_EN_ERROR_MARK_OPCODE   0x3500

Definition at line 107 of file v1290.h.

Referenced by v1290_EnableTDCErrorMark().

#define V1290_EN_HEAD_TRAILER_OPCODE   0x3000

Definition at line 102 of file v1290.h.

Referenced by v1290_EnableHeader().

#define V1290_EN_SUB_TRG_OPCODE   0x1400

Definition at line 90 of file v1290.h.

Referenced by v1290_EnableTriggerSubtraction().

#define V1290_EN_TEST_MODE_OPCODE   0xC500

Definition at line 151 of file v1290.h.

#define V1290_EVENT_COUNTER   0x101C

Definition at line 41 of file v1290.h.

Referenced by v1290_ReadEventCounter().

#define V1290_EVENT_FIFO   0x1038

Definition at line 53 of file v1290.h.

Referenced by v1290_ReadEventFIFO().

#define V1290_EVENT_FIFO_STATUS   0x103E

Definition at line 55 of file v1290.h.

Referenced by v1290_ReadEventFIFOStatus().

#define V1290_EVENT_FIFO_STORED   0x103C

Definition at line 54 of file v1290.h.

#define V1290_EVENT_STORED   0x1020

Definition at line 42 of file v1290.h.

Referenced by v1290_ReadEventStored().

#define V1290_FILLER   0xc0000000

Definition at line 169 of file v1290.h.

#define V1290_FLASH   0x1034

Definition at line 51 of file v1290.h.

#define V1290_FW_REV   0x1026

Definition at line 45 of file v1290.h.

Referenced by v1290_FWRev().

#define V1290_GEORESS   0x100E

Definition at line 34 of file v1290.h.

#define V1290_GET_TDC_MSR_CHANNEL (   data)    ((uint32_t)((((uint32_t)data)& V1290_TDC_MSR_CHANNEL_MSK)>>21))

Definition at line 199 of file v1290.h.

#define V1290_GET_TDC_MSR_MEASURE (   data)    ((uint32_t)(((uint32_t)data)& V1290_TDC_MSR_MEASURE_MSK))

Definition at line 200 of file v1290.h.

#define V1290_GLB_HDR_EVENT_COUNT_MSK   0x07ffffe0

Definition at line 172 of file v1290.h.

#define V1290_GLB_HDR_GEO_MSK   0x0000001f

Definition at line 173 of file v1290.h.

#define V1290_GLB_HDR_MAX_EVENT_COUNT   (0x003fffff+ 1)

Definition at line 171 of file v1290.h.

#define V1290_GLB_TRG_TIME_TAG_MSK   0x07ffffff

Definition at line 174 of file v1290.h.

#define V1290_GLB_TRL_GEO_MSK   0x0000001f

Definition at line 177 of file v1290.h.

#define V1290_GLB_TRL_STATUS_MSK   0x07000000

Definition at line 175 of file v1290.h.

#define V1290_GLB_TRL_WCOUNT_MSK   0x001fffe0

Definition at line 176 of file v1290.h.

#define V1290_GLOBAL_HEADER   0x40000000

Definition at line 162 of file v1290.h.

#define V1290_GLOBAL_TRAILER   0x80000000

Definition at line 163 of file v1290.h.

#define V1290_GLOBAL_TRIGGER_TIME   0x88000000

Definition at line 168 of file v1290.h.

#define V1290_INT_LEVEL   0x100A

Definition at line 32 of file v1290.h.

#define V1290_INT_VECTOR   0x100C

Definition at line 33 of file v1290.h.

#define V1290_IS_FILLER (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_FILLER)

Definition at line 198 of file v1290.h.

#define V1290_IS_GLOBAL_HEADER (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_GLOBAL_HEADER)

Definition at line 191 of file v1290.h.

#define V1290_IS_GLOBAL_TRAILER (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_GLOBAL_TRAILER)

Definition at line 192 of file v1290.h.

#define V1290_IS_GLOBAL_TRIGGER_TIME (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_GLOBAL_TRIGGER_TIME)

Definition at line 197 of file v1290.h.

#define V1290_IS_TDC_ERROR (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_ERROR)

Definition at line 195 of file v1290.h.

#define V1290_IS_TDC_HEADER (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_HEADER)

Definition at line 193 of file v1290.h.

#define V1290_IS_TDC_MEASURE (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_MEASURE)

Definition at line 194 of file v1290.h.

#define V1290_IS_TDC_TRAILER (   data)    ((data& V1290_DATA_TYPE_MASK)== V1290_TDC_TRAILER)

Definition at line 196 of file v1290.h.

#define V1290_LOAD_DEF_CONFIG_OPCODE   0x0500

Definition at line 80 of file v1290.h.

#define V1290_LOAD_USER_CONFIG_OPCODE   0x0700

Definition at line 82 of file v1290.h.

#define V1290_MCST_CBLT_CTRL   0x1012

Definition at line 36 of file v1290.h.

#define V1290_MCST_CBLTRESS   0x1010

Definition at line 35 of file v1290.h.

#define V1290_MICRO   0x102E

Definition at line 48 of file v1290.h.

Referenced by v1290_MicroRead(), and v1290_MicroWrite().

#define V1290_MICRO_HND   0x1030

Definition at line 49 of file v1290.h.

Referenced by v1290_MicroRead(), and v1290_MicroWrite().

#define V1290_MICRO_RD_OK   0x0002

Definition at line 74 of file v1290.h.

Referenced by v1290_MicroRead().

#define V1290_MICRO_WR_OK   0x0001

Definition at line 73 of file v1290.h.

Referenced by v1290_MicroWrite().

#define V1290_MICROCONTROLLER_FW_OPCODE   0xC200

Definition at line 148 of file v1290.h.

#define V1290_MOD_RESET   0x1014

Definition at line 37 of file v1290.h.

Referenced by v1290_ModuleReset().

#define V1290_NUM_TDC_B   2

Definition at line 24 of file v1290.h.

#define V1290_NUM_TDC_N   2

Definition at line 26 of file v1290.h.

#define V1290_OUT_BUFFER   0x0000

Definition at line 28 of file v1290.h.

#define V1290_OUT_PROG_CTRL   0x102C

Definition at line 47 of file v1290.h.

#define V1290_READ_ACQ_MOD_OPCODE   0x0200

Definition at line 77 of file v1290.h.

Referenced by v1290_AcqModeRead().

#define V1290_READ_ADJUST_CH_OPCODE   0x5300

Definition at line 128 of file v1290.h.

#define V1290_READ_DEAD_TIME_OPCODE   0x2900

Definition at line 100 of file v1290.h.

Referenced by v1290_ReadDeadtime(), and v1290_ReadEdgeDetection().

#define V1290_READ_DETECTION_OPCODE   0x2300

Definition at line 95 of file v1290.h.

#define V1290_READ_DLL_LOCK_OPCODE   0x7500

Definition at line 142 of file v1290.h.

#define V1290_READ_EEPROM_OPCODE   0xC100

Definition at line 147 of file v1290.h.

#define V1290_READ_EN_PATTERN32_OPCODE   0x4700

Definition at line 123 of file v1290.h.

#define V1290_READ_EN_PATTERN_OPCODE   0x4500

Definition at line 121 of file v1290.h.

Referenced by v1290_ReadEnablePattern().

#define V1290_READ_ERROR_STATUS_OPCODE   0x7400

Definition at line 141 of file v1290.h.

#define V1290_READ_ERROR_TYPES_OPCODE   0x3A00

Definition at line 112 of file v1290.h.

#define V1290_READ_EVENT_SIZE_OPCODE   0x3400

Definition at line 106 of file v1290.h.

Referenced by v1290_ReadMaxHits().

#define V1290_READ_FIFO_SIZE_OPCODE   0x3C00

Definition at line 114 of file v1290.h.

Referenced by v1290_ReadFIFOSize().

#define V1290_READ_GLOB_OFFSET_OPCODE   0x5100

Definition at line 126 of file v1290.h.

#define V1290_READ_HEAD_TRAILER_OPCODE   0x3200

Definition at line 104 of file v1290.h.

Referenced by v1290_HeaderIsEnabled().

#define V1290_READ_MICRO_REV_OPCODE   0x6100

Definition at line 134 of file v1290.h.

#define V1290_READ_RC_ADJ_OPCODE   0x5500

Definition at line 130 of file v1290.h.

#define V1290_READ_RES_OPCODE   0x2600

Definition at line 98 of file v1290.h.

Referenced by v1290_ReadEdgeResolution().

#define V1290_READ_SETUP_REG_OPCODE   0x7100

Definition at line 138 of file v1290.h.

#define V1290_READ_SPARE_OPCODE   0xC400

Definition at line 150 of file v1290.h.

#define V1290_READ_STATUS_STREAM_OPCODE   0x7600

Definition at line 143 of file v1290.h.

#define V1290_READ_TDC_ID_OPCODE   0x6000

Definition at line 133 of file v1290.h.

#define V1290_READ_TDC_SETUP_SCAN_PATH_OPCODE   0xC800

Definition at line 155 of file v1290.h.

#define V1290_READ_TRG_CONF_OPCODE   0x1600

Definition at line 92 of file v1290.h.

Referenced by v1290_TriggerConfRead().

#define V1290_REG_DW   MVME_DMODE_D16

Definition at line 15 of file v1290.h.

Referenced by v1290_MicroRead(), v1290_MicroWrite(), v1290_Read16(), and v1290_Write16().

#define V1290_RESET_DLL_PLL_OPCODE   0x6200

Definition at line 135 of file v1290.h.

#define V1290_ROM_BOARD_ID_0   0x403C

Definition at line 64 of file v1290.h.

#define V1290_ROM_BOARD_ID_1   0x4038

Definition at line 63 of file v1290.h.

#define V1290_ROM_BOARD_ID_2   0x4034

Definition at line 62 of file v1290.h.

#define V1290_ROM_OUI_0   0x402C

Definition at line 60 of file v1290.h.

#define V1290_ROM_OUI_1   0x4028

Definition at line 59 of file v1290.h.

#define V1290_ROM_OUI_2   0x4024

Definition at line 58 of file v1290.h.

#define V1290_ROM_REVISION_0   0x404C

Definition at line 68 of file v1290.h.

#define V1290_ROM_REVISION_1   0x4048

Definition at line 67 of file v1290.h.

#define V1290_ROM_REVISION_2   0x4044

Definition at line 66 of file v1290.h.

#define V1290_ROM_REVISION_3   0x4040

Definition at line 65 of file v1290.h.

#define V1290_ROM_SERIAL_0   0x4084

Definition at line 70 of file v1290.h.

#define V1290_ROM_SERIAL_1   0x4080

Definition at line 69 of file v1290.h.

#define V1290_ROM_VERSION   0x4030

Definition at line 61 of file v1290.h.

#define V1290_SAVE_RC_ADJ_OPCODE   0x5600

Definition at line 131 of file v1290.h.

#define V1290_SAVE_USER_CONFIG_OPCODE   0x0600

Definition at line 81 of file v1290.h.

#define V1290_SEL_FLASH   0x1032

Definition at line 50 of file v1290.h.

#define V1290_SET_ADJUST_CH_OPCODE   0x5200

Definition at line 127 of file v1290.h.

#define V1290_SET_DEAD_TIME_OPCODE   0x2800

Definition at line 99 of file v1290.h.

Referenced by v1290_SetDeadtime().

#define V1290_SET_DETECTION_OPCODE   0x2200

Definition at line 94 of file v1290.h.

Referenced by v1290_SetEdgeDetection().

#define V1290_SET_DLL_CLOCK_OPCODE   0xC800

Definition at line 154 of file v1290.h.

#define V1290_SET_ERROR_TYPES_OPCODE   0x3900

Definition at line 111 of file v1290.h.

#define V1290_SET_EVENT_SIZE_OPCODE   0x3300

Definition at line 105 of file v1290.h.

Referenced by v1290_SetMaxHits().

#define V1290_SET_FIFO_SIZE_OPCODE   0x3B00

Definition at line 113 of file v1290.h.

Referenced by v1290_SetFIFOSize().

#define V1290_SET_GLOB_OFFSET_OPCODE   0x5000

Definition at line 125 of file v1290.h.

#define V1290_SET_KEEP_TOKEN_OPCODE   0x0300

Definition at line 78 of file v1290.h.

#define V1290_SET_PAIR_RES_OPCODE   0x2500

Definition at line 97 of file v1290.h.

#define V1290_SET_RC_ADJ_OPCODE   0x5400

Definition at line 129 of file v1290.h.

#define V1290_SET_REJ_MARGIN_OPCODE   0x1300

Definition at line 89 of file v1290.h.

Referenced by v1290_SetRejectMargin().

#define V1290_SET_SW_MARGIN_OPCODE   0x1200

Definition at line 88 of file v1290.h.

Referenced by v1290_SetExtraMargin().

#define V1290_SET_TDC_TEST_OUTPUT_OPCODE   0xC700

Definition at line 153 of file v1290.h.

#define V1290_SET_TR_LEAD_LSB_OPCODE   0x2400

Definition at line 96 of file v1290.h.

Referenced by v1290_SetEdgeResolution().

#define V1290_SET_WIN_OFFSET_OPCODE   0x1100

Definition at line 87 of file v1290.h.

Referenced by v1290_SetWindowOffset().

#define V1290_SET_WIN_WIDTH_OPCODE   0x1000

Definition at line 86 of file v1290.h.

Referenced by v1290_SetWindowWidth().

#define V1290_STATUS   0x1002
#define V1290_SW_CLEAR   0x1016

Definition at line 38 of file v1290.h.

Referenced by v1290_SoftClear().

#define V1290_SW_EVENT_RESET   0x1018

Definition at line 39 of file v1290.h.

Referenced by v1290_EventReset().

#define V1290_SW_TRIGGER   0x101A

Definition at line 40 of file v1290.h.

Referenced by v1290_SoftTrigger().

#define V1290_TDC_ERR_ERR_FLAGS_MSK   0x00003fff

Definition at line 189 of file v1290.h.

#define V1290_TDC_ERR_TDC_MSK   0x03000000

Definition at line 188 of file v1290.h.

#define V1290_TDC_ERROR   0x20000000

Definition at line 166 of file v1290.h.

#define V1290_TDC_HDR_BUNCH_ID_MSK   0x00000fff

Definition at line 181 of file v1290.h.

#define V1290_TDC_HDR_EVENT_ID_MSK   0x00fff000

Definition at line 180 of file v1290.h.

#define V1290_TDC_HDR_TDC_MSK   0x03000000

Definition at line 179 of file v1290.h.

#define V1290_TDC_HEADER   0x08000000

Definition at line 164 of file v1290.h.

#define V1290_TDC_MEASURE   0x00000000

Definition at line 165 of file v1290.h.

#define V1290_TDC_MSR_CHANNEL_MSK   0x03f80000

Definition at line 183 of file v1290.h.

#define V1290_TDC_MSR_MEASURE_MSK   0x0007ffff

Definition at line 184 of file v1290.h.

#define V1290_TDC_MSR_TRAILING_MSK   0x04000000

Definition at line 182 of file v1290.h.

#define V1290_TDC_TRAILER   0x18000000

Definition at line 167 of file v1290.h.

#define V1290_TDC_TRL_EVENT_ID_MSK   0x00fff000

Definition at line 186 of file v1290.h.

#define V1290_TDC_TRL_TDC_MSK   0x03000000

Definition at line 185 of file v1290.h.

#define V1290_TDC_TRL_WCOUNT_MSK   0x00000fff

Definition at line 187 of file v1290.h.

#define V1290_TESTREG   0x1028

Definition at line 46 of file v1290.h.

#define V1290_TRG_MATCH_OPCODE   0x0000

Definition at line 75 of file v1290.h.

Referenced by v1290_TriggerMatchingSet().

#define V1290_UPDATE_SETUP_REG_OPCODE   0x7200

Definition at line 139 of file v1290.h.

#define V1290_UPDATE_SETUP_TDC_OPCODE   0x7700

Definition at line 144 of file v1290.h.

#define V1290_WRITE_EEPROM_OPCODE   0xC000

Definition at line 146 of file v1290.h.

#define V1290_WRITE_EN_PATTERN32_OPCODE   0x4600

Definition at line 122 of file v1290.h.

#define V1290_WRITE_EN_PATTERN_OPCODE   0x4400

Definition at line 120 of file v1290.h.

Referenced by v1290_WriteEnablePattern().

#define V1290_WRITE_SETUP_REG_OPCODE   0x7000

Definition at line 137 of file v1290.h.

#define V1290_WRITE_SPARE_OPCODE   0xC300

Definition at line 149 of file v1290.h.

Enumeration Type Documentation

Enumerator
V1190_CH_PER_TDC 
V1290_CH_PER_TDC 

Definition at line 17 of file v1290.h.

18 {
19  V1190_CH_PER_TDC = 32,
20  V1290_CH_PER_TDC = 8,

Function Documentation

int v1290_AcqModeRead ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 148 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), printf(), v1290_MicroRead(), v1290_MicroWrite(), V1290_READ_ACQ_MOD_OPCODE, and value.

149 {
150  int cmode, value;
151  mvme_get_dmode(mvme, &cmode);
153  value = v1290_MicroWrite(mvme, base, V1290_READ_ACQ_MOD_OPCODE);
154  value = v1290_MicroRead(mvme, base);
155  printf("AcqMode (0 - cont., 1 - trigger matching): %X\n",value&0x1);
156  mvme_set_dmode(mvme, cmode);
157  return (value & 0x1);
158 }
void v1290_ContinuousSet ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 139 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), V1290_CONT_STORE_OPCODE, v1290_MicroWrite(), and value.

140 {
141  int cmode, value;
142  mvme_get_dmode(mvme, &cmode);
144  value = v1290_MicroWrite(mvme, base, V1290_CONT_STORE_OPCODE);
145  mvme_set_dmode(mvme, cmode);
146 }
int v1290_DataRead ( MVME_INTERFACE mvme,
uint32_t  base,
uint32_t *  pdest,
int  nentry 
)

Definition at line 47 of file v1290.c.

References MVME_BLT_BLT32, MVME_BLT_NONE, mvme_read(), mvme_set_am(), mvme_set_blt(), mvme_set_dmode(), status, V1290_AM, and V1290_BUFF_DW.

48 {
49  int status;
50  mvme_set_am(mvme, V1290_AM);
53  status = mvme_read(mvme, pdest, base, sizeof(uint32_t) * nentry);
55  return nentry;
56  /*
57  for (i=0 ; i<nentry ; i++) {
58  if (!v1190_DataReady(mvme, base))
59  break;
60  pdest[i] = mvme_read_value(mvme, base);
61  }
62  mvme_set_dmode(mvme, cmode);
63  return i;
64  */
65 }
void v1290_DisableAllChannels ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 344 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), printf(), V1290_DIS_ALL_CH_OPCODE, v1290_MicroWrite(), and value.

345 {
346  int cmode, value;
347  mvme_get_dmode(mvme, &cmode);
349  value = v1290_MicroWrite(mvme, base, V1290_DIS_ALL_CH_OPCODE);
350  printf("value: %d\n", value);
351  mvme_set_dmode(mvme, cmode);
352 }
void v1290_EnableAllChannels ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 335 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), V1290_EN_ALL_CH_OPCODE, v1290_MicroWrite(), and value.

336 {
337  int cmode, value;
338  mvme_get_dmode(mvme, &cmode);
340  value = v1290_MicroWrite(mvme, base, V1290_EN_ALL_CH_OPCODE);
341  mvme_set_dmode(mvme, cmode);
342 }
void v1290_EnableBusError ( MVME_INTERFACE mvme,
uint32_t  base,
bool  en 
)

Definition at line 376 of file v1290.c.

References V1290_CONTROL, v1290_Read16(), and v1290_Write16().

377 {
378  uint16_t reg = v1290_Read16(mvme, base, V1290_CONTROL);
379  if (en)
380  v1290_Write16(mvme, base, V1290_CONTROL, reg + 0x1);
381  else
382  v1290_Write16(mvme, base, V1290_CONTROL, reg & 0xfffe);
383 }
void v1290_EnableBypassTDC ( MVME_INTERFACE mvme,
uint32_t  base,
bool  en 
)

Definition at line 294 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), V1290_DIS_ERROR_BYPASS_OPCODE, V1290_EN_ERROR_BYPASS_OPCODE, v1290_MicroWrite(), and value.

295 {
296  int cmode, value;
297  mvme_get_dmode(mvme, &cmode);
299  uint32_t opcode;
300  if (en)
302  else
304 
305  value = v1290_MicroWrite(mvme, base, opcode);
306  mvme_set_dmode(mvme, cmode);
307 }
void v1290_EnableChannel ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  chn,
bool  en 
)

Definition at line 319 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), V1290_DIS_CHANNEL_OPCODE, V1290_EN_CHANNEL_OPCODE, v1290_MicroWrite(), and value.

320 {
321  int cmode, value;
322  mvme_get_dmode(mvme, &cmode);
324  uint32_t opcode;
325  if (en)
326  opcode = V1290_EN_CHANNEL_OPCODE;
327  else
328  opcode = V1290_DIS_CHANNEL_OPCODE;
329 
330  en += chn;
331  value = v1290_MicroWrite(mvme, base, opcode);
332  mvme_set_dmode(mvme, cmode);
333 }
void v1290_EnableEmptyEvent ( MVME_INTERFACE mvme,
uint32_t  base,
bool  en 
)

Definition at line 385 of file v1290.c.

References V1290_CONTROL, v1290_Read16(), and v1290_Write16().

386 {
387  uint16_t reg = v1290_Read16(mvme, base, V1290_CONTROL);
388  if (en)
389  v1290_Write16(mvme, base, V1290_CONTROL, reg + (0x1<<3));
390  else
391  v1290_Write16(mvme, base, V1290_CONTROL, reg & (0xfff7));
392 }
void v1290_EnableEventFIFO ( MVME_INTERFACE mvme,
uint32_t  base,
bool  en 
)

Definition at line 394 of file v1290.c.

References V1290_CONTROL, v1290_Read16(), and v1290_Write16().

395 {
396  uint16_t reg = v1290_Read16(mvme, base, V1290_CONTROL);
397  if (en)
398  v1290_Write16(mvme, base, V1290_CONTROL, reg + 0x100);
399  else
400  v1290_Write16(mvme, base, V1290_CONTROL, reg & 0xfeff);
401 }
void v1290_EnableHeader ( MVME_INTERFACE mvme,
uint32_t  base,
bool  en 
)

Definition at line 249 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), V1290_DIS_HEAD_TRAILER_OPCODE, V1290_EN_HEAD_TRAILER_OPCODE, v1290_MicroWrite(), and value.

250 {
251  int cmode, value;
252  mvme_get_dmode(mvme, &cmode);
254  uint32_t opcode;
255  if (en)
257  else
259 
260  value = v1290_MicroWrite(mvme, base, opcode);
261  mvme_set_dmode(mvme, cmode);
262 }
void v1290_EnableTDCErrorMark ( MVME_INTERFACE mvme,
uint32_t  base,
bool  en 
)

Definition at line 279 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), V1290_DIS_ERROR_MARK_OPCODE, V1290_EN_ERROR_MARK_OPCODE, v1290_MicroWrite(), and value.

280 {
281  int cmode, value;
282  mvme_get_dmode(mvme, &cmode);
284  uint32_t opcode;
285  if (en)
287  else
289 
290  value = v1290_MicroWrite(mvme, base, opcode);
291  mvme_set_dmode(mvme, cmode);
292 }
void v1290_EnableTriggerSubtraction ( MVME_INTERFACE mvme,
uint32_t  base,
bool  en 
)

Definition at line 202 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), V1290_DIS_SUB_TRG_OPCODE, V1290_EN_SUB_TRG_OPCODE, v1290_MicroWrite(), and value.

203 {
204  int cmode, value;
205  mvme_get_dmode(mvme, &cmode);
207  uint32_t opcode;
208  if (en)
209  opcode = V1290_EN_SUB_TRG_OPCODE;
210  else
211  opcode = V1290_DIS_SUB_TRG_OPCODE;
212 
213  value = v1290_MicroWrite(mvme, base, opcode);
214  mvme_set_dmode(mvme, cmode);
215 }
int v1290_EventRead ( MVME_INTERFACE mvme,
uint32_t  base,
uint32_t *  pdest,
int *  nentry 
)
void v1290_EventReset ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 453 of file v1290.c.

References V1290_SW_EVENT_RESET, and v1290_Write16().

454 {
455  v1290_Write16(mvme,base, V1290_SW_EVENT_RESET,0x1);
456 }
void v1290_FWRev ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 485 of file v1290.c.

References showbits(), V1290_FW_REV, and v1290_Read16().

486 {
487  unsigned short int reg = v1290_Read16(mvme,base, V1290_FW_REV);
488  showbits(reg);
489 }
bool v1290_HeaderIsEnabled ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 264 of file v1290.c.

References V1290_READ_HEAD_TRAILER_OPCODE, and v1290_ReadMicro().

265 {
266  return (v1290_ReadMicro(mvme, base, V1290_READ_HEAD_TRAILER_OPCODE) & 0x1);
267 }
bool v1290_IsAlmostFull ( MVME_INTERFACE mvme,
uint32_t  base_addr 
)

Definition at line 431 of file v1290.c.

References v1290_Read16(), and V1290_STATUS.

432 {
433  uint16_t reg = v1290_Read16(mvme, base, V1290_STATUS);
434  return (reg & (0x1<<1))>>1;
435 }
bool v1290_IsDataReady ( MVME_INTERFACE mvme,
uint32_t  base_addr 
)

Definition at line 425 of file v1290.c.

References v1290_Read16(), and V1290_STATUS.

426 {
427  uint16_t reg = v1290_Read16(mvme, base, V1290_STATUS);
428  return ((reg & (0x1)));
429 }
bool v1290_IsFull ( MVME_INTERFACE mvme,
uint32_t  base_addr 
)

Definition at line 437 of file v1290.c.

References v1290_Read16(), and V1290_STATUS.

438 {
439  uint16_t reg = v1290_Read16(mvme, base, V1290_STATUS);
440  return (reg & (0x1<<2))>>2;
441 }
int v1290_MicroRead ( MVME_INTERFACE mvme,
const uint32_t  base 
)

Definition at line 87 of file v1290.c.

References i, mvme_read_value(), mvme_set_am(), mvme_set_dmode(), V1290_AM, V1290_MICRO, V1290_MICRO_HND, V1290_MICRO_RD_OK, and V1290_REG_DW.

Referenced by v1290_AcqModeRead(), v1290_ReadMicro(), and v1290_TriggerConfRead().

88 {
89  int i;
90  int reg=-1;
91  mvme_set_am(mvme, V1290_AM);
93 
94  for (i=100; i>0; i--) {
95  uint16_t microHS = mvme_read_value(mvme, base+V1290_MICRO_HND);
96  if (microHS & V1290_MICRO_RD_OK) {
97  reg = mvme_read_value(mvme, base+V1290_MICRO);
98 // printf("i:%d microHS:%d %x\n", i, microHS, reg);
99  return (reg);
100  }
101  usleep(1);
102  };
103  return -1;
104 }
int v1290_MicroWrite ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  data 
)

Definition at line 68 of file v1290.c.

References i, mvme_read_value(), mvme_set_am(), mvme_set_dmode(), mvme_write_value(), printf(), V1290_AM, V1290_MICRO, V1290_MICRO_HND, V1290_MICRO_WR_OK, and V1290_REG_DW.

Referenced by v1290_AcqModeRead(), v1290_ContinuousSet(), v1290_DisableAllChannels(), v1290_EnableAllChannels(), v1290_EnableBypassTDC(), v1290_EnableChannel(), v1290_EnableHeader(), v1290_EnableTDCErrorMark(), v1290_EnableTriggerSubtraction(), v1290_ReadMicro(), v1290_TriggerConfRead(), v1290_TriggerMatchingSet(), and v1290_WriteMicro().

69 {
70  int i;
71 
72  mvme_set_am(mvme, V1290_AM);
74  for (i=0; i<1000; i++)
75  {
76  uint16_t microHS = mvme_read_value(mvme, base+V1290_MICRO_HND);
77  if (microHS & V1290_MICRO_WR_OK) {
78  mvme_write_value(mvme, base+V1290_MICRO, data);
79  return 1;
80  }
81  usleep(1);
82  }
83  printf("v1290_MicroWrite: Micro not ready for writing!\n");
84  return -1;
85 }
void v1290_ModuleReset ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 443 of file v1290.c.

References V1290_MOD_RESET, and v1290_Write16().

444 {
445  v1290_Write16(mvme,base, V1290_MOD_RESET,0x1);
446 }
uint16_t v1290_Read16 ( MVME_INTERFACE mvme,
uint32_t  base,
int  offset 
)
uint32_t v1290_Read32 ( MVME_INTERFACE mvme,
uint32_t  base,
int  offset 
)

Definition at line 24 of file v1290.c.

References mvme_get_dmode(), mvme_read_value(), mvme_set_am(), mvme_set_dmode(), V1290_AM, and V1290_BUFF_DW.

Referenced by v1290_ReadEventCounter(), and v1290_ReadEventFIFO().

25 {
26  int cmode;
27  mvme_get_dmode(mvme, &cmode);
28  mvme_set_am(mvme, V1290_AM);
30  uint32_t data = mvme_read_value(mvme, base+offset);
31 
32  mvme_set_dmode(mvme, cmode);
33  return data;
34 }
uint16_t v1290_ReadAlmostFullLevel ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  level 
)

Definition at line 479 of file v1290.c.

References V1290_ALMOST_FULL_LVL, and v1290_Read16().

481 {
482  return v1290_Read16(mvme, base, V1290_ALMOST_FULL_LVL);
483 }
void v1290_ReadControlRegister ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 365 of file v1290.c.

References printf(), V1290_CONTROL, and v1290_Read16().

366 {
367  uint16_t reg = v1290_Read16(mvme, base, V1290_CONTROL);
368  printf("Control register: 0x%X\n", V1290_CONTROL);
369  printf(" - Bus error enable: %d\n", reg & 0x1);
370  printf(" - Empty event enable: %d\n", (reg & (0x1<<3))>>3);
371  printf(" - Compensation enable: %d\n", (reg & (0x1<<5))>>5);
372  printf(" - Event FIFO enable: %d\n", (reg & (0x1<<8))>>8);
373  /*showbits(reg);*/
374 }
uint16_t v1290_ReadDeadtime ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 243 of file v1290.c.

References V1290_READ_DEAD_TIME_OPCODE, and v1290_ReadMicro().

244 {
245  return v1290_ReadMicro(mvme, base, V1290_READ_DEAD_TIME_OPCODE);
246 }
uint16_t v1290_ReadEdgeDetection ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 233 of file v1290.c.

References V1290_READ_DEAD_TIME_OPCODE, and v1290_ReadMicro().

234 {
235  return v1290_ReadMicro(mvme, base, V1290_READ_DEAD_TIME_OPCODE);
236 }
uint16_t v1290_ReadEdgeResolution ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 228 of file v1290.c.

References V1290_READ_RES_OPCODE, and v1290_ReadMicro().

229 {
230  return v1290_ReadMicro(mvme, base, V1290_READ_RES_OPCODE);
231 }
uint16_t v1290_ReadEnablePattern ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 359 of file v1290.c.

References V1290_READ_EN_PATTERN_OPCODE, and v1290_ReadMicro().

360 {
361  return (v1290_ReadMicro(mvme,base,V1290_READ_EN_PATTERN_OPCODE));
362 }
uint32_t v1290_ReadEventCounter ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 463 of file v1290.c.

References V1290_EVENT_COUNTER, and v1290_Read32().

464 {
465  return v1290_Read32(mvme, base, V1290_EVENT_COUNTER);
466 }
void v1290_ReadEventFIFO ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t *  dest 
)

Definition at line 491 of file v1290.c.

References showbits(), V1290_EVENT_FIFO, and v1290_Read32().

492 {
493  uint32_t reg = v1290_Read32(mvme, base, V1290_EVENT_FIFO);
494  showbits(reg);
495  dest[0] = reg&0xffff0000;
496  dest[1] = reg&0xffff;
497 }
uint16_t v1290_ReadEventFIFOStatus ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 499 of file v1290.c.

References V1290_EVENT_FIFO_STATUS, and v1290_Read16().

500 {
501  return (v1290_Read16(mvme, base, V1290_EVENT_FIFO_STATUS)&0x3);
502 }
uint16_t v1290_ReadEventFIFOStored ( MVME_INTERFACE mvme,
uint32_t  base 
)
uint16_t v1290_ReadEventStored ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 468 of file v1290.c.

References V1290_EVENT_STORED, and v1290_Read16().

469 {
470  return v1290_Read16(mvme, base, V1290_EVENT_STORED);
471 }
uint16_t v1290_ReadFIFOSize ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 314 of file v1290.c.

References V1290_READ_FIFO_SIZE_OPCODE, and v1290_ReadMicro().

315 {
316  return (v1290_ReadMicro(mvme, base, V1290_READ_FIFO_SIZE_OPCODE) &0x7);
317 }
uint16_t v1290_ReadMaxHits ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 274 of file v1290.c.

References V1290_READ_EVENT_SIZE_OPCODE, and v1290_ReadMicro().

275 {
276  return (v1290_ReadMicro(mvme, base, V1290_READ_EVENT_SIZE_OPCODE) &0xf);
277 }
uint16_t v1290_ReadMicro ( MVME_INTERFACE mvme,
const uint32_t  base,
uint16_t  opcode 
)

Definition at line 106 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), v1290_MicroRead(), v1290_MicroWrite(), and value.

Referenced by v1290_HeaderIsEnabled(), v1290_ReadDeadtime(), v1290_ReadEdgeDetection(), v1290_ReadEdgeResolution(), v1290_ReadEnablePattern(), v1290_ReadFIFOSize(), and v1290_ReadMaxHits().

108 {
109  int cmode, value;
110  mvme_get_dmode(mvme, &cmode);
112  value = v1290_MicroWrite(mvme, base, opcode);
113  value = v1290_MicroRead(mvme, base);
114  mvme_set_dmode(mvme, cmode);
115  return (uint16_t) value;
116 }
void v1290_ReadStatusRegister ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 403 of file v1290.c.

References printf(), v1290_Read16(), and V1290_STATUS.

404 {
405  uint16_t reg = v1290_Read16(mvme, base, V1290_STATUS);
406  printf("Status register: 0x%X\n", V1290_STATUS);
407  printf(" - Data ready: %d\n", reg & 0x1);
408  printf(" - Almost full: %d\n", (reg & (0x1<<1))>>1);
409  printf(" - Full: %d\n", (reg & (0x1<<2))>>2);
410  printf(" - Trigger match: %d\n", (reg & (0x1<<3))>>3);
411  printf(" - Header enable: %d\n", (reg & (0x1<<4))>>4);
412  printf(" - Term on: %d\n", (reg & (0x1<<5))>>5);
413  printf(" - Error TDC0: %d\n", (reg & (0x1<<6))>>6);
414  printf(" - Error TDC1: %d\n", (reg & (0x1<<7))>>7);
415  printf(" - Error TDC2: %d\n", (reg & (0x1<<8))>>8);
416  printf(" - Error TDC3: %d\n", (reg & (0x1<<9))>>9);
417  printf(" - Bus error: %d\n", (reg & (0x1<<10))>>10);
418  printf(" - Purged: %d\n", (reg & (0x1<<11))>>11);
419  printf(" - Res 0: %d\n", (reg & (0x1<<12))>>12);
420  printf(" - Res 1: %d\n", (reg & (0x1<<13))>>13);
421  printf(" - Pair: %d\n", (reg & (0x1<<14))>>14);
422  printf(" - Trigger lost: %d\n", (reg & (0x1<<15))>>15);
423 }
void v1290_SetAlmostFullLevel ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  level 
)

Definition at line 473 of file v1290.c.

References V1290_ALMOST_FULL_LVL, and v1290_Write16().

475 {
476  v1290_Write16(mvme, base, V1290_ALMOST_FULL_LVL, level);
477 }
void v1290_SetDeadtime ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  deadtime 
)

Definition at line 238 of file v1290.c.

References V1290_SET_DEAD_TIME_OPCODE, and v1290_WriteMicro().

239 {
240  v1290_WriteMicro(mvme, base, V1290_SET_DEAD_TIME_OPCODE, deadtime);
241 }
void v1290_SetEdgeDetection ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  edge 
)

Definition at line 218 of file v1290.c.

References V1290_SET_DETECTION_OPCODE, and v1290_WriteMicro().

219 {
220  v1290_WriteMicro(mvme, base, V1290_SET_DETECTION_OPCODE, edge);
221 }
void v1290_SetEdgeResolution ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  res 
)

Definition at line 223 of file v1290.c.

References V1290_SET_TR_LEAD_LSB_OPCODE, and v1290_WriteMicro().

224 {
226 }
void v1290_SetExtraMargin ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  margin 
)

Definition at line 192 of file v1290.c.

References V1290_SET_SW_MARGIN_OPCODE, and v1290_WriteMicro().

193 {
194  v1290_WriteMicro(mvme, base, V1290_SET_SW_MARGIN_OPCODE, margin);
195 }
void v1290_SetFIFOSize ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  size 
)

Definition at line 309 of file v1290.c.

References V1290_SET_FIFO_SIZE_OPCODE, and v1290_WriteMicro().

310 {
312 }
void v1290_SetMaxHits ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  max 
)

Definition at line 269 of file v1290.c.

References V1290_SET_EVENT_SIZE_OPCODE, and v1290_WriteMicro().

270 {
272 }
void v1290_SetRejectMargin ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  margin 
)

Definition at line 197 of file v1290.c.

References V1290_SET_REJ_MARGIN_OPCODE, and v1290_WriteMicro().

198 {
199  v1290_WriteMicro(mvme, base, V1290_SET_REJ_MARGIN_OPCODE, margin);
200 }
void v1290_SetWindowOffset ( MVME_INTERFACE mvme,
uint32_t  base,
int16_t  offset 
)

Definition at line 182 of file v1290.c.

References V1290_SET_WIN_OFFSET_OPCODE, and v1290_WriteMicro().

183 {
184  uint16_t tmp = abs(offset/25);
185  if (offset>0)
186  tmp += 0xf000;
187  else
188  tmp += 0xf800;
190 }
void v1290_SetWindowWidth ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  width 
)

Definition at line 177 of file v1290.c.

References V1290_SET_WIN_WIDTH_OPCODE, and v1290_WriteMicro().

178 {
180 }
void v1290_SoftClear ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 448 of file v1290.c.

References V1290_SW_CLEAR, and v1290_Write16().

449 {
450  v1290_Write16(mvme,base , V1290_SW_CLEAR,0x1);
451 }
void v1290_SoftTrigger ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 458 of file v1290.c.

References V1290_SW_TRIGGER, and v1290_Write16().

459 {
460  v1290_Write16(mvme, base, V1290_SW_TRIGGER, 0x1);
461 }
int v1290_TriggerConfRead ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t *  conf 
)

Definition at line 160 of file v1290.c.

References i, MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), printf(), v1290_MicroRead(), v1290_MicroWrite(), V1290_READ_TRG_CONF_OPCODE, and value.

161 {
162  int cmode, value;
163  mvme_get_dmode(mvme, &cmode);
165  value = v1290_MicroWrite(mvme, base, V1290_READ_TRG_CONF_OPCODE);
166  for (int i = 0; i < 5; ++i)
167  {
168  value = v1290_MicroRead(mvme, base);
169  printf("%x\n", (uint16_t)value);
170  *conf++ = (uint16_t)value;
171  }
172 
173  mvme_set_dmode(mvme, cmode);
174  return 0;
175 }
void v1290_TriggerMatchingSet ( MVME_INTERFACE mvme,
uint32_t  base 
)

Definition at line 130 of file v1290.c.

References MVME_DMODE_D16, mvme_get_dmode(), mvme_set_dmode(), v1290_MicroWrite(), V1290_TRG_MATCH_OPCODE, and value.

131 {
132  int cmode, value;
133  mvme_get_dmode(mvme, &cmode);
135  value = v1290_MicroWrite(mvme, base, V1290_TRG_MATCH_OPCODE);
136  mvme_set_dmode(mvme, cmode);
137 }
void v1290_Write16 ( MVME_INTERFACE mvme,
uint32_t  base,
int  offset,
uint16_t  value 
)
void v1290_WriteEnablePattern ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  pattern 
)

Definition at line 354 of file v1290.c.

References V1290_WRITE_EN_PATTERN_OPCODE, and v1290_WriteMicro().

355 {
356  v1290_WriteMicro(mvme, base, V1290_WRITE_EN_PATTERN_OPCODE, pattern);
357 }
void v1290_WriteMicro ( MVME_INTERFACE mvme,
uint32_t  base,
uint16_t  opcode,
uint16_t  data 
)