AlcapDAQ  1
rpv130.c
Go to the documentation of this file.
1 // ****************************************************************************
2 // * Filename: rpv130.c
3 // * Description:
4 // * Created by: Nam Tran (nam at kuno-g.phys.sci.osaka-u.ac.jp)
5 // * Time tag: 2013-04-06 13:55:20
6 // ****************************************************************************
7 // ****************************************************************************
8 #include "rpv130.h"
9 #include "bt617.h"
10 
12 {
15 
16  mvme_write_value(vme,base_addr + RPV130_CSR_1, 0x3);
17  mvme_write_value(vme,base_addr + RPV130_CSR_2, 0x3);
18 
19  return 0;
20 }
21 
23 {
26 
27  unsigned short int reg = mvme_read_value(vme,base_addr + RPV130_CSR_1);
28 
29  return ((reg & (1<<5))>>5);
30 }
31 
33 {
36 
37  unsigned short int reg = mvme_read_value(vme,base_addr + RPV130_CSR_2);
38 
39  return ((reg & (1<<5))>>5);
40 }
41 
43 {
46 
47  unsigned short int reg = mvme_read_value(vme,base_addr + RPV130_CSR_2);
48 
49  return ((reg & (1<<7))>>7);
50 }
51 
53 {
54  printf("Busy1: %d\n",rpv130_IsBusy1(vme,base_addr));
55  printf("Busy2: %d\n",rpv130_IsBusy2(vme,base_addr));
56  printf("Busy3: %d\n",rpv130_IsBusy3(vme,base_addr));
57 }
58 
60 {
63 
64  mvme_write_value(vme,base_addr + RPV130_CSR_1, 0x2);
65 
66  return 0;
67 }
68 
70 {
73  mvme_write_value(vme,base_addr + RPV130_CSR_2, 0x2);
74 
75  return 0;
76 }
77 
79 {
82  mvme_write_value(vme,base_addr + RPV130_CSR_2, 0x3);
83 
84  return 0;
85 }
86 
87 int rpv130_Pulse(MVME_INTERFACE *vme, mvme_addr_t base_addr, int chn)
88 {
89  if ((chn < 1) || (chn > 8))
90  return -1;
91 
94  mvme_write_value(vme,base_addr + RPV130_PULSE, (0x1<<(chn-1)));
95 
96  return 0;
97 }
98 /*#define TEST_RPV130*/
99 #ifdef TEST_RPV130
100 #define V1290N_BASE 0x0040000
101 #define RPV130_BASE 0x8000
102 
103 int main ()
104 {
105  printf("Test program for RPV130: \n");
107  mvme_open(&myvme, 0);
108 
110  printf("\n");
111 
114  printf("\n");
115 
116  sleep(1);
117  rpv130_Pulse(myvme,RPV130_BASE,1);
119 
120  // Finish
121  mvme_close(myvme);
122  return 0;
123 }
124 #endif