Beispiel #1
0
/******************************************************************
*
*   File Contains the Enter 
* Sample#   Rack# Zone# TrayIndex Volume Flow 
*     e.g.
*   sampleloc is an encoded number
*    lsw, 10k-1k digits are sample type
*         100-1  Tray Location (loc)
*
*    hsw,  1k digit rack zone (1-3)
*	   100 digit rack location on Gilson
*	   10-1 racktype 1-36  
*         
*    long  100 - 1 	Location
*          10k - 1k 	Sample Type
*           1m - 100k 	Rack Type
*          	  10m 	Rack Position
*         	 100m 	Zone of rack
*
*/
int gilSampleSetup(unsigned int sampleloc, char *sampleDir)
{
   
    int racktype,zone,rackLoc,sampType,loc;
    int sampIndex,rackIndex;
    int maxzone,maxsample;

    double zspeed;

    /* if haven't malloc space for SampleInfoFile yet then do so */
    if (SampleInfoFile == NULL)
        SampleInfoFile = (char *) malloc(512);

    /* gilShow(1); */

    /* Decode sample value into gilson rack & sample parameters */
    /* rrzzllll */

    /* Decode sample value into gilson rack & sample parameters */
    loc = sampleloc % 10000;  /* get location */

    /* rr000000 */
    rackLoc = (sampleloc / 1000000) % 100L;

    /* rrzz0000 */
    zone = (sampleloc / 10000L) % 100L;

    sprintf(SampleInfoFile, "%s%s%s%d_%d_%d", systemdir, "/asm/info/",
            sampleDir, rackLoc, zone, loc);
    DPRINT4(1, "\ngilSampleSetup: sampdecode: rackloc: %d,  zone: %d,  "
               "sample: %d,  samplefile: '%s'\n",
            rackLoc, zone, loc, SampleInfoFile);

    return(0);
}
Beispiel #2
0
int gilShow(int level)
{
    int location, type;
    int i,j;

    DPRINT(0,"Defined Racks: \n");
    for(j=0;j<g215Bed.NumRacks;j++)
    {

        DPRINT4(0,"Rack[%d]: 0x%lx, Id: '%s', Type: %d\n", j,
            g215Bed.DefinedRacks[j].pRackObj,
            g215Bed.DefinedRacks[j].IdStr,
            g215Bed.DefinedRacks[j].type);
    }

    DPRINT(0,"\n\nCenters: \n");
    DPRINT3(0,"Injector: X: %d, Y: %d, Z: %d\n",
        g215Bed.InjectorCenter[0],
        g215Bed.InjectorCenter[1],
        g215Bed.InjectorBot);
    DPRINT2(0,"1st Rack: X: %d, Y: %d\n",
	g215Bed.Rack1Center[0],
        g215Bed.Rack1Center[1]);

    DPRINT(0,"Loaded Racks: \n");
    for(j=0;j<GIL_MAX_RACKS;j++)
    {

        if (g215Bed.LoadedRacks[j] != NULL)
            DPRINT2(0,"Rack[%d]: 0x%lx \n", j, g215Bed.LoadedRacks[j]);
    }

    return 0;
}
Beispiel #3
0
/**************************************************************
*
*  dataInitial - Initializes the Data Object, based on the experiment
*
*
*  This routine initializes the DATA Object base on the experimental
*parameters. The parameters:
*   <fidSize> is the smallest FID size (bytes) for the experiment
*   <totalFidBlks> is the total number of fid blocks to acquire. 
*  Note: <totalFidBlks> is NOT the number of FID Elements but instead
*the number of FID elements times the number of blocksizes (nt/bs). 
*E.G. arraydim=10,nt=32 & bs=8 then <totalFidBlks> = 10 * (32/8) = 40
*
*
* RETURNS:
*  OK or ERROR
*
*	Author Greg Brissey 8/5/93
*/
int dataInitial(DATAOBJ_ID pStmId, ulong_t totalFidBlks, ulong_t fidSize)
/* DATAOBJ_ID 	pStmId - data Object identifier */
/* totalFidBlks Number of FID BLocks to be acquired */
/* fidSize Size of FID in bytes */
{
   char *addr;
   long maxNumFidBlkToAlloc;
   long i;
   FID_STAT_BLOCK *pStatBlk; /* pointer to FID Entry */

   extern long maxBufSize();

   if (pStmId == NULL)
     return(ERROR);

   DPRINT2(-1,"dataInitial: nFids: %lu, size: %lu\n", totalFidBlks, fidSize);
   /*
      The msg Q That the ISR use to pass on Info is Passed as an Argument
      it is Owned by the Uplinker
	e.g. interrupt type, CT or NT, Tag value
   */

   maxNumFidBlkToAlloc = maxBufSize(fidSize, totalFidBlks,pStmId->dspMemSize);
   DPRINT4(-1,"maxBufSize: fidsize: %lu, fidblks: %lu, stm memsize: %lu, maxNumFidBlkToAlloc: %ld\n",
		fidSize,totalFidBlks,pStmId->dspMemSize,maxNumFidBlkToAlloc);

   /* if requested number is greater than already exist will need to realloc */
   if (maxNumFidBlkToAlloc > pStmId->maxFreeList)
   {
      if (reAllocateResources(pStmId,maxNumFidBlkToAlloc))
      {
         dataFreeAllRes(pStmId);
         errLogSysRet(LOGIT,debugInfo,
	    "stmInitial: A resource could not be Allocated");
         return(ERROR);
      }
   }

   /* Fill Free List with the list of Tag Values (0 to maxNumFidBlk...) */
   pStmId->maxFidBlkBuffered = maxNumFidBlkToAlloc;
   rngXBlkFlush(pStmId->pTagFreeList); 
   for (i=0; i<maxNumFidBlkToAlloc; i++)
   {
       rngXBlkPut(pStmId->pTagFreeList, &i, 1); 
   }

   /* Mark all StatBlocks as Not Allocated */
   for (i=0; i<maxNumFidBlkToAlloc; i++)
   {
       pStatBlk = &((pStmId->pStatBlkArray)[i]);
       pStatBlk->doneCode = NOT_ALLOCATED;
       pStatBlk->errorCode = 0;
       pStatBlk->fidAddr = NULL;
       pStatBlk->dataSize = fidSize;	 /* FID size in bytes */
       pStatBlk += sizeof(FID_STAT_BLOCK);
   }
   return( OK );
}
Beispiel #4
0
void
TheGrimReaper(void* arg)
{
    int coredump;
    int pid;
    int status;
    int termsig;
    int kidstatus;

    DPRINT(1,"|||||||||||||||||||  SIGCHLD   ||||||||||||||||||||||||\n");
    DPRINT(1,"TheGrimReaper(): At Work !!!\n");

    /* --- GrimReaper get all exited or signal children before leaving --- */
    /*     Note:  1st argument to waitpid is -1 to specify any child process.  */
 
    while ((pid = waitpid( -1, &kidstatus, WNOHANG | WUNTRACED )) > 0)
    {
        if ( WIFSTOPPED(kidstatus) ) /* Is this an exiting or stopped Process */
           continue;             /* If a STOPPED Process go to next waitpid() */
 
        /* if non-zero if normal termination of child */
        if (WIFEXITED( kidstatus ) != 0)
          status = WEXITSTATUS( kidstatus );
        else
          status = 0;

        /* child terminated due to an uncaught signal */
        if (WIFSIGNALED( kidstatus ) != 0)
        {
          termsig = WTERMSIG( kidstatus );
          coredump = WCOREDUMP( kidstatus );
        }
        else
        {
          coredump = termsig = 0;
        }

        DPRINT4(1,"TheGrimReaper: Child Pid: %d, Status: %d, Core Dumped: %d, Termsig: %d\n",
            	pid,status,coredump,termsig);
        if (pid == VnmrPid)
        {
           DPRINT(1,"Child is VNMR, Update doneQ, call Resume to check psgQ\n");
	   VnmrPid = 0;		/* clear pid */
	   Resume("");		/* call Resume to allow checking of psgQ */
        }
   }
   return;
}
Beispiel #5
0
/*
 *  Find and Exec a function in the System Symbol Table
 *
 */
