esone.h File Reference

Go to the source code of this file.

Defines

#define INLINE
#define EXTERNAL   extern
#define EXPRT

Functions

EXTERNAL INLINE void ccinit (void)
EXTERNAL INLINE void cdreg (int *ext, const int b, const int c, const int n, const int a)
EXTERNAL INLINE void cssa (const int f, int ext, unsigned short *d, int *q)
EXTERNAL INLINE void cfsa (const int f, const int ext, unsigned long *d, int *q)
EXTERNAL INLINE void cccc (const int ext)
EXTERNAL INLINE void cccz (const int ext)
EXTERNAL INLINE void ccci (const int ext, int l)
EXTERNAL INLINE void ctci (const int ext, int *l)
EXTERNAL INLINE void cccd (const int ext, int l)
EXTERNAL INLINE void ctcd (const int ext, int *l)
EXTERNAL INLINE void cdlam (int *lam, const int b, const int c, const int n, const int a, const int inta[2])
EXTERNAL INLINE void ctgl (const int lam, int *l)
EXTERNAL INLINE void cclm (const int lam, int l)
EXTERNAL INLINE void cclc (const int lam)
EXTERNAL INLINE void ctlm (const int lam, int *l)
EXTERNAL INLINE void cfga (int f[], int exta[], int intc[], int qa[], int cb[])
EXTERNAL INLINE void csga (int f[], int exta[], int intc[], int qa[], int cb[])
EXTERNAL INLINE void cfmad (int f, int extb[], int intc[], int cb[])
EXTERNAL INLINE void csmad (int f, int extb[], int intc[], int cb[])
EXTERNAL INLINE void cfubc (const int f, int ext, int intc[], int cb[])
EXTERNAL INLINE void csubc (const int f, int ext, int intc[], int cb[])
EXTERNAL INLINE void cfubr (const int f, int ext, int intc[], int cb[])
EXTERNAL INLINE void csubr (const int f, int ext, int intc[], int cb[])


Define Documentation

#define EXPRT

Definition at line 28 of file esone.h.

#define EXTERNAL   extern

Definition at line 22 of file esone.h.

#define INLINE

Definition at line 18 of file esone.h.


Function Documentation

EXTERNAL INLINE void cccc ( const int  ext  ) 

Control Crate Clear.

Generate Crate Clear function. Execute cam_crate_clear()

Parameters:
ext external address
Returns:
void

Definition at line 193 of file esone.c.

00194 {
00195    int b, c, n, a;
00196 
00197    came_ext(ext, &b, &c, &n, &a);
00198    cam_crate_clear(c);
00199 }

EXTERNAL INLINE void cccd ( const int  ext,
int  l 
)

Control Crate D.

Enable or Disable Crate Demand.

Parameters:
ext external address
l action l=0 -> Clear D, l=1 -> Set D
Returns:
void

Definition at line 267 of file esone.c.

00268 {
00269    int b, c, n, a;
00270 
00271    came_ext(ext, &b, &c, &n, &a);
00272 
00273    if (l)
00274       cam_interrupt_enable(c);
00275    else
00276       cam_interrupt_disable(c);
00277 }

EXTERNAL INLINE void ccci ( const int  ext,
int  l 
)

Control Crate I.

Set or Clear Dataway Inhibit, Execute cam_inhinit_set() /clear()

Parameters:
ext external address
l action l=0 -> Clear I, l=1 -> Set I
Returns:
void

Definition at line 228 of file esone.c.

00229 {
00230    int b, c, n, a;
00231 
00232    came_ext(ext, &b, &c, &n, &a);
00233    if (l)
00234       cam_inhibit_set(c);
00235    else
00236       cam_inhibit_clear(c);
00237 }

EXTERNAL INLINE void cccz ( const int  ext  ) 

Control Crate Z.

Generate Dataway Initialize. Execute cam_crate_zinit()

Parameters:
ext external address
Returns:
void

Definition at line 210 of file esone.c.

00211 {
00212    int b, c, n, a;
00213 
00214    came_ext(ext, &b, &c, &n, &a);
00215    cam_crate_zinit(c);
00216 }

EXTERNAL INLINE void ccinit ( void   ) 

CAMAC initialization

CAMAC initialization must be called before any other ESONE subroutine call.

Returns:
void

Definition at line 72 of file esone.c.

00073 {
00074    cam_init();
00075 }

EXTERNAL INLINE void cclc ( const int  lam  ) 

Control Clear LAM.

Clear the LAM of the station pointer by the lam address.

Parameters:
lam external address
Returns:
void

