added pvAdapter
This commit is contained in:
+3
-1
@@ -20,6 +20,8 @@ typedef struct dbAddr{
|
||||
short special; /* special processing */
|
||||
short dbr_field_type; /* field type as seen by database request*/
|
||||
/*DBR_STRING,...,DBR_ENUM,DBR_NOACCESS*/
|
||||
}DBADDR;
|
||||
}dbAddr;
|
||||
|
||||
typedef dbAddr DBADDR;
|
||||
|
||||
#endif /* dbAddrh */
|
||||
|
||||
+1
-1
@@ -944,7 +944,7 @@ LOCAL void event_task (void *pParm)
|
||||
* DB_START_EVENTS()
|
||||
*/
|
||||
int epicsShareAPI db_start_events (
|
||||
dbEventCtx ctx, char *taskname, void (*init_func)(threadId),
|
||||
dbEventCtx ctx,const char *taskname, void (*init_func)(threadId),
|
||||
void *init_func_arg, int priority_offset)
|
||||
{
|
||||
struct event_user *evUser = (struct event_user *) ctx;
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ typedef void OVRFFUNC (void *overflow_arg, unsigned count);
|
||||
typedef void EXTRALABORFUNC (void *extralabor_arg);
|
||||
epicsShareFunc dbEventCtx epicsShareAPI db_init_events (void);
|
||||
epicsShareFunc int epicsShareAPI db_start_events (
|
||||
dbEventCtx ctx, char *taskname, void (*init_func)(void *),
|
||||
dbEventCtx ctx, const char *taskname, void (*init_func)(void *),
|
||||
void *init_func_arg, int priority_offset);
|
||||
epicsShareFunc void epicsShareAPI db_close_events (dbEventCtx ctx);
|
||||
epicsShareFunc void epicsShareAPI db_event_flow_ctrl_mode_on (dbEventCtx ctx);
|
||||
|
||||
+6
-5
@@ -68,7 +68,7 @@ typedef struct pnWaitNode {
|
||||
/*Local routines*/
|
||||
static void restartAdd(PUTNOTIFY *ppnto, PUTNOTIFY *ppnfrom);
|
||||
static void waitAdd(struct dbCommon *precord,PUTNOTIFY *ppn);
|
||||
static long putNotify(PUTNOTIFY *ppn);
|
||||
static long doPutNotify(PUTNOTIFY *ppn);
|
||||
static void notifyCallback(CALLBACK *pcallback);
|
||||
static void notifyCancel(PUTNOTIFY *ppn);
|
||||
static void issueCallback(PUTNOTIFY *ppn);
|
||||
@@ -153,12 +153,12 @@ long epicsShareAPI dbPutNotify(PUTNOTIFY *ppn)
|
||||
dbScanLock(precord);
|
||||
ellInit(&ppn->restartList);
|
||||
memset(&ppn->restartNode,'\0',sizeof(PNRESTARTNODE));
|
||||
status = putNotify(ppn);
|
||||
status = doPutNotify(ppn);
|
||||
dbScanUnlock(precord);
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long putNotify(PUTNOTIFY *ppn)
|
||||
static long doPutNotify(PUTNOTIFY *ppn)
|
||||
{
|
||||
struct dbAddr *paddr = ppn->paddr;
|
||||
short dbrType = ppn->dbrType;
|
||||
@@ -237,7 +237,7 @@ static void notifyCallback(CALLBACK *pcallback)
|
||||
}
|
||||
if(ppn->callbackState==callbackActive) {
|
||||
if(ppn->restart) {
|
||||
putNotify(ppn);
|
||||
doPutNotify(ppn);
|
||||
dbScanUnlock(precord);
|
||||
} else {
|
||||
dbScanUnlock(precord);
|
||||
@@ -459,4 +459,5 @@ epicsShareFunc void epicsShareAPI dbPutNotifyDestroy (dbPutNotifyID idIn)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
+4
-2
@@ -28,7 +28,8 @@ typedef struct pnRestartNode {
|
||||
ELLNODE node;
|
||||
struct putNotify *ppn;
|
||||
struct putNotify *ppnrestartList; /*ppn with restartList*/
|
||||
}PNRESTARTNODE;
|
||||
}pnRestartNode;
|
||||
typedef pnRestartNode PNRESTARTNODE;
|
||||
|
||||
|
||||
typedef struct putNotify{
|
||||
@@ -49,7 +50,8 @@ typedef struct putNotify{
|
||||
short restart;
|
||||
short callbackState;
|
||||
void *waitForCallback;
|
||||
}PUTNOTIFY;
|
||||
}putNotify;
|
||||
typedef putNotify PUTNOTIFY;
|
||||
|
||||
epicsShareFunc int epicsShareAPI dbPutNotifyMapType (PUTNOTIFY *ppn, short oldtype);
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "errlog.h"
|
||||
#include "ellLib.h"
|
||||
#include "tsStamp.h"
|
||||
#include "pvAdapter.h"
|
||||
#include "dbStaticLib.h"
|
||||
#include "dbBase.h"
|
||||
#include "dbCommon.h"
|
||||
@@ -63,6 +64,7 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "dbNotify.h"
|
||||
#include "dbAccessDefs.h"
|
||||
#include "dbEvent.h"
|
||||
#include "db_access_routines.h"
|
||||
|
||||
#ifndef NULL
|
||||
@@ -1608,6 +1610,135 @@ int no_elements
|
||||
return(0);
|
||||
}
|
||||
|
||||
pvId pvNameToId(const char *pname)
|
||||
{
|
||||
int status;
|
||||
dbAddr addr;
|
||||
dbAddr *paddr;
|
||||
status = db_name_to_addr(pname, &addr);
|
||||
if(status) return(0);
|
||||
paddr = dbCalloc(1,sizeof(dbAddr));
|
||||
*paddr = addr;
|
||||
return(paddr);
|
||||
}
|
||||
|
||||
int pvPutField(pvId id, int src_type,
|
||||
const void *psrc, int no_elements)
|
||||
{
|
||||
dbAddr *pdbAddr = (dbAddr *)id;
|
||||
return(db_put_field(pdbAddr,src_type,psrc,no_elements));
|
||||
}
|
||||
|
||||
int pvGetField(pvId id, int dest_type,
|
||||
void *pdest, int no_elements, void *pfl)
|
||||
{
|
||||
dbAddr *pdbAddr = (dbAddr *)id;
|
||||
return(db_get_field(pdbAddr,dest_type,pdest,no_elements,pfl));
|
||||
}
|
||||
|
||||
long pvPutNotifyInitiate(pvId id, unsigned type, unsigned long count,
|
||||
const void *pValue, putNotifyCallback func, void *usrPvt, putNotifyId * pID)
|
||||
{
|
||||
return( dbPutNotifyInitiate(
|
||||
(dbAddr *)id,type,count,pValue,func,usrPvt,(dbPutNotifyID *)pID));
|
||||
}
|
||||
|
||||
void pvPutNotifyDestroy(putNotifyId id)
|
||||
{
|
||||
dbPutNotifyDestroy((dbPutNotifyID)id);
|
||||
}
|
||||
|
||||
const char * pvName(pvId id)
|
||||
{
|
||||
dbAddr *pdbAddr = (dbAddr *)id;
|
||||
return(pdbAddr->precord->name);
|
||||
}
|
||||
|
||||
unsigned long pvNoElements(pvId id)
|
||||
{
|
||||
dbAddr *pdbAddr = (dbAddr *)id;
|
||||
return(pdbAddr->no_elements);
|
||||
}
|
||||
|
||||
short pvType(pvId id)
|
||||
{
|
||||
dbAddr *pdbAddr = (dbAddr *)id;
|
||||
return(pdbAddr->dbr_field_type);
|
||||
}
|
||||
|
||||
void * pvEventQueueInit(void)
|
||||
{
|
||||
return((void *)db_init_events());
|
||||
}
|
||||
|
||||
int pvEventQueueStart(void *id, const char *taskname,
|
||||
eventQueueInit initFunc, void *init_func_arg, int priority_offset)
|
||||
{
|
||||
return(db_start_events(
|
||||
(dbEventCtx)id,taskname,initFunc,init_func_arg,priority_offset));
|
||||
}
|
||||
|
||||
void pvEventQueueClose(void * id)
|
||||
{
|
||||
db_close_events((dbEventCtx)id);
|
||||
}
|
||||
|
||||
int pvEventQueuePostSingleEvent(void *es)
|
||||
{
|
||||
db_post_single_event((dbEventSubscription)es);
|
||||
printf("pvEventQueuePostSingleEvent why does this return int\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
void * pvEventQueueAddEvent(void *ctx, pvId id,
|
||||
eventQueueEventUser func, void *user_arg, unsigned select)
|
||||
{
|
||||
return((void *)db_add_event(
|
||||
(dbEventCtx)ctx,(dbAddr *)id,(EVENTFUNC*)func,user_arg,select));
|
||||
}
|
||||
|
||||
void pvEventQueueCancelEvent(void *es)
|
||||
{
|
||||
db_cancel_event((dbEventSubscription)es);
|
||||
}
|
||||
|
||||
int pvEventQueueAddExtraLaborEvent(void *ctx,
|
||||
eventQueueExtraLaborUser func, void *arg)
|
||||
{
|
||||
return(db_add_extra_labor_event((dbEventCtx)ctx,func,arg));
|
||||
}
|
||||
|
||||
int pvEventQueuePostExtraLabor(void *ctx)
|
||||
{
|
||||
return(db_post_extra_labor((dbEventCtx)ctx));
|
||||
}
|
||||
|
||||
|
||||
static pvAdapter adapter = {
|
||||
pvNameToId,
|
||||
pvPutField,
|
||||
pvGetField,
|
||||
pvPutNotifyInitiate,
|
||||
pvPutNotifyDestroy,
|
||||
pvName,
|
||||
pvNoElements,
|
||||
pvType,
|
||||
pvEventQueueInit,
|
||||
pvEventQueueStart,
|
||||
pvEventQueueClose,
|
||||
pvEventQueuePostSingleEvent,
|
||||
pvEventQueueAddEvent,
|
||||
pvEventQueueCancelEvent,
|
||||
pvEventQueueAddExtraLaborEvent,
|
||||
pvEventQueuePostExtraLabor
|
||||
};
|
||||
|
||||
|
||||
epicsShareFunc void epicsShareAPI db_attach_pvAdapter(void)
|
||||
{
|
||||
printf("db_attach_pvAdapter I dont know what to call\n");
|
||||
}
|
||||
|
||||
epicsShareFunc int epicsShareAPI dbPutNotifyMapType (PUTNOTIFY *ppn, short oldtype)
|
||||
{
|
||||
switch(oldtype) {
|
||||
|
||||
@@ -43,6 +43,8 @@ epicsShareFunc int epicsShareAPI db_put_field(
|
||||
epicsShareFunc int epicsShareAPI db_get_field(
|
||||
DBADDR *paddr, int dest_type,void *pdest, int no_elements, void *pfl);
|
||||
|
||||
epicsShareFunc void epicsShareAPI db_attach_pvAdapter(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+4
-1
@@ -79,8 +79,10 @@ of this distribution.
|
||||
#include "errMdef.h"
|
||||
#include "recSup.h"
|
||||
#include "envDefs.h"
|
||||
#include "rsrv.h"
|
||||
epicsShareFunc int epicsShareAPI rsrv_init (void);
|
||||
epicsShareFunc int epicsShareAPI asInit (void);
|
||||
#include "dbStaticLib.h"
|
||||
#include "db_access_routines.h"
|
||||
#include "initHooks.h"
|
||||
|
||||
LOCAL int initialized=FALSE;
|
||||
@@ -145,6 +147,7 @@ int iocInit()
|
||||
|
||||
/* Start up CA server */
|
||||
rsrv_init();
|
||||
db_attach_pvAdapter();
|
||||
|
||||
errlogPrintf("iocInit: All initialization complete\n");
|
||||
initHooks(initHookAtEnd);
|
||||
|
||||
Reference in New Issue
Block a user