int execFunc(char *funcName, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6, void *arg7, void *arg8)
{
    int stat;
    char *addr,type;
    PFIentry   pFuncEntry;

    /* function name in the sysmbol table, obtain entry point if present */
    stat = symFindByName(sysSymTbl,funcName,&addr,&type);
    if ((stat != 0) || (addr == NULL))
        return(-1);

    DPRINT4(2,"execFunc()  stat: %d from sysFindByname('%s'): Addr: 0x%lx, Type: %d\n",stat,funcName,addr,type);
    pFuncEntry = (PFIentry) addr;
    stat =  (*pFuncEntry)(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
    return(stat);
}
Beispiel #6
0
/*
 * read file data into  buffer using Posix Thread Safe pread() routine
 *
 *      Author:  Greg Brissey
 */
int fFileRead(FILE_ID md,char *data, int bytelen, long long offset)
{
   ssize_t bytes;
   if (md == NULL)
      return(-1);

   if (md->fd < 0)
     return(-1);

   /* bytes = pread(md->fd,(void*) data,(size_t) bytelen, (off_t) md->offsetAddr); */
   DPRINT4(1,"fFileRead(fd: %d, dataAddr: 0x%lx, len: %d, offset: %lu\n",
		md->fd,data,bytelen,(unsigned long) offset);

   bytes = pread(md->fd,(void*) data,(size_t) bytelen, offset);
 
   return((int) bytes);
}
Beispiel #7
0
/*
 * write buffer out to File using Posix Thread Safe pwrite() routine
 *
 *      Author:  Greg Brissey
 */
int fFileWrite(FILE_ID md,char *data, int bytelen, long long offset)
{
   ssize_t bytes;
   if (md == NULL)
      return(-1);

   if (md->fd < 0)
     return(-1);

   /* bytes = pwrite(md->fd,(const void*) data,(size_t) bytelen, (off_t) md->offsetAddr); */
   DPRINT4(1,"fFileWrite(fd: %d, dataAddr: 0x%lx, len: %d, offset: %lld\n",
		md->fd,data,bytelen, offset);

   bytes = pwrite(md->fd,(const void*) data,(size_t) bytelen, offset);
 
   return((int) bytes);
}
Beispiel #8
0
/**************************************************************
*
*  dataFreeFidBlk - Frees all STM resources associated with the FID Block
*
*  This routines Frees the STM resources associated with a FID Block
* reference thought its index. This includes:
*  1. Marking the Stat Block as NOT_ALLOCATED
*  2. Place the Tag value back into the Tag Free List
*
* NOTE: A Task calling this routine could block if the FID 
*	Block Free List is full.
*
*  RETURNS
*    OK  or ERROR
*/
int dataFreeFidBlk(DATAOBJ_ID pStmId,long tag)
/* pStmId - stm Object Id */ 
/* tag - index to the FID Block, etc.. */
{
  FID_STAT_BLOCK *pStatBlk;

  if (pStmId == NULL)
     return(ERROR);

  if (tag < 0)
     return(-1);
  pStatBlk = &((pStmId->pStatBlkArray)[tag]);
  pStatBlk->doneCode = NOT_ALLOCATED;
  pStatBlk->errorCode = 0;
  rngXBlkPut(pStmId->pTagFreeList,(long*) &tag,1);
  DPRINT4(1,"stmFreeFidBlk: Tag: %d, FID Addr: 0x%lx, size: %ld (0x%lx)\n",
	tag,pStatBlk->fidAddr,pStatBlk->dataSize,pStatBlk->dataSize);
  return( OK );
}
Beispiel #9
0
/*****************************************************************************
 * rack file
 *
 * rack_type rack_pathname injector_port/rack_index X-center Y-center Z-bottom
 *
 * e.g.:
 *  injector /vnmr/asm/racks/m215_inj.grk 1 Center X, Center Y (5576 38)
 *  rack /vnmr/asm/racks/code_205.grk  1 546 1872
 *  rack /vnmr/asm/racks/code_201.grk  2 546+(1*1196) 1872
 *  rack /vnmr/asm/racks/code_204.grk  3 546+(2*1196) 1872
 *  rack /vnmr/asm/racks/code_202.grk  4 546+(3*1196) 1872
 *  rack /vnmr/asm/racks/code_209.grk  5 546+(4*1196) 1872
 *
 ****************************************************************************/
int readRacks(char *rackpath)
{
    FILE *stream;
    struct stat s;
    char eolch;
    char textline[256],buffer[256],path[256];
    char *rackstype,*racktype,*filepath,*port_rack,*X,*Y,*Z;
    char *rackIdStr,*chrptr;
    int status,line,j,t,typefound,len;
    int portnum, xcenter, ycenter, bot;
    int xAxis,yAxis;
    int rackType,rackIndex;
    int sampType,sampIndex;
    int numSRacks;
    

    j=0;
    line = 0;
    numSRacks = 0;

    stat(rackpath, &s);
    DPRINT3(1,"'%s': MDate: %ld, File: %ld \n",rackpath,MDate,s.st_mtime);
    if (s.st_mtime <= MDate) {
        DPRINT(1,"File has not changed.\n");
        return(0);
    }
    DPRINT(1,"File has Changed.\n");

    stream = fopen(rackpath,"r");

    /* does file exist? */
    if (stream == NULL) {
        errLogSysRet(LOGOPT,debugInfo,
           "initRacks: setup file '%s' could not be opened.", rackpath);
        return(ERROR);
    }
 
    while ( ( chrptr = fgets(textline, 256, stream) )  != NULL) {

        /* note: the CR is included in textline */
        j++;

        if ( (len = strlen(textline)) < 15)
            continue;

        if (textline[0] == '#')  /* # then it's a comment */
            continue;

        /* extract the string tokens, Prompt and Text */
        rackstype = (char*) strtok(textline," \n");
        if ( rackstype == NULL )
            continue;

        racktype = (char*) strtok(NULL," \n");
        if ( racktype == NULL )
            continue;

        filepath = (char*) strtok(NULL," \n");
        if ( filepath == NULL )
            continue;

        DPRINT4(1,"\n\n Nracks: %d, Rack: '%s', Type: '%s', filepath: '%s'\n",
                g215Bed.NumRacks,rackstype,racktype,filepath);

        X = (char*) strtok(NULL," \n");
        Y = (char*) strtok(NULL," \n");
        Z = (char*) strtok(NULL," \n");
        port_rack = (char*) strtok(NULL," \n");

        rackType = atoi(racktype);
        if ((rackType < 0) || (rackType > 37)) {
            errLogRet(LOGOPT, debugInfo, "initRacks: Rack Type of "
                                         "Range(0-37): %d \n", rackType);
            fclose(stream);
            return(ERROR);
        }

        strcpy(buffer, filepath);
        rackIdStr = strtok(buffer,"_");
        /* DPRINT1(1,"Id prefix: '%s'\n",rackIdStr); */
        rackIdStr = strtok(NULL,".");
        /* DPRINT1(1,"Id string: '%s'\n",rackIdStr); */
   
        for (typefound=rackIndex=0; rackIndex<g215Bed.NumRacks; rackIndex++) {

            DPRINT4(1,"Index: %d, Type: %d, Defined Type: %d, '%s'\n",
                    rackIndex, rackType, g215Bed.DefinedRacks[rackIndex].type,
                    g215Bed.DefinedRacks[rackIndex].IdStr);

            if (g215Bed.DefinedRacks[rackIndex].type == rackType) {
                typefound = 1;
                break;
            }
        } 

        /* Centers depths etc. for Injector or rack */
        if (rackType == 0)  /* Injector */ {

            portnum = atoi(port_rack);
            xcenter = atoi(X);
            ycenter = atoi(Y);
            bot = atoi(Z);

            DPRINT4(1,"Port: %d, center: X=%d, Y=%d, Bottom: %d\n",
                    portnum, xcenter, ycenter, bot);

            g215Bed.InjectorCenter[0] = xcenter; /* Center of Injector */
            g215Bed.InjectorCenter[1] = ycenter; /* Center of Injector */
            g215Bed.InjectorBot = bot;           /* Bottom of Injector */

            if (typefound) {
                rackCenter(g215Bed.DefinedRacks[rackIndex].pRackObj,
                           xcenter, ycenter); /* 5565 */
                xAxis = rackGetX(g215Bed.DefinedRacks[rackIndex].pRackObj,
                                 1, portnum);
                yAxis = rackGetY(g215Bed.DefinedRacks[rackIndex].pRackObj,
                                 1, portnum);
                DPRINT3(1,"Inject Loc: X=%d, Y=%d, Bottom: %d\n",
                        xAxis,yAxis,bot);

                gilInitInjLoc(pGilObjId,xAxis, yAxis, bot);
            }
        }
        else {
            numSRacks++;

            if ( X != NULL )
                xcenter = atoi(X);
            else
                xcenter = -1;
   
            if ( Y != NULL )
                ycenter = atoi(Y);
            else
                ycenter = -1;

            DPRINT4(1,"NumRacksRead: %d, rackIndex: %d, Center: X=%d, Y=%d\n",
                    numSRacks, rackIndex, xcenter, ycenter);

            if ((xcenter != -1) && (ycenter != -1)) {
                g215Bed.Rack1Center[0] = xcenter; /* Center of Well */
                g215Bed.Rack1Center[1] = ycenter; /* Center of Well */
            }
        }

        if (typefound != 1) {
            /* rack IdStr e.g. 205, 205h, adpt2, etc. */
            strncpy(g215Bed.DefinedRacks[g215Bed.NumRacks].IdStr,
                    rackIdStr, 80);
            g215Bed.DefinedRacks[g215Bed.NumRacks].type = rackType;

            DPRINT4(1, "Adding racktype: '%s', Idstr: '%s', type: %d, "
                       "path: '%s'\n", rackstype, 
                    g215Bed.DefinedRacks[g215Bed.NumRacks].IdStr, 
                    g215Bed.DefinedRacks[g215Bed.NumRacks].type, filepath);

            DPRINT1(1,"rack definition file: '%s'\n", filepath);
         
            if ( (g215Bed.DefinedRacks[g215Bed.NumRacks].pRackObj =
                  rackCreate(filepath)) == NULL) {

                DPRINT1(1, "initRacks: Unable to Initialize Rack: '%s'\n",
                          filepath);
                fclose(stream);
                return(-1);
            }

            if (rackType == 0)  /* Injector */ {

                rackCenter(g215Bed.DefinedRacks[g215Bed.NumRacks].pRackObj,
                           xcenter, ycenter);
                xAxis = rackGetX(
                            g215Bed.DefinedRacks[g215Bed.NumRacks].pRackObj,
                            1, portnum);
                yAxis = rackGetY(
                            g215Bed.DefinedRacks[g215Bed.NumRacks].pRackObj,
                            1, portnum);
                DPRINT3(1,"Inject Loc: X=%d, Y=%d, Bottom: %d\n",
                        xAxis, yAxis, bot);

                gilInitInjLoc(pGilObjId, xAxis, yAxis, bot);
            }

            g215Bed.NumRacks++;
        }
    }

    fclose(stream);
    /* gilShow(0); */
    MDate = s.st_mtime;

    /*------------ HERMES - READ RACK DELTAS FROM CONFIG FILE -------------*/
    sprintf(path, "%s/asm/info/liqhandlerInfo", systemdir);
    stream = fopen(path, "r");
    if (stream != NULL) {
        int x1,y1,x2,y2,x3,y3,x4,y4;
        if ((fscanf(stream, "%[^\n]\n", textline) != 1) ||
            (fscanf(stream, "X1Delta:  %d\r\n", &x1) != 1) ||
            (fscanf(stream, "Y1Delta:  %d\r\n", &y1) != 1) ||
            (fscanf(stream, "X2Delta:  %d\r\n", &x2) != 1) ||
            (fscanf(stream, "Y2Delta:  %d\r\n", &y2) != 1) ||
            (fscanf(stream, "X3Delta:  %d\r\n", &x3) != 1) ||
            (fscanf(stream, "Y3Delta:  %d\r\n", &y3) != 1) ||
            (fscanf(stream, "X4Delta:  %d\r\n", &x4) != 1) ||
            (fscanf(stream, "Y4Delta:  %d\r\n", &y4) != 1)) {
            DPRINT3(0, "\r\nError reading 768AS liquid handler "
                    "setup file %s %d %s\r\n", path, errno,
                    strerror(errno));
        }
        else {
            rackDelta[0][0] = x1; rackDelta[0][1] = y1;
            rackDelta[1][0] = x2; rackDelta[1][1] = y2;
            rackDelta[2][0] = x3; rackDelta[2][1] = y3;
            rackDelta[3][0] = x4; rackDelta[3][1] = y4;
        }

        fclose(stream);
    }

    return (0);
}
Beispiel #10
0
char *find_and_load(const char *path, unsigned *size, int *dataOffset)
{
  char *buffer;
  DPRINT1(3,"find_and_load(%s)\n", path);
  *dataOffset = 0;
  if (strncmp(ICAT_DEV_PREFIX,path,sizeof(ICAT_DEV_PREFIX)-1) == 0)
    {
      const char *filename = path+sizeof(ICAT_DEV_PREFIX)-1;
      buffer = readIsfFile(filename,size,dataOffset);
      DPRINT4(3,"readIsfFile(%s) returned %d bytes offset %d @0x%x\n", filename, *size, *dataOffset, buffer);
    }
  else if (strncmp(FLASH_DEV_PREFIX,path,sizeof(FLASH_DEV_PREFIX)-1) == 0)
    {
      FFSHANDLE fileHdl;
      unsigned cnt;
      const char *filename = path+sizeof(FLASH_DEV_PREFIX)-1;
      
      if ((fileHdl = vfOpenFile((char *)filename)) == NULL)
	{
	  *size = 0;
	  return NULL;
	}

      *size = vfFilesize(fileHdl);
      if ((buffer = (char *) malloc(*size)) == NULL)
	{
	  vfCloseFile(fileHdl);
	  *size = 0;
	  return NULL;
	}

      vfReadFile(fileHdl,0,buffer,*size,&cnt);
      if (cnt != *size)
	{
	  free(buffer);
	  vfCloseFile(fileHdl);
	  *size = 0;
	  return 0;
	}

      vfCloseFile(fileHdl);
    }
  else
    {
      FILE *fp;
      const char* filename;
      if (strncmp(NFS_DEV_PREFIX,path,sizeof(NFS_DEV_PREFIX)-1) == 0)
	filename = path+sizeof(NFS_DEV_PREFIX)-1;
      else
	filename = path;

      if ((fp = fopen(filename,"r")) == NULL)
	{
	  *size = 0;
	  return NULL;
	}

      fseek(fp,0,SEEK_END);
      *size = ftell(fp);
      fseek(fp,0,SEEK_SET);
      if ((buffer = malloc(*size+1)) == NULL)
	{
	  *size = 0;
	  fclose(fp);
	  return NULL;
	}
      if (fread(buffer,1,*size,fp) < *size)
	{
	  *size = 0;
	  free(buffer);
	  fclose(fp);
	  return NULL;
	}
      buffer[*size] = '\0';
      fclose(fp);
    }
  return buffer;
}
Beispiel #11
0
static int
readBondTableOverlay(char *filename)
{
  char buf[4096];
  char *token;
  int lineNumber = 0;
  int err;
  int protons;
  int group;
  int period;
  char *parentSymbol;
  char *symbol;
  char *name;
  double mass;
  double rvdW;
  double evdW;
  int nBonds;
  double rCovalent;
  double charge;
  int isVirtual;
  double ks;
  double r0;
  double de;
  double beta;
  double inflectionR;
  double x1;
  double y1;
  double x2;
  double y2;
  int quality;
  int quadratic;
  double ktheta;
  double theta0;
  double cutoffRadiusStart;
  double cutoffRadiusEnd;
  double value;
  double angleUnits = 1.0; // default to radians
  FILE *f = fopen(filename, "r");
  
  if (f == NULL) {
    // silent about not finding file
    return 0;
  }
  write_traceline("# reading parameter file: %s\n", filename);
  while (fgets(buf, 4096, f)) {
    lineNumber++;
    token = strtok(buf, " \n");
    if (token) {
      if (!strncmp(token, "#", 1) ) {
        continue;
      } else if (!strcmp(token, "units")) {
        err = 0;
        name = strtok(NULL, " \n");
        if (!strcmp(name, "degrees")) {
          angleUnits = Pi / 180.0;
        } else if (!strcmp(name, "radians")) {
          angleUnits = 1.0;
        } else {
          fprintf(stderr, "unknown unit at file %s line %d\n", filename, lineNumber);
        }
        if (err || name == NULL) {
          fprintf(stderr, "format error at file %s line %d\n", filename, lineNumber);
        }
      } else if (!strcmp(token, "element")) {
        err = 0;
        protons = tokenizeInt(&err);
        group = tokenizeInt(&err);
        period = tokenizeInt(&err);
        parentSymbol = strtok(NULL, " \n");
        symbol = strtok(NULL, " \n");
        name = strtok(NULL, " \n");
        mass = tokenizeDouble(&err);
        rvdW = tokenizeDouble(&err);
        evdW = tokenizeDouble(&err);
        nBonds = tokenizeInt(&err);
        rCovalent = tokenizeDouble(&err);
        charge = tokenizeDouble(&err);
        isVirtual = tokenizeInt(&err);
        if (err || symbol == NULL || name == NULL) {
          fprintf(stderr, "format error at file %s line %d\n", filename, lineNumber);
        } else {
          setElement(protons, group, period, parentSymbol, symbol, name, mass, rvdW, evdW, nBonds, rCovalent, charge, isVirtual);
          DPRINT13(D_READER, "setElement: %d %d %d %s %s %s %f %f %f %d %f %f %d\n", protons, group, period, parentSymbol, symbol, name, mass, rvdW, evdW, nBonds, rCovalent, charge, isVirtual);
        }
      } else if (!strcmp(token, "stretch")) {
        err = 0;
        ks = tokenizeDouble(&err);
        r0 = tokenizeDouble(&err);
        de = tokenizeDouble(&err);
        beta = tokenizeDouble(&err);
        inflectionR = tokenizeDouble(&err);
        quality = tokenizeInt(&err);
        quadratic = tokenizeInt(&err);
        name = strtok(NULL, " \n");
        if (err || name == NULL) {
          fprintf(stderr, "format error at file %s line %d\n", filename, lineNumber);
        } else {
          addInitialBondStretch(ks, r0, de, beta, inflectionR, quality, quadratic, name);
          DPRINT8(D_READER, "addBondStretch: %f %f %f %f %f %d %d %s\n", ks, r0, de, beta, inflectionR, quality, quadratic, name);

        }
      } else if (!strcmp(token, "bend")) {
        err = 0;
        ktheta = tokenizeDouble(&err);
        theta0 = tokenizeDouble(&err) * angleUnits;
        quality = tokenizeInt(&err);
        name = strtok(NULL, " \n");
        if (err || name == NULL) {
          fprintf(stderr, "format error at file %s line %d\n", filename, lineNumber);
        } else {
          addInitialBendData(ktheta, theta0, quality, name);
          DPRINT4(D_READER, "addBendData: %f %f %d %s\n", ktheta, theta0, quality, name);
        }
      } else if (!strcmp(token, "vdw")) {
        err = 0;
        rvdW = tokenizeDouble(&err);
        evdW = tokenizeDouble(&err);
        cutoffRadiusStart = tokenizeDouble(&err);
        cutoffRadiusEnd = tokenizeDouble(&err);
        name = strtok(NULL, " \n");
        if (err || name == NULL) {
          fprintf(stderr, "format error at file %s line %d\n", filename, lineNumber);
        } else {
          addVanDerWaalsInteraction(name, rvdW, evdW, cutoffRadiusStart, cutoffRadiusEnd);
          DPRINT5(D_READER, "addVanDerWaalsInteraction: %f %f %f %f %s\n", rvdW, evdW, cutoffRadiusStart, cutoffRadiusEnd, name);
        }
      } else if (!strcmp(token, "pattern")) {
        err = 0;
        name = strtok(NULL, " \n");
        value = tokenizeDouble(&err);
        if (err || name == NULL) {
          fprintf(stderr, "format error at file %s line %d\n", filename, lineNumber);
        } else {
          addPatternParameter(name, value, angleUnits, NULL);
          DPRINT2(D_READER, "addPatternParameter: %s %f\n", name, value);
        }
      } else if (!strcmp(token, "strut")) {
        err = 0;
        name = strtok(NULL, " \n");
        ks = tokenizeDouble(&err);
        r0 = tokenizeDouble(&err);
        x1 = tokenizeDouble(&err);
        y1 = tokenizeDouble(&err);
        x2 = tokenizeDouble(&err);
        y2 = tokenizeDouble(&err);
        if (err || name == NULL) {
          fprintf(stderr, "format error at file %s line %d\n", filename, lineNumber);
        } else {
          addStrutDefinition(name, ks, r0, x1, y1, x2, y2);
          DPRINT7(D_READER, "addStrutDefinition: %s %f %f %f %f %f %f\n", name, ks, r0, x1, y1, x2, y2);
        }
        //} else {
        //fprintf(stderr, "unrecognized line type at file %s line %d: %s\n", filename, lineNumber, token);
      }
    }
  }
  fclose(f);
  return 1;
}
Beispiel #12
0
/*-----------------------------------------------
|						|
|	     init2d_getfidparms()/2		|
|						|
|   This function initializes various data	|
|   parameters.					|
|						|
+----------------------------------------------*/
int init2d_getfidparms(int dis_setup)
{
  char		aig[5];
  int		r;
  double	rnp;
  double	hzpp;


  d2flag = FALSE;
  revflag = FALSE;
  ni = 1;


  if ( (r=P_getstring(CURRENT, "aig", aig, 1, 4)) )
  {
     if ( expdir_to_expnum(curexpdir) > 0 )
        P_err(r, "aig", ":");
     return(ERROR);
  }

  normflag = (aig[0] == 'n');

  if (P_getreal(CURRENT, "vpf", &vp, 1))
     C_GETPAR("vp", &vp);
  if (P_getreal(CURRENT, "vpfi", &vpi, 1))
     vpi = vp;
  C_GETPAR("vf", &vs);
  if (P_getreal(CURRENT, "crf", &cr, 1))
     C_GETPAR("cr", &cr);
  if (P_getreal(CURRENT, "deltaf", &delta, 1))
     C_GETPAR("delta", &delta);

  C_GETPAR("sf", &sp);
  C_GETPAR("wf", &wp);
  P_GETPAR("at", &sw);
  P_GETPAR("np", &rnp);

  fn = (int) (rnp + 0.5);

/**************************************
*  Initialize certain 2D parameters.  *
**************************************/

  rflrfp = 0.0;
  sw1 = 0.0;
  rflrfp1 = 0.0;
  fn1 = fn;

  hzpp = sw/(double) (fn/2);
  checkreal(&wp, 4.0*hzpp, sw-hzpp);
  wp = (double) ((int) (wp/hzpp + 0.01)) * hzpp;
  checkreal(&sp, rflrfp, sw-wp-hzpp);
  sp = (double) ((int) (sp/hzpp + 0.01)) * hzpp;
  if (dis_setup)
  {
     P_setreal(CURRENT, "wf", wp, 0);
     P_setreal(CURRENT, "sf", sp, 0);
  }

  set_fid_display();
  get_sfrq(HORIZ,&sfrq);
  get_scale_axis(HORIZ,&axisHoriz);
  axisVert = '\0';

  C_GETPAR("vo", &vo);
  C_GETPAR("ho", &ho);

  DPRINT4("np=%d, at=%g, rflrfp=%g, sfrq=%g\n",
                  fn,sw,rflrfp,sfrq);

  return(COMPLETE); 
}
Beispiel #13
0
/* spec	flag to distinguish spectra from fids */
int exp_factors( int spec)
/*****************/
{
  double	hzpp,
		hzpp1;
#ifdef VNMRJ

  if(spec) {
	frame_set_pnt();
  } else {

  dfpnt  = (int)((double)(mnumxpnts-right_edge)*(wcmax-sc-wc)/wcmax);
  dnpnt  = (int)((double)(mnumxpnts-right_edge)*wc/wcmax);
  dfpnt2 = (int)((double)(mnumypnts-ymin)*sc2/wc2max)+ymin;
  dnpnt2 = (int)((double)(mnumypnts-ymin)*wc2/wc2max);

  }

#else
  dfpnt  = (int)((double)(mnumxpnts-right_edge)*(wcmax-sc-wc)/wcmax);
  dnpnt  = (int)((double)(mnumxpnts-right_edge)*wc/wcmax);
  dfpnt2 = (int)((double)(mnumypnts-ymin)*sc2/wc2max)+ymin;
  dnpnt2 = (int)((double)(mnumypnts-ymin)*wc2/wc2max);
#endif

  if (dnpnt2 < 1)
    dnpnt2 = 1;

  if (dfpnt < 1)
    dfpnt = 1;
  if (dnpnt < 1)
    dnpnt = 1;
  if ((dfpnt + dnpnt) >= (mnumxpnts - right_edge - 2))
  {
    dnpnt = mnumxpnts - right_edge - 2 - dfpnt;
    if (dnpnt < 1)
    {
      dnpnt = 1;
      dfpnt = mnumxpnts - right_edge - 2 - dnpnt;
    }
  }

  DPRINT("chart parameters\n");
  DPRINT4("dfpnt=%d, dnpnt=%d, dfpnt2=%d, dnpnt2=%d\n",
                  dfpnt,dnpnt,dfpnt2,dnpnt2);

  hzpp = sw/((double)(fn/2));
  // don't know why added 1. It may make a difference for small fn
  npnt = (int)(wp/hzpp + 0.01) + 1;
  if(npnt<1) npnt = 1;

  if (get_axis_freq(HORIZ))
  {
     fpnt = (int)((sw-sp-rflrfp-wp)/hzpp + 0.01);
  }
  else
  {
     fpnt = (int)(sp/hzpp + 0.01);
  }

  DPRINT3("npnt=%d, fpnt=%d, hzpp=%g\n",npnt,fpnt,hzpp);

  if (d2flag)
  {
     hzpp1 = sw1/((double)(fn1/2));
    // don't know why added 1. It may make a difference for small fn
     npnt1 = (int)(wp1/hzpp1 + 0.01) + 1;
     if(npnt1<1) npnt1 = 1;

     if (get_axis_freq(VERT))
        fpnt1 = (int)((sw1-sp1-rflrfp1-wp1)/hzpp1 + 0.01);
     else
        fpnt1 = (int)(sp1/hzpp1 + 0.01);

     DPRINT3("npnt1=%d, fpnt1=%d, hzpp1=%g\n",npnt1,fpnt1,hzpp1);
  }

  return COMPLETE;
}
Beispiel #14
0
int main(int argc, char *argv[])
{
   char *tmpptr;
   struct stat statbuf;
   sigset_t    blockmask;
   void TheGrimReaper(void*);
   void processMsge(void*);
   void set_output();
 
   strncpy(ProcName,argv[0],256);
   ProcName[255] = '\0';

  /* --- mask to block SIGALRM, SIGIO and SIGCHLD interrupts --- */
  sigemptyset( &blockmask );
  sigaddset( &blockmask, SIGALRM );
  sigaddset( &blockmask, SIGIO );
  sigaddset( &blockmask, SIGCHLD );
  sigaddset( &blockmask, SIGQUIT );
  sigaddset( &blockmask, SIGPIPE );
  sigaddset( &blockmask, SIGALRM );
  sigaddset( &blockmask, SIGTERM );
  sigaddset( &blockmask, SIGUSR1 );
  sigaddset( &blockmask, SIGUSR2 );
 
  DebugLevel = 0;

  umask(000); /* clear file creation mode mask,so that open has control */

  strcpy(autodir,argv[1]);
  set_output();

   DPRINT1(1,"Automation Directory: '%s'\n",autodir);
   fprintf(stdout,"Start of Automation\n");

   /* Lets use the syslog facility provide by the OS. */
   logSysInit("Autoproc",AUTOLOG_FACILITY);

   /* initialize exception handlers */
   setupexcepthandler();
 
   /* initialize command parser */
   initCmdParser();

   /* Map in Expproc Experiment Queues */
   initExpQs(0);   /* Experiment waiting to be run */
   initActiveExpQ(0);  /* Experiment that is presently acquiring */

   /* Map in Processing Queues */
   initProcQs(0);	/* pending processing */
   initActiveQ(0);	/* active processing */

    /* initialize environment parameter vnmrsystem value */
    tmpptr = getenv("vnmrsystem");            /* vnmrsystem */
    if (tmpptr != NULL)
    {
        strcpy(systemdir,tmpptr);      /* copy value into global */
    }
    else
    {
        strcpy(systemdir,"/vnmr");     /* use /vnmr as default value */
    }
    sprintf(enterpath,"%s/acqbin/Autolog",systemdir);
    if ( ! access(enterpath,F_OK) )
    {
        DebugLevel = 1;
    }
    strcpy(enterpath,autodir);
    strcat(enterpath,"/enterQ");
    strcpy(samplepath,autodir);
    strcat(samplepath,"/exp1/sampleinfo");
    strcpy(psgQpath,autodir);
    strcat(psgQpath,"/psgQ");
    strcpy(doneQpath,autodir);
    strcat(doneQpath,"/doneQ");
 
    DPRINT3(1,"autodir:'%s', enter:'%s', psgQ:'%s'\n",
        autodir,enterpath,psgQpath);
 
    /* do any remapping of enterQ key words */
    read_info_file(autodir);  

    /* Obtain the owner of the Automation directory. Forked Vnmr(s)
       will be run under this owner uid & gid.
    */
    if (stat(autodir, &statbuf) < 0)
    { 
      perror("autoproc: stat() can't stat enterQ: ");
      /* OK, default to root */
      enter_uid = (pid_t) 0;
      enter_gid = (gid_t) 0;
    }
    else
    {
      enter_uid = statbuf.st_uid;
      enter_gid = statbuf.st_gid;
    }
 
   /* Initialize the Event Handlers Queue */
   setupForAsync(20, &blockmask);
   blockAllEvents();

   /* here we register both the signal handler to be called
       and the non-interrupt function to handle the I/O */
   registerAsyncHandlers(
			  SIGCHLD,	/* BG processing Signal */
			  childItrp,	/* this puts the event on the eventQ */
			  TheGrimReaper
			 );

   /* setup key database, and Message Queue, facilities */
   pRecvMsgQ = createMsgQ("Autoproc", (int) AUTOPROC_MSGQ_KEY, (int) AUTO_MSG_SIZE);
   if (pRecvMsgQ == NULL)
      exit(1);

   pExpMsgQ = openMsgQ("Expproc");
   if (pExpMsgQ == NULL)
      exit(1);

   setMsgQAsync(pRecvMsgQ,processMsge);
   unblockAllEvents();

   /* switch to root here so that autoproc will have permission to lock and unlock the 
      various Qs it uses
   */
   seteuid(getuid());
   DPRINT4(1,"uid: %d, euid: %d, gid: %d, egid: %d\n",getuid(),geteuid(),getgid(),getegid());

   /*
    * Used to get this first resume from Expproc, but there is a race between Expproc
    * sending the resume and Autoproc's createMsgQ() which may interpret that resume
    * as an old message and delete it
    */
   Resume("");
   asyncMainLoop();

   closeMsgQ(pExpMsgQ);
   shutdownComm();

   return(EXIT_SUCCESS);
}
Beispiel #15
0
/*********************************************************************
*
* recovery, based on the cmd code decides what recovery action 
*		to perform.
*
*					Author Greg Brissey 12-7-94
*/
void recovery(CNTLR_COMM_MSG *msge, int externflag)
{
   char *token;
   int len;
   int cmd;
   int i,nMsg2Read;
   int bytes;
   extern int systemConRestart();
   CNTLR_COMM_MSG discardedmsge;

   DPRINT(-1,"Local Exception\n");
   switch( msge->cmd /* exceptionType */ )
   {
      case PANIC:
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_PANIC,NULL,NULL);
#endif
    		errLogRet(LOGIT,debugInfo,
       		"phandler: Panic Error: %d", msge->errorcode);
		break;

      case WARNING_MSG:
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_WARNMSG,NULL,NULL);
#endif
  	        DPRINT2(-10,"WARNING: doneCode: %d, errorCode: %d\n",
			msge->cmd,msge->errorcode);
    		/* errLogRet(LOGIT,debugInfo,
       		"phandler: Warning Message: %d", msge->reportEvent); */

		/* the send2Expproc is commented out. The msg is send 
		/* via other ways. We got two warning msgs for the 
		/* following numbers:
        	/* PNEU_ERROR + PRESSURE;
         	/* PNEU_ERROR + NB_STACK;
         	/* PNEU_ERROR + VTTHRESH;
         	/* PNEU_ERROR + PS;
		/* VTERROR + NOGAS
                /* Don't send ADC overflows to Expproc */
                /* if ( (msge->errorcode != WARNINGS+ADCOVER) && 
                /*     (msge->errorcode != SFTERROR+LOCKLOST) )
                /*   send2Expproc(CASE,msge->cmd,msge->errorcode,0,NULL,0); 
                 */
		break;

      case SOFT_ERROR:
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_SOFTERROR,NULL,NULL);
#endif
		/* update_acqstate( ACQ_IDLE ); INOVA */

  	        DPRINT2(0,"SOFT_ERROR: doneCode: %d, errorCode: %d\n",
			msge->cmd,msge->errorcode);
    		/* errLogRet(LOGIT,debugInfo,
       		"phandler: Soft Error: %d", msge->reportEvent); */
