changeset 1492:8b3549abe4ac

* cdl/redboot.cdl: Bring CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER under CYGBLD_BUILD_REDBOOT_WITH_ZLIB. Add CYGPRI_REDBOOT_ZLIB_FLASH to control whether decompression can be used with flash images. * src/flash.c: Use CYGPRI_REDBOOT_ZLIB_FLASH instead of CYGPKG_COMPRESS_ZLIB. * src/load.c: Use CYGBLD_BUILD_REDBOOT_WITH_ZLIB in place of CYGPKG_COMPRESS_ZLIB. * src/main.c: only set fis_zlib_common_buffer if CYGPRI_REDBOOT_ZLIB_FLASH.
author jlarmour
date Wed, 11 Feb 2004 13:40:53 +0000
parents ab4a708d689e
children 3c206814d866
files packages/redboot/current/ChangeLog packages/redboot/current/cdl/redboot.cdl packages/redboot/current/src/flash.c packages/redboot/current/src/load.c packages/redboot/current/src/main.c
diffstat 5 files changed, 49 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,5 +1,15 @@
 2004-02-11  Jonathan Larmour  <jifl@eCosCentric.com>
 
+	* cdl/redboot.cdl: Bring CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER under
+	CYGBLD_BUILD_REDBOOT_WITH_ZLIB. Add CYGPRI_REDBOOT_ZLIB_FLASH to
+	control whether decompression can be used with flash images.
+	* src/flash.c: Use CYGPRI_REDBOOT_ZLIB_FLASH instead of
+	CYGPKG_COMPRESS_ZLIB.
+	* src/load.c: Use CYGBLD_BUILD_REDBOOT_WITH_ZLIB in place of
+	CYGPKG_COMPRESS_ZLIB.
+	* src/main.c: only set fis_zlib_common_buffer if
+	CYGPRI_REDBOOT_ZLIB_FLASH.
+
 	* src/main.c (set_comm_baud_rate): Get current rate with GETBAUD
 	not SETBAUD!
 
--- a/packages/redboot/current/cdl/redboot.cdl
+++ b/packages/redboot/current/cdl/redboot.cdl
@@ -161,16 +161,37 @@ cdl_package CYGPKG_REDBOOT {
               additional segments."
         }
     
-        cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB {
+        cdl_component CYGBLD_BUILD_REDBOOT_WITH_ZLIB {
             display       "Include support gzip/zlib decompression"
             active_if     CYGPKG_COMPRESS_ZLIB
-## FIXME!
-            requires      { !CYGSEM_IO_FLASH_READ_INDIRECT }
-## FIXME!
-            no_define
             default_value 1
             implements    CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC
             compile       decompress.c
+
+            cdl_option CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER {
+                display       "Size of zlib decompression buffer"
+                flavor        data
+                default_value 64
+                legal_values  5 to 256
+                description   "
+                    This is the size of the buffer filled with incoming data
+                    during load before calls are made to the decompressor
+                    function. For ethernet downloads this can be made bigger
+                    (at the cost of memory), but for serial downloads on slow
+                    processors it may be necessary to reduce the size to
+                    avoid serial overruns. zlib appears to bail out if less than
+                    five bytes are available initially so this is the minimum."
+            }
+    
+            cdl_option CYGPRI_REDBOOT_ZLIB_FLASH {
+                 display       "Support compression of Flash images"
+                 active_if     CYGPKG_REDBOOT_FLASH
+                 active_if     !CYGSEM_IO_FLASH_READ_INDIRECT
+                 calculated    1
+                 description   "
+                        This CDL indicates whether flash images can
+                        be decompressed from gzip/zlib format into RAM."
+            }
         }
 
         cdl_option CYGBLD_BUILD_REDBOOT_WITH_XYZMODEM {
@@ -505,22 +526,6 @@ cdl_package CYGPKG_REDBOOT {
               tradeoff between responsiveness and overhead."
         }
     
-        cdl_option CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER {
-            display       "Size of zlib decompression buffer"
-            active_if     CYGPKG_COMPRESS_ZLIB
-            flavor        data
-            default_value 64
-            legal_values  5 to 256
-            description   "
-                This is the size of the buffer filled with incoming data
-                during load before calls are made to the decompressor
-                function. For ethernet downloads this can be made bigger
-                (at the cost of memory), but for serial downloads on slow
-                processors it may be necessary to reduce the size to
-                avoid serial overruns. zlib appears to bail out if less than
-                five bytes are available initially so this is the minimum."
-        }
-    
         cdl_option CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS {
             display       "Validate RAM addresses during load"
             flavor        bool
--- a/packages/redboot/current/src/flash.c
+++ b/packages/redboot/current/src/flash.c
@@ -98,7 +98,7 @@ local_cmd_entry("delete",
     );
 
 static char fis_load_usage[] = 
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGPRI_REDBOOT_ZLIB_FLASH
                       "[-d] "
 #endif
                       "[-b <memory_load_address>] [-c] name";
@@ -986,7 +986,7 @@ fis_load(int argc, char *argv[])
     unsigned long cksum;
 #endif
     int num_options;
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGPRI_REDBOOT_ZLIB_FLASH
     bool decompress = false;
 #endif
     void *err_addr;
@@ -996,7 +996,7 @@ fis_load(int argc, char *argv[])
     init_opts(&opts[1], 'c', false, OPTION_ARG_TYPE_FLG, 
               (void **)&show_cksum, (bool *)0, "display checksum");
     num_options = 2;
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGPRI_REDBOOT_ZLIB_FLASH
     init_opts(&opts[num_options], 'd', false, OPTION_ARG_TYPE_FLG, 
               (void **)&decompress, 0, "decompress");
     num_options++;
@@ -1021,7 +1021,7 @@ fis_load(int argc, char *argv[])
         return;
     }
 #endif
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGPRI_REDBOOT_ZLIB_FLASH
     if (decompress) {
         int err;
         _pipe_t fis_load_pipe;
@@ -1330,7 +1330,7 @@ do_flash_init(void)
 #ifdef CYGOPT_REDBOOT_FIS
         fisdir_size = CYGNUM_REDBOOT_FIS_DIRECTORY_ENTRY_COUNT * CYGNUM_REDBOOT_FIS_DIRECTORY_ENTRY_SIZE;
         fisdir_size = ((fisdir_size + flash_block_size - 1) / flash_block_size) * flash_block_size;
-# ifdef CYGOPT_REDBOOT_FIS_ZLIB_COMMON_BUFFER
+# if defined(CYGPRI_REDBOOT_ZLIB_FLASH) && defined(CYGOPT_REDBOOT_FIS_ZLIB_COMMON_BUFFER)
 	fis_work_block = fis_zlib_common_buffer;
 	if(CYGNUM_REDBOOT_FIS_ZLIB_COMMON_BUFFER_SIZE < fisdir_size) {
             diag_printf("FLASH: common buffer too small\n");
--- a/packages/redboot/current/src/load.c
+++ b/packages/redboot/current/src/load.c
@@ -74,7 +74,7 @@
 #endif
 
 static char usage[] = "[-r] [-v] "
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB
                       "[-d] "
 #endif
                       "[-h <host>] [-m <varies>] "
@@ -108,7 +108,7 @@ struct {
     unsigned char *bufp;
     int   avail, len, err;
     int   verbose, decompress, tick;
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB
     int (*raw_fun)(char *, int len, int *err);
     _pipe_t load_pipe;
     unsigned char _buffer[CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER];
@@ -156,7 +156,7 @@ redboot_getc(void)
     return *getc_info.bufp++;
 }
 
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB
 //
 // Called to fetch a new chunk of data and decompress it
 //
@@ -211,7 +211,7 @@ redboot_getc_init(connection_info_t *inf
     getc_info.verbose = verbose;
     getc_info.decompress = decompress;
     getc_info.tick = 0;
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB
     if (decompress) {
         _pipe_t* p = &getc_info.load_pipe;
         p->out_buf = &getc_info.buf[0];
@@ -247,7 +247,7 @@ static void
 redboot_getc_close(void)
 {
     (getc_info.io->close)(&getc_info.err);
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB
     if (getc_info.decompress) {
         _pipe_t* p = &getc_info.load_pipe;
         int err = getc_info.err;
@@ -570,7 +570,7 @@ load_srec_image(getc_t getc, unsigned lo
 //   -b - specify a load [base] address
 //   -m - specify an I/O stream/method
 //   -c - Alternate serial I/O channel
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB
 //   -d - Decompress data [packed via 'zlib']
 #endif
 //
@@ -631,7 +631,7 @@ do_load(int argc, char *argv[])
               (void **)&hostname, (bool *)&hostname_set, "host name or IP address");
     num_options++;
 #endif
-#ifdef CYGPKG_COMPRESS_ZLIB
+#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB
     init_opts(&opts[num_options], 'd', false, OPTION_ARG_TYPE_FLG, 
               (void **)&decompress, 0, "decompress");
     num_options++;
--- a/packages/redboot/current/src/main.c
+++ b/packages/redboot/current/src/main.c
@@ -297,7 +297,7 @@ cyg_start(void)
 
     bist();
 
-#ifdef CYGOPT_REDBOOT_FIS_ZLIB_COMMON_BUFFER
+#if defined(CYGPRI_REDBOOT_ZLIB_FLASH) && defined(CYGOPT_REDBOOT_FIS_ZLIB_COMMON_BUFFER)
     fis_zlib_common_buffer =
     workspace_end -= CYGNUM_REDBOOT_FIS_ZLIB_COMMON_BUFFER_SIZE;
 #endif