source: trigger/v560_dummy.c@ 604

Last change on this file since 604 was 52, checked in by rissim, 15 years ago
trigger software (VME) v1
File size: 4.7 KB
Line 
1#include <stdio.h>
2#include "rcc_error/rcc_error.h"
3#include "vme_rcc/vme_rcc.h"
4
5//******************************************************************************
6//Constants
7//******************************************************************************
8
9#define NMAX_V560_MODULES 10 //maximum 65535, probably more than enough...
10#define V560_CHANNELS 16
11
12//******************************************************************************
13//Type definitions
14//******************************************************************************
15
16//This struct maps the memory of a v560 module.
17typedef struct {
18// Variable name //Adress offset //Read-/Write-Mode
19 u_short threshold_ch[V560_CHANNELS]; //0x00-0x1E //w
20 u_short dummy1[16]; //0x20-0x3E //none
21 u_short output_width[2]; //0x40-0x42 //w
22 u_short dead_time[2]; //0x44-0x46 //w
23 u_short majority_threshold; //0x48 //w
24 u_short pattern_inhibit; //0x4A //w
25 u_short test_pulse; //0x4C //w
26 u_short dummy2[86]; //0x4E-0xF8 //none
27 u_short fixed_code; //0xFA //r
28 u_short manufacturer_type; //0xFC //r
29 u_short version_serialnumber; //0xFE //r
30} v560_registers_t;
31
32//This struct contains the information necessary to handle one module
33typedef struct {
34 v560_registers_t* registers; //contains the virtual address of the module
35 int master_mapping; //contains the handle of the module
36 char present; //0 if module not present, 1 if present
37} v560_module_t;
38
39//******************************************************************************
40//Global Variables
41//******************************************************************************
42
43v560_module_t v560_modules[NMAX_V560_MODULES];
44
45//******************************************************************************
46//Function Definitions
47//******************************************************************************
48
49VME_ErrorCode_t V560_Open(void)
50{
51 printf("V560_Open() was called.\n");
52 return VME_SUCCESS;
53}
54
55//******************************************************************************
56
57int V560_Set_Threshold(u_short module, u_char channel, u_short threshold)
58{
59 printf("V560_Set_Threshold(module %i, channel %i, threshold %i) was called.\n", module, channel, threshold);
60 return 0;
61}
62
63//******************************************************************************
64
65int V560_Set_Pattern_Inhibit(u_short module, u_char channels[16])
66{
67 //create the pattern of inhibit
68 u_short pattern = 0;
69 int i;
70 for(i=0; i<16; i++) {
71 if(channels[i]!=0) {
72 switch(i) {
73 case 0: pattern |= 0x0001; break;
74 case 1: pattern |= 0x0002; break;
75 case 2: pattern |= 0x0004; break;
76 case 3: pattern |= 0x0008; break;
77 case 4: pattern |= 0x0010; break;
78 case 5: pattern |= 0x0020; break;
79 case 6: pattern |= 0x0040; break;
80 case 7: pattern |= 0x0080; break;
81 case 8: pattern |= 0x0100; break;
82 case 9: pattern |= 0x0200; break;
83 case 10: pattern |= 0x0400; break;
84 case 11: pattern |= 0x0800; break;
85 case 12: pattern |= 0x1000; break;
86 case 13: pattern |= 0x2000; break;
87 case 14: pattern |= 0x4000; break;
88 case 15: pattern |= 0x8000; break;
89 }
90 }
91 }
92 printf("v560_pattern_inhibit(module %i, pattern %04x) was called.\n", module, pattern);
93 return 0;
94}
95
96//******************************************************************************
97
98int V560_Set_Output_Width(u_short module, u_char channel_block, u_short width)
99{
100 printf("V560_Set_Output_Width(module %i, channel block %i, width %i) was called.\n", module, channel_block, width);
101 return 0;
102}
103
104//******************************************************************************
105
106int V560_Set_Dead_Time(u_short module, u_char channel_block, u_short dead_time)
107{
108 printf("V560_Set_Dead_Time(module %i, channel block %i, dead time %i) was called.\n", module, channel_block, dead_time);
109 return 0;
110}
111
112//******************************************************************************
113
114int V560_Set_Majority_Level(u_short module, u_short majority_level)
115{
116 printf("V560_Set_Majority_Level(module %i, majority_level %i) was called.\n", module, majority_level);
117 return 0;
118}
119
120//******************************************************************************
121
122int V560_Test_Pulse(u_short module)
123{
124 printf("V560_Test_Pulse(module %i) was called.\n", module);
125 return 0;
126}
127
128//******************************************************************************
129
130int V560_Print_Info(void)
131{
132 printf("V560_Print_Info() was called.\n");
133 return 0;
134}
135
136//******************************************************************************
137
138VME_ErrorCode_t V560_Close(void)
139{
140 printf("V560_Close() was called.\n");
141 return VME_SUCCESS;
142}
143
144//******************************************************************************
Note: See TracBrowser for help on using the repository browser.