changeset 812:515a36c8eb9d

Improve handling of CPM/DPRAM aloocation.
author gthomas
date Fri, 07 Mar 2003 02:34:57 +0000
parents c16ef62116ec
children 125de7def8a4
files packages/hal/powerpc/mpc8xx/current/ChangeLog packages/hal/powerpc/mpc8xx/current/src/var_misc.c packages/hal/powerpc/quicc/current/ChangeLog packages/hal/powerpc/quicc/current/include/ppc8xx.h packages/hal/powerpc/quicc/current/src/cpm.c
diffstat 5 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/powerpc/mpc8xx/current/ChangeLog
+++ b/packages/hal/powerpc/mpc8xx/current/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-06  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/var_misc.c: Can only reset CPM if not relying on a ROM monitor.
+
 2003-03-05  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/var_misc.c (hal_variant_init): Reset CPM - always.
--- a/packages/hal/powerpc/mpc8xx/current/src/var_misc.c
+++ b/packages/hal/powerpc/mpc8xx/current/src/var_misc.c
@@ -73,11 +73,10 @@ hal_variant_init(void)
         CYGARC_MTSPR (ICTRL, ictrl);
     }
 
-    // Note: it would be nice to only do this in the ROM/monitor.  However,
-    // "new" programs which rely on that happening would break if the monitor
-    // environment does not handle this properly.
+#ifndef CYGSEM_HAL_USE_ROM_MONITOR
     // Reset CPM
     _mpc8xx_reset_cpm();
+#endif
 }
 
 //--------------------------------------------------------------------------
--- a/packages/hal/powerpc/quicc/current/ChangeLog
+++ b/packages/hal/powerpc/quicc/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-06  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/cpm.c: Handle case where DPRAM allocation is unknown.
+	
+	* include/ppc8xx.h: Define limits of CPM/DPRAM space.
+
 2003-03-05  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/quicc_smc1.c: Need to flush data cache because the serial
--- a/packages/hal/powerpc/quicc/current/include/ppc8xx.h
+++ b/packages/hal/powerpc/quicc/current/include/ppc8xx.h
@@ -943,6 +943,7 @@ static inline EPPC *eppc_base(void)
 __externC unsigned short _mpc8xx_allocBd(int len);
 
 #define QUICC_BD_BASE               0x2000  // Start of shared memory
+#define QUICC_BD_END                0x3000  // End of shared memory
 
 
 #endif /* __ASSEMBLER__ */
--- a/packages/hal/powerpc/quicc/current/src/cpm.c
+++ b/packages/hal/powerpc/quicc/current/src/cpm.c
@@ -96,8 +96,13 @@ void
 unsigned short
 _mpc8xx_allocBd(int len)
 {
-    unsigned short bd = *nextBd;
+    unsigned short bd;
 
+    bd = *nextBd;
+    if ((bd < QUICC_BD_BASE) || (bd > QUICC_BD_END)) {
+        // Most likely not set up :-(
+        bd = *nextBd = QUICC_BD_BASE;
+    }
     len = (len + 7) & ~7;  // Multiple of 8 bytes
     *nextBd += len;
     return bd;