| 1 | /********************************************/ | 
|---|
| 2 | /*Header file for the CAEN V812             */ | 
|---|
| 3 | /*16 Channel constant fraction discriminator*/ | 
|---|
| 4 | /*                                          */ | 
|---|
| 5 | /*Author: Thomas Kraehenbuehl               */ | 
|---|
| 6 | /* adapted by Michael Rissi to be wrapped by*/ | 
|---|
| 7 | /* Python                                   */ | 
|---|
| 8 | /*Date: 27 February 2008                    */ | 
|---|
| 9 | /*Based on v792.h by Markus Joos            */ | 
|---|
| 10 | /********************************************/ | 
|---|
| 11 |  | 
|---|
| 12 | #ifndef _V812_H | 
|---|
| 13 | #define _V812_H | 
|---|
| 14 |  | 
|---|
| 15 | //****************************************************************************** | 
|---|
| 16 | //Constants | 
|---|
| 17 | //****************************************************************************** | 
|---|
| 18 |  | 
|---|
| 19 | #define V812_CHANNELS 16 | 
|---|
| 20 | #include "rcc_error/rcc_error.h" | 
|---|
| 21 | #include "vme_rcc/vme_rcc.h" | 
|---|
| 22 | //****************************************************************************** | 
|---|
| 23 | //Type definitions | 
|---|
| 24 | //****************************************************************************** | 
|---|
| 25 |  | 
|---|
| 26 | //This struct maps the memory of a v812 module. | 
|---|
| 27 | typedef struct { | 
|---|
| 28 | //      Variable name                                                   //Adress offset         //Read-/Write-Mode | 
|---|
| 29 | u_short threshold_ch[V812_CHANNELS];    //0x00-0x1E                     //w | 
|---|
| 30 | u_short dummy1[16];                                             //0x20-0x3E                     //none | 
|---|
| 31 | u_short output_width[2];                                //0x40-0x42                     //w | 
|---|
| 32 | u_short dead_time[2];                                   //0x44-0x46                     //w | 
|---|
| 33 | u_short majority_threshold;                             //0x48                          //w | 
|---|
| 34 | u_short pattern_inhibit;                                //0x4A                          //w | 
|---|
| 35 | u_short test_pulse;                                             //0x4C                          //w | 
|---|
| 36 | u_short dummy2[86];                                             //0x4E-0xF8                     //none | 
|---|
| 37 | u_short fixed_code;                                             //0xFA                          //r | 
|---|
| 38 | u_short manufacturer_type;                              //0xFC                          //r | 
|---|
| 39 | u_short version_serialnumber;                   //0xFE                          //r | 
|---|
| 40 | } v812_registers_t; | 
|---|
| 41 |  | 
|---|
| 42 | //This struct contains the information necessary to handle one module | 
|---|
| 43 | typedef struct { | 
|---|
| 44 | v812_registers_t* registers;            //contains the virtual address of the module | 
|---|
| 45 | int master_mapping;                                     //contains the handle of the module | 
|---|
| 46 | char present;                                           //0 if module not present, 1 if present | 
|---|
| 47 | } v812_module_t; | 
|---|
| 48 |  | 
|---|
| 49 | //****************************************************************************** | 
|---|
| 50 | //Global Variables | 
|---|
| 51 | //****************************************************************************** | 
|---|
| 52 |  | 
|---|
| 53 | v812_module_t v812_modules[]; //TODO: not sure if this is correct | 
|---|
| 54 |  | 
|---|
| 55 | //****************************************************************************** | 
|---|
| 56 | //Function Definitions | 
|---|
| 57 | //****************************************************************************** | 
|---|
| 58 |  | 
|---|
| 59 | VME_ErrorCode_t V812_Open(void); | 
|---|
| 60 | int V812_Set_Threshold(short module, short channel, short threshold); | 
|---|
| 61 | int V812_Set_Pattern_Inhibit(short module, char channel[16]); | 
|---|
| 62 | int V812_Set_Output_Width(short module,short channel_block, short width); | 
|---|
| 63 | int V812_Set_Dead_Time(short module, short channel_block, short dead_time); | 
|---|
| 64 | int V812_Set_Majority_Level(short module, short majority_level); | 
|---|
| 65 | int V812_Set_Majority_Threshold(short module, short majority_threshold); | 
|---|
| 66 | int V812_Test_Pulse(short module); | 
|---|
| 67 | int V812_Print_Info(void); | 
|---|
| 68 | int V812_Set_Pattern_Inhibit_Hex(short module, int pattern); | 
|---|
| 69 | VME_ErrorCode_t V812_Close(void); | 
|---|
| 70 |  | 
|---|
| 71 | //****************************************************************************** | 
|---|
| 72 |  | 
|---|
| 73 | #endif | 
|---|