MIDAS
Loading...
Searching...
No Matches
cnaf_callback.cxx File Reference
#include "mcstd.h"
#include "midas.h"
#include "msystem.h"
#include <assert.h>
#include <stdio.h>
Include dependency graph for cnaf_callback.cxx:

Go to the source code of this file.

Functions

INT cnaf_callback (INT index, void *prpc_param[])
 
void register_cnaf_callback (int debug)
 

Variables

static int cnaf_debug = 0
 

Function Documentation

◆ cnaf_callback()

INT cnaf_callback ( INT  index,
void prpc_param[] 
)

Definition at line 24 of file cnaf_callback.cxx.

24 {
25 DWORD cmd, b, c, n, a, f, *pdword, *size, *x, *q, dtemp;
26 WORD *pword, *pdata, temp;
27 INT i, count;
28
29 /* Decode parameters */
30 cmd = CDWORD(0);
31 b = CDWORD(1);
32 c = CDWORD(2);
33 n = CDWORD(3);
34 a = CDWORD(4);
35 f = CDWORD(5);
36 pdword = CPDWORD(6);
37 pword = CPWORD(6);
38 pdata = CPWORD(6);
39 size = CPDWORD(7);
40 x = CPDWORD(8);
41 q = CPDWORD(9);
42
43 /* determine repeat count */
44 if (index == RPC_CNAF16)
45 count = *size / sizeof(WORD); /* 16 bit */
46 else
47 count = *size / sizeof(DWORD); /* 24 bit */
48
49 switch (cmd) {
50 //---- special commands
53 break;
56 break;
59 break;
62 break;
63
64 case CNAF_TEST:
65 break;
66
67 case CNAF:
68 if (index == RPC_CNAF16) {
69 for (i = 0; i < count; i++)
70 if (f < 16)
71 cam16i_q(c, n, a, f, pword++, (int *) x, (int *) q);
72 else if (f < 24)
73 cam16o_q(c, n, a, f, pword[i], (int *) x, (int *) q);
74 else
75 cam16i_q(c, n, a, f, &temp, (int *) x, (int *) q);
76 } else {
77 for (i = 0; i < count; i++)
78 if (f < 16)
79 cam24i_q(c, n, a, f, pdword++, (int *) x, (int *) q);
80 else if (f < 24)
81 cam24o_q(c, n, a, f, pdword[i], (int *) x, (int *) q);
82 else
83 cam24i_q(c, n, a, f, &dtemp, (int *) x, (int *) q);
84 }
85
86 break;
87
88 case CNAF_nQ:
89 if (index == RPC_CNAF16) {
90 if (f < 16) {
91 cam16i_rq(c, n, a, f, &pword, count);
92 *size = (POINTER_T) pword - (POINTER_T) pdata;
93 }
94 } else {
95 if (f < 16) {
96 cam24i_rq(c, n, a, f, &pdword, count);
97 *size = (POINTER_T) pdword - (POINTER_T) pdata;
98 }
99 }
100
101 /* return reduced return size */
102 break;
103
104 default:
105 printf("cnaf: Unknown command 0x%X\n", (unsigned int) cmd);
106 }
107
108 if (cnaf_debug) {
109 if (index == RPC_CNAF16)
110 printf("cmd=%d r=%d c=%d n=%d a=%d f=%d d=%X x=%d q=%d\n",
111 (int) cmd, (int) count, (int) c, (int) n, (int) a, (int) f,
112 (int) pword[0], (int) *x, (int) *q);
113 else if (index == RPC_CNAF24)
114 printf("cmd=%d r=%d c=%d n=%d a=%d f=%d d=%X x=%d q=%d\n",
115 (int) cmd, (int) count, (int) c, (int) n, (int) a, (int) f,
116 (int) pdword[0], (int) *x, (int) *q);
117 }
118
119 return RPC_SUCCESS;
120}
static int cnaf_debug
#define RPC_SUCCESS
Definition midas.h:698
EXTERNAL void EXPRT cam24o_q(const int c, const int n, const int a, const int f, DWORD d, int *x, int *q)
EXTERNAL void EXPRT cam16i_q(const int c, const int n, const int a, const int f, WORD *d, int *x, int *q)
EXTERNAL void EXPRT cam_inhibit_set(const int c)
EXTERNAL void EXPRT cam24i_q(const int c, const int n, const int a, const int f, DWORD *d, int *x, int *q)
EXTERNAL void EXPRT cam_inhibit_clear(const int c)
EXTERNAL void EXPRT cam16o_q(const int c, const int n, const int a, const int f, WORD d, int *x, int *q)
EXTERNAL void EXPRT cam_crate_clear(const int c)
EXTERNAL void EXPRT cam16i_rq(const int c, const int n, const int a, const int f, WORD **d, const int r)
EXTERNAL void EXPRT cam24i_rq(const int c, const int n, const int a, const int f, DWORD **d, const int r)
EXTERNAL void EXPRT cam_crate_zinit(const int c)
unsigned short int WORD
Definition mcstd.h:49
unsigned int DWORD
Definition mcstd.h:51
#define RPC_CNAF16
Definition mrpc.h:125
#define RPC_CNAF24
Definition mrpc.h:126
static std::string q(const char *s)
DWORD n[4]
Definition mana.cxx:247
INT index
Definition mana.cxx:271
double count
Definition mdump.cxx:33
INT i
Definition mdump.cxx:32
#define DWORD
Definition mhdump.cxx:31
int INT
Definition midas.h:129
#define CNAF_INHIBIT_SET
Definition midas.h:494
#define CDWORD(_i)
Definition midas.h:1631
#define CPWORD(_i)
Definition midas.h:1626
#define CNAF_TEST
Definition midas.h:498
#define CNAF_CRATE_ZINIT
Definition midas.h:497
#define CNAF
Definition midas.h:491
#define CNAF_CRATE_CLEAR
Definition midas.h:496
#define CNAF_nQ
Definition midas.h:492
#define POINTER_T
Definition midas.h:166
#define CNAF_INHIBIT_CLEAR
Definition midas.h:495
#define CPDWORD(_i)
Definition midas.h:1632
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
char c
Definition system.cxx:1310
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_cnaf_callback()

void register_cnaf_callback ( int  debug)

Definition at line 122 of file cnaf_callback.cxx.

122 {
124 /* register CNAF callback */
127}
INT cnaf_callback(INT index, void *prpc_param[])
INT cm_register_function(INT id, INT(*func)(INT, void **))
Definition midas.cxx:5790
BOOL debug
debug printouts
Definition mana.cxx:254
Here is the call graph for this function:

Variable Documentation

◆ cnaf_debug

int cnaf_debug = 0
static

Definition at line 22 of file cnaf_callback.cxx.