#ifdef INOVA
                statMsg.Status = msge->exceptionType;
                statMsg.Event = msge->reportEvent; /* Error Code */
		msgQSend(pMsgesToHost,(char*) &statMsg,sizeof(statMsg),
					WAIT_FOREVER, MSG_PRI_NORMAL);
#endif
		break;

      case EXP_ABORTED:
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_EXPABORTED,NULL,NULL);
#endif
  	        DPRINT(0,"Exp. Aborted");

      case HARD_ERROR:

#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_HARDERROR,NULL,NULL);
#endif
  	        DPRINT2(0,"HARD_ERROR: doneCode: %d, errorCode: %d\n", msge->cmd, msge->errorcode);

		AbortExp(msge,externflag);

		/* fifoCloseLog(pTheFifoObject); */
  	        DPRINT(0,"Done");
		break;
		

      case INTERACTIVE_ABORT:

#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_HARDERROR,NULL,NULL);
#endif
/*
  	        DPRINT1(0,"INTERACTIVE_ABORT: doneCode: %d, errorCode: %d\n", msge->reportEvent);
*/

		AbortExp(msge,externflag);

		/* fifoCloseLog(pTheFifoObject); */
  	        DPRINT(0,"Done");
		break;


      case EXP_HALTED:
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_EXPHALTED,NULL,NULL);
#endif
  	        DPRINT2(0,"EXP_HALTED: doneCode: %d, errorCode: %d\n", msge->cmd, msge->errorcode);

		AbortExp(msge,externflag);

		break;


      case STOP_CMPLT:
                /* the monitor set the SA_Criteria value,
		   when the upLinker obtained a FID that meet this
		   Criteria the upLinker sent this msge here and
		   then blocked itself
                  Our job is to
	          1. Foward the Stopped msge to Host
	          2. reset hardware
                  3. put hardware into a safe state
		  4. call stmSA, clears upLinker msgQ, send SA msge
	          5. reset SA_Criteria back to Zero
		  6. give the semaphore to restart upLinker
		  7. reset update task
		  8. reset parser task
	          9. Free the buffers
	         10. Re-enable Interrupts 
		*/

