00001 /*----------------------------------------------------------------------------- 00002 * Copyright (c) 1998 TRIUMF Data Acquistion Group 00003 * Please leave this header in any reproduction of that distribution 00004 * 00005 * TRIUMF Data Acquisition Group, 4004 Wesbrook Mall, Vancouver, B.C. V6T 2A3 00006 * Email: online@triumf.ca Tel: (604) 222-1047 Fax: (604) 222-1074 00007 * amaudruz@triumf.ca 00008 * ----------------------------------------------------------------------------- 00009 * 00010 * Description : Midas Camac Standard calls. 00011 * Requires : 00012 * Application : Used in any camac driver 00013 * Author: Pierre-Andre Amaudruz Data Acquisition Group 00014 * 00015 * $Log: mcstd.h,v $ 00016 * Revision 1.13 2004/01/13 00:50:53 pierre 00017 * fix dox comment for vxworks 00018 * 00019 * Revision 1.12 2004/01/08 08:40:09 midas 00020 * Implemented standard indentation 00021 * 00022 * Revision 1.11 2004/01/08 06:30:02 pierre 00023 * Doxygen the file 00024 * 00025 * Revision 1.10 2002/02/08 06:46:42 pierre 00026 * fix doc++ comments 00027 * 00028 * Revision 1.9 2001/08/21 11:18:28 midas 00029 * Added c,n to cam_interrupt_attach/detach, added comments 00030 * 00031 * Revision 1.8 2001/08/21 09:32:02 midas 00032 * Added cam_lam_wait 00033 * 00034 * Revision 1.7 2001/08/13 11:25:34 midas 00035 * Added some new functions 00036 * 00037 * Revision 1.6 2000/08/10 07:49:04 midas 00038 * Added client name together with frontend name in cam_init_rpc 00039 * 00040 * Revision 1.5 2000/04/17 17:38:10 pierre 00041 * - First round of doc++ comments 00042 * 00043 * Revision 1.4 1999/02/19 21:59:59 pierre 00044 * - Moved came_xxx to esone 00045 * 00046 * Revision 1.3 1998/10/13 07:04:29 midas 00047 * Added Log in header 00048 * 00049 * 00050 * Previous revision 1.0 1998 Pierre Initial revision 00051 * 1.1 JUL 98 SR Added 8-bit functions, BYTE definition 00052 *---------------------------------------------------------------------------*/ 00053 00054 /**dox***************************************************************/ 00055 /** @file mcstd.h 00056 The Midas CAMAC include file 00057 */ 00058 00059 /** @defgroup mcstdinclude Midas CAMAC standard 00060 */ 00061 /** @defgroup mcstdfunctionh Camac Functions (camxxx) 00062 */ 00063 00064 /**dox***************************************************************/ 00065 /** @addtogroup mcstdinclude 00066 * 00067 * @{ */ 00068 00069 /**dox***************************************************************/ 00070 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00071 00072 #ifndef INLINE 00073 #if defined( _MSC_VER ) 00074 #define INLINE __inline 00075 #elif defined(__GNUC__) 00076 #define INLINE __inline__ 00077 #else 00078 #define INLINE 00079 #endif 00080 #endif 00081 00082 /* make functions under WinNT dll exportable */ 00083 #if defined(_MSC_VER) && defined(MIDAS_DLL) 00084 #define EXPRT __declspec(dllexport) 00085 #else 00086 #define EXPRT 00087 #endif 00088 00089 #define EXTERNAL extern 00090 00091 #ifndef MIDAS_TYPE_DEFINED 00092 #define MIDAS_TYPE_DEFINED 00093 00094 typedef unsigned char BYTE; 00095 typedef unsigned short int WORD; 00096 00097 #ifdef __alpha 00098 typedef unsigned int DWORD; 00099 #else 00100 typedef unsigned long int DWORD; 00101 #endif 00102 00103 #define SUCCESS 1 00104 00105 #endif /* MIDAS_TYPE_DEFINED */ 00106 00107 00108 /*------------------------------------------------------------------*/ 00109 00110 /* make functions callable from a C++ program */ 00111 #ifdef __cplusplus 00112 extern "C" { 00113 #endif 00114 00115 EXTERNAL INLINE void EXPRT cam8i(const int c, const int n, const int a, const int f, 00116 BYTE * d); 00117 EXTERNAL INLINE void EXPRT cam8i_r(const int c, const int n, const int a, const int f, 00118 BYTE ** d, const int r); 00119 00120 /**dox***************************************************************/ 00121 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00122 00123 /**dox***************************************************************/ 00124 /** @addtogroup mcstdfunctionh 00125 * 00126 * @{ */ 00127 00128 /********************************************************************/ 00129 /** 00130 16 bits input. 00131 @param c crate number (0..) 00132 @param n station number (0..30) 00133 @param a sub-address (0..15) 00134 @param f function (0..7) 00135 @param d data read out data 00136 @return void 00137 */ 00138 EXTERNAL INLINE void EXPRT cam16i(const int c, const int n, const int a, const int f, 00139 WORD * d); 00140 00141 /********************************************************************/ 00142 /** 00143 24 bits input. 00144 @param c crate number (0..) 00145 @param n station number (0..30) 00146 @param a sub-address (0..15) 00147 @param f function (0..7) 00148 @param d data read out data 00149 @return void 00150 */ 00151 EXTERNAL INLINE void EXPRT cam24i(const int c, const int n, const int a, const int f, 00152 DWORD * d); 00153 00154 /********************************************************************/ 00155 /** 00156 8 bits input with Q response. 00157 @param c crate number (0..) 00158 @param n station number (0..30) 00159 @param a sub-address (0..15) 00160 @param f function (0..7) 00161 @param d data read out data 00162 @param x X response (0:failed,1:success) 00163 @param q Q resonpse (0:no Q, 1: Q) 00164 @return void 00165 */ 00166 EXTERNAL INLINE void EXPRT cam8i_q(const int c, const int n, const int a, const int f, 00167 BYTE * d, int *x, int *q); 00168 00169 /********************************************************************/ 00170 /** 00171 16 bits input with Q response. 00172 @param c crate number (0..) 00173 @param n station number (0..30) 00174 @param a sub-address (0..15) 00175 @param f function (0..7) 00176 @param d data read out data 00177 @param x X response (0:failed,1:success) 00178 @param q Q resonpse (0:no Q, 1: Q) 00179 @return void 00180 */ 00181 EXTERNAL INLINE void EXPRT cam16i_q(const int c, const int n, const int a, const int f, 00182 WORD * d, int *x, int *q); 00183 00184 /********************************************************************/ 00185 /** 00186 24 bits input with Q response. 00187 @param c crate number (0..) 00188 @param n station number (0..30) 00189 @param a sub-address (0..15) 00190 @param f function (0..7) 00191 @param d data read out data 00192 @param x X response (0:failed,1:success) 00193 @param q Q resonpse (0:no Q, 1: Q) 00194 @return void 00195 */ 00196 EXTERNAL INLINE void EXPRT cam24i_q(const int c, const int n, const int a, const int f, 00197 DWORD * d, int *x, int *q); 00198 00199 00200 /********************************************************************/ 00201 /** 00202 Repeat 16 bits input. 00203 @param c crate number (0..) 00204 @param n station number (0..30) 00205 @param a sub-address (0..15) 00206 @param f function (0..7) 00207 @param d data read out data 00208 @param r repeat time 00209 @return void 00210 */ 00211 EXTERNAL INLINE void EXPRT cam16i_r(const int c, const int n, const int a, const int f, 00212 WORD ** d, const int r); 00213 00214 /********************************************************************/ 00215 /** 00216 Repeat 24 bits input. 00217 @param c crate number (0..) 00218 @param n station number (0..30) 00219 @param a sub-address (0..15) 00220 @param f function (0..7) 00221 @param d data read out 00222 @param r repeat time 00223 @return void 00224 */ 00225 EXTERNAL INLINE void EXPRT cam24i_r(const int c, const int n, const int a, const int f, 00226 DWORD ** d, const int r); 00227 00228 /********************************************************************/ 00229 /** 00230 Repeat 8 bits input with Q stop. 00231 @param c crate number (0..) 00232 @param n station number (0..30) 00233 @param a sub-address (0..15) 00234 @param f function (0..7) 00235 @param d pointer to data read out 00236 @param r repeat time 00237 @return void 00238 */ 00239 EXTERNAL INLINE void EXPRT cam8i_rq(const int c, const int n, const int a, const int f, 00240 BYTE ** d, const int r); 00241 00242 /********************************************************************/ 00243 /** 00244 Repeat 16 bits input with Q stop. 00245 @param c crate number (0..) 00246 @param n station number (0..30) 00247 @param a sub-address (0..15) 00248 @param f function (0..7) 00249 @param d pointer to data read out 00250 @param r repeat time 00251 @return void 00252 */ 00253 EXTERNAL INLINE void EXPRT cam16i_rq(const int c, const int n, const int a, 00254 const int f, WORD ** d, const int r); 00255 00256 /********************************************************************/ 00257 /** 00258 Repeat 24 bits input with Q stop. 00259 @param c crate number (0..) 00260 @param n station number (0..30) 00261 @param a sub-address (0..15) 00262 @param f function (0..7) 00263 @param d pointer to data read out 00264 @param r repeat time 00265 @return void 00266 */ 00267 EXTERNAL INLINE void EXPRT cam24i_rq(const int c, const int n, const int a, 00268 const int f, DWORD ** d, const int r); 00269 00270 /********************************************************************/ 00271 /** 00272 Read the given CAMAC address and increment the sub-address by one. Repeat r times. 00273 00274 \code 00275 BYTE pbkdat[4]; 00276 cam8i_sa(crate, 5, 0, 2, &pbkdat, 4); 00277 \endcode 00278 equivalent to : 00279 \code 00280 cam8i(crate, 5, 0, 2, &pbkdat[0]); 00281 cam8i(crate, 5, 1, 2, &pbkdat[1]); 00282 cam8i(crate, 5, 2, 2, &pbkdat[2]); 00283 cam8i(crate, 5, 3, 2, &pbkdat[3]); 00284 \endcode 00285 @param c crate number (0..) 00286 @param n station number (0..30) 00287 @param a sub-address (0..15) 00288 @param f function (0..7) 00289 @param d pointer to data read out 00290 @param r number of consecutive sub-address to read 00291 @return void 00292 */ 00293 EXTERNAL INLINE void EXPRT cam8i_sa(const int c, const int n, const int a, const int f, 00294 BYTE ** d, const int r); 00295 00296 /********************************************************************/ 00297 /** 00298 Read the given CAMAC address and increment the sub-address by one. Repeat r times. 00299 00300 \code 00301 WORD pbkdat[4]; 00302 cam16i_sa(crate, 5, 0, 2, &pbkdat, 4); 00303 \endcode equivalent to : 00304 \code 00305 cam16i(crate, 5, 0, 2, &pbkdat[0]); 00306 cam16i(crate, 5, 1, 2, &pbkdat[1]); 00307 cam16i(crate, 5, 2, 2, &pbkdat[2]); 00308 cam16i(crate, 5, 3, 2, &pbkdat[3]); 00309 \endcode 00310 @param c crate number (0..) 00311 @param n station number (0..30) 00312 @param a sub-address (0..15) 00313 @param f function (0..7) 00314 @param d pointer to data read out 00315 @param r number of consecutive sub-address to read 00316 @return void 00317 */ 00318 EXTERNAL INLINE void EXPRT cam16i_sa(const int c, const int n, const int a, 00319 const int f, WORD ** d, const int r); 00320 00321 /********************************************************************/ 00322 /** 00323 Read the given CAMAC address and increment the sub-address by one. Repeat r times. 00324 00325 \code 00326 DWORD pbkdat[8]; 00327 cam24i_sa(crate, 5, 0, 2, &pbkdat, 8); 00328 \endcode 00329 equivalent to 00330 \code 00331 cam24i(crate, 5, 0, 2, &pbkdat[0]); 00332 cam24i(crate, 6, 0, 2, &pbkdat[1]); 00333 cam24i(crate, 7, 0, 2, &pbkdat[2]); 00334 cam24i(crate, 8, 0, 2, &pbkdat[3]); 00335 \endcode 00336 @param c crate number (0..) 00337 @param n station number (0..30) 00338 @param a sub-address (0..15) 00339 @param f function (0..7) 00340 @param d pointer to data read out 00341 @param r number of consecutive sub-address to read 00342 @return void 00343 */ 00344 EXTERNAL INLINE void EXPRT cam24i_sa(const int c, const int n, const int a, 00345 const int f, DWORD ** d, const int r); 00346 00347 /********************************************************************/ 00348 /** 00349 Read the given CAMAC address and increment the station number by one. Repeat r times. 00350 00351 \code 00352 BYTE pbkdat[4]; 00353 cam8i_sa(crate, 5, 0, 2, &pbkdat, 4); 00354 \endcode 00355 equivalent to : 00356 \code 00357 cam8i(crate, 5, 0, 2, &pbkdat[0]); 00358 cam8i(crate, 6, 0, 2, &pbkdat[1]); 00359 cam8i(crate, 7, 0, 2, &pbkdat[2]); 00360 cam8i(crate, 8, 0, 2, &pbkdat[3]); 00361 \endcode 00362 @param c crate number (0..) 00363 @param n station number (0..30) 00364 @param a sub-address (0..15) 00365 @param f function (0..7) 00366 @param d pointer to data read out 00367 @param r number of consecutive station to read 00368 @return void 00369 */ 00370 EXTERNAL INLINE void EXPRT cam8i_sn(const int c, const int n, const int a, const int f, 00371 BYTE ** d, const int r); 00372 00373 /********************************************************************/ 00374 /** 00375 Read the given CAMAC address and increment the station number by one. Repeat r times. 00376 00377 \code 00378 WORD pbkdat[4]; 00379 cam16i_sa(crate, 5, 0, 2, &pbkdat, 4); 00380 \endcode 00381 equivalent to : 00382 \code 00383 cam16i(crate, 5, 0, 2, &pbkdat[0]); 00384 cam16i(crate, 6, 0, 2, &pbkdat[1]); 00385 cam16i(crate, 7, 0, 2, &pbkdat[2]); 00386 cam16i(crate, 8, 0, 2, &pbkdat[3]); 00387 \endcode 00388 @param c crate number (0..) 00389 @param n station number (0..30) 00390 @param a sub-address (0..15) 00391 @param f function (0..7) 00392 @param d pointer to data read out 00393 @param r number of consecutive station to read 00394 @return void 00395 */ 00396 EXTERNAL INLINE void EXPRT cam16i_sn(const int c, const int n, const int a, 00397 const int f, WORD ** d, const int r); 00398 00399 /********************************************************************/ 00400 /** 00401 Read the given CAMAC address and increment the station number by one. Repeat r times. 00402 00403 \code 00404 DWORD pbkdat[4]; 00405 cam24i_sa(crate, 5, 0, 2, &pbkdat, 4); 00406 \endcode 00407 equivalent to : 00408 \code 00409 cam24i(crate, 5, 0, 2, &pbkdat[0]); 00410 cam24i(crate, 6, 0, 2, &pbkdat[1]); 00411 cam24i(crate, 7, 0, 2, &pbkdat[2]); 00412 cam24i(crate, 8, 0, 2, &pbkdat[3]); 00413 \endcode 00414 @param c crate number (0..) 00415 @param n station number (0..30) 00416 @param a sub-address (0..15) 00417 @param f function (0..7) 00418 @param d pointer to data read out 00419 @param r number of consecutive station to read 00420 @return void 00421 */ 00422 EXTERNAL INLINE void EXPRT cam24i_sn(const int c, const int n, const int a, 00423 const int f, DWORD ** d, const int r); 00424 /********************************************************************/ 00425 00426 /** 00427 Same as cam16i() 00428 */ 00429 EXTERNAL INLINE void EXPRT cami(const int c, const int n, const int a, const int f, 00430 WORD * d); 00431 00432 /********************************************************************/ 00433 /** 00434 Write data to given CAMAC address. 00435 @param c crate number (0..) 00436 @param n station number (0..30) 00437 @param a sub-address (0..15) 00438 @param f function (16..31) 00439 @param d data to be written to CAMAC 00440 @return void 00441 */ 00442 EXTERNAL INLINE void EXPRT cam8o(const int c, const int n, const int a, const int f, 00443 BYTE d); 00444 00445 /********************************************************************/ 00446 /** 00447 Write data to given CAMAC address. 00448 @param c crate number (0..) 00449 @param n station number (0..30) 00450 @param a sub-address (0..15) 00451 @param f function (16..31) 00452 @param d data to be written to CAMAC 00453 @return void 00454 */ 00455 EXTERNAL INLINE void EXPRT cam16o(const int c, const int n, const int a, const int f, 00456 WORD d); 00457 00458 /********************************************************************/ 00459 /** 00460 Write data to given CAMAC address. 00461 @param c crate number (0..) 00462 @param n station number (0..30) 00463 @param a sub-address (0..15) 00464 @param f function (16..31) 00465 @param d data to be written to CAMAC 00466 @return void 00467 */ 00468 EXTERNAL INLINE void EXPRT cam24o(const int c, const int n, const int a, const int f, 00469 DWORD d); 00470 00471 /********************************************************************/ 00472 /** 00473 Write data to given CAMAC address with Q response. 00474 @param c crate number (0..) 00475 @param n station number (0..30) 00476 @param a sub-address (0..15) 00477 @param f function (16..31) 00478 @param d data to be written to CAMAC 00479 @param x X response (0:failed,1:success) 00480 @param q Q resonpse (0:no Q, 1: Q) 00481 @return void 00482 */ 00483 EXTERNAL INLINE void EXPRT cam8o_q(const int c, const int n, const int a, const int f, 00484 BYTE d, int *x, int *q); 00485 00486 /********************************************************************/ 00487 /** 00488 Write data to given CAMAC address with Q response. 00489 @param c crate number (0..) 00490 @param n station number (0..30) 00491 @param a sub-address (0..15) 00492 @param f function (16..31) 00493 @param d data to be written to CAMAC 00494 @param x X response (0:failed,1:success) 00495 @param q Q resonpse (0:no Q, 1: Q) 00496 @return void 00497 */ 00498 EXTERNAL INLINE void EXPRT cam16o_q(const int c, const int n, const int a, const int f, 00499 WORD d, int *x, int *q); 00500 00501 /********************************************************************/ 00502 /** 00503 Write data to given CAMAC address with Q response. 00504 @param c crate number (0..) 00505 @param n station number (0..30) 00506 @param a sub-address (0..15) 00507 @param f function (16..31) 00508 @param d data to be written to CAMAC 00509 @param x X response (0:failed,1:success) 00510 @param q Q response (0:no Q, 1: Q) 00511 @return void 00512 */ 00513 EXTERNAL INLINE void EXPRT cam24o_q(const int c, const int n, const int a, const int f, 00514 DWORD d, int *x, int *q); 00515 00516 /********************************************************************/ 00517 /** 00518 Repeat write data to given CAMAC address r times. 00519 @param c crate number (0..) 00520 @param n station number (0..30) 00521 @param a sub-address (0..15) 00522 @param f function (16..31) 00523 @param d data to be written to CAMAC 00524 @param r number of repeatition 00525 @return void 00526 */ 00527 EXTERNAL INLINE void EXPRT cam8o_r(const int c, const int n, const int a, const int f, 00528 BYTE * d, const int r); 00529 00530 /********************************************************************/ 00531 /** 00532 Repeat write data to given CAMAC address r times. 00533 @param c crate number (0..) 00534 @param n station number (0..30) 00535 @param a sub-address (0..15) 00536 @param f function (16..31) 00537 @param d data to be written to CAMAC 00538 @param r number of repeatition 00539 @return void 00540 */ 00541 EXTERNAL INLINE void EXPRT cam16o_r(const int c, const int n, const int a, const int f, 00542 WORD * d, const int r); 00543 00544 /********************************************************************/ 00545 /** 00546 Repeat write data to given CAMAC address r times. 00547 @param c crate number (0..) 00548 @param n station number (0..30) 00549 @param a sub-address (0..15) 00550 @param f function (16..31) 00551 @param d data to be written to CAMAC 00552 @param r number of repeatition 00553 @return void 00554 */ 00555 EXTERNAL INLINE void EXPRT cam24o_r(const int c, const int n, const int a, const int f, 00556 DWORD * d, const int r); 00557 00558 /********************************************************************/ 00559 /** 00560 Same as cam16o() 00561 */ 00562 EXTERNAL INLINE void EXPRT camo(const int c, const int n, const int a, const int f, 00563 WORD d); 00564 00565 /********************************************************************/ 00566 /** 00567 Crate presence check. 00568 @param c crate number (0..) 00569 @return 0:Success, -1:No CAMAC response 00570 */ 00571 EXTERNAL INLINE int EXPRT camc_chk(const int c); 00572 00573 /********************************************************************/ 00574 /** 00575 CAMAC command (no data). 00576 @param c crate number (0..) 00577 @param n station number (0..30) 00578 @param a sub-address (0..15) 00579 @param f function (8..15, 24..31) 00580 @return void 00581 */ 00582 EXTERNAL INLINE void EXPRT camc(const int c, const int n, const int a, const int f); 00583 00584 /********************************************************************/ 00585 /** 00586 CAMAC command with Q response (no data). 00587 @param c crate number (0..) 00588 @param n station number (0..30) 00589 @param a sub-address (0..15) 00590 @param f function (8..15, 24..31) 00591 @param q Q response (0:no Q, 1:Q) 00592 @return void 00593 */ 00594 EXTERNAL INLINE void EXPRT camc_q(const int c, const int n, const int a, const int f, 00595 int *q); 00596 00597 /********************************************************************/ 00598 /** 00599 Scan CAMAC command on sub-address. 00600 @param c crate number (0..) 00601 @param n station number (0..30) 00602 @param a sub-address (0..15) 00603 @param f function (8..15, 24..31) 00604 @param r number of consecutive sub-address to read 00605 @return void 00606 */ 00607 EXTERNAL INLINE void EXPRT camc_sa(const int c, const int n, const int a, const int f, 00608 const int r); 00609 00610 /********************************************************************/ 00611 /** 00612 Scan CAMAC command on station. 00613 @param c crate number (0..) 00614 @param n station number (0..30) 00615 @param a sub-address (0..15) 00616 @param f function (8..15, 24..31) 00617 @param r number of consecutive station to read 00618 @return void 00619 */ 00620 EXTERNAL INLINE void EXPRT camc_sn(const int c, const int n, const int a, const int f, 00621 const int r); 00622 00623 /********************************************************************/ 00624 /** 00625 Initialize CAMAC access. 00626 @return 1: success 00627 */ 00628 EXTERNAL INLINE int EXPRT cam_init(void); 00629 00630 /********************************************************************/ 00631 /** 00632 Initialize CAMAC access for rpc calls 00633 @internal 00634 @param host_name Midas host to contact 00635 @param exp_name Midas experiment to contact 00636 @param fe_name frontend application name to contact 00637 @param client_name RPC host name 00638 @param rpc_server RPC server name 00639 @return 1: success 00640 */ 00641 EXTERNAL INLINE int EXPRT cam_init_rpc(char *host_name, char *exp_name, char *fe_name, 00642 char *client_name, char *rpc_server); 00643 00644 /********************************************************************/ 00645 /** 00646 Close CAMAC accesss. 00647 */ 00648 EXTERNAL INLINE void EXPRT cam_exit(void); 00649 00650 /********************************************************************/ 00651 /** 00652 Set Crate inhibit. 00653 @param c crate number (0..) 00654 @return void 00655 */ 00656 EXTERNAL INLINE void EXPRT cam_inhibit_set(const int c); 00657 00658 /********************************************************************/ 00659 /** 00660 Clear Crate inhibit. 00661 @param c crate number (0..) 00662 @return void 00663 */ 00664 EXTERNAL INLINE void EXPRT cam_inhibit_clear(const int c); 00665 00666 /********************************************************************/ 00667 /** 00668 Test Crate Inhibit. 00669 @param c crate number (0..) 00670 @return 1 for set, 0 for cleared 00671 */ 00672 EXTERNAL INLINE int EXPRT cam_inhibit_test(const int c); 00673 00674 /********************************************************************/ 00675 /** 00676 Issue CLEAR to crate. 00677 @param c crate number (0..) 00678 @return void 00679 */ 00680 EXTERNAL INLINE void EXPRT cam_crate_clear(const int c); 00681 00682 /********************************************************************/ 00683 /** 00684 Issue Z to crate. 00685 @param c crate number (0..) 00686 @return void 00687 */ 00688 EXTERNAL INLINE void EXPRT cam_crate_zinit(const int c); 00689 00690 /********************************************************************/ 00691 /** 00692 Enable LAM generation for given station to the Crate controller. 00693 It doesn't enable the LAM of the actual station itself. 00694 @param c crate number (0..) 00695 @param n LAM station 00696 @return void 00697 */ 00698 EXTERNAL INLINE void EXPRT cam_lam_enable(const int c, const int n); 00699 00700 /********************************************************************/ 00701 /** 00702 Disable LAM generation for given station to the Crate controller. 00703 It doesn't disable the LAM of the actual station itself. 00704 @param c crate number (0..) 00705 @param n LAM station 00706 @return void 00707 */ 00708 EXTERNAL INLINE void EXPRT cam_lam_disable(const int c, const int n); 00709 00710 /********************************************************************/ 00711 /** 00712 Reads in lam the lam pattern of the entire crate. 00713 @param c crate number (0..) 00714 @param lam LAM pattern of the crate 00715 @return void 00716 */ 00717 EXTERNAL INLINE void EXPRT cam_lam_read(const int c, DWORD * lam); 00718 00719 /********************************************************************/ 00720 /** 00721 Clear the LAM register of the crate controller. 00722 It doesn't clear the LAM of the particular station. 00723 @param c crate number (0..) 00724 @param n LAM station 00725 @return void 00726 */ 00727 EXTERNAL INLINE void EXPRT cam_lam_clear(const int c, const int n); 00728 00729 /********************************************************************/ 00730 /** 00731 Wait for a LAM to occur with a certain timeout. Return 00732 crate and station if LAM occurs. 00733 @param c crate number (0..) 00734 @param n LAM station 00735 @param millisec If there is no LAM after this timeout, the routine returns 00736 @return 1 if LAM occured, 0 else 00737 */ 00738 EXTERNAL INLINE int EXPRT cam_lam_wait(int *c, DWORD * n, const int millisec); 00739 00740 /********************************************************************/ 00741 /** 00742 Enable interrupts in specific crate 00743 @param c crate number (0..) 00744 @return void 00745 */ 00746 EXTERNAL INLINE void EXPRT cam_interrupt_enable(const int c); 00747 00748 /********************************************************************/ 00749 /** 00750 Disables interrupts in specific crate 00751 @param c crate number (0..) 00752 @return void 00753 */ 00754 EXTERNAL INLINE void EXPRT cam_interrupt_disable(const int c); 00755 00756 /********************************************************************/ 00757 /** 00758 Test Crate Interrupt. 00759 @param c crate number (0..) 00760 @return 1 for set, 0 for cleared 00761 */ 00762 EXTERNAL INLINE int EXPRT cam_interrupt_test(const int c); 00763 00764 /********************************************************************/ 00765 /** 00766 Attach service routine to LAM of specific crate and station. 00767 @param c crate number (0..) 00768 @param n station number 00769 @param (*isr) Function pointer to attach to the LAM 00770 @return void 00771 */ 00772 EXTERNAL INLINE void EXPRT cam_interrupt_attach(const int c, const int n, 00773 void (*isr) (void)); 00774 00775 /********************************************************************/ 00776 /** 00777 Detach service routine from LAM. 00778 @param c crate number (0..) 00779 @param n station number 00780 @return void 00781 */ 00782 EXTERNAL INLINE void EXPRT cam_interrupt_detach(const int c, const int n); 00783 00784 #ifdef __cplusplus 00785 } 00786 #endif 00787 00788 /**dox***************************************************************/ 00789 /** @} */ /* end of mcstdfunctinoh */ 00790 /**dox***************************************************************/ 00791 /** @} */ /* end of mcstdinclude */