Update example template, release notes

Changed device support to use the long string input rectype.
Moved the device registration into its own file.
Used _APPNAME_ more, trying to prevent future name clashes.
This commit is contained in:
Andrew Johnson
2015-07-10 12:28:49 -05:00
parent 837111296e
commit ed4bcd831f
13 changed files with 65 additions and 81 deletions
+6 -6
View File
@@ -17,13 +17,13 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.</p>
<h3>Generate Version Header</h3>
<p>A Perl script and Makefile rules are added to allow modules
to generate a C header file with a macro defined with an automatically updated identifier.
This is a VCS revision ID (Darcs, Git, and Mercurial supported) or
the time of the build if not VCS system is in use.</p>
<p>A Perl script and Makefile rules have been added to allow modules to generate
a C header file with a macro defined with an automatically updated identifier.
This is a VCS revision ID (Darcs, Git, Mercurial Subversion and Bazaar are all
supported) or the date/time of the build if no VCS system is in use.</p>
<p>The example template is updated with a demonstration which makes this
identifier visible with a stringin record.</p>
<p>The makeBaseApp example template has been updated with a new device support
which makes this identifier visible via a lsi (long string input) record.</p>
<h3>Implement EPICS_CAS_INTF_ADDR_LIST in rsrv</h3>
+3 -2
View File
@@ -28,11 +28,12 @@ TEMPLATES += top/exampleApp/Makefile
TEMPLATES += top/exampleApp/Db/Makefile
TEMPLATES += top/exampleApp/Db/dbExample1.db
TEMPLATES += top/exampleApp/Db/dbExample2.db
TEMPLATES += top/exampleApp/Db/dbVersionExample.db
TEMPLATES += top/exampleApp/Db/_APPNAME_Version.db
TEMPLATES += top/exampleApp/Db/dbSubExample.db
TEMPLATES += top/exampleApp/Db/user.substitutions
TEMPLATES += top/exampleApp/src/Makefile
TEMPLATES += top/exampleApp/src/devGenVersion.c
TEMPLATES += top/exampleApp/src/dev_APPNAME_Version.c
TEMPLATES += top/exampleApp/src/dev_APPNAME_Version.dbd
TEMPLATES += top/exampleApp/src/xxxRecord.dbd
TEMPLATES += top/exampleApp/src/xxxRecord.c
TEMPLATES += top/exampleApp/src/devXxxSoft.c
+1 -1
View File
@@ -12,7 +12,7 @@ include $(TOP)/configure/CONFIG
# databases, templates, substitutions like this
DB += dbExample1.db
DB += dbExample2.db
DB += dbVersionExample.db
DB += _APPNAME_Version.db
DB += dbSubExample.db
DB += user.substitutions
@@ -0,0 +1,6 @@
record(lsi, "$(user):_APPNAME_:version") {
field(DTYP, "_APPNAME_ version")
field(DESC, "Version string")
field(SIZV, "$(SIZV=200)")
field(PINI, "YES")
}
@@ -1,7 +0,0 @@
record(waveform, "$(user):version") {
field(DTYP, "Module Version")
field(DESC, "Module version")
field(FTVL, "CHAR")
field(NELM, "$(NELM=200)")
field(PINI, "YES")
}
@@ -14,21 +14,22 @@ DBDINC += xxxRecord
# Install devXxxSoft.dbd into <top>/dbd
DBD += xxxSupport.dbd
# Compile and add the code to the support library
# Compile and add code to the support library
_APPNAME_Support_SRCS += xxxRecord.c
_APPNAME_Support_SRCS += devXxxSoft.c
_APPNAME_Support_SRCS += devGenVersion.c
# Link locally-provided code into the support library,
# rather than directly into the IOC application.
# rather than directly into the IOC application, that
# causes problems on Windows DLL builds
_APPNAME_Support_SRCS += dbSubExample.c
_APPNAME_Support_SRCS += dev_APPNAME_Version.c
_APPNAME_Support_SRCS += _APPNAME_Hello.c
_APPNAME_Support_SRCS += initTrace.c
_APPNAME_Support_LIBS += $(EPICS_BASE_IOC_LIBS)
# Generate a header which defines a macro with a version string
# with the date and time, or a revision id from VCS system if available
# Auto-generate a header file containing a version string.
# Version comes from the VCS if available, else date+time.
GENVERSION = _APPNAME_Version.h
# Macro name
GENVERSIONMACRO = _APPNAME_VERSION
@@ -44,6 +45,7 @@ DBD += _APPNAME_.dbd
_APPNAME__DBD += base.dbd
_APPNAME__DBD += xxxSupport.dbd
_APPNAME__DBD += dbSubExample.dbd
_APPNAME__DBD += dev_APPNAME_Version.dbd
_APPNAME__DBD += _APPNAME_Hello.dbd
_APPNAME__DBD += initTrace.dbd
@@ -1,2 +1 @@
registrar(helloRegister)
device(waveform,INST_IO,devWfMyModVersion,"Module Version")
@@ -1,56 +0,0 @@
/* devGenVersion.c */
/* Example device support providing the module version string as a charactor array (long string) */
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "recGbl.h"
#include "alarm.h"
#include "recSup.h"
#include "devSup.h"
#include "menuFtype.h"
#include "waveformRecord.h"
#include "_APPNAME_Version.h"
/* must be last include */
#include "epicsExport.h"
static long read_wf(waveformRecord *prec)
{
size_t N = strlen(_APPNAME_VERSION)+1;
char *buf = prec->bptr;
if(prec->ftvl!=menuFtypeCHAR) {
(void)recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
return 0;
}
if(N>=prec->nelm)
N = prec->nelm;
prec->nord = N;
memcpy(buf, _APPNAME_VERSION, N);
buf[prec->nelm-1] = '\0';
return 0;
}
static struct {
long number;
DEVSUPFUN report;
DEVSUPFUN init;
DEVSUPFUN init_record;
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_si;
}devWfMyModVersion={
5,
NULL,
NULL,
NULL,
NULL,
read_wf,
};
epicsExportAddress(dset,devWfMyModVersion);
@@ -0,0 +1,38 @@
/* dev_APPNAME_Version.c */
/* Example device support for the lsi (long string input) record
* providing the module version string as the value
*/
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "devSup.h"
#include "lsiRecord.h"
#include "_APPNAME_Version.h"
/* must be last include */
#include "epicsExport.h"
const char const version[] = _APPNAME_VERSION;
static long read_string(lsiRecord *prec)
{
size_t N = sizeof version;
char *buf = prec->val;
if (N > prec->sizv)
N = prec->sizv;
prec->len = N;
memcpy(buf, version, N);
buf[N - 1] = '\0';
return 0;
}
static lsidset dev_CSAFEAPPNAME_Version = {
5, NULL, NULL, NULL, NULL, read_string
};
epicsExportAddress(dset,dev_CSAFEAPPNAME_Version);
@@ -0,0 +1 @@
device(lsi,INST_IO,dev_CSAFEAPPNAME_Version,"_APPNAME_ version")
@@ -13,7 +13,7 @@ _CSAFEAPPNAME__registerRecordDeviceDriver pdbbase
## Load record instances
dbLoadTemplate "db/user.substitutions"
dbLoadRecords "db/dbVersionExample.db", "user=_USER_"
dbLoadRecords "db/_APPNAME_Version.db", "user=_USER_"
dbLoadRecords "db/dbSubExample.db", "user=_USER_"
## Set this to see messages from mySub
@@ -11,7 +11,7 @@ _CSAFEAPPNAME__registerRecordDeviceDriver(pdbbase)
## Load record instances
dbLoadTemplate("db/user.substitutions")
dbLoadRecords("db/dbVersionExample.db", "user=_USER_")
dbLoadRecords("db/_APPNAME_Version.db", "user=_USER_")
dbLoadRecords("db/dbSubExample.db", "user=_USER_")
## Set this to see messages from mySub
@@ -20,7 +20,7 @@ _CSAFEAPPNAME__registerRecordDeviceDriver pdbbase
## Load record instances
dbLoadTemplate "db/user.substitutions"
dbLoadRecords "db/dbVersionExample.db", "user=_USER_"
dbLoadRecords "db/_APPNAME_Version.db", "user=_USER_"
dbLoadRecords "db/dbSubExample.db", "user=_USER_"
## Set this to see messages from mySub