Пример #1
0
/** Constructor for function attribute
  * \param[in] pName The name of the attribute to be created; case-insensitive. 
  * \param[in] pDescription The description of the attribute.
  * \param[in] pSource The symbol name for the function to be called to get the value of the parameter.
  * \param[in] pParam A string that will be passed to the function, typically to specify what/how to get the value.
  */
functAttribute::functAttribute(const char *pName, const char *pDescription, const char *pSource, const char *pParam)

    : NDAttribute(pName, pDescription, NDAttrSourceFunct, pSource, NDAttrUndefined, 0),
      pFunction(0), functionPvt(0)
{
    static const char *functionName = "functAttribute";
    
    /* Create the static pasynUser if not already done */
    if (!pasynUserSelf) pasynUserSelf = pasynManager->createAsynUser(0,0);
    if (pParam) 
        functParam = epicsStrDup(pParam);
    else
        functParam = epicsStrDup("");
    if (!pSource) {
        asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
            "%s:%s: ERROR, must specify function name\n",
            driverName, functionName);
        goto error;
    }
    this->pFunction = (NDAttributeFunction)registryFunctionFind(pSource);
    if (!this->pFunction) {
        asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
            "%s:%s: ERROR, cannot find function %s\n",
            driverName, functionName, pSource);
        goto error;
    }
    
error:
    return;
}
Пример #2
0
/* init routine */
int drvFzoomAsynConfigure(const char *portName, const char *octetPortName)
{
    FZOOM_ID pfzoomPvt;
    asynStatus status;

    assert(sizeof(unsigned short) == 2); /* 32 bits required */
    pfzoomPvt  = callocMustSucceed(1, sizeof(*pfzoomPvt), "drvFzoomAsynConfigure");
    pfzoomPvt->portName = epicsStrDup(portName);
    pfzoomPvt->octetPortName = epicsStrDup(octetPortName);
    pfzoomPvt->mutexId = epicsMutexMustCreate();

    /* initialise position, error threshold */
    pfzoomPvt->devInfo.zoomPosition = 1;
    pfzoomPvt->devInfo.posThreshold = 1010;
    pfzoomPvt->devInfo.timeoutDelay = 1025;

    /* connect to asyn octet port with asynOctetSyncIO */ 
    status = pasynOctetSyncIO->connect(octetPortName, 0, &pfzoomPvt->pasynUserOctet,
                                       0);
    if (status != asynSuccess) {
        errlogPrintf("%s::drvFzoomAsynConfigure port %s"
                     " can't connect to Octet port %s.\n",
                     driver, portName, octetPortName);
        return asynError;
    }

    /* Create asynUser for asynTrace */
    pfzoomPvt->pasynUserTrace = pasynManager->createAsynUser(0, 0);
    pfzoomPvt->pasynUserTrace->userPvt = pfzoomPvt;

    status = pasynManager->registerPort(pfzoomPvt->portName,
                                        ASYN_CANBLOCK,
                                        1, /* autoconnect */
                                        0, /* medium priority */
                                        0); /* default stack size */
    if (status != asynSuccess) {
        errlogPrintf("%s::drvFzoomAsynConfigure port %s"
                     "%s:: can't register port\n",
                     driver, pfzoomPvt->portName, pfzoomPvt->octetPortName);
        return(asynError);
    }

    /* Create asyn interfaces and register with asynManager */
    pfzoomPvt->asynStdInterfaces.common.pinterface          = (void *)&drvCommon;
    pfzoomPvt->asynStdInterfaces.drvUser.pinterface         = (void *)&drvUser;
    pfzoomPvt->asynStdInterfaces.int32.pinterface           = (void *)&drvInt32;

    status = pasynStandardInterfacesBase->initialize(pfzoomPvt->portName, &pfzoomPvt->asynStdInterfaces,
                                                     pfzoomPvt->pasynUserTrace, pfzoomPvt);
    if (status != asynSuccess) {
        errlogPrintf("%s::drvFzoomAsynConfigure port %s"
                     " can't register standard interfaces: %s\n",
                     driver, pfzoomPvt->portName, pfzoomPvt->pasynUserTrace->errorMessage);
        return(asynError);
    }
    return (asynSuccess);
}
Пример #3
0
/** NDAttribute constructor
  * \param[in] pName The name of the attribute to be created. 
  * \param[in] pDescription The description of the attribute.
  * \param[in] dataType The data type of the attribute.
  * \param[in] pValue A pointer to the value for this attribute.
  */
NDAttribute::NDAttribute(const char *pName, const char *pDescription, NDAttrDataType_t dataType, void *pValue)
{

  this->pName = epicsStrDup(pName);
  this->pDescription = epicsStrDup(pDescription);
  this->pSource = epicsStrDup("");
  this->sourceType = NDAttrSourceDriver;
  this->pString = NULL;
  if (pValue) this->setValue(dataType, pValue);
  this->listNode.pNDAttribute = this;
}
Пример #4
0
/* asynDrvUser routines */
static asynStatus drvUserCreate(void *drvPvt, asynUser *pasynUser,
                                const char *drvInfo,
                                const char **pptypeName, size_t *psize)
{
    FZOOM_ID pfzoom = (FZOOM_ID)drvPvt;
    int i;
    char *pstring;
    
    for (i=0; i<MAX_FZOOM_COMMANDS; i++) {
        pstring = fzoomCommands[i].commandString;
        if (epicsStrCaseCmp(drvInfo, pstring) == 0) {
            pasynUser->reason = fzoomCommands[i].command;
            if (pptypeName) *pptypeName = epicsStrDup(pstring);
            if (psize) *psize = sizeof(fzoomCommands[i].command);
            asynPrint(pasynUser, ASYN_TRACE_FLOW,
                      "%s::drvUserCreate, port %s command=%s\n", 
                      driver, pfzoom->portName, pstring);
            return(asynSuccess);
        }
    }
    
    asynPrint(pasynUser, ASYN_TRACE_ERROR,
              "%s::drvUserCreate, port %s unknown command=%s\n", 
              driver, pfzoom->portName, drvInfo);
    return(asynError);
}
Пример #5
0
void dbRegisterFilter(const char *name, const chFilterIf *fif, void *puser)
{
    GPHENTRY *pgph;
    chFilterPlugin *pfilt;

    if (!pdbbase) {
        printf("dbRegisterFilter: pdbbase not set!\n");
        return;
    }

    pgph = gphFind(pdbbase->pgpHash, name, &pdbbase->filterList);
    if (pgph)
        return;

    pfilt = dbCalloc(1, sizeof(chFilterPlugin));
    pfilt->name = epicsStrDup(name);
    pfilt->fif = fif;
    pfilt->puser = puser;

    ellAdd(&pdbbase->filterList, &pfilt->node);
    pgph = gphAdd(pdbbase->pgpHash, pfilt->name, &pdbbase->filterList);
    if (!pgph) {
        free((void *) pfilt->name);
        free(pfilt);
        printf("dbRegisterFilter: gphAdd failed\n");
        return;
    }
    pgph->userPvt = pfilt;
}
Пример #6
0
epicsShareFunc int
    asynOctetConnect(const char *entry, const char *port, int addr,
             int timeout, int buffer_len, const char *drvInfo)
{
    asynIOPvt *pPvt;
    asynUser *pasynUser;
    asynStatus status;
    GPHENTRY *hashEntry;

    pPvt = asynFindEntry(entry);
    if (pPvt) {
       printf("Entry already connected\n");
       return(-1);
    }

    status = pasynOctetSyncIO->connect(port, addr, &pasynUser,drvInfo);
    if (status) {
        printf("connect failed %s\n",pasynUser->errorMessage);
        pasynOctetSyncIO->disconnect(pasynUser);
        return(-1);
    }
    hashEntry = gphAdd(asynHash, epicsStrDup(entry), NULL);
    pPvt = (asynIOPvt *)calloc(1, sizeof(asynIOPvt)); 
    hashEntry->userPvt = pPvt;
    pPvt->pasynUser = pasynUser;
    pPvt->timeout = timeout ? (double)timeout : READ_TIMEOUT;
    pPvt->write_buffer_len = buffer_len ? buffer_len : BUFFER_SIZE;
    pPvt->write_buffer = calloc(1, pPvt->write_buffer_len);
    pPvt->read_buffer_len = pPvt->write_buffer_len;
    pPvt->read_buffer = calloc(1, pPvt->read_buffer_len);
    return(0);
}
Пример #7
0
static void
setThreadInfo (rtems_id tid, const char *name, EPICSTHREADFUNC funptr,void *parm)
{
    struct taskVar *v;
    uint32_t note;
    rtems_status_code sc;

    v = mallocMustSucceed (sizeof *v, "epicsThreadCreate_vars");
    v->name = epicsStrDup(name);
    v->id = tid;
    v->funptr = funptr;
    v->parm = parm;
    v->threadVariableCapacity = 0;
    v->threadVariables = NULL;
    note = (uint32_t)v;
    rtems_task_set_note (tid, RTEMS_NOTEPAD_TASKVAR, note);
    taskVarLock ();
    v->forw = taskVarHead;
    v->back = NULL;
    if (v->forw)
        v->forw->back = v;
    taskVarHead = v;
    taskVarUnlock ();
    if (funptr) {
        sc = rtems_task_start (tid, threadWrapper, (rtems_task_argument)v);
        if (sc !=  RTEMS_SUCCESSFUL)
            errlogPrintf ("setThreadInfo:  Can't start  %s: %s\n",name, rtems_status_text (sc));
    }
}
Пример #8
0
motorSimController::motorSimController(const char *portName, int numAxes, int priority, int stackSize)
  :  asynMotorController(portName, numAxes, NUM_SIM_CONTROLLER_PARAMS, 
                         asynInt32Mask | asynFloat64Mask, 
                         asynInt32Mask | asynFloat64Mask,
                         ASYN_CANBLOCK | ASYN_MULTIDEVICE, 
                         1, // autoconnect
                         priority, stackSize)
{
  int axis;
  motorSimControllerNode *pNode;
  
  if (!motorSimControllerListInitialized) {
    motorSimControllerListInitialized = 1;
    ellInit(&motorSimControllerList);
  }
  
  // We should make sure this portName is not already in the list */
  pNode = (motorSimControllerNode*) calloc(1, sizeof(motorSimControllerNode));
  pNode->portName = epicsStrDup(portName);
  pNode->pController = this;
  ellAdd(&motorSimControllerList, (ELLNODE *)pNode);

  if (numAxes < 1 ) numAxes = 1;
  numAxes_ = numAxes;
  this->movesDeferred_ = 0;
  for (axis=0; axis<numAxes; axis++) {
    new motorSimAxis(this, axis, DEFAULT_LOW_LIMIT, DEFAULT_HI_LIMIT, DEFAULT_HOME, DEFAULT_START);
    setDoubleParam(axis, this->motorPosition_, DEFAULT_START);
  }

  this->motorThread_ = epicsThreadCreate("motorSimThread", 
                                         epicsThreadPriorityLow,
                                         epicsThreadGetStackSize(epicsThreadStackMedium),
                                         (EPICSTHREADFUNC) motorSimTaskC, (void *) this);
}
Пример #9
0
/* asynDrvUser methods */
asynStatus ct_drvUserCreate(void *drvPvt, asynUser *pasynUser, const char *drvInfo, const char **pptypeName, size_t *psize)
{
    int i;
    char *pstring;
    const char *functionName = "ct_drvUserCreate";

    asynPrint(	pasynUser, ASYN_TRACE_FLOW,
    "%s: attempting to create cmd: %s (CT_MAX_CMD: %d)\n", functionName, drvInfo, CT_MAX_CMD);

    for (i=0; i < CT_MAX_CMD; i++)
    {
        pstring = ct_commands[i].commandString;
        if (epicsStrCaseCmp( drvInfo, pstring) == 0)
        {
            pasynUser->reason = ct_commands[i].command;
            if (pptypeName)
                *pptypeName = epicsStrDup(pstring);
            if (psize)
                *psize = sizeof( ct_commands[i].command);
            asynPrint(	pasynUser, ASYN_TRACE_FLOW,
                        "%s: command created: %s\n", functionName, pstring);
            return( asynSuccess );
        }
    }
    asynPrint(	pasynUser, ASYN_TRACE_ERROR,
                "%s: unknown command: %s\n", functionName, drvInfo);
    return( asynError );			
}
Пример #10
0
/* asynDrvUser routines */
static asynStatus drvUserCreate(void *drvPvt, asynUser *pasynUser,
                                const char *drvInfo,
                                const char **pptypeName, size_t *psize)
{
    XPSInterposePvt *pPvt = (XPSInterposePvt *) drvPvt;
    int i;
    char *pstring;
    int ncommands = sizeof(XPSCommands)/sizeof(XPSCommands[0]);

    asynPrint(pasynUser, ASYN_TRACE_FLOW,
              "XPSInterpose::drvUserCreate, drvInfo=%s, pptypeName=%p, psize=%p, pasynUser=%p\n", 
               drvInfo, pptypeName, psize, pasynUser);

    for (i=0; i < ncommands; i++) {
        pstring = XPSCommands[i].commandString;
        if (epicsStrCaseCmp(drvInfo, pstring) == 0) {
            break;
        }
    }
    if (i < ncommands) {
        pasynUser->reason = XPSCommands[i].command;
        if (pptypeName) {
            *pptypeName = epicsStrDup(pstring);
        }
        if (psize) {
            *psize = sizeof(XPSCommands[i].command);
        }
        asynPrint(pasynUser, ASYN_TRACE_FLOW,
                  "XPSInterpose::drvUserCreate, command=%s\n", pstring);
        return(asynSuccess);
    } else {
        /* This command is not recognized, call the previous driver's routine */
        return(pPvt->drvUserPrev->create(pPvt->drvUserPrevPvt, pasynUser, drvInfo, pptypeName, psize));
    }
}
Пример #11
0
/** Copy constructor for function attribute
  * \param[in] attribute The functAttribute to copy from.
  */
functAttribute::functAttribute(functAttribute& attribute)

    : NDAttribute(attribute)
{
    functParam = epicsStrDup(attribute.functParam);
    pFunction = attribute.pFunction;
    functionPvt = attribute.functionPvt;
}
Пример #12
0
/** Sets the value for this attribute. 
  * \param[in] dataType Data type of the value.
  * \param[in] pValue Pointer to the value. */
int NDAttribute::setValue(NDAttrDataType_t dataType, void *pValue)
{
  NDAttrDataType_t prevDataType = this->dataType;
    
  this->dataType = dataType;

  /* If any data type but undefined then pointer must be valid */
  if ((dataType != NDAttrUndefined) && !pValue) return(ND_ERROR);

  /* Treat strings specially */
  if (dataType == NDAttrString) {
    /* If the previous value was the same string don't do anything, 
     * saves freeing and allocating memory.  
     * If not the same free the old string and copy new one. */
    if ((prevDataType == NDAttrString) && this->pString) {
      if (strcmp(this->pString, (char *)pValue) == 0) return(ND_SUCCESS);
      free(this->pString);
    }
    this->pString = epicsStrDup((char *)pValue);
    return(ND_SUCCESS);
  }
  if (this->pString) {
    free(this->pString);
    this->pString = NULL;
  }
  switch (dataType) {
    case NDAttrInt8:
      this->value.i8 = *(epicsInt8 *)pValue;
      break;
    case NDAttrUInt8:
      this->value.ui8 = *(epicsUInt8 *)pValue;
      break;
    case NDAttrInt16:
      this->value.i16 = *(epicsInt16 *)pValue;
      break;
    case NDAttrUInt16:
      this->value.ui16 = *(epicsUInt16 *)pValue;
      break;
    case NDAttrInt32:
      this->value.i32 = *(epicsInt32*)pValue;
      break;
    case NDAttrUInt32:
      this->value.ui32 = *(epicsUInt32 *)pValue;
      break;
    case NDAttrFloat32:
      this->value.f32 = *(epicsFloat32 *)pValue;
      break;
    case NDAttrFloat64:
      this->value.f64 = *(epicsFloat64 *)pValue;
      break;
    case NDAttrUndefined:
      break;
    default:
      return(ND_ERROR);
      break;
  }
  return(ND_SUCCESS);
}
Пример #13
0
static epicsThreadOSD * create_threadInfo(const char *name)
{
    epicsThreadOSD *pthreadInfo;

    pthreadInfo = callocMustSucceed(1,sizeof(*pthreadInfo),"create_threadInfo");
    pthreadInfo->suspendEvent = epicsEventMustCreate(epicsEventEmpty);
    pthreadInfo->name = epicsStrDup(name);
    return pthreadInfo;
}
Пример #14
0
static void dbBreakItem(char *value)
{
    double dummy;
    if (duplicate) return;
    if (epicsScanDouble(value, &dummy) != 1) {
	yyerrorAbort("Non-numeric value in breaktable");
    }
    allocTemp(epicsStrDup(value));
}
Пример #15
0
// called by server application to specify access rights 
// by given ASG name. 
// this is called in Python subclass SimplePV
bool PV :: setAccessSecurityGroup (const char *asgName)
{
    asg = epicsStrDup(asgName); 
    if (asAddMember(&member, asg)) {
        member = NULL; 
        return false; 
    }
    return true; 
}
Пример #16
0
static void dbDevice(char *recordtype,char *linktype,
	char *dsetname,char *choicestring)
{
    devSup	*pdevSup;
    dbRecordType	*pdbRecordType;
    GPHENTRY	*pgphentry;
    int		i,link_type;
    pgphentry = gphFind(pdbbase->pgpHash,recordtype,&pdbbase->recordTypeList);
    if(!pgphentry) {
        epicsPrintf("Record type \"%s\" not found for device \"%s\"\n",
                    recordtype, choicestring);
	yyerror(NULL);
	return;
    }
    link_type=-1;
    for(i=0; i<LINK_NTYPES; i++) {
	if(strcmp(pamaplinkType[i].strvalue,linktype)==0) {
	    link_type = pamaplinkType[i].value;
	    break;
	}
    }
    if(link_type==-1) {
        epicsPrintf("Bad link type \"%s\" for device \"%s\"\n",
                    linktype, choicestring);
	yyerror(NULL);
	return;
    }
    pdbRecordType = (dbRecordType *)pgphentry->userPvt;
    pgphentry = gphFind(pdbbase->pgpHash,choicestring,&pdbRecordType->devList);
    if(pgphentry) {
	return;
    }
    pdevSup = dbCalloc(1,sizeof(devSup));
    pdevSup->name = epicsStrDup(dsetname);
    pdevSup->choice = epicsStrDup(choicestring);
    pdevSup->link_type = link_type;
    pgphentry = gphAdd(pdbbase->pgpHash,pdevSup->choice,&pdbRecordType->devList);
    if(!pgphentry) {
	yyerrorAbort("gphAdd failed");
    } else {
	pgphentry->userPvt = pdevSup;
    }
    ellAdd(&pdbRecordType->devList,&pdevSup->node);
}
Пример #17
0
static void dbVariable(char *name, char *type)
{
    dbVariableDef	*pvar;
    GPHENTRY	*pgphentry;

    pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->variableList);
    if(pgphentry) {
	return;
    }
    pvar = dbCalloc(1,sizeof(dbVariableDef));
    pvar->name = epicsStrDup(name);
    pvar->type = epicsStrDup(type);
    pgphentry = gphAdd(pdbbase->pgpHash,pvar->name,&pdbbase->variableList);
    if(!pgphentry) {
	yyerrorAbort("gphAdd failed");
    } 
    pgphentry->userPvt = pvar;
    ellAdd(&pdbbase->variableList,&pvar->node);
}
Пример #18
0
static asynStatus drvUserGetType(void *drvPvt, asynUser *pasynUser,
                                 const char **pptypeName, size_t *psize)
{
    int command = pasynUser->reason;

    if (pptypeName)
        *pptypeName = epicsStrDup(fzoomCommands[command].commandString);
    if (psize) *psize = sizeof(command);
    return(asynSuccess);
}
Пример #19
0
asynStatus testErrors::readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn)
{
    int function = pasynUser->reason;
    size_t i;

    if (function == P_StatusReturn) {
        for (i=0; ((i<MAX_STATUS_ENUMS) && (i<nElements)); i++) {
            if (strings[i]) free(strings[i]);
            strings[i] = epicsStrDup(statusEnumStrings[i]);
            values[i] = statusEnumValues[i];
            severities[i] = statusEnumSeverities[i];
        }
    }
    else if ((function == P_Int32Value)       ||
             (function == P_BinaryInt32Value) ||   
             (function == P_MultibitInt32Value)) {
        for (i=0; ((i<MAX_INT32_ENUMS) && (i<nElements)); i++) {
            if (strings[i]) free(strings[i]);
            strings[i] = epicsStrDup(int32EnumStrings_[i]);
            values[i] = int32EnumValues_[i];
            severities[i] = int32EnumSeverities_[i];
        }
    }
    else if ((function == P_UInt32DigitalValue)       ||
             (function == P_BinaryUInt32DigitalValue) ||
             (function == P_MultibitUInt32DigitalValue)) {
        for (i=0; ((i<MAX_UINT32_ENUMS) && (i<nElements)); i++) {
            if (strings[i]) free(strings[i]);
            strings[i] = epicsStrDup(uint32EnumStrings_[i]);
            values[i] = uint32EnumValues_[i];
            severities[i] = uint32EnumSeverities_[i];
        }
    }
    else {
        *nIn = 0;
        return asynError;
    }
    *nIn = i;
    return asynSuccess;   

}
Пример #20
0
/** Sets the description string for this attribute.
  * This method must be used to set the description string; pDescription must not be directly modified. 
  * \param[in] pDescription String with the desciption. */
int NDAttribute::setDescription(const char *pDescription) {

  if (this->pDescription) {
    /* If the new description is the same as the old one return, 
     * saves freeing and allocating memory */
    if (strcmp(this->pDescription, pDescription) == 0) return(ND_SUCCESS);
    free(this->pDescription);
  }
  if (pDescription) this->pDescription = epicsStrDup(pDescription);
  else this->pDescription = NULL;
  return(ND_SUCCESS);
}
Пример #21
0
/** Sets the source string for this attribute. 
  * This method must be used to set the source string; pSource must not be directly modified. 
  * \param[in] pSource String with the source. */
int NDAttribute::setSource(const char *pSource) {

  if (this->pSource) {
    /* If the new srouce is the same as the old one return, 
     * saves freeing and allocating memory */
    if (strcmp(this->pSource, pSource) == 0) return(ND_SUCCESS);
    free(this->pSource);
  }
  if (pSource) this->pSource = epicsStrDup(pSource);
  else this->pSource = NULL;
  return(ND_SUCCESS);
}
Пример #22
0
dbStateId dbStateCreate(const char *name)
{
    dbStateId id;

    if ((id = dbStateFind(name)))
        return id;

    id = callocMustSucceed(1, sizeof(dbState), "createDbState");
    id->name = epicsStrDup(name);
    id->lock = epicsMutexMustCreate();
    ellAdd(&states, &id->node);

    return id;
}
Пример #23
0
static void dbMenuHead(char *name)
{
    dbMenu		*pdbMenu;
    GPHENTRY		*pgphentry;

    pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->menuList);
    if(pgphentry) {
	duplicate = TRUE;
	return;
    }
    if(ellCount(&tempList)) yyerrorAbort("dbMenuHead: tempList not empty");
    pdbMenu = dbCalloc(1,sizeof(dbMenu));
    pdbMenu->name = epicsStrDup(name);
    allocTemp(pdbMenu);
}
Пример #24
0
static void dbRecordtypeCdef(char *text) {
    dbText		*pdbCdef;
    tempListNode	*ptempListNode;
    dbRecordType	*pdbRecordType;
    
    if (!pdbbase->loadCdefs || duplicate) return;
    ptempListNode = (tempListNode *)ellFirst(&tempList);
    pdbRecordType = ptempListNode->item;
    
    pdbCdef = dbCalloc(1,sizeof(dbText));
    if (text[0] == ' ') text++;	/* strip leading space if present */
    pdbCdef->text = epicsStrDup(text);
    ellAdd(&pdbRecordType->cdefList, &pdbCdef->node);
    return;
}
Пример #25
0
bool addToList(const char *portName, PMCVController *drv) {
    if (!PMCVListInitialized) {
        PMCVListInitialized = 1;
        ellInit(&PMCVList);
    } else if (findByPortName(portName) != NULL) {
        fprintf(stderr, "ERROR: Re-using portName=%s\n", portName);
        return false;
    }

    PMCVNode *pNode = (PMCVNode*)calloc(1, sizeof(PMCVNode));
    pNode->portName = epicsStrDup(portName);
    pNode->pController = drv;
    ellAdd(&PMCVList, (ELLNODE*)pNode);
    return true;
}
Пример #26
0
static void dbBreakHead(char *name)
{
    brkTable	*pbrkTable;
    GPHENTRY	*pgphentry;

    pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->bptList);
    if(pgphentry) {
	duplicate = TRUE;
	return;
    }
    pbrkTable = dbCalloc(1,sizeof(brkTable));
    pbrkTable->name = epicsStrDup(name);
    if(ellCount(&tempList)) yyerrorAbort("dbBreakHead:tempList not empty");
    allocTemp(pbrkTable);
}
Пример #27
0
static void dbRecordtypeHead(char *name)
{
    dbRecordType		*pdbRecordType;
    GPHENTRY		*pgphentry;

    pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->recordTypeList);
    if(pgphentry) {
	duplicate = TRUE;
	return;
    }
    pdbRecordType = dbCalloc(1,sizeof(dbRecordType));
    pdbRecordType->name = epicsStrDup(name);
    if (pdbbase->loadCdefs) ellInit(&pdbRecordType->cdefList);
    if(ellCount(&tempList))
	yyerrorAbort("dbRecordtypeHead tempList not empty");
    allocTemp(pdbRecordType);
}
Пример #28
0
static void dbDriver(char *name)
{
    drvSup	*pdrvSup;
    GPHENTRY	*pgphentry;

    pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->drvList);
    if(pgphentry) {
	return;
    }
    pdrvSup = dbCalloc(1,sizeof(drvSup));
    pdrvSup->name = epicsStrDup(name);
    pgphentry = gphAdd(pdbbase->pgpHash,pdrvSup->name,&pdbbase->drvList);
    if(!pgphentry) {
	yyerrorAbort("gphAdd failed");
    } 
    pgphentry->userPvt = pdrvSup;
    ellAdd(&pdbbase->drvList,&pdrvSup->node);
}
Пример #29
0
static void dbRecordtypeFieldHead(char *name,char *type)
{
    dbFldDes		*pdbFldDes;
    int			i;
    
    if(duplicate) return;
    pdbFldDes = dbCalloc(1,sizeof(dbFldDes));
    allocTemp(pdbFldDes);
    pdbFldDes->name = epicsStrDup(name);
    pdbFldDes->as_level = ASL1;
    for(i=0; i<DBF_NTYPES; i++) {
	if(strcmp(type,pamapdbfType[i].strvalue)==0) {
	    pdbFldDes->field_type = pamapdbfType[i].value;
	    return;
	}
    }
    yyerrorAbort("Illegal Field Type");
}
Пример #30
0
static void dbFunction(char *name)
{
    dbText     *ptext;
    GPHENTRY   *pgphentry;

    pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->functionList);
    if(pgphentry) {
       return;
    }
    ptext = dbCalloc(1,sizeof(dbText));
    ptext->text = epicsStrDup(name);
    pgphentry = gphAdd(pdbbase->pgpHash,ptext->text,&pdbbase->functionList);
    if(!pgphentry) {
       yyerrorAbort("gphAdd failed");
    }
    pgphentry->userPvt = ptext;
    ellAdd(&pdbbase->functionList,&ptext->node);
}