Added initTrace command to exampleApp, registers a verbose initHook.

This commit is contained in:
Andrew Johnson
2008-06-24 21:49:57 +00:00
parent df39142335
commit c97214d4d2
7 changed files with 64 additions and 19 deletions

View File

@@ -45,6 +45,8 @@ TEMPLATES += top/exampleApp/src/dbSubExample.dbd
TEMPLATES += top/exampleApp/src/_APPNAME_Main.cpp
TEMPLATES += top/exampleApp/src/_APPNAME_Hello.c
TEMPLATES += top/exampleApp/src/_APPNAME_Hello.dbd
TEMPLATES += top/exampleApp/src/initTrace.c
TEMPLATES += top/exampleApp/src/initTrace.dbd
TEMPLATES += top/exampleBoot/Makefile
TEMPLATES += top/exampleBoot/nfsCommands@vxWorks

View File

@@ -33,6 +33,7 @@ _APPNAME__DBD += base.dbd
_APPNAME__DBD += xxxSupport.dbd
_APPNAME__DBD += dbSubExample.dbd
_APPNAME__DBD += _APPNAME_Hello.dbd
_APPNAME__DBD += initTrace.dbd
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
_APPNAME__SRCS += _APPNAME__registerRecordDeviceDriver.cpp
@@ -42,6 +43,7 @@ _APPNAME__SRCS_vxWorks += -nil-
# Add locally compiled object code
_APPNAME__SRCS += dbSubExample.c
_APPNAME__SRCS += _APPNAME_Hello.c
_APPNAME__SRCS += initTrace.c
# The following adds support from base/src/vxWorks
_APPNAME__OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary

View File

@@ -0,0 +1,34 @@
/* initTrace.c */
/*
* An initHook routine to trace the iocInit() process.
* Prints out the name of each state as it is reached.
*/
#include <stdio.h>
#include "initHooks.h"
#include "epicsExport.h"
#include "iocsh.h"
static void trace(initHookState state) {
printf("iocInit: Reached %s\n", initHookName(state));
}
int traceIocInit(void) {
initHookRegister(trace);
puts("iocInit will be traced");
return 0;
}
static const iocshFuncDef traceInitFuncDef = {"traceIocInit", 0, NULL};
static void traceInitFunc(const iocshArgBuf *args) {
traceIocInit();
}
static void initTraceRegister(void) {
iocshRegister(&traceInitFuncDef, traceInitFunc);
}
epicsExportRegistrar(initTraceRegister);

View File

@@ -0,0 +1 @@
registrar(initTraceRegister)

View File

@@ -8,18 +8,21 @@
cd ${TOP}
## Register all support components
dbLoadDatabase("dbd/_APPNAME_.dbd")
_CSAFEAPPNAME__registerRecordDeviceDriver(pdbbase)
dbLoadDatabase "dbd/_APPNAME_.dbd"
_CSAFEAPPNAME__registerRecordDeviceDriver pdbbase
## Load record instances
dbLoadTemplate "db/userHost.substitutions"
dbLoadRecords("db/dbSubExample.db","user=_USER_Host")
dbLoadRecords "db/dbSubExample.db", "user=_USER_Host"
## Set this to see messages from mySub
#var mySubDebug 1
## Run this to trace the stages of iocInit
#traceIocInit
cd ${TOP}/iocBoot/${IOC}
iocInit()
iocInit
## Start any sequence programs
#seq sncExample,"user=_USER_Host"
#seq sncExample, "user=_USER_Host"

View File

@@ -6,17 +6,20 @@
#< envPaths
## Register all support components
dbLoadDatabase("dbd/_APPNAME_.dbd")
_CSAFEAPPNAME__registerRecordDeviceDriver(pdbbase)
dbLoadDatabase "dbd/_APPNAME_.dbd"
_CSAFEAPPNAME__registerRecordDeviceDriver pdbbase
## Load record instances
dbLoadTemplate "db/user.substitutions"
dbLoadRecords("db/dbSubExample.db","user=_USER_")
dbLoadRecords "db/dbSubExample.db", "user=_USER_"
## Set this to see messages from mySub
#var mySubDebug 1
iocInit()
## Run this to trace the stages of iocInit
#traceIocInit
iocInit
## Start any sequence programs
#seq sncExample,"user=_USER_"
#seq sncExample, "user=_USER_"

View File

@@ -8,28 +8,28 @@
#< ../nfsCommands
cd topbin
## You may have to change _APPNAME_ to something else
## everywhere it appears in this file
ld < _APPNAME_.munch
## This drvTS initializer is needed if the IOC has a hardware event system
#TSinit
## Register all support components
cd top
dbLoadDatabase("dbd/_APPNAME_.dbd",0,0)
_CSAFEAPPNAME__registerRecordDeviceDriver(pdbbase)
dbLoadDatabase "dbd/_APPNAME_.dbd"
_CSAFEAPPNAME__registerRecordDeviceDriver pdbbase
## Load record instances
dbLoadTemplate "db/user.substitutions"
dbLoadRecords("db/dbSubExample.db","user=_USER_")
dbLoadRecords "db/dbSubExample.db", "user=_USER_"
## Set this to see messages from mySub
#mySubDebug = 1
## Run this to trace the stages of iocInit
#traceIocInit
cd startup
iocInit()
iocInit
## Start any sequence programs
#seq &sncExample,"user=_USER_"
#seq &sncExample, "user=_USER_"