changeset 42:94fd8fbfe8fe ecos-sw-1999-10-05

Merge from eCos master repository on 1999-10-05-12:38:44-BST
author jlarmour
date Tue, 05 Oct 1999 12:09:26 +0000
parents 7b92742d1d6f
children 3e1bfbe59ff6
files packages/hal/arm/cl7211/current/ChangeLog packages/hal/arm/cl7211/current/include/hal_platform_setup.h packages/hal/arm/cl7211/current/src/cl7211_misc.c packages/hal/i386/arch/current/ChangeLog packages/hal/i386/arch/current/include/hal_arch.h packages/hal/i386/linux/current/ChangeLog packages/hal/i386/linux/current/include/pkgconf/hal_i386_linux.h packages/hal/i386/linux/current/src/PKGconf.mak packages/hal/i386/linux/current/src/linux_misc.c packages/hal/i386/linux/current/src/syscall-i386-linux-1.0.S packages/language/c/libc/current/ChangeLog packages/language/c/libc/current/include/pkgconf/libc.h
diffstat 12 files changed, 155 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/arm/cl7211/current/ChangeLog
+++ b/packages/hal/arm/cl7211/current/ChangeLog
@@ -1,3 +1,7 @@
+1999-10-04  Gary Thomas  <gthomas@cygnus.co.uk>
+	* include/hal_platform_setup.h: Allow ROM applications to be linked
+	at "ram" addresses and be automatically relocated at startup time.
+
 1999-09-15  Gary Thomas  <gthomas@cygnus.co.uk>
 
 	* misc/nand_test.c (nand_exercise): Check "read ID" function.
--- a/packages/hal/arm/cl7211/current/include/hal_platform_setup.h
+++ b/packages/hal/arm/cl7211/current/include/hal_platform_setup.h
@@ -242,22 +242,26 @@ 20:
 	nop	                                                                        ;\
 10:
 #else // EP7211, 720T processor
-#define MMU_INITIALIZE                                                                   \
-	ldr	r1,=MMU_Control_Init                                                    ;\
-	mcr	MMU_CP,0,r1,MMU_Control,c0	/* MMU off */                           ;\
-	ldr	r1,=MMU_BASE                                                            ;\
-	mcr	MMU_CP,0,r1,MMU_Base,c0                                                 ;\
-	mcr	MMU_CP,0,r1,MMU_TLB,c7,0	/*  Invalidate TLB - 720 style */       ;\
-	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0	/* Invalidate Caches */                 ;\
-	ldr	r1,=0xFFFFFFFF                                                          ;\
-	mcr	MMU_CP,0,r1,MMU_DomainAccess,c0	                                        ;\
-	ldr	r2,=10f                 	                                        ;\
-	ldr	r1,=MMU_Control_Init|MMU_Control_M                                      ;\
-	mcr	MMU_CP,0,r1,MMU_Control,c0	                                        ;\
-	mov	pc,r2    /* Change address spaces */                                    ;\
-	nop	                                                                        ;\
-	nop	                                                                        ;\
-	nop	                                                                        ;\
+#define MMU_INITIALIZE                                                                   ;\
+	ldr	r1,=MMU_Control_Init                                                     ;\
+        mcr	MMU_CP,0,r1,MMU_Control,c0	/* MMU off */                            ;\
+	ldr	r1,=MMU_BASE                                                             ;\
+	mcr	MMU_CP,0,r1,MMU_Base,c0                                                  ;\
+	mcr	MMU_CP,0,r1,MMU_TLB,c7,0	/*  Invalidate TLB - 720 style */        ;\
+	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0	/* Invalidate Caches */                  ;\
+	ldr	r1,=0xFFFFFFFF                                                           ;\
+	mcr	MMU_CP,0,r1,MMU_DomainAccess,c0	                                         ;\
+	ldr	r2,=10f                 	                                         ;\
+        ldr     r3,=__exception_handlers                                                              ;\
+        sub     r2,r2,r3                                                                 ;\
+        ldr     r3,=ROM0_LA_START                                                        ;\
+        add     r2,r2,r3                                                                 ;\
+	ldr	r1,=MMU_Control_Init|MMU_Control_M                                       ;\
+	mcr	MMU_CP,0,r1,MMU_Control,c0	                                         ;\
+	mov	pc,r2    /* Change address spaces */                                     ;\
+	nop	                                                                         ;\
+	nop	                                                                         ;\
+	nop	                                                                         ;\
 10:
 #endif
 
@@ -392,7 +396,18 @@ 10:	orr	r0,r5,r6                        
 	cmp	r3,r4                                                                   ;\
 	bne	10b                                                                     ;\
 /* Now initialize the MMU to use this new page table */                                 ;\
-        MMU_INITIALIZE                                                                  
+        MMU_INITIALIZE                                                                   ;\
+        ldr     r2,=__exception_handlers                                                              ;\
+        ldr     r3,=ROM0_LA_START                                                        ;\
+        cmp     r2,r3                                                                    ;\
+        beq     20f                                                                      ;\
+        ldr     r4,=__rom_data_end                                                       ;\
+15:                                                                                      ;\
+        ldr     r0,[r3],#4                                                               ;\
+        str     r0,[r2],#4                                                               ;\
+        cmp     r2,r4                                                                    ;\
+        bne     15b                                                                      ;\
+20:
 
 #else
 
--- a/packages/hal/arm/cl7211/current/src/cl7211_misc.c
+++ b/packages/hal/arm/cl7211/current/src/cl7211_misc.c
@@ -236,6 +236,12 @@ void hal_hardware_init(void)
     HAL_ICACHE_INVALIDATE_ALL();
     HAL_ICACHE_ENABLE();
     // Any hardware/platform initialization that needs to be done.
+    *(volatile cyg_uint32 *)INTMR1 = 0;
+    *(volatile cyg_uint32 *)INTMR2 = 0;
+#if !defined(__CL7111)
+    *(volatile cyg_uint32 *)INTMR3 = 0;
+    *(volatile cyg_uint8 *)SYSCON3 = SYSCON3_CLKCTL(CPU_CLOCK);
+#endif
 #if 0
     diag_printf("IMR1: %04x, IMR2: %04x\n",
                 *(volatile cyg_uint32 *)INTMR1,
@@ -246,12 +252,6 @@ void hal_hardware_init(void)
                 *(volatile cyg_uint8 *)DRFPR);
 #endif
     // Reset all interrupt masks (disable all interrupt sources)
-    *(volatile cyg_uint32 *)INTMR1 = 0;
-    *(volatile cyg_uint32 *)INTMR2 = 0;
-#if !defined(__CL7111)
-    *(volatile cyg_uint32 *)INTMR3 = 0;
-    *(volatile cyg_uint8 *)SYSCON3 = SYSCON3_CLKCTL(CPU_CLOCK);
-#endif
     for (vector = CYGNUM_HAL_ISR_MIN;  vector < CYGNUM_HAL_ISR_COUNT;  vector++) {
         icr = (volatile cyg_uint32 *)hal_interrupt_clear_map[vector];
         if (icr) *icr = 0;  // Just a write clears the latch
--- a/packages/hal/i386/arch/current/ChangeLog
+++ b/packages/hal/i386/arch/current/ChangeLog
@@ -1,3 +1,7 @@
+1999-10-05  Jesper Skov  <jskov@cygnus.co.uk>
+        From Andrew Lunn (lunn@ma.tech.ascom.ch)
+	* include/hal_arch.h (HAL_IDLE_THREAD_ACTION): Defined.
+
 1999-05-14  Jesper Skov  <jskov@cygnus.co.uk>
         PR 18956
 	* src/i386.ld: Fixed problem with rel_got.
--- a/packages/hal/i386/arch/current/include/hal_arch.h
+++ b/packages/hal/i386/arch/current/include/hal_arch.h
@@ -185,9 +185,9 @@ externC void hal_longjmp(hal_jmp_buf env
 // chance to insert code. Typical idle thread behaviour might be to halt the
 // processor.
 
-//externC void hal_idle_thread_action(cyg_uint32 loop_count);
+externC void hal_idle_thread_action(cyg_uint32 loop_count);
 
-#define HAL_IDLE_THREAD_ACTION(_count_)
+#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_)
 
 //-----------------------------------------------------------------------------
 // Minimal and sensible stack sizes: the intention is that applications
--- a/packages/hal/i386/linux/current/ChangeLog
+++ b/packages/hal/i386/linux/current/ChangeLog
@@ -1,3 +1,14 @@
+1999-10-05  Jesper Skov  <jskov@cygnus.co.uk>
+
+	* include/pkgconf/hal_i386_linux.h: Changed to use REAL TIME as
+	default.
+
+        From Andrew Lunn (lunn@ma.tech.ascom.ch)
+	* src/PKGconf.mak: 
+	* src/linux_misc.c:  [added]
+	* src/syscall-i386-linux-1.0.S: 
+	Added idle thread action, reducing host load when eCos is idle.
+
 1999-08-16  John Dallaway  <jld@cygnus.co.uk>
 
 	* include/pkgconf/hal_i386_linux.h:
--- a/packages/hal/i386/linux/current/include/pkgconf/hal_i386_linux.h
+++ b/packages/hal/i386/linux/current/include/pkgconf/hal_i386_linux.h
@@ -60,18 +60,18 @@
        display          "Use Linux real-time timer"
        parent           CYGPKG_HAL_I386_LINUX
        description      "
-           By default the eCos timer will driven by a virtual timer,
-           meaning that it will only tick when the Linux task is
-           executing. This prevents (to some degree) time skew in
-           the eCos kernel due to heavy load on Linux. By checking
-           this option, the eCos timer can be driven by the Linux
-           real-time timer instead."
+           Using the real-time timer to drive the eCos RTC allows the
+           eCos idle loop to call select(2) and thus not put any load
+           on the host machine.
+           Deselecting this option means the virtual timer will be used
+           instead. This may prevent (to some degree) time skew in the
+           eCos kernel, especially if the host machine has a high load."
    }
 
    }}CFG_DATA */
 
 #define CYGHWR_HAL_I386_LINUX_STARTUP       ram
-#undef  CYGSEM_HAL_I386_LINUX_REAL_TIME
+#define CYGSEM_HAL_I386_LINUX_REAL_TIME
 
 // Real-time clock/counter specifics
 
--- a/packages/hal/i386/linux/current/src/PKGconf.mak
+++ b/packages/hal/i386/linux/current/src/PKGconf.mak
@@ -34,7 +34,7 @@ include ../../../../../pkgconf/pkgconf.m
 
 LIBRARY       := libtarget.a
 COMPILE       := hal_diag.c hal_startup.c syscall-i386-linux-1.0.S entry.c \
-                 linux.S
+                 linux.S linux_misc.c
 OTHER_OBJS    :=
 OTHER_TARGETS :=
 OTHER_CLEAN   :=
new file mode 100644
--- /dev/null
+++ b/packages/hal/i386/linux/current/src/linux_misc.c
@@ -0,0 +1,72 @@
+//=============================================================================
+//
+//      linux_misc.c
+//
+//      Misc code for the Linux HAL
+//
+//=============================================================================
+//####COPYRIGHTBEGIN####
+//
+// -------------------------------------------
+// The contents of this file are subject to the Cygnus eCos Public License
+// Version 1.0 (the "License"); you may not use this file except in
+// compliance with the License.  You may obtain a copy of the License at
+// http://sourceware.cygnus.com/ecos
+// 
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the
+// License for the specific language governing rights and limitations under
+// the License.
+// 
+// The Original Code is eCos - Embedded Cygnus Operating System, released
+// October 31, 1998.
+// 
+// The Initial Developer of the Original Code is Cygnus.  Portions created
+// by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions.  All Rights Reserved.
+// -------------------------------------------
+//
+//####COPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):   asl
+// Contributors:asl
+// Date:        1999-09-23
+// Purpose:     Misc functions for the Linux HAL
+// Description: Misc functions for the Linux HAL
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <cyg/infra/cyg_type.h>         // base types
+
+#ifdef CYGPKG_KERNEL
+# include <pkgconf/kernel.h>
+#endif
+
+// This in not correct, but it will do.
+externC int cyg_hal_sys__newselect(int,int,int,int,int);
+
+// Here we define an action to do in the idle thread. For the
+// synthetic architecture it makes no sence to spin eating processor
+// time that other processes could make use of. Instead we call
+// select. The itimer will still go off and kick the schedular back
+// into life so giving up an escape path from the select. There is one
+// catch 22. This only works if we are using the real time clock for
+// itimer, not the virtual clock.  The virtual clock works on time the
+// process actually uses. When its sitting in the select it does not
+// use any time, so the timer does not expire!  Also we don't do a
+// select when the THREAD_YIELD optin is in use since we want the
+// yield to be called regularly.
+
+void
+hal_idle_thread_action(cyg_uint32 loop_count)
+{
+#ifndef CYGIMP_IDLE_THREAD_YIELD
+#ifdef CYGSEM_HAL_I386_LINUX_REAL_TIME
+    cyg_hal_sys__newselect(0,0,0,0,0);
+#endif
+#endif
+}
--- a/packages/hal/i386/linux/current/src/syscall-i386-linux-1.0.S
+++ b/packages/hal/i386/linux/current/src/syscall-i386-linux-1.0.S
@@ -344,9 +344,9 @@ NAME(x):                                
 //=========================================================================
 //              exit             1              select           82
 //              fork             2              socketcall      102
-//              read             3              readv           145
-//              write            4              writev          146
-//              open             5
+//              read             3              newselect       142
+//              write            4              readv           145
+//              open             5              writev          146
 //              creat            8
 //              link             9
 //              unlink          10
@@ -356,7 +356,7 @@ NAME(x):                                
 //              chown           16
 //              lseek           19
 //              rename          38
-//              dup                     41
+//              dup             41
 //              pipe            42
 //              ioctl           54
 //              fcntl           55
@@ -575,3 +575,6 @@ SYSCALL3(readv)
 SYSCALL3(writev)
 #endif
 
+//==========================================================================
+// machdep_sys_newselect()
+SYSCALL5(_newselect)
--- a/packages/language/c/libc/current/ChangeLog
+++ b/packages/language/c/libc/current/ChangeLog
@@ -1,3 +1,10 @@
+1999-10-01  Jonathan Larmour  <jlarmour@cygnus.co.uk>
+
+	* include/pkgconf/libc.h (CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE): Change
+	default to /dev/ttydiag to get correct console-like behaviour
+	Also don't preclude use if haldiag package isn't included
+	(case 102065)
+
 1999-09-15  Jesper Skov  <jskov@cygnus.co.uk>
 
 	* tests/signal/signal2.c (cause_fpe): Try both float and integer
--- a/packages/language/c/libc/current/include/pkgconf/libc.h
+++ b/packages/language/c/libc/current/include/pkgconf/libc.h
@@ -466,7 +466,6 @@
             type         boolean
             parent       CYGPKG_LIBC
             requires     CYGPKG_IO
-            requires     CYGPKG_IO_SERIAL_HALDIAG
         }
 
         cdl_option CYGIMP_LIBC_STDIO_INLINES {
@@ -619,7 +618,7 @@
                              the name of a device. The name of the device
                              depends on the device drivers you have
                              configured in your system. For example,
-                             /dev/haldiag could be the HAL diagnostic output
+                             /dev/ttydiag could be the HAL diagnostic output
                              pseudo-device, or /dev/tty0 could be your
                              first serial driver, depending on your
                              configuration."
@@ -739,7 +738,7 @@
 //
 // So what is the name of the device that is the default console device
 
-#define CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE        "/dev/haldiag"
+#define CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE        "/dev/ttydiag"
 
 #define CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT