From 7395d1d88d457f63935eeff3ebff6cace2e7ac48 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 24 Jul 2015 14:06:45 -0500 Subject: [PATCH] Make dbCa routines macros to dbLink wrappers --- src/ioc/db/dbCa.c | 41 ++++++++++++------------ src/ioc/db/dbCa.h | 75 +++++++++++++++++++++++--------------------- src/ioc/db/dbCaPvt.h | 13 +++----- src/ioc/db/dbLink.c | 29 +++++++++-------- src/ioc/db/dbLink.h | 14 ++++----- 5 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/ioc/db/dbCa.c b/src/ioc/db/dbCa.c index 7fa04db79..c35515801 100644 --- a/src/ioc/db/dbCa.c +++ b/src/ioc/db/dbCa.c @@ -6,8 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ - -/* $Revision-Id$ +/* dbCa.c * * Original Authors: Bob Dalesio and Marty Kraimer * Date: 26MAR96 @@ -95,9 +94,9 @@ static int dbca_chan_count; * All dbCa* functions operating on a single link may only be called when * the record containing the DBLINK is locked. Including: * dbCaGet*() - * dbCaIsLinkConnected() + * isConnected() * dbCaPutLink() - * dbCaScanFwdLink() + * scanForward() * dbCaAddLinkCallback() * dbCaRemoveLink() * @@ -472,7 +471,7 @@ long dbCaPutLink(struct link *plink, short dbrType, return dbCaPutLinkCallback(plink, dbrType, pbuffer, nRequest, 0, NULL); } -int dbCaIsLinkConnected(const struct link *plink) +static int isConnected(const struct link *plink) { caLink *pca; @@ -482,7 +481,7 @@ int dbCaIsLinkConnected(const struct link *plink) return pca->isConnected; } -void dbCaScanFwdLink(struct link *plink) { +static void scanForward(struct link *plink) { short fwdLinkValue = 1; if (plink->value.pv_link.pvlMask & pvlOptFWD) @@ -501,7 +500,7 @@ void dbCaScanFwdLink(struct link *plink) { return -1; \ } -long dbCaGetNelements(const struct link *plink, long *nelements) +static long getElements(const struct link *plink, long *nelements) { caLink *pca; @@ -511,7 +510,7 @@ long dbCaGetNelements(const struct link *plink, long *nelements) return 0; } -long dbCaGetAlarm(const struct link *plink, +static long getAlarm(const struct link *plink, epicsEnum16 *pstat, epicsEnum16 *psevr) { caLink *pca; @@ -523,7 +522,7 @@ long dbCaGetAlarm(const struct link *plink, return 0; } -long dbCaGetTimeStamp(const struct link *plink, +static long getTimeStamp(const struct link *plink, epicsTimeStamp *pstamp) { caLink *pca; @@ -534,7 +533,7 @@ long dbCaGetTimeStamp(const struct link *plink, return 0; } -int dbCaGetLinkDBFtype(const struct link *plink) +static int getDBFtype(const struct link *plink) { caLink *pca; int type; @@ -565,7 +564,7 @@ long dbCaGetAttributes(const struct link *plink, return 0; } -long dbCaGetControlLimits(const struct link *plink, +static long getControlLimits(const struct link *plink, double *low, double *high) { caLink *pca; @@ -581,7 +580,7 @@ long dbCaGetControlLimits(const struct link *plink, return gotAttributes ? 0 : -1; } -long dbCaGetGraphicLimits(const struct link *plink, +static long getGraphicLimits(const struct link *plink, double *low, double *high) { caLink *pca; @@ -597,7 +596,7 @@ long dbCaGetGraphicLimits(const struct link *plink, return gotAttributes ? 0 : -1; } -long dbCaGetAlarmLimits(const struct link *plink, +static long getAlarmLimits(const struct link *plink, double *lolo, double *low, double *high, double *hihi) { caLink *pca; @@ -615,7 +614,7 @@ long dbCaGetAlarmLimits(const struct link *plink, return gotAttributes ? 0 : -1; } -long dbCaGetPrecision(const struct link *plink, short *precision) +static long getPrecision(const struct link *plink, short *precision) { caLink *pca; int gotAttributes; @@ -627,7 +626,7 @@ long dbCaGetPrecision(const struct link *plink, short *precision) return gotAttributes ? 0 : -1; } -long dbCaGetUnits(const struct link *plink, +static long getUnits(const struct link *plink, char *units, int unitsSize) { caLink *pca; @@ -676,14 +675,14 @@ static void scanLinkOnce(dbCommon *prec, caLink *pca) { static lset dbCa_lset = { dbCaRemoveLink, - dbCaIsLinkConnected, - dbCaGetLinkDBFtype, dbCaGetNelements, + isConnected, + getDBFtype, getElements, dbCaGetLink, - dbCaGetControlLimits, dbCaGetGraphicLimits, dbCaGetAlarmLimits, - dbCaGetPrecision, dbCaGetUnits, - dbCaGetAlarm, dbCaGetTimeStamp, + getControlLimits, getGraphicLimits, getAlarmLimits, + getPrecision, getUnits, + getAlarm, getTimeStamp, dbCaPutLink, - dbCaScanFwdLink + scanForward }; static void connectionCallback(struct connection_handler_args arg) diff --git a/src/ioc/db/dbCa.h b/src/ioc/db/dbCa.h index 21bedb684..841b48f16 100644 --- a/src/ioc/db/dbCa.h +++ b/src/ioc/db/dbCa.h @@ -1,20 +1,17 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* Copyright (c) 2015 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* dbCa.h */ +/* dbCa.h */ #ifndef INCdbCah #define INCdbCah -#include "shareLib.h" -#include "epicsTime.h" -#include "link.h" +#include "dbLink.h" #ifdef __cplusplus extern "C" { @@ -34,44 +31,52 @@ epicsShareFunc void dbCaAddLinkCallback(struct link *plink, dbCaCallback connect, dbCaCallback monitor, void *userPvt); epicsShareFunc long dbCaAddLink(struct dbLocker *locker, struct link *plink, short dbfType); epicsShareFunc void dbCaRemoveLink(struct dbLocker *locker, struct link *plink); + epicsShareFunc long dbCaGetLink(struct link *plink, short dbrType, void *pbuffer, epicsEnum16 *pstat, epicsEnum16 *psevr, long *nRequest); + +epicsShareFunc long dbCaGetAttributes(const struct link *plink, + dbCaCallback callback, void *userPvt); + epicsShareFunc long dbCaPutLinkCallback(struct link *plink, short dbrType, const void *pbuffer,long nRequest, dbCaCallback callback, void *userPvt); epicsShareFunc long dbCaPutLink(struct link *plink,short dbrType, const void *pbuffer,long nRequest); -epicsShareFunc int dbCaIsLinkConnected(const struct link *plink); -epicsShareFunc void dbCaScanFwdLink(struct link *plink); - -/* The following are available after the link is connected*/ -epicsShareFunc long dbCaGetNelements(const struct link *plink, - long *nelements); -#define dbCaGetSevr(plink, severity) \ - dbCaGetAlarm((plink), NULL, (severity)) -epicsShareFunc long dbCaGetAlarm(const struct link *plink, - epicsEnum16 *status, epicsEnum16 *severity); -epicsShareFunc long dbCaGetTimeStamp(const struct link *plink, - epicsTimeStamp *pstamp); -epicsShareFunc int dbCaGetLinkDBFtype(const struct link *plink); - -/*The following are available after attribute request is complete*/ -epicsShareFunc long dbCaGetAttributes(const struct link *plink, - dbCaCallback callback, void *userPvt); -epicsShareFunc long dbCaGetControlLimits(const struct link *plink, - double *low, double *high); -epicsShareFunc long dbCaGetGraphicLimits(const struct link *plink, - double *low, double *high); -epicsShareFunc long dbCaGetAlarmLimits(const struct link *plink, - double *lolo, double *low, double *high, double *hihi); -epicsShareFunc long dbCaGetPrecision(const struct link *plink, - short *precision); -epicsShareFunc long dbCaGetUnits(const struct link *plink, - char *units, int unitsSize); extern struct ca_client_context * dbCaClientContext; + +/* These macros are for backwards compatibility */ + +#define dbCaIsLinkConnected(link) \ + dbIsLinkConnected(link) + +#define dbCaGetLinkDBFtype(link) \ + dbGetLinkDBFtype(link) +#define dbCaGetNelements(link, nelements) \ + dbGetNelements(link, nelements) +#define dbCaGetSevr(link, sevr) \ + dbGetAlarm(link, NULL, sevr) +#define dbCaGetAlarm(link, stat, sevr) \ + dbGetAlarm(link, stat, sevr) +#define dbCaGetTimeStamp(link, pstamp) \ + dbGetTimeStamp(link, pstamp) +#define dbCaGetControlLimits(link, low, high) \ + dbGetControlLimits(link, low, high) +#define dbCaGetGraphicLimits(link, low, high) \ + dbGetGraphicLimits(link, low, high) +#define dbCaGetAlarmLimits(link, lolo, low, high, hihi) \ + dbGetAlarmLimits(link, lolo, low, high, hihi) +#define dbCaGetPrecision(link, prec) \ + dbGetPrecision(link, prec) +#define dbCaGetUnits(link, units, unitSize) \ + dbGetUnits(link, units, unitSize) + +#define dbCaScanFwdLink(link) \ + dbScanFwdLink(link) + #ifdef __cplusplus } #endif diff --git a/src/ioc/db/dbCaPvt.h b/src/ioc/db/dbCaPvt.h index d5274c577..553d48481 100644 --- a/src/ioc/db/dbCaPvt.h +++ b/src/ioc/db/dbCaPvt.h @@ -6,14 +6,11 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* dbCaPvt.h */ -/**************************************************************** -* -* Current Author: Bob Dalesio -* Contributing Author: Marty Kraimer -* Date: 08APR96 -* -****************************************************************/ +/* dbCaPvt.h + * + * Original Authors: Bob Dalesio, Marty Kraimer + * + */ #ifndef INC_dbCaPvt_H #define INC_dbCaPvt_H diff --git a/src/ioc/db/dbLink.c b/src/ioc/db/dbLink.c index b97d2a4ea..a224eac0f 100644 --- a/src/ioc/db/dbLink.c +++ b/src/ioc/db/dbLink.c @@ -1,14 +1,13 @@ /*************************************************************************\ * Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne - * National Laboratory. - * Copyright (c) 2002 The Regents of the University of California, as - * Operator of Los Alamos National Laboratory. - * EPICS BASE is distributed subject to a Software License Agreement found - * in file LICENSE that is included with this distribution. - \*************************************************************************/ -/* dbLink.c */ -/* $Id$ */ -/* +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* dbLink.c + * * Original Authors: Bob Dalesio, Marty Kraimer * Current Author: Andrew Johnson */ @@ -205,7 +204,7 @@ static void dbDbRemoveLink(dbLocker *locker, struct link *plink) free(pdbAddr); } -static int dbDbIsLinkConnected(const struct link *plink) +static int dbDbIsConnected(const struct link *plink) { return TRUE; } @@ -433,7 +432,7 @@ static void dbDbScanFwdLink(struct link *plink) static lset dbDb_lset = { dbDbRemoveLink, - dbDbIsLinkConnected, + dbDbIsConnected, dbDbGetDBFtype, dbDbGetElements, dbDbGetValue, dbDbGetControlLimits, dbDbGetGraphicLimits, dbDbGetAlarmLimits, @@ -542,10 +541,10 @@ int dbIsLinkConnected(const struct link *plink) { lset *plset = plink->lset; - if (!plset || !plset->isLinkConnected) + if (!plset || !plset->isConnected) return FALSE; - return plset->isLinkConnected(plink); + return plset->isConnected(plink); } int dbGetLinkDBFtype(const struct link *plink) @@ -687,8 +686,8 @@ void dbScanFwdLink(struct link *plink) { lset *plset = plink->lset; - if (plset && plset->scanFwdLink) - plset->scanFwdLink(plink); + if (plset && plset->scanForward) + plset->scanForward(plink); } /* Helper functions for long string support */ diff --git a/src/ioc/db/dbLink.h b/src/ioc/db/dbLink.h index fd9b2c250..a2e9175df 100644 --- a/src/ioc/db/dbLink.h +++ b/src/ioc/db/dbLink.h @@ -6,8 +6,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* - * dbLink.h +/* dbLink.h * * Created on: Mar 21, 2010 * Author: Andrew Johnson @@ -30,11 +29,11 @@ struct dbLocker; typedef struct lset { void (*removeLink)(struct dbLocker *locker, struct link *plink); - int (*isLinkConnected)(const struct link *plink); + int (*isConnected)(const struct link *plink); int (*getDBFtype)(const struct link *plink); long (*getElements)(const struct link *plink, long *nelements); long (*getValue)(struct link *plink, short dbrType, void *pbuffer, - epicsEnum16 *pstat, epicsEnum16 *psevr, long *pnRequest); + epicsEnum16 *pstat, epicsEnum16 *psevr, long *pnRequest); long (*getControlLimits)(const struct link *plink, double *lo, double *hi); long (*getGraphicLimits)(const struct link *plink, double *lo, double *hi); long (*getAlarmLimits)(const struct link *plink, double *lolo, double *lo, @@ -46,11 +45,11 @@ typedef struct lset { long (*getTimeStamp)(const struct link *plink, epicsTimeStamp *pstamp); long (*putValue)(struct link *plink, short dbrType, const void *pbuffer, long nRequest); - void (*scanFwdLink)(struct link *plink); + void (*scanForward)(struct link *plink); } lset; -#define dbGetSevr(PLINK, PSEVERITY) \ - dbGetAlarm((PLINK), NULL, (PSEVERITY)) +#define dbGetSevr(link, sevr) \ + dbGetAlarm(link, NULL, sevr) epicsShareFunc void dbInitLink(struct link *plink, short dbfType); epicsShareFunc void dbAddLink(struct dbLocker *locker, struct link *plink, short dbfType, @@ -58,6 +57,7 @@ epicsShareFunc void dbAddLink(struct dbLocker *locker, struct link *plink, short epicsShareFunc long dbLoadLink(struct link *plink, short dbrType, void *pbuffer); epicsShareFunc void dbRemoveLink(struct dbLocker *locker, struct link *plink); + epicsShareFunc long dbGetNelements(const struct link *plink, long *nelements); epicsShareFunc int dbIsLinkConnected(const struct link *plink); epicsShareFunc int dbGetLinkDBFtype(const struct link *plink);