changeset 447:44f818173f96

Export RedBoot version via virtual vector table.
author gthomas
date Tue, 03 Dec 2002 19:48:20 +0000
parents bb9dadc169ef
children c3adb3b974a2
files packages/hal/common/current/ChangeLog packages/hal/common/current/cdl/hal.cdl packages/hal/common/current/include/hal_if.h packages/hal/common/current/src/hal_if.c packages/redboot/current/ChangeLog packages/redboot/current/src/main.c
diffstat 6 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/common/current/ChangeLog
+++ b/packages/hal/common/current/ChangeLog
@@ -1,3 +1,10 @@
+2002-12-03  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* src/hal_if.c (hal_if_init): 
+	* include/hal_if.h: 
+	* cdl/hal.cdl: Allow monitor (RedBoot) version string to be exported
+	via the virtual vector table.
+
 2002-11-13  Gary Thomas  <gthomas@ecoscentric.com>
 
 	* cdl/hal.cdl: Add CDL control over DATA cache startup mode.
--- a/packages/hal/common/current/cdl/hal.cdl
+++ b/packages/hal/common/current/cdl/hal.cdl
@@ -306,6 +306,15 @@ cdl_package CYGPKG_HAL {
                     virtual vectors to be claimed."
             }
 
+            cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_VERSION {
+                display       "Claim version virtual vectors"
+                default_value { CYGSEM_HAL_VIRTUAL_VECTOR_INIT_WHOLE_TABLE \
+                                || CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_DEFAULT }
+                description   "
+                    This option will cause the version
+                    virtual vectors to be claimed."
+            }
+
             cdl_option CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_DELAY_US {
                 display       "Claim delay_us virtual vector"
                 default_value { CYGSEM_HAL_VIRTUAL_VECTOR_INIT_WHOLE_TABLE \
--- a/packages/hal/common/current/include/hal_if.h
+++ b/packages/hal/common/current/include/hal_if.h
@@ -12,6 +12,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -357,7 +358,7 @@ static __inline__ _rt_                  
 #define CYGNUM_CALL_IF_available_11               11
 #define CYGNUM_CALL_IF_SET_DEBUG_COMM             12
 #define CYGNUM_CALL_IF_SET_CONSOLE_COMM           13
-#define CYGNUM_CALL_IF_available_14               14
+#define CYGNUM_CALL_IF_MONITOR_VERSION            14
 #define CYGNUM_CALL_IF_DBG_SYSCALL                15
 #define CYGNUM_CALL_IF_RESET                      16
 #define CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG     17
@@ -422,6 +423,7 @@ typedef void (__call_if_delay_us_t)(cyg_
 typedef void (__call_if_install_bpt_fn_t)(void *__epc);
 typedef cyg_bool (__call_if_flash_cfg_op_fn_t)(int __oper, char *__key,
                                                void *__val, int __type);
+typedef char *__call_if_monitor_version_t;
 
 #ifndef CYGACC_CALL_IF_DEFINED
 
@@ -586,6 +588,12 @@ static __inline__ _rt_                  
 #define CYGACC_CALL_IF_RESET_GET() \
  ((__call_if_reset_t*)hal_virtual_vector_table[CYGNUM_CALL_IF_RESET])
 
+#define CYGACC_CALL_IF_MONITOR_VERSION() \
+ CYGACC_DATA_VV(__call_if_monitor_version_t, CYGNUM_CALL_IF_MONITOR_VERSION)
+__data_VV(CYGNUM_CALL_IF_MONITOR_VERSION, __call_if_monitor_version_t)
+#define CYGACC_CALL_IF_MONITOR_VERSION_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_MONITOR_VERSION]=(CYG_ADDRWORD)(_x_)
+
 #define CYGACC_CALL_IF_CONSOLE_INTERRUPT_FLAG() \
  CYGACC_DATA_VV(__call_if_console_interrupt_flag_t, CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG)
 __data_VV(CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG, __call_if_console_interrupt_flag_t)
--- a/packages/hal/common/current/src/hal_if.c
+++ b/packages/hal/common/current/src/hal_if.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -895,6 +896,10 @@ hal_if_init(void)
     CYGACC_CALL_IF_DBG_DATA_SET(0);
 #endif
 
+#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_VERSION
+    CYGACC_CALL_IF_MONITOR_VERSION_SET(0);
+#endif
+
     // Comm controls
 #ifdef CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_COMMS
     {
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,7 @@
+2002-12-03  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* src/main.c: Export version string via virtual vector table.
+
 2002-11-05  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* src/io.c (_rb_gets_preloaded): Null terminate when buffer full.
--- a/packages/redboot/current/src/main.c
+++ b/packages/redboot/current/src/main.c
@@ -128,12 +128,12 @@ extern void HAL_ARCH_PROGRAM_NEW_STACK(v
 void
 do_version(int argc, char *argv[])
 {
-    extern char RedBoot_version[];
 #ifdef CYGPKG_IO_FLASH
     externC void _flash_info(void);
 #endif
+    char *version = CYGACC_CALL_IF_MONITOR_VERSION();
 
-    diag_printf(RedBoot_version);
+    diag_printf(version);
 #ifdef HAL_PLATFORM_CPU
     diag_printf("Platform: %s (%s) %s\n", HAL_PLATFORM_BOARD, HAL_PLATFORM_CPU, HAL_PLATFORM_EXTRA);
 #endif
@@ -180,6 +180,10 @@ cyg_start(void)
     struct cmd *cmd;
     int cur;
     struct init_tab_entry *init_entry;
+    extern char RedBoot_version[];
+
+    // Export version information
+    CYGACC_CALL_IF_MONITOR_VERSION_SET(RedBoot_version);
 
     // Make sure the channels are properly initialized.
     diag_init_putc(_mon_write_char);