#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_STOPCMPLT,NULL,NULL);
#endif
#ifdef INOVA
                statMsg.Status = msge->exceptionType;
                statMsg.Event = msge->reportEvent; /* Error Code */
		msgQSend(pMsgesToHost,(char*) &statMsg,sizeof(statMsg),
					WAIT_FOREVER, MSG_PRI_NORMAL);

    		errLogRet(LOGIT,debugInfo,
       		"phandler: Exp. Stopped: %d", msge->reportEvent);

                /* reprogram HSlines, ap registers to safe state */
                reset2SafeState( msge->exceptionType );  

                resetSystem();  /* reset fifo, disable intrps, reset tasks & buffers */

  	        DPRINT2(0,"stmHaltCode: doneCode: %d, errorCode: %d\n",
			msge->exceptionType,msge->reportEvent);

                semGive(pSemSAStop);   /* release the UpLinker */
		/* stmHaltCode(pTheStmObject,(int) msge->exceptionType, 
				(int) msge->reportEvent);
		*/
  	        /* DPRINT(0,"stmSA"); stmSA(pTheStmObject); */
   		DPRINT(0,"STOP_CMPLT: lower priority below upLinker\n");
                taskPrioritySet(pHandlerTid,(UPLINKER_TASK_PRIORITY+1));  
   	        taskPrioritySet(pHandlerTid,pHandlerPriority);  

		SA_Criteria = 0;
		SA_Mod = 0L;

  	        DPRINT(0,"wait4DowninkerReady");
		wait4DownLinkerReady();	/* let downlinker become ready, then delete any left over buffers */

                resetNameBufs();   /* free all named buffers */

   		/* stmInitial(pTheStmObject, 1, 1024, pUpLinkMsgQ, 0); */

	        clrDwnLkAbort();

                wait4SystemReady(); /* pend till all activities are complete */

  	        DPRINT(0,"enableInterrupts");
		enableInterrupts();

	        /* now inform Expproc System is Ready */
                statMsg.Status = SYSTEM_READY; /* Console Ready  */
                statMsg.Event = 0; /* Error Code */
		msgQSend(pMsgesToHost,(char*) &statMsg,sizeof(statMsg),
					WAIT_FOREVER, MSG_PRI_NORMAL);

		update_acqstate( ACQ_IDLE );
	        getstatblock();