Definition at line 428 of file esone.c.

00429 {
00430    int b, c, n, a;
00431 
00432    came_ext(lam, &b, &c, &n, &a);
00433    camc(c, n, 0, 10);
00434 }

EXTERNAL INLINE void cclm ( const int  lam,
int  l 
)

Control Crate LAM.

Enable or Disable LAM. Execute F24 for disable, F26 for enable.

Parameters:
lam external address
l action l=0 -> disable LAM , l=1 -> enable LAM
Returns:
void

Definition at line 348 of file esone.c.

00349 {
00350    int b, c, n, a;
00351 
00352    came_ext(lam, &b, &c, &n, &a);
00353 
00354    if (l)
00355       camc(c, n, 0, 26);
00356    else
00357       camc(c, n, 0, 24);
00358 }

EXTERNAL INLINE void cdlam ( int *  lam,
const int  b,
const int  c,
const int  n,
const int  a,
const int  inta[2] 
)

Control Declare LAM.

Declare LAM, Identical to cdreg.

Parameters:
lam external LAM address
b branch number (0..7)
c crate number (0..)
n station number (0..30)
a sub-address (0..15)
inta implementation dependent
Returns:
void

Definition at line 311 of file esone.c.

00313 {
00314    /* inta[2] ignored */
00315    cdreg(lam, b, c, n, a);
00316 }

EXTERNAL INLINE void cdreg ( int *  ext,
const int  b,
const int  c,
const int  n,
const int  a 
)

Control Declaration REGister.

Compose an external address from BCNA for later use. Accessing CAMAC through ext could be faster if the external address is memory mapped to the processor (hardware dependent). Some CAMAC controller do not have this option see Supported hardware.

Parameters:
ext external address
b branch number (0..7)
c crate number (0..)
n station number (0..30)
a sub-address (0..15)
Returns:
void

Definition at line 109 of file esone.c.

Referenced by cdlam().

00110 {
00111    came_cn(ext, b, c, n, a);
00112 }

EXTERNAL INLINE void cfga ( int  f[],
int  exta[],
int  intc[],
int  qa[],
int  cb[] 
)

Control Full (24bit) word General Action.

Parameters:
f function code
exta[] external address array
intc[] data array
qa[] Q response array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 467 of file esone.c.

00468 {
00469    int i;
00470 
00471    for (i = 0; i < cb[0]; i++)
00472       cfsa(f[i], exta[i], (unsigned long *) (&(intc[i])), &(qa[i]));
00473 
00474    cb[1] = cb[0];
00475 }

EXTERNAL INLINE void cfmad ( int  f,
int  extb[],
int  intc[],
int  cb[] 
)

Control Full (24bit) Address Q scan.

Scan all sub-address while Q=1 from a0..a15 max from address extb[0] and store corresponding data in intc[]. If Q=0 while A<15 or A=15 then cross station boundary is applied (n-> n+1) and sub-address is reset (a=0). Perform action until either cb[0] action are performed or current external address exceeds extb[1].

implementation of cb[2] for LAM recognition is not implemented.

Parameters:
f function code
extb[] external address array
extb[0] : first valid external address
extb[1] : last valid external address
intc[] data array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 521 of file esone.c.

00522 {
00523    int j, count;
00524    int x, q, b, c, n, a;
00525    unsigned long exts, extc, exte;
00526 
00527    exts = extb[0];
00528    exte = extb[1];
00529    count = cb[0];
00530    j = 0;
00531    came_ext(exts, &b, &c, &n, &a);
00532    do {
00533       cam24i_q(c, n, a, f, (unsigned long *) &intc[j], &x, &q);
00534       if (q == 0) {
00535          a = 0;                 /* set subaddress to zero */
00536          n++;                   /* select next slot */
00537          j++;
00538       } else {
00539          a++;                   /* increment address */
00540          ++cb[1];               /* increment tally count */
00541          ++intc;                /* next data array */
00542          --count;
00543       }
00544       came_cn((int *) &extc, b, c, n, a);
00545 
00546       if (extc > exte)
00547          count = 0;             /* force exit */
00548 
00549    } while (count);
00550 }

EXTERNAL INLINE void cfsa ( const int  f,
const int  ext,
unsigned long *  d,
int *  q 
)

Control Full Operation.

24 bit operation on a given external CAMAC address.

The range of the f is hardware dependent. The number indicated below are for standard ANSI/IEEE Std (758-1979) Execute cam24i for f<8, cam24o for f>15, camc_q for (f>7 or f>23)

Parameters:
f function code (0..31)
ext external address
d data long word
q Q response
Returns:
void

Definition at line 165 of file esone.c.

Referenced by cfga(), cfubc(), and cfubr().

00166 {
00167    int b, c, n, a, x;
00168 
00169    if (f < 8) {
00170       /* read */
00171       came_ext(ext, &b, &c, &n, &a);
00172       cam24i_q(c, n, a, f, d, &x, q);
00173    } else if (f > 15) {
00174       /* write */
00175       came_ext(ext, &b, &c, &n, &a);
00176       cam24o_q(c, n, a, f, *d, &x, q);
00177    } else if ((f > 7) || (f > 23)) {
00178       /* command */
00179       came_ext(ext, &b, &c, &n, &a);
00180       camc_q(c, n, a, f, q);
00181    }
00182 }

EXTERNAL INLINE void cfubc ( const int  f,
int  ext,
int  intc[],
int  cb[] 
)

Control Full (24bit) Block Repeat with Q-stop.

Execute function f on address ext with data intc[] while Q.

Parameters:
f function code
ext external address array
intc[] data array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 618 of file esone.c.

00619 {
00620    int count, q;
00621 
00622    count = cb[0];
00623    do {
00624       cfsa(f, ext, (unsigned long *) intc, &q);
00625       if (q == 0)
00626          count = 0;             /* stop on no q */
00627       else {
00628          ++cb[1];               /* increment tally count */
00629          ++intc;                /* next data array */
00630          --count;
00631       }
00632    } while (count);
00633 }

EXTERNAL INLINE void cfubr ( const int  f,
int  ext,
int  intc[],
int  cb[] 
)

Repeat Mode Block Transfer (24bit).

Execute function f on address ext with data intc[] if Q. If noQ keep current intc[] data. Repeat cb[0] times.

Parameters:
f function code
ext external address array
intc[] data array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 681 of file esone.c.

00682 {
00683    int q, count;
00684 
00685    count = cb[0];
00686    do {
00687       do {
00688          cfsa(f, ext, (unsigned long *) intc, &q);
00689       } while (q == 0);
00690 
00691       ++cb[1];                  /* increment tally count */
00692       ++intc;                   /* next data array */
00693       --count;
00694    } while (count);
00695 }

EXTERNAL INLINE void csga ( int  f[],
int  exta[],
int  intc[],
int  qa[],
int  cb[] 
)

Control (16bit) word General Action.

Parameters:
f function code
exta[] external address array
intc[] data array
qa[] Q response array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 490 of file esone.c.

00491 {
00492    int i;
00493 
00494    for (i = 0; i < cb[0]; i++)
00495       cssa(f[i], exta[i], (unsigned short *) (&(intc[i])), &(qa[i]));
00496 
00497    cb[1] = cb[0];
00498 }

EXTERNAL INLINE void csmad ( int  f,
int  extb[],
int  intc[],
int  cb[] 
)

Control (16bit) Address Q scan.

Scan all sub-address while Q=1 from a0..a15 max from address extb[0] and store corresponding data in intc[]. If Q=0 while A<15 or A=15 then cross station boundary is applied (n-> n+1) and sub-address is reset (a=0). Perform action until either cb[0] action are performed or current external address exceeds extb[1].

implementation of cb[2] for LAM recognition is not implemented.

Parameters:
f function code
extb[] external address array
extb[0] : first valid external address
extb[1] : last valid external address
intc[] data array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 573 of file esone.c.

00574 {
00575    int j, count;
00576    int x, q, b, c, n, a;
00577    unsigned long exts, extc, exte;
00578 
00579    exts = extb[0];
00580    exte = extb[1];
00581    count = cb[0];
00582    j = 0;
00583    came_ext(exts, &b, &c, &n, &a);
00584    do {
00585       cam16i_q(c, n, a, f, (unsigned short *) &intc[j], &x, &q);
00586       if (q == 0) {
00587          a = 0;                 /* set subaddress to zero */
00588          n++;                   /* select next slot */
00589          j++;
00590       } else {
00591          a++;                   /* increment address */
00592          ++cb[1];               /* increment tally count */
00593          ++intc;                /* next data array */
00594          --count;
00595       }
00596       came_cn((int *) &extc, b, c, n, a);
00597 
00598       if (extc > exte)
00599          count = 0;             /* force exit */
00600 
00601    } while (count);
00602 }

EXTERNAL INLINE void cssa ( const int  f,
int  ext,
unsigned short *  d,
int *  q 
)

Control Short Operation.

16 bit operation on a given external CAMAC address.

The range of the f is hardware dependent. The number indicated below are for standard ANSI/IEEE Std (758-1979) Execute cam16i for f<8, cam16o for f>15, camc_q for (f>7 or f>23)

Parameters:
f function code (0..31)
ext external address
d data word
q Q response
Returns:
void

Definition at line 130 of file esone.c.

Referenced by csga(), csubc(), and csubr().

00131 {
00132    int b, c, n, a, x;
00133 
00134    if (f < 8) {
00135       /* read */
00136       came_ext(ext, &b, &c, &n, &a);
00137       cam16i_q(c, n, a, f, d, &x, q);
00138    } else if (f > 15) {
00139       /* write */
00140       came_ext(ext, &b, &c, &n, &a);
00141       cam16o_q(c, n, a, f, *d, &x, q);
00142    } else if ((f > 7) || (f > 23)) {
00143       /* command */
00144       came_ext(ext, &b, &c, &n, &a);
00145       camc_q(c, n, a, f, q);
00146    }
00147 }

EXTERNAL INLINE void csubc ( const int  f,
int  ext,
int  intc[],
int  cb[] 
)

Control (16bit) Block Repeat with Q-stop.

Execute function f on address ext with data intc[] while Q.

Parameters:
f function code
ext external address array
intc[] data array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 649 of file esone.c.

00650 {
00651    int count, q;
00652 
00653    count = cb[0];
00654    do {
00655       cssa(f, ext, (unsigned short *) intc, &q);
00656       if (q == 0)
00657          count = 0;             /* stop on no q */
00658       else {
00659          ++cb[1];               /* increment tally count */
00660          ++intc;                /* next data array */
00661          --count;
00662       }
00663    } while (count);
00664 }

EXTERNAL INLINE void csubr ( const int  f,
int  ext,
int  intc[],
int  cb[] 
)

Repeat Mode Block Transfer (16bit).

Execute function f on address ext with data intc[] if Q. If noQ keep current intc[] data. Repeat cb[0] times.

Parameters:
f function code
ext external address array
intc[] data array
cb[] control block array
cb[0] : number of function to perform
cb[1] : returned number of function performed
Returns:
void

Definition at line 712 of file esone.c.

00713 {
00714    int q, count;
00715 
00716    count = cb[0];
00717    do {
00718       do {
00719          cssa(f, ext, (unsigned short *) intc, &q);
00720       } while (q == 0);
00721 
00722       ++cb[1];                  /* increment tally count */
00723       ++intc;                   /* next data array */
00724       --count;
00725    } while (count);
00726 }

EXTERNAL INLINE void ctcd ( const int  ext,
int *  l 
)

Control Test Crate D.

Test Crate Demand.

Parameters:
ext external address
l D cleared -> l=0, D set -> l=1
Returns:
void

Definition at line 289 of file esone.c.

00290 {
00291    int b, c, n, a;
00292 
00293    came_ext(ext, &b, &c, &n, &a);
00294    *l = cam_interrupt_test(c);
00295 }

EXTERNAL INLINE void ctci ( const int  ext,
int *  l 
)

Test Crate I.

Test Crate Inhibit, Execute cam_inhibit_test()

Parameters:
ext external address
l action l=0 -> Clear I, l=1 -> Set I
Returns:
void

Definition at line 249 of file esone.c.

00250 {
00251    int b, c, n, a;
00252 
00253    came_ext(ext, &b, &c, &n, &a);
00254    *l = cam_inhibit_test(c);
00255 }

EXTERNAL INLINE void ctgl ( const int  ext,
int *  l 
)

Control Test Demand Present.

Test the LAM register.

Parameters:
ext external LAM register address
l l !=0 if any LAM is set.
Returns:
void

Definition at line 328 of file esone.c.

00329 {
00330    int b, c, n, a;
00331    unsigned long lam;
00332 
00333    came_ext(ext, &b, &c, &n, &a);
00334    cam_lam_read(c, &lam);
00335    *l = (lam > 0);
00336 }

EXTERNAL INLINE void ctlm ( const int  lam,
int *  l 
)

Test LAM.

Test the LAM of the station pointed by lam. Performs an F8

Parameters:
lam external address
l No LAM-> l=0, LAM present-> l=1
Returns:
void

Definition at line 446 of file esone.c.

00447 {
00448    int b, c, n, a;
00449 
00450    came_ext(lam, &b, &c, &n, &a);
00451    camc_q(c, n, a, 8, l);
00452 }


Midas DOC Version 3.0.0 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Exaos Lee - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk