| 1 | /********************************************/
 | 
|---|
| 2 | /*Header file for the CAEN V560             */
 | 
|---|
| 3 | /*16 Channel scaler                         */
 | 
|---|
| 4 | /*        
 | 
|---|
| 5 | /*Author: Michael Rissi
 | 
|---|
| 6 | /*Date: 29 May 2009                         */
 | 
|---|
| 7 | /*Based on v792.h by Markus Joos            */
 | 
|---|
| 8 | /********************************************/
 | 
|---|
| 9 | 
 | 
|---|
| 10 | #ifndef _V560_H
 | 
|---|
| 11 | #define _V560_H
 | 
|---|
| 12 | 
 | 
|---|
| 13 | //******************************************************************************
 | 
|---|
| 14 | //Constants
 | 
|---|
| 15 | //******************************************************************************
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #define V560_CHANNELS 16
 | 
|---|
| 18 | #include "rcc_error/rcc_error.h"
 | 
|---|
| 19 | #include "vme_rcc/vme_rcc.h"
 | 
|---|
| 20 | //******************************************************************************
 | 
|---|
| 21 | //Type definitions
 | 
|---|
| 22 | //******************************************************************************
 | 
|---|
| 23 | 
 | 
|---|
| 24 | //This struct maps the memory of a v560 module.
 | 
|---|
| 25 | typedef struct {
 | 
|---|
| 26 |   //    Variable name                                                   //Adress offset         //Read-/Write-Mode
 | 
|---|
| 27 |   u_short dummy1[2];                                                    //0x00-0x04                     // none
 | 
|---|
| 28 |   u_short interrupt_vector_register;                                    //0x04-0x06                     // r/w
 | 
|---|
| 29 |   u_short interrupt_level_register;                                     //0x06-0x08                     // r/w
 | 
|---|
| 30 |   u_short enable_VME_interrupt;                                         //0x08-0x0A                     // r/w
 | 
|---|
| 31 |   u_short disable_VME_interrupt;                                        //0x0A-0x0C                     // r/w
 | 
|---|
| 32 |   u_short clear_VME_interrupt;                                          //0x0C-0x0E                     // r/w
 | 
|---|
| 33 |   u_short request_register;                                             //0x0E-0x10                     // r/w
 | 
|---|
| 34 |   u_int counter[V560_CHANNELS];                                         //0x10-0x50                     // r
 | 
|---|
| 35 |   u_short scale_clear;                                                  //0x50-0x52                     // r/w
 | 
|---|
| 36 |   u_short VME_veto_set;                                                 //0x52-0x54                     // r/w
 | 
|---|
| 37 |   u_short VME_veto_reset;                                               //0x54-0x56                     // r/w
 | 
|---|
| 38 |   u_short scale_increase;                                               //0x56-0x58                     // r/w
 | 
|---|
| 39 |   u_short scale_status_register;                                        //0x58-0x5A                     // r/w
 | 
|---|
| 40 |    u_short dummy2[80];                                                   //0x5A-0xF8                    // not used
 | 
|---|
| 41 |   u_short fixed_code;                                                   //0xFA-0xFC                     // r
 | 
|---|
| 42 |   u_short manufacturer_type;                                            //0xFC-0xFE                     // r
 | 
|---|
| 43 |   u_short version_series;                                               //0xFE                          // r 
 | 
|---|
| 44 | } v560_registers_t;
 | 
|---|
| 45 | 
 | 
|---|
| 46 | //This struct contains the information necessary to handle one module
 | 
|---|
| 47 | typedef struct {
 | 
|---|
| 48 |         v560_registers_t* registers;            //contains the virtual address of the module
 | 
|---|
| 49 |         int master_mapping;                                     //contains the handle of the module
 | 
|---|
| 50 |         char present;                                           //0 if module not present, 1 if present
 | 
|---|
| 51 | } v560_module_t;
 | 
|---|
| 52 | 
 | 
|---|
| 53 | //******************************************************************************
 | 
|---|
| 54 | //Global Variables
 | 
|---|
| 55 | //******************************************************************************
 | 
|---|
| 56 | 
 | 
|---|
| 57 | v560_module_t v560_modules[]; //TODO: not sure if this is correct
 | 
|---|
| 58 | 
 | 
|---|
| 59 | //******************************************************************************
 | 
|---|
| 60 | //Function Definitions
 | 
|---|
| 61 | //******************************************************************************
 | 
|---|
| 62 | 
 | 
|---|
| 63 | VME_ErrorCode_t V560_Open();
 | 
|---|
| 64 | int V560_Send_Scale_Increment(short module);
 | 
|---|
| 65 | int V560_Set_Veto(short module);
 | 
|---|
| 66 | int V560_Reset_Veto(short module);
 | 
|---|
| 67 | int V560_Clear_Scales(short module);
 | 
|---|
| 68 | u_short V560_Read_Request_Register(short module);
 | 
|---|
| 69 | int V560_Write_Request_Register(short module,short request);
 | 
|---|
| 70 | int V560_Clear_VME_Interrupt(short module);
 | 
|---|
| 71 | int V560_Read_Counter(short module, short channel);
 | 
|---|
| 72 | //int V560_Set_Threshold(u_short module, u_char channel, u_short threshold);
 | 
|---|
| 73 | /*extern int V560_Set_Pattern_Inhibit(u_short module, u_char channel[16]);
 | 
|---|
| 74 | extern int V560_Set_Output_Width(u_short module, u_char channel_block, u_short width);
 | 
|---|
| 75 | extern int V560_Set_Dead_Time(u_short module, u_char channel_block, u_short dead_time);
 | 
|---|
| 76 | extern int V560_Set_Majority_Level(u_short module, u_short majority_level);
 | 
|---|
| 77 | extern int V560_Test_Pulse(u_short module);*/
 | 
|---|
| 78 | int V560_Print_Info(void);
 | 
|---|
| 79 | VME_ErrorCode_t V560_Close(void);
 | 
|---|
| 80 | 
 | 
|---|
| 81 | //******************************************************************************
 | 
|---|
| 82 | 
 | 
|---|
| 83 | #endif
 | 
|---|