* [ECOS] ZLIB functions
@ 2002-11-14 4:18 Chris Garry
2002-11-14 15:42 ` Chris Garry
0 siblings, 1 reply; 2+ messages in thread
From: Chris Garry @ 2002-11-14 4:18 UTC (permalink / raw)
To: ecos-discuss
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ECOS] ZLIB functions
2002-11-14 4:18 [ECOS] ZLIB functions Chris Garry
@ 2002-11-14 15:42 ` Chris Garry
0 siblings, 0 replies; 2+ messages in thread
From: Chris Garry @ 2002-11-14 15:42 UTC (permalink / raw)
To: ecos-discuss
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-11-14 23:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-14 4:18 [ECOS] ZLIB functions Chris Garry
2002-11-14 15:42 ` Chris Garry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).