#include <stdio.h>
#include <unistd.h>
#include <camac.h>
Go to the source code of this file.
Defines | |
#define | camread16(b, c, n, a, f) (CAMRD16(CBDPTR((b), (c),(n),(a),(f), CAM16))) |
#define | camread24(b, c, n, a, f) (CAMRD24(CBDPTR((b), (c),(n),(a),(f), CAM24))) |
#define | camread32(b, c, n, a, f) (CAMRD32(CBDPTR((b), (c),(n),(a),(f), CAM24))) |
#define | camwrite16(b, c, n, a, f, d) (CAMWR16(CBDPTR((b), (c),(n),(a),(f), CAM16),d)) |
#define | camwrite24(b, c, n, a, f, d) (CAMWR24(CBDPTR((b), (c),(n),(a),(f), CAM24),d)) |
#define | camctl(b, c, n, a, f) |
#define | inhibit(b, c) camctl(b,c,27, 0, 26) |
#define | uninhibit(b, c) camctl(b,c,27, 1, 24) |
#define | qtst(c) ((camread16(0,(c),0,0,0) & 0x08) != 0) |
#define | xtst(c) ((camread16(0,(c),0,0,0) & 0X04) != 0) |
#define | AR 0x1000 |
#define | ROAK 0x0800 |
#define | VME_LAM_INT 0x0000 |
#define | VME_INT_VEC 0x0000 |
#define | branchinit(b) |
#define | crateinit(b, c) |
#define | BEGINLAM(br, cr) |
#define | ENDLAM } |
#define | NEEDLAM(b, c, n) _lammsk[b][c-1] |= (1 << (n-1)) |
#define | IFTIMEOUT(maxloop) |
#define | LAMREAD(b, c) camread24((b), (c), 28, 4, 0) |
Functions | |
void | WIENERBranchAccess (int branch) |
#define AR 0x1000 |
Definition at line 83 of file wienermacros.h.
#define BEGINLAM | ( | br, | |||
cr | ) |
Value:
{ \ UINT16 _b,_c; \ INT16 _timout; \ UINT32 _lammsk[br][cr]; \ UINT16 MAXBR = br; \ UINT16 MAXCR = cr; \ \ for(_b = 0; _b<br; _b++) \ for(_c = 0; _c < cr; _c++) _lammsk[_b][_c] = 0;
Definition at line 105 of file wienermacros.h.
#define branchinit | ( | b | ) |
Value:
WIENERBranchAccess(b); \ camwrite16(b,b+1,0,0,3,VME_LAM_INT|VME_INT_VEC); \ camctl(b,b+1,31,0,16); \ sleep(2)
Definition at line 87 of file wienermacros.h.
#define camctl | ( | b, | |||
c, | |||||
n, | |||||
a, | |||||
f | ) |
#define camread16 | ( | b, | |||
c, | |||||
n, | |||||
a, | |||||
f | ) | (CAMRD16(CBDPTR((b), (c),(n),(a),(f), CAM16))) |
Definition at line 37 of file wienermacros.h.
#define camread24 | ( | b, | |||
c, | |||||
n, | |||||
a, | |||||
f | ) | (CAMRD24(CBDPTR((b), (c),(n),(a),(f), CAM24))) |
Definition at line 38 of file wienermacros.h.
#define camread32 | ( | b, | |||
c, | |||||
n, | |||||
a, | |||||
f | ) | (CAMRD32(CBDPTR((b), (c),(n),(a),(f), CAM24))) |
Definition at line 39 of file wienermacros.h.
#define camwrite16 | ( | b, | |||
c, | |||||
n, | |||||
a, | |||||
f, | |||||
d | ) | (CAMWR16(CBDPTR((b), (c),(n),(a),(f), CAM16),d)) |
Definition at line 41 of file wienermacros.h.
#define camwrite24 | ( | b, | |||
c, | |||||
n, | |||||
a, | |||||
f, | |||||
d | ) | (CAMWR24(CBDPTR((b), (c),(n),(a),(f), CAM24),d)) |
Definition at line 42 of file wienermacros.h.
#define crateinit | ( | b, | |||
c | ) |
Value:
while((camread16(b,c,0,0,3) & 0x4000) == 0) \ { \ fprintf(stderr, "Crate %d is offline\n",c); \ sleep(5); \ } \ camwrite24(b,c,28,1,16,0); \ camctl(b,c,0,3,16); \ camctl(b,c,0,2,16)
Definition at line 94 of file wienermacros.h.
#define ENDLAM } |
Definition at line 115 of file wienermacros.h.
#define IFTIMEOUT | ( | maxloop | ) |
Value:
_timout = maxloop; /* maxloop in ~10us */ \ _b = 0; _c = 0; \ while(_timout >= 0) \ { \ if(_lammsk[_b][_c] == 0) \ { \ _c++; \ if(_c >= MAXCR) \ { \ _c = 0; \ _b++; \ if(_b >= MAXBR) break; \ } \ } else \ { \ _timout--; \ _lammsk[_b][_c] &= ~(_lammsk[_b][_c] & \ camread24(_b,_c+1,28,4,0));\ } \ } \ if(_timout < 0)
Definition at line 119 of file wienermacros.h.
#define inhibit | ( | b, | |||
c | ) | camctl(b,c,27, 0, 26) |
Definition at line 61 of file wienermacros.h.
#define LAMREAD | ( | b, | |||
c | ) | camread24((b), (c), 28, 4, 0) |
Definition at line 141 of file wienermacros.h.
#define NEEDLAM | ( | b, | |||
c, | |||||
n | ) | _lammsk[b][c-1] |= (1 << (n-1)) |
Definition at line 117 of file wienermacros.h.
#define qtst | ( | c | ) | ((camread16(0,(c),0,0,0) & 0x08) != 0) |
Definition at line 67 of file wienermacros.h.
#define ROAK 0x0800 |
Definition at line 84 of file wienermacros.h.
#define uninhibit | ( | b, | |||
c | ) | camctl(b,c,27, 1, 24) |
Definition at line 62 of file wienermacros.h.
#define VME_INT_VEC 0x0000 |
Definition at line 86 of file wienermacros.h.
#define VME_LAM_INT 0x0000 |
Definition at line 85 of file wienermacros.h.
#define xtst | ( | c | ) | ((camread16(0,(c),0,0,0) & 0X04) != 0) |
Definition at line 68 of file wienermacros.h.
void WIENERBranchAccess | ( | int | nBranch | ) |
Map to a WIENER crate controller. These take up 0x20 << CAMN bytes of storage. We organize the WIENER crates so that a branch is one crate. This allows 8 WIENER crates to be controlled from one vme crate which, for now, is probably sufficient. If we need to do more, we need to do something more intelligent with the mapping of crates/branches/vme crates. So crates 0-7 are in VME crate 0 etc.
Definition at line 302 of file camacmap.cpp.
References BRANCHESINCRATE, CAMN, pBranchBases, VMECRATES, and vmeFds.