- Minor changes
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@449 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -4,9 +4,12 @@
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#define CPU_FREQ_HZ 100000000
|
||||
#include "libsys.h"
|
||||
|
||||
#include "crc32.h"
|
||||
#include "inflate.h"
|
||||
#include "libsys.h"
|
||||
|
||||
char buffer[1024*1024];
|
||||
char * volatile pPtr_r;
|
||||
@@ -16,10 +19,10 @@ volatile int file_len;
|
||||
|
||||
void handler3(void)
|
||||
{
|
||||
volatile UINT32 *pUART_stat = (UINT32*)sys_uart_stat;
|
||||
volatile UINT32 *pUART_data = (UINT32*)sys_uart_data;
|
||||
volatile UINT32 *pUART_stat = (UINT32*)sys_uart0_stat;
|
||||
volatile UINT32 *pUART_data = (UINT32*)sys_uart0_data;
|
||||
|
||||
while((0x10 & *pUART_stat))
|
||||
while(0x200 & *pUART_stat)
|
||||
{
|
||||
// sputs("w: "); print_word((int)pPtr_w); sputs("\n");
|
||||
if (pPtr_w == &buffer[sizeof(buffer)-1])
|
||||
@@ -42,19 +45,23 @@ int READBYTE(z_stream *zs) {
|
||||
#define MAX_BUFOUT 16*1024*1024
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned char outData[MAX_BUFOUT];
|
||||
FILE *infp;
|
||||
int i, gpflags, tmp[4];
|
||||
unsigned long size, crc;
|
||||
unsigned char *fileData;
|
||||
unsigned long bytes, InflatedSize, InflatedCRC, speed_count;
|
||||
z_stream zs;
|
||||
time_t start_time, work_time;
|
||||
volatile UINT32 *pUART_stat = (UINT32*)sys_uart0_stat;
|
||||
unsigned char outData[MAX_BUFOUT];
|
||||
FILE *infp;
|
||||
int i, gpflags, tmp[4];
|
||||
unsigned long size, crc;
|
||||
unsigned char *fileData;
|
||||
unsigned long bytes, InflatedSize, InflatedCRC, speed_count;
|
||||
z_stream zs;
|
||||
time_t start_time, work_time;
|
||||
|
||||
sputs("Reading gzipped stream..\n");
|
||||
UART0_setbaud(460800);
|
||||
|
||||
printf("Reading gzipped stream..\n");
|
||||
|
||||
pPtr_r = buffer;
|
||||
pPtr_w = buffer;
|
||||
*pUART_stat = (1 << 6);
|
||||
interrupt_register(3, handler3);
|
||||
interrupt_enable(3);
|
||||
|
||||
@@ -65,6 +72,7 @@ int main(int argc, char **argv)
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
printf("file_len: %d\n", file_len);
|
||||
bytes = file_len;
|
||||
fileData = pPtr_r;
|
||||
|
||||
@@ -77,7 +85,7 @@ int main(int argc, char **argv)
|
||||
if (tmp[0] == -1)
|
||||
{
|
||||
// error reading from file
|
||||
sputs("error reading data from file\n");
|
||||
printf("error reading data from file\n");
|
||||
return 0;
|
||||
}
|
||||
tmp[1] = READBYTE(&zs);
|
||||
@@ -96,7 +104,7 @@ int main(int argc, char **argv)
|
||||
|
||||
gpflags = READBYTE(&zs);
|
||||
if ((gpflags & ~0x1f)) {
|
||||
sputs("Unknown flags set!\n");
|
||||
printf("Unknown flags set!\n");
|
||||
}
|
||||
|
||||
/* Skip file modification time (4 bytes) */
|
||||
@@ -132,12 +140,12 @@ int main(int argc, char **argv)
|
||||
READBYTE(&zs);
|
||||
}
|
||||
|
||||
sputs("Go\n");
|
||||
printf("Go\n");
|
||||
// normal test
|
||||
start_time = clock();
|
||||
if (InflateData(&zs))
|
||||
{
|
||||
sputs("Problem during decompression!\n");
|
||||
printf("Problem during decompression!\n");
|
||||
return 0;
|
||||
}
|
||||
work_time = clock() - start_time;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
* chunk on the Palm.
|
||||
* 2002-12-07 - Removed bit reverse table. Removed unzip code.
|
||||
*/
|
||||
#include "libsys.h"
|
||||
#include "inflate.h"
|
||||
#ifdef VERBOSE
|
||||
#include <stdio.h> // Just in case you put a printf() function back in
|
||||
@@ -153,7 +154,6 @@ int CreateTree(HufNode *currentTree, int numval, unsigned char *lengths) {
|
||||
if (len)
|
||||
return 1;
|
||||
|
||||
|
||||
// Step 3: Assign numerical values to all codes
|
||||
BlankNode = 1;
|
||||
currentTree[0].b0 = 0x0000;
|
||||
@@ -321,7 +321,6 @@ int MakeTrees(z_stream *zs, char is_fixed, HufNode *literalTree,
|
||||
{
|
||||
ll[border[j]] = READBITS(zs, 3);
|
||||
}
|
||||
|
||||
if (CreateTree(distanceTree, 19, ll))
|
||||
return 1;
|
||||
|
||||
@@ -473,6 +472,9 @@ int InflateData(z_stream *zs) {
|
||||
|
||||
if (type == 0)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
fprintf(stderr, "Decompress_Stored..");
|
||||
#endif
|
||||
if (Decompress_Stored(zs))
|
||||
return 1;
|
||||
}
|
||||
@@ -489,6 +491,9 @@ int InflateData(z_stream *zs) {
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
fprintf(stderr, "Decompress_DynamicOrFixed..");
|
||||
#endif
|
||||
if (Decompress_DynamicOrFixed(zs, type & 0x01))
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user