From eff6f305c8f0b937f2eab4bc77b9585a2b1f09c8 Mon Sep 17 00:00:00 2001
From: "W. Eric Norum"
Date: Thu, 29 Jun 2006 15:22:53 +0000
Subject: [PATCH] Add RTEMS initialization hooks.
---
documentation/RELEASE_NOTES.html | 7 ++++++-
src/RTEMS/base/Makefile | 4 ++++
src/RTEMS/base/epicsRtemsInitHookPost.c | 19 +++++++++++++++++++
src/RTEMS/base/epicsRtemsInitHookPre.c | 19 +++++++++++++++++++
src/RTEMS/base/epicsRtemsInitHooks.h | 21 +++++++++++++++++++++
src/RTEMS/base/rtems_init.c | 7 ++++---
src/RTEMS/base/setBootConfigFromNVRAM.c | 4 ++--
7 files changed, 75 insertions(+), 6 deletions(-)
create mode 100644 src/RTEMS/base/epicsRtemsInitHookPost.c
create mode 100644 src/RTEMS/base/epicsRtemsInitHookPre.c
create mode 100644 src/RTEMS/base/epicsRtemsInitHooks.h
diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html
index 84f93c446..6b965bed5 100644
--- a/documentation/RELEASE_NOTES.html
+++ b/documentation/RELEASE_NOTES.html
@@ -40,7 +40,12 @@ affect vxWorks-(intel) targets.
Added space for user extensions. This provides the infrastructure for the
spy command.
Fixed error in epicsThreadGetName for non-EPICS threads.
-
+Added hooks for application routines to supply special network configuration
+parameters.
+The RTEMS startup code calls epicsRtemsInitPreSetBootConfigFromNVRAM just
+before reading values from NVRAM and
+epicsRtemsInitPostSetBootConfigFromNVRAM just afterwards. See
+epicsRtemsInitHooks.h for prototypes and global variables.
libCom
diff --git a/src/RTEMS/base/Makefile b/src/RTEMS/base/Makefile
index be3391722..95d5a06c1 100644
--- a/src/RTEMS/base/Makefile
+++ b/src/RTEMS/base/Makefile
@@ -10,12 +10,16 @@
TOP=../../..
include $(TOP)/configure/CONFIG
+INC += epicsRtemsInitHooks.h
+
SRCS += rtems_init.c
SRCS += rtems_config.c
SRCS += rtems_netconfig.c
SRCS += rtems_util.c
SRCS += rtems_dummyreg.c
SRCS += setBootConfigFromNVRAM.c
+SRCS += epicsRtemsInitHookPre.c
+SRCS += epicsRtemsInitHookPost.c
LIBRARY_RTEMS = rtemsCom
LIBRARY_SRCS = $(SRCS) $(BUILD_ARCHS)
diff --git a/src/RTEMS/base/epicsRtemsInitHookPost.c b/src/RTEMS/base/epicsRtemsInitHookPost.c
new file mode 100644
index 000000000..37ec013cc
--- /dev/null
+++ b/src/RTEMS/base/epicsRtemsInitHookPost.c
@@ -0,0 +1,19 @@
+/*************************************************************************\
+* Copyright (c) 2006 The University of Chicago, as Operator of Argonne
+* 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.
+\*************************************************************************/
+
+/*
+ * Dummy version -- use if application does not provide its own version
+ * $Id$
+ */
+#include "epicsRtemsInitHooks.h"
+
+int
+epicsRtemsInitPostSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config)
+{
+ return 0;
+}
diff --git a/src/RTEMS/base/epicsRtemsInitHookPre.c b/src/RTEMS/base/epicsRtemsInitHookPre.c
new file mode 100644
index 000000000..31cd1ff1b
--- /dev/null
+++ b/src/RTEMS/base/epicsRtemsInitHookPre.c
@@ -0,0 +1,19 @@
+/*************************************************************************\
+* Copyright (c) 2006 The University of Chicago, as Operator of Argonne
+* 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.
+\*************************************************************************/
+
+/*
+ * Dummy version -- use if application does not provide its own version
+ * $Id$
+ */
+#include "epicsRtemsInitHooks.h"
+
+int
+epicsRtemsInitPreSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config)
+{
+ return 0;
+}
diff --git a/src/RTEMS/base/epicsRtemsInitHooks.h b/src/RTEMS/base/epicsRtemsInitHooks.h
new file mode 100644
index 000000000..c0220ab28
--- /dev/null
+++ b/src/RTEMS/base/epicsRtemsInitHooks.h
@@ -0,0 +1,21 @@
+/*************************************************************************\
+* Copyright (c) 2006 The University of Chicago, as Operator of Argonne
+* 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.
+\*************************************************************************/
+
+/*
+ * Hooks into RTEMS startup code
+ * $Id$
+ */
+#include
+#include
+
+extern char *env_nfsServer;
+extern char *env_nfsPath;
+extern char *env_nfsMountPoint;
+
+int epicsRtemsInitPreSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);
+int epicsRtemsInitPostSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);
diff --git a/src/RTEMS/base/rtems_init.c b/src/RTEMS/base/rtems_init.c
index e7b6b710d..dc485424f 100644
--- a/src/RTEMS/base/rtems_init.c
+++ b/src/RTEMS/base/rtems_init.c
@@ -39,6 +39,8 @@
#include
#include
+#include "epicsRtemsInitHooks.h"
+
static void
logReset (void)
{
@@ -178,9 +180,6 @@ initialize_remote_filesystem(const char **argv, int hasLocalFilesystem)
argv[1] = path;
}
#else
- extern char *env_nfsServer;
- extern char *env_nfsPath;
- extern char *env_nfsMountPoint;
char *server_name;
char *server_path;
char *mount_point;
@@ -431,10 +430,12 @@ Init (rtems_task_argument ignored)
/*
* Architecture-specific hooks
*/
+ epicsRtemsInitPreSetBootConfigFromNVRAM(&rtems_bsdnet_config);
if (rtems_bsdnet_config.bootp == NULL) {
extern void setBootConfigFromNVRAM(void);
setBootConfigFromNVRAM();
}
+ epicsRtemsInitPostSetBootConfigFromNVRAM(&rtems_bsdnet_config);
/*
* Override RTEMS configuration
diff --git a/src/RTEMS/base/setBootConfigFromNVRAM.c b/src/RTEMS/base/setBootConfigFromNVRAM.c
index af1eece16..81b9cd8b0 100644
--- a/src/RTEMS/base/setBootConfigFromNVRAM.c
+++ b/src/RTEMS/base/setBootConfigFromNVRAM.c
@@ -262,7 +262,7 @@ setBootConfigFromNVRAM(void)
rtems_bsdnet_config.domainname = cp1;
rtems_bsdnet_config.hostname = env("HOSTNAME", "iocNobody");
rtems_bsdnet_config.ifconfig->ip_address = env("IPADDR0", "192.168.0.2");
- rtems_bsdnet_bootp_boot_file_name = env("BOOTFILE", "epics/iocNobody/bin/RTEMS-uC5282/myApp.boot");
+ rtems_bsdnet_bootp_boot_file_name = env("BOOTFILE", "uC5282App.boot");
rtems_bsdnet_bootp_cmdline = env("CMDLINE", "epics/iocBoot/iocNobody/st.cmd");
if ((cp1 = env("NFSMOUNT", NULL)) != NULL) {
char *cp2, *cp3;
@@ -293,6 +293,6 @@ void
setBootConfigFromNVRAM(void)
{
printf("SYSTEM HAS NO NON-VOLATILE RAM!\n");
- printf("YOU MUST USE BOOTP/DHCP TO OBTAIN NETWORK CONFIGURATION\n");
+ printf("YOU MUST USE SOME OTHER METHOD TO OBTAIN NETWORK CONFIGURATION\n");
}
#endif