cnaf_callback.c File Reference

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

INT cnaf_callback ( INT  index,
void *  prpc_param[] 
)

Definition at line 24 of file cnaf_callback.c.

Referenced by register_cnaf_callback().

00025 {
00026    DWORD cmd, b, c, n, a, f, *pdword, *size, *x, *q, dtemp;
00027    WORD *pword, *pdata, temp;
00028    INT i, count;
00029 
00030    /* Decode parameters */
00031    cmd = CDWORD(0);
00032    b = CDWORD(1);
00033    c = CDWORD(2);
00034    n = CDWORD(3);
00035    a = CDWORD(4);
00036    f = CDWORD(5);
00037    pdword = CPDWORD(6);
00038    pword = CPWORD(6);
00039    pdata = CPWORD(6);
00040    size = CPDWORD(7);
00041    x = CPDWORD(8);
00042    q = CPDWORD(9);
00043 
00044    /* determine repeat count */
00045    if (index == RPC_CNAF16)
00046       count = *size / sizeof(WORD);     /* 16 bit */
00047    else
00048       count = *size / sizeof(DWORD);    /* 24 bit */
00049 
00050    switch (cmd) {
00051     /*---- special commands ----*/
00052 
00053    case CNAF_INHIBIT_SET:
00054       cam_inhibit_set(c);
00055       break;
00056    case CNAF_INHIBIT_CLEAR:
00057       cam_inhibit_clear(c);
00058       break;
00059    case CNAF_CRATE_CLEAR:
00060       cam_crate_clear(c);
00061       break;
00062    case CNAF_CRATE_ZINIT:
00063       cam_crate_zinit(c);
00064       break;
00065 
00066    case CNAF_TEST:
00067       break;
00068 
00069    case CNAF:
00070       if (index == RPC_CNAF16) {
00071          for (i = 0; i < count; i++)
00072             if (f < 16)
00073                cam16i_q(c, n, a, f, pword++, (int *) x, (int *) q);
00074             else if (f < 24)
00075                cam16o_q(c, n, a, f, pword[i], (int *) x, (int *) q);
00076             else
00077                cam16i_q(c, n, a, f, &temp, (int *) x, (int *) q);
00078       } else {
00079          for (i = 0; i < count; i++)
00080             if (f < 16)
00081                cam24i_q(c, n, a, f, pdword++, (int *) x, (int *) q);
00082             else if (f < 24)
00083                cam24o_q(c, n, a, f, pdword[i], (int *) x, (int *) q);
00084             else
00085                cam24i_q(c, n, a, f, &dtemp, (int *) x, (int *) q);
00086       }
00087 
00088       break;
00089 
00090    case CNAF_nQ:
00091      if (index == RPC_CNAF16) {
00092        if (f < 16) {
00093          cam16i_rq(c, n, a, f, &pword, count);
00094          *size = (POINTER_T) pword - (POINTER_T) pdata;
00095        }
00096      } else {
00097        if (f < 16) {
00098          cam24i_rq(c, n, a, f, &pdword, count);
00099          *size = (POINTER_T) pdword - (POINTER_T) pdata;
00100        }
00101      }
00102      
00103      /* return reduced return size */
00104      break;
00105      
00106    default:
00107      printf("cnaf: Unknown command 0x%X\n", (unsigned int) cmd);
00108    }
00109 
00110    if (cnaf_debug) {
00111       if (index == RPC_CNAF16)
00112          printf("cmd=%d r=%d c=%d n=%d a=%d f=%d d=%X x=%d q=%d\n",
00113                 (int) cmd, (int) count, (int) c, (int) n, (int) a, (int) f,
00114                 (int) pword[0], (int) *x, (int) *q);
00115       else if (index == RPC_CNAF24)
00116          printf("cmd=%d r=%d c=%d n=%d a=%d f=%d d=%X x=%d q=%d\n",
00117                 (int) cmd, (int) count, (int) c, (int) n, (int) a, (int) f,
00118                 (int) pdword[0], (int) *x, (int) *q);
00119    }
00120 
00121    return RPC_SUCCESS;
00122 }

void register_cnaf_callback ( int  debug  ) 

Definition at line 124 of file cnaf_callback.c.

00125 {
00126    cnaf_debug = debug;
00127    /* register CNAF callback */
00128    cm_register_function(RPC_CNAF16, cnaf_callback);
00129    cm_register_function(RPC_CNAF24, cnaf_callback);
00130 }


Variable Documentation

int cnaf_debug = 0 [static]

Definition at line 22 of file cnaf_callback.c.

Referenced by cnaf_callback(), and register_cnaf_callback().


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