#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static long SUCCESS = 0; /*static long ERROR = -1;*/ #undef DEBUG #define NCAVS 8 long asub_cryo(struct aSubRecord *prec) { short rfstate[NCAVS] = { *(short *)prec->a, *(short *)prec->b, *(short *)prec->c, *(short *)prec->d, *(short *)prec->e, *(short *)prec->f, *(short *)prec->g, *(short *)prec->h }; short gdata[NCAVS] = { *(short *)prec->i, *(short *)prec->j, *(short *)prec->k, *(short *)prec->l, *(short *)prec->m, *(short *)prec->n, *(short *)prec->o, *(short *)prec->p }; long *sum = (long *)prec->vala; /* Status word sent to cryo system */ long *procmask = (long *)prec->valb; /* Determines which records get processed next */ long oldsum = *(long *)prec->ovla; /* TODO: clear gdata bits after asub processes */ /* TODO: work out processing of RFstate */ int i; *sum = 0; /* Initialize to RF-off */ *procmask = 0; /* Initialize to do-not-send-gradient */ if ( prec->tpro > 1 ) printf("Enter %s: old output %li\n", prec->name, oldsum); for ( i = 0; i < NCAVS; i++ ){ *sum |= (!rfstate[i])<tpro >= 5 ) printf("Or-ed in rf state bit %i; new value %li\n", i, *sum); if ( gdata[i] ) { /* If new gradient data, update heartbeat, and write gradient value to cryo */ *sum |= 1<<(i + 8); if ( prec->tpro >= 5 ) printf("Or-ed in new-gradient-calc bit %i; new sum %li\n", i, *sum); *procmask |= 1<