This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: ZLIB functions
- From: "Chris Garry" <cgarry at sweeneydesign dot co dot uk>
- To: <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 14 Nov 2002 23:44:10 -0000
- Subject: Re: [ECOS] ZLIB functions
- Organization: Sweeney Design
- References: <20021114121846.70560.qmail@web20704.mail.yahoo.com>
- Reply-to: "Chris Garry" <cgarry at sweeneydesign dot co dot uk>
Okay, looking at the code fresh I see my basic C coding error.
Whoops.
Chris
----- Original Message -----
From: "Chris Garry" <chris_garry@yahoo.co.uk>
To: <ecos-discuss@sources.redhat.com>
Sent: Thursday, November 14, 2002 12:18 PM
Subject: [ECOS] ZLIB functions
> Hi,
>
> I have added a function to Redboot to program an FPGA with an
> FPGA image stored in FLASH. This has all been working fine.
>
> Now I am trying to add support for compressed FPGA images
> in FLASH. As part of this I have added the zlib package
> to Redboot and tried to write a routine to decompress the
> image - but I am seeing some strange things.
>
> When I call the decompress_image function below:
>
>
> int decompress_image(cyg_uint8 *start_addr, cyg_uint8 *dest_addr)
> {
> _pipe_t* p;
> int err;
>
> diag_printf("Start add: 0x%x\n", start_addr);
> diag_printf("Dest add: 0x%x\n", dest_addr);
>
> diag_printf("\nInitial values:\n");
> diag_printf("in_buf: 0x%x\n", p->in_buf);
> diag_printf("in_avail: 0x%x\n", p->in_avail);
> diag_printf("out_buf: 0x%x\n", p->out_buf);
> diag_printf("out_size: 0x%x\n", p->out_size);
> diag_printf("out_max: 0x%x\n", p->out_max);
>
> // Initialise pipe values
> p->in_buf = start_addr;
> p->in_avail = 0x00;
> p->out_buf = dest_addr;
> p->out_size = 0x00;
> p->out_max = 0x100;
>
> diag_printf("\nBefore _dc_int() is called:\n");
> diag_printf("in_buf: 0x%x\n", p->in_buf);
> diag_printf("in_avail: 0x%x\n", p->in_avail);
> diag_printf("out_buf: 0x%x\n", p->out_buf);
> diag_printf("out_size: 0x%x\n", p->out_size);
> diag_printf("out_max: 0x%x\n", p->out_max);
>
> // Call the decompress initialise function
> err = (*_dc_init)(p);
> diag_printf("Err: 0x%x\n", err);
>
> diag_printf("\nAfter _dc_int() has been called:\n");
> diag_printf("in_buf: 0x%x\n", p->in_buf);
> diag_printf("in_avail: 0x%x\n", p->in_avail);
> diag_printf("out_buf: 0x%x\n", p->out_buf);
> diag_printf("out_size: 0x%x\n", p->out_size);
> diag_printf("out_max: 0x%x\n", p->out_max);
>
> return 1;
> }
>
>
> I get the following output:
>
> -- Output start
> Start add: 0x1840000
> Dest add: 0x10000
>
> Initial values:
> in_buf: 0xa
> in_avail: 0x53324358
> out_buf: 0x46203531
> out_size: 0x20414750
> out_max: 0x65746564
>
> Before _dc_int() is called:
> in_buf: 0x1840000
> in_avail: 0x0
> out_buf: 0x10000
> out_size: 0x0
> out_max: 0x65746564
> Err: 0x0
>
> After _dc_int() has been called:
> in_buf: 0xa
> in_avail: 0x53324358
> out_buf: 0x46203531
> out_size: 0x20414750
> out_max: 0x65746564
> -- Output end
>
> I notice that before the _dc_int() function has been called
> p->out_max has failed to take the value 0x100. After
> _dc_int() has been called all the values have reverted to
> their uninitialized state.
>
> If I comment out the 'err = (*_dc_init)(p);' line everything
> works as expected. Also adding or removing diag_printf's
> change which pipe values get correctly initialized before
> the _dc_int() function is called.
>
> Does anybody have any ideas as to what is going wrong?
>
> Thanks,
> Chris
>
>
>
>
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss