Experimental Physics and Industrial Control System
Benjamin Franksen and I have had a couple of E-mail
messages discussing the final format for his initHooks
implementation. Attached are the sources for initHooks.h
and initHooks.c.
This will be in beta12. Beta11 is now being used at
APS/ASD and will be put into the APS EPICS software distribution
soon as we get the doc up to date, hopefully tomorrow.
The new initHooks discussion started after beta11 was
created and thus is NOT part of beta11.
Begining with beta12 the new implementation of initHooks
will be part of iocCore. Since iocInit looks up the name
initHooks, old private versions will work as before as long
as the private version of initHooks.o is loaded after iocCore.
The next version of the Application Developers Guide will
describe the new version.
Benjamin's version of initHooks is much nicer than the
previous implementation.
Marty Kraimer
/* share/src/db/initHooks.h*/
/*
* Authors: Benjamin Franksen (BESY) and Marty Kraimer
* Date: 06-01-91
* major Revision: 07JuL97
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .01 09-05-92 rcz initial version
* .02 09-10-92 rcz changed completely
* .03 07-15-97 mrk Benjamin Franksen allow multiple functions
*
*/
#ifndef INCinitHooksh
#define INCinitHooksh 1
typedef enum {
initHookAtBeginning,
initHookAfterGetResources,
initHookAfterLogInit,
initHookAfterCallbackInit,
initHookAfterCaLinkInit,
initHookAfterInitDrvSup,
initHookAfterInitRecSup,
initHookAfterInitDevSup,
initHookAfterTS_init,
initHookAfterInitDatabase,
initHookAfterFinishDevSup,
initHookAfterScanInit,
initHookAfterInterruptAccept,
initHookAfterInitialProcess,
initHookAtEnd
}initHookState;
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __STDC__
typedef void (*initHookFunction)(initHookState state);
int initHookRegister(initHookFunction func);
void initHooks(initHookState state);
#else /*__STDC__*/
typedef void (*initHookFunction)();
int initHookRegister();
void initHooks();
#endif /*__STDC__*/
#ifdef __cplusplus
}
#endif
/*FOLLOWING IS OBSOLETE*/
/*The following are for compatibility with old initHooks.c functions*/
#define INITHOOKatBeginning initHookAtBeginning
#define INITHOOKafterGetResources initHookAfterGetResources
#define INITHOOKafterLogInit initHookAfterLogInit
#define INITHOOKafterCallbackInit initHookAfterCallbackInit
#define INITHOOKafterCaLinkInit initHookAfterCaLinkInit
#define INITHOOKafterInitDrvSup initHookAfterInitDrvSup
#define INITHOOKafterInitRecSup initHookAfterInitRecSup
#define INITHOOKafterInitDevSup initHookAfterInitDevSup
#define INITHOOKafterTS_init initHookAfterTS_init
#define INITHOOKafterInitDatabase initHookAfterInitDatabase
#define INITHOOKafterFinishDevSup initHookAfterFinishDevSup
#define INITHOOKafterScanInit initHookAfterScanInit
#define INITHOOKafterInterruptAccept initHookAfterInterruptAccept
#define INITHOOKafterInitialProcess initHookAfterInitialProcess
#define INITHOOKatEnd initHookAtEnd
/*END OF OBSOLETE DEFINITIONS*/
#endif /*INCinitHooksh*/
/* share/src/db/initHooks.c*/
/*
* Authors: Benjamin Franksen (BESY) and Marty Kraimer
* Date: 06-01-91
* major Revision: 07JuL97
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .01 09-05-92 rcz initial version
* .02 09-10-92 rcz changed return from void to long
* .03 09-10-92 rcz changed completely
* .04 09-10-92 rcz bug - moved call to setMasterTimeToSelf later
* .04 07-15-97 mrk Benjamin Franksen allow multiple functions
*
*/
#include <vxWorks.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <ellLib.h>
#include <initHooks.h>
typedef struct initHookLink {
ELLNODE node;
initHookFunction func;
} initHookLink;
static functionListInited = FALSE;
static ELLLIST functionList;
static void initFunctionList(void)
{
ellInit(&functionList);
functionListInited = TRUE;
}
/*
* To be called before iocInit reaches state desired.
*/
int initHookRegister(initHookFunction func)
{
initHookLink *newHook;
if(!functionListInited) initFunctionList();
newHook = (initHookLink *)malloc(sizeof(initHookLink));
if (newHook == NULL)
{
printf("Cannot malloc a new initHookLink\n");
return ERROR;
}
newHook->func = func;
ellAdd(&functionList,&newHook->node);
return OK;
}
/*
* Called by iocInit at various points during initialization.
* Do not call this function from any other function than iocInit.
*/
void initHooks(initHookState state)
{
initHookLink *hook;
if(!functionListInited) initFunctionList();
hook = (initHookLink *)ellFirst(&functionList);
while(hook != NULL)
{
hook->func(state);
hook = (initHookLink *)ellNext(&hook->node);
}
}
- References:
- InitHooks Benjamin Franksen
- Re: InitHooks Marty Kraimer
- Re: InitHooks Benjamin Franksen
- Navigate by Date:
- Prev:
IOC's for new project Hammonds, John
- Next:
change in promotion of types from database to channel access Chip Watson
- Index:
1994
1995
1996
<1997>
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: InitHooks Benjamin Franksen
- Next:
RE: InitHooks Jeff Hill
- Index:
1994
1995
1996
<1997>
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024