/*
		if (pTheTuneObject != NULL)
		  semGive( pTheTuneObject->pSemAccessFIFO );
*/

#endif
                sendSysReady();
		break;

      case LOST_CONN:
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_LOSTCONN,NULL,NULL);
#endif
#ifdef INOVA
    		errLogRet(LOGIT,debugInfo,
       		"phandler: Host Closed Connection to Console: %d", msge->reportEvent);
		update_acqstate( ACQ_IDLE );
		/* stmItrpDisable(pTheStmObject, STM_ALLITRPS); */
                storeConsoleDebug( SYSTEM_ABORT );
                /* reprogram HSlines, ap registers to safe state */
                reset2SafeState( msge->exceptionType );
                resetSystem();  /* reset fifo, disable intrps, reset tasks & buffers */
		/* stmReset(pTheStmObject); */
                taskDelay(calcSysClkTicks(332));  /* taskDelay(20); */
                resetNameBufs();   /* free all named buffers */
		enableInterrupts();
/*
		if (pTheTuneObject != NULL)
		  semGive( pTheTuneObject->pSemAccessFIFO );
*/
     		taskSpawn("tRestart",50,0,2048,systemConRestart,NULL,
				2,3,4,5,6,7,8,9,10);
	        clrDwnLkAbort();

#endif
	        break;

      case ALLOC_ERROR:
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_ALLOCERROR,NULL,NULL);
#endif
#ifdef INOVA
    		errLogRet(LOGIT,debugInfo,
       		"phandler: Memory Allocation Error: %d", msge->reportEvent);

		update_acqstate( ACQ_IDLE );

                statMsg.Status = HARD_ERROR; /* HARD_ERROR */
                statMsg.Event = msge->reportEvent; /* Error Code */
		msgQSend(pMsgesToHost,(char*) &statMsg,sizeof(statMsg),
					WAIT_FOREVER, MSG_PRI_URGENT);
                

		/* report HARD_ERROR to Recvproc */
  	        DPRINT2(0,"stmHaltCode: doneCode: %d, errorCode: %d\n",
			HARD_ERROR,msge->reportEvent);
/*
		stmHaltCode(pTheStmObject,(int) HARD_ERROR, 
				(int) msge->reportEvent);
*/

                /* reprogram HSlines, ap registers to safe state */
                reset2SafeState( msge->exceptionType );

                resetSystem();  /* reset fifo, disable intrps, reset tasks & buffers */

	      
#ifdef XXXX
                statMsg.Status = WARNING_MSG;
                statMsg.Event = WARNINGS + MEM_ALLOC_ERR; /* Error Code */
		msgQSend(pMsgesToHost,(char*) &statMsg,sizeof(statMsg),
					WAIT_FOREVER, MSG_PRI_NORMAL);
#endif

                resetNameBufs();   /* free all named buffers */

   		/* stmInitial(pTheStmObject, 1, 1024, pUpLinkMsgQ, 0); */

	        clrDwnLkAbort();

  	        DPRINT(0,"enableInterrupts");
		enableInterrupts();

	        /* now inform Expproc System is Ready */
                statMsg.Status = SYSTEM_READY; /* Console Ready  */
                statMsg.Event = 0; /* Error Code */
		msgQSend(pMsgesToHost,(char*) &statMsg,sizeof(statMsg),
					WAIT_FOREVER, MSG_PRI_NORMAL);

	        getstatblock();
/*
		if (pTheTuneObject != NULL)
		  semGive( pTheTuneObject->pSemAccessFIFO );
*/

#endif
		break;
      
      case WATCHDOG:
#ifdef INOVA
#ifdef INSTRUMENT
        wvEvent(EVENT_PHDLR_WATCHDOG,NULL,NULL);
#endif
		/* Giv'm a bone */
    		errLogRet(LOGIT,debugInfo,
       		"phandler: Watch Dog: %d", msge->reportEvent);
#endif
		break;

      default:
		/* Who Cares */
    		errLogRet(LOGIT,debugInfo,
       		"phandler: Invalid Exception Type: %d, Event: %d", 
			msge->cmd, msge->errorcode);
		break;
   }
/*
   nMsg2Read = msgQNumMsgs(pMsgesToPHandlr);
   DPRINT1(-1,"Message in Q: %d\n",nMsg2Read);
*/
   if (msge->cmd != WARNING_MSG)
      resumeLedShow(); /* resume LED Idle display */

   while ( (bytes = msgQReceive(pMsgesToPHandlr, (char*) &discardedmsge, sizeof( CNTLR_COMM_MSG ), NO_WAIT)) != ERROR )
   {
     DPRINT(-1,"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n");
     DPRINT1(0,"Read %d bytes from Phandler msgQ, (Bogus Errors at this point)\n",bytes);
     DPRINT4(-1,"'%s': Exception from: -> '%s' <-, Type: %d, ErrorCode: %d \n",
			hostName, discardedmsge.cntlrId, discardedmsge.cmd, discardedmsge.errorcode);
     DPRINT(-1,"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");


   }
}