Browse Source

add lzs comp & decomp tools

Olaf Rempel 11 years ago
parent
commit
59aab39252
10 changed files with 673 additions and 6 deletions
  1. 8
    5
      Makefile
  2. 68
    0
      compress.c
  3. 65
    0
      decompress.c
  4. 75
    0
      filedata.c
  5. 13
    0
      filedata.h
  6. 293
    0
      lzsc.c
  7. 6
    0
      lzsc.h
  8. 138
    0
      lzsd.c
  9. 6
    0
      lzsd.h
  10. 1
    1
      zyxel-revert.conf

+ 8
- 5
Makefile View File

@@ -1,11 +1,14 @@
1 1
 CFLAGS := -O2 -pipe -Wall
2 2
 
3
-OBJS := configfile.o event.o logging.o
4
-OBJS += context.o serial.o statemachine.o xmodem.o
3
+all: zyxel-revert compress decompress
5 4
 
6
-all: zyxel-revert
5
+zyxel-revert: configfile.o event.o logging.o context.o serial.o statemachine.o xmodem.o zyxel-revert.o
6
+	$(CC) $(CFLAGS) $^ -o $@
7
+
8
+compress: lzsc.o filedata.o compress.o
9
+	$(CC) $(CFLAGS) $^ -o $@
7 10
 
8
-zyxel-revert: $(OBJS) zyxel-revert.o
11
+decompress: lzsd.o filedata.o decompress.o
9 12
 	$(CC) $(CFLAGS) $^ -o $@
10 13
 
11 14
 %.o: %.c
@@ -15,7 +18,7 @@ zyxel-revert: $(OBJS) zyxel-revert.o
15 18
 	$(CC) $(CFLAGS) -MM -c $< -o $@
16 19
 
17 20
 clean:
18
-	rm -f zyxel-revert *.d *.o *.log
21
+	rm -f zyxel-revert compress decompress *.d *.o *.log
19 22
 
20 23
 DEPS := $(wildcard *.c)
21 24
 -include $(DEPS:.c=.d)

+ 68
- 0
compress.c View File

@@ -0,0 +1,68 @@
1
+#include <stdio.h>
2
+#include <stdlib.h>
3
+#include <unistd.h>
4
+#include <string.h>
5
+#include <stdint.h>
6
+
7
+#include <arpa/inet.h>
8
+
9
+#include "lzsc.h"
10
+#include "filedata.h"
11
+
12
+struct rom0file {
13
+	uint16_t version;
14
+	uint16_t size;
15
+	uint16_t offset;
16
+
17
+	char name[14];
18
+} __attribute__((packed));
19
+
20
+int parse_rom0(struct filedata *filedata, const char *infile)
21
+{
22
+	struct rom0file file;
23
+
24
+	/* zweite page enthält config */
25
+	uint32_t offset = 0x2000;
26
+	while (1) {
27
+		memcpy(&file, (void *)(filedata->data) + offset, sizeof(file));
28
+
29
+		if (strcmp(file.name, "autoexec.net") == 0) {
30
+			printf("found autoexec.net: 0x%04x - 0x%04x (%d bytes)\n",
31
+				0x2000 + htons(file.offset), 0x2000 + htons(file.offset) + htons(file.size), htons(file.size));
32
+
33
+			/* 16 byte header */
34
+			void *buf = (void *)(filedata->data) + 0x2000 + htons(file.offset) +12;
35
+
36
+			/* little cleanup */
37
+			memset(buf, 0, htons(file.size));
38
+
39
+			struct filedata *indata = get_filedata(infile);
40
+			int size = lzs_pack(indata->data, indata->size, buf, 0xC00);
41
+
42
+			file.size = htons(size +12);
43
+
44
+			memcpy((void *)(filedata->data) + offset, &file, sizeof(file));
45
+			printf("new autoexec.net: 0x%04x - 0x%04x (%d bytes)\n",
46
+				0x2000 + htons(file.offset), 0x2000 + htons(file.offset) + htons(file.size), htons(file.size));
47
+
48
+			put_filedata("350LI2C1.rom.own", filedata);
49
+
50
+			free(indata);
51
+			return 0;
52
+		}
53
+
54
+		if (file.name[0] == 0 || file.name[0] == -1)
55
+			return -1;
56
+
57
+		offset += sizeof(file);
58
+	}
59
+}
60
+
61
+int main(int argc, char *argv[])
62
+{
63
+	struct filedata *rom0 = get_filedata("350LI2C1.rom");
64
+	parse_rom0(rom0, "350LI2C1.rom.own_decomp");
65
+
66
+	free(rom0);
67
+	return 0;
68
+}

+ 65
- 0
decompress.c View File

@@ -0,0 +1,65 @@
1
+#include <stdio.h>
2
+#include <stdlib.h>
3
+#include <unistd.h>
4
+#include <string.h>
5
+#include <stdint.h>
6
+
7
+#include <arpa/inet.h>
8
+
9
+#include "lzsd.h"
10
+#include "filedata.h"
11
+
12
+struct rom0file {
13
+	uint16_t version;
14
+	uint16_t size;
15
+	uint16_t offset;
16
+
17
+	char name[14];
18
+} __attribute__((packed));
19
+
20
+int parse_rom0(struct filedata *filedata, const char *outfile)
21
+{
22
+	struct rom0file file;
23
+
24
+	/* zweite page enthält config */
25
+	uint32_t offset = 0x2000;
26
+	while (1) {
27
+		memcpy(&file, (void *)(filedata->data) + offset, sizeof(file));
28
+
29
+		if (strcmp(file.name, "autoexec.net") == 0) {
30
+			printf("found autoexec.net: 0x%04x - 0x%04x (%d bytes)\n",
31
+				0x2000 + htons(file.offset), 0x2000 + htons(file.offset) + htons(file.size), htons(file.size));
32
+
33
+			/* 64kb sollten reichen */
34
+			struct filedata *out = alloc_filedata(65535);
35
+
36
+			/* 16 byte header */
37
+			void *buf = (void *)(filedata->data) + 0x2000 + htons(file.offset) +12;
38
+
39
+			out->size = lzs_unpack(buf, htons(file.size) -12, out->data, out->size);
40
+			put_filedata(outfile, out);
41
+			free(out);
42
+
43
+			return 0;
44
+		}
45
+
46
+		if (file.name[0] == 0 || file.name[0] == -1)
47
+			return -1;
48
+
49
+		offset += sizeof(file);
50
+	}
51
+}
52
+
53
+int main(int argc, char *argv[])
54
+{
55
+	struct filedata *in = get_filedata(argv[1]);
56
+
57
+	char outname[64];
58
+	strncpy(outname, argv[1], sizeof(outname));
59
+	strcat(outname, ".own_decomp");
60
+
61
+	parse_rom0(in, outname);
62
+
63
+	free(in);
64
+	return 0;
65
+}

+ 75
- 0
filedata.c View File

@@ -0,0 +1,75 @@
1
+#include <stdio.h>
2
+#include <stdlib.h>
3
+#include <unistd.h>
4
+
5
+#include <sys/types.h>
6
+#include <sys/stat.h>
7
+#include <fcntl.h>
8
+
9
+#include "filedata.h"
10
+
11
+struct filedata * get_filedata(const char *filename)
12
+{
13
+	int fd = open(filename, O_RDONLY);
14
+	if (fd < 0) {
15
+		perror("get_filedata(): open()");
16
+		return NULL;
17
+	}
18
+
19
+	struct stat filestat;
20
+	if (fstat(fd, &filestat) < 0) {
21
+		perror("get_filedata(): fstat()");
22
+		close(fd);
23
+		return NULL;
24
+	}
25
+
26
+	struct filedata *filedata = malloc(sizeof(struct filedata) + filestat.st_size);
27
+	if (filedata == NULL) {
28
+		perror("get_filedata(): malloc()");
29
+		close(fd);
30
+		return NULL;
31
+	}
32
+
33
+	filedata->size = filestat.st_size;
34
+
35
+	int readsize = read(fd, filedata->data, filedata->size);
36
+	if (readsize != filedata->size) {
37
+		perror("get_filedata(): read()");
38
+		free(filedata);
39
+		close(fd);
40
+		return NULL;
41
+	}
42
+
43
+	close(fd);
44
+	return filedata;
45
+}
46
+
47
+struct filedata * alloc_filedata(int size)
48
+{
49
+	struct filedata *retval = malloc(sizeof(struct filedata) + size);
50
+	if (retval == NULL) {
51
+		perror("alloc_filedata(): malloc()");
52
+		return NULL;
53
+	}
54
+	retval->size = size;
55
+	return retval;
56
+}
57
+
58
+int put_filedata(const char *filename, struct filedata *filedata)
59
+{
60
+	int fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
61
+	if (fd < 0) {
62
+		perror("put_filedata(): open()");
63
+		return -1;
64
+	}
65
+
66
+	int writesize = write(fd, filedata->data, filedata->size);
67
+	if (writesize != filedata->size) {
68
+		perror("put_filedata(): write()");
69
+		close(fd);
70
+		return -1;
71
+	}
72
+
73
+	close(fd);
74
+	return 0;
75
+}

+ 13
- 0
filedata.h View File

@@ -0,0 +1,13 @@
1
+#ifndef _FILEDATA_H_
2
+#define _FILEDATA_H_
3
+
4
+struct filedata {
5
+	int size;
6
+	void *data[0];
7
+};
8
+
9
+struct filedata * get_filedata(const char *filename);
10
+struct filedata * alloc_filedata(int size);
11
+int put_filedata(const char *filename, struct filedata *filedata);
12
+
13
+#endif /* _FILEDATA_H_ */

+ 293
- 0
lzsc.c View File

@@ -0,0 +1,293 @@
1
+#include <stdio.h>
2
+#include <stdlib.h>
3
+#include <unistd.h>
4
+#include <stdint.h>
5
+#include <string.h>
6
+
7
+#include "list.h"
8
+
9
+#define HASH_BUCKETS 127
10
+
11
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
12
+
13
+struct lzs_state {
14
+	uint8_t *srcblkstart;
15
+	uint8_t *src;
16
+	uint32_t srcsize;
17
+
18
+	uint8_t *dstblkstart;
19
+	uint8_t *dst;
20
+	uint32_t dstsize;
21
+
22
+	uint32_t bitbuf;
23
+	uint32_t bitcnt;
24
+
25
+	struct list_head *hash;
26
+};
27
+
28
+struct lzs_hash_entry {
29
+	struct list_head list;
30
+	uint8_t *pos;
31
+};
32
+
33
+/* TODO: check dstsize */
34
+static int put_bits(struct lzs_state *state, uint32_t bits, uint32_t len)
35
+{
36
+	state->bitbuf <<= len;
37
+	state->bitbuf |= bits;
38
+	state->bitcnt += len;
39
+
40
+	while (state->bitcnt >= 8) {
41
+		state->bitcnt -= 8;
42
+		*(state->dst)++ = (state->bitbuf >> (state->bitcnt)) & 0xFF;
43
+//		printf("    wrote byte: 0x%02x\n", *(state->dst -1));
44
+	}
45
+
46
+	return 0;
47
+}
48
+
49
+/* TODO: check dstsize */
50
+static int put_literal_byte(struct lzs_state *state, uint8_t byte)
51
+{
52
+	printf("  put_literal_byte: 0x%02x\n", byte);
53
+	return put_bits(state, (0 << 8) | byte, 1+8);
54
+}
55
+
56
+/* TODO: check dstsize */
57
+static int put_compressed_string(struct lzs_state *state, uint32_t offset, uint32_t len)
58
+{
59
+	printf("  put_compressed_string: offset=0x%03x len=0x%03x\n", offset, len);
60
+
61
+	if (offset > 0x7ff || len > 0x800)
62
+		printf("    ERROR\n");
63
+
64
+	if (offset < 128)
65
+		put_bits(state, (1 << 8) | (1 << 7) | offset, 1+1+7);
66
+	else
67
+		put_bits(state, (1 << 12) | (0 << 11) | offset, 1+1+11);
68
+
69
+	if (len <= 4) {
70
+		/*
71
+		 * 00 - 2
72
+		 * 01 - 3
73
+		 * 10 - 4
74
+		 */
75
+		put_bits(state, len - 2, 2);
76
+
77
+	} else if (len < 8) {
78
+		/*
79
+		 * 1100 - 5
80
+		 * 1101 - 6
81
+		 * 1110 - 7
82
+		 */
83
+		put_bits(state, len + 7, 4);
84
+
85
+	} else if (len >= 8) {
86
+		/*
87
+		 * 1111 0000 - 8
88
+		 * 1111 0001 - 9
89
+		 * ...
90
+		 * 1111 1110 - 22
91
+		 * 1111 1111 0000 - 23
92
+		 * 1111 1111 0001 - 24
93
+		 * ...
94
+		 */
95
+		len -= 8;
96
+		put_bits(state, 15, 4);
97
+		while (len >= 15) {
98
+			put_bits(state, 15, 4);
99
+			len -= 15;
100
+		}
101
+		put_bits(state, len, 4);
102
+	}
103
+	return 0;
104
+}
105
+
106
+/* TODO: check dstsize */
107
+static int put_blockend(struct lzs_state *state)
108
+{
109
+	/* 7bit offset = 0 -> end code */
110
+	put_bits(state, (1 << 8) | (1 << 7) | 0, 1+1+7);
111
+
112
+	/* align to bytes */
113
+	if (state->bitcnt)
114
+		put_bits(state, 0, 8 - state->bitcnt);
115
+
116
+	printf(" =============== BLOCK END =============== \n");
117
+	return 0;
118
+}
119
+
120
+static int put_zyxel_header(struct lzs_state *state)
121
+{
122
+	uint16_t len = state->src - state->srcblkstart;
123
+	uint16_t lenc = state->dst - state->dstblkstart;
124
+
125
+	/* remove own header size */
126
+	lenc -= 4;
127
+
128
+	printf("header of previous block: 0x%04x%04x\n", len, lenc);
129
+
130
+	uint8_t *p = state->dstblkstart;
131
+	p[0] = (len >> 8) & 0xFF;
132
+	p[1] = len & 0xFF;
133
+
134
+	p[2] = (lenc >> 8) & 0xFF;
135
+	p[3] = lenc & 0xFF;
136
+
137
+	return 0;
138
+}
139
+
140
+static int alloc_hash(struct lzs_state *state)
141
+{
142
+	state->hash = malloc(sizeof(struct lzs_hash_entry) * HASH_BUCKETS);
143
+	if (state->hash == NULL) {
144
+		perror("alloc_hashtable(): malloc()");
145
+		return -1;
146
+	}
147
+
148
+	int i;
149
+	for (i = 0; i < HASH_BUCKETS; i++)
150
+		INIT_LIST_HEAD(&state->hash[i]);
151
+
152
+	return 0;
153
+}
154
+
155
+static int free_hash(struct lzs_state *state)
156
+{
157
+	int i;
158
+	for (i = 0; i < HASH_BUCKETS; i++) {
159
+		struct lzs_hash_entry *entry, *tmp;
160
+		list_for_each_entry_safe(entry, tmp, &state->hash[i], list) {
161
+			list_del(&entry->list);
162
+			free(entry);
163
+		}
164
+	}
165
+
166
+	return 0;
167
+}
168
+
169
+static int hash_key_calc(uint8_t *data)
170
+{
171
+	int key = 0x456789AB;
172
+
173
+	key = (key << 5) ^ (key >> 27) ^ data[0];
174
+	key = (key << 5) ^ (key >> 27) ^ data[1];
175
+
176
+	return key % HASH_BUCKETS;
177
+}
178
+
179
+static int hash_add(struct lzs_state *state, uint8_t *data)
180
+{
181
+	struct lzs_hash_entry *entry = malloc(sizeof(struct lzs_hash_entry));
182
+	if (entry == NULL) {
183
+		perror("hash_add_bytes(): malloc()");
184
+		return -1;
185
+	}
186
+
187
+	entry->pos = data;
188
+
189
+	list_add(&entry->list, &state->hash[hash_key_calc(data)]);
190
+	return 0;
191
+}
192
+
193
+static int getMatchLen(uint8_t *a, uint8_t *b, uint32_t maxlen)
194
+{
195
+	/* shortcut, first 2 bytes *must* match */
196
+	if ((a[0] ^ b[0]) | (a[1] ^ b[1]))
197
+		return 0;
198
+
199
+	a += 2;
200
+	b += 2;
201
+	maxlen -= 2;
202
+
203
+	int retval = 2;
204
+	while ((*a++ == *b++) && maxlen--)
205
+		retval++;
206
+
207
+	return retval;
208
+}
209
+
210
+int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
211
+{
212
+	struct lzs_state state = {
213
+		.srcblkstart = srcbuf,
214
+		.src = srcbuf,
215
+		.srcsize = srcsize,
216
+
217
+		.dstblkstart = dstbuf,
218
+		.dst = dstbuf,
219
+		.dstsize = dstsize,
220
+
221
+		.bitbuf = 0,
222
+		.bitcnt = 0,
223
+	};
224
+
225
+	alloc_hash(&state);
226
+
227
+	/* at least 2 bytes in input */
228
+	while (state.src +2 <= srcbuf + srcsize) {
229
+
230
+		/* new dst block: insert dummy header */
231
+		if (state.dstblkstart == state.dst)
232
+			state.dst += 4;
233
+
234
+		int key = hash_key_calc(state.src);
235
+		int maxlen = MIN(state.srcblkstart + 2048, srcbuf + srcsize) - state.src;
236
+
237
+		printf("searching for 0x%02x%02x abs=0x%04x key=0x%02x maxlen=%d\n",
238
+			state.src[0], state.src[1], state.src - srcbuf, key, maxlen);
239
+
240
+		int bestmatchlen = 0;
241
+		struct lzs_hash_entry *search, *tmp, *bestmatch = NULL;
242
+		list_for_each_entry_safe(search, tmp, &state.hash[key], list) {
243
+			/* hash entry too old, discard it */
244
+			if (search->pos + 2048 <= state.src) {
245
+				list_del(&search->list);
246
+				free(search);
247
+				continue;
248
+			}
249
+
250
+			/* get length of match (min. 2, 0 if collision) */
251
+			int matchlen = getMatchLen(search->pos, state.src, maxlen);
252
+			if (matchlen > bestmatchlen) {
253
+				bestmatchlen = matchlen;
254
+				bestmatch = search;
255
+			}
256
+		}
257
+
258
+		/* found something? */
259
+		if (bestmatch != NULL) {
260
+			put_compressed_string(&state, state.src - bestmatch->pos, bestmatchlen);
261
+			/* add bytes to history hash */
262
+			while (bestmatchlen--)
263
+				hash_add(&state, state.src++);
264
+
265
+		} else {
266
+			put_literal_byte(&state, *state.src);
267
+			hash_add(&state, state.src++);
268
+		}
269
+
270
+		/* block full? */
271
+		if (state.src - state.srcblkstart >= 2048) {
272
+			put_blockend(&state);
273
+
274
+			put_zyxel_header(&state);
275
+			state.srcblkstart = state.src;
276
+			state.dstblkstart = state.dst;
277
+		}
278
+	}
279
+
280
+	/* add remaining bytes (== last one) as literal */
281
+	if (state.src < srcbuf + srcsize)
282
+		put_literal_byte(&state, *state.src++);
283
+
284
+	put_blockend(&state);
285
+	put_zyxel_header(&state);
286
+
287
+	free_hash(&state);
288
+
289
+	printf("lzs_pack: packed %d (%d) bytes to %d (%d) bytes\n",
290
+		state.src - srcbuf, srcsize, state.dst - dstbuf, dstsize);
291
+
292
+	return state.dst - dstbuf;
293
+}

+ 6
- 0
lzsc.h View File

@@ -0,0 +1,6 @@
1
+#ifndef _LZSC_H_
2
+#define _LZSC_H_
3
+
4
+int lzs_pack(void *src, int srcsize, void *dst, int dstsize);
5
+
6
+#endif /* _LZSC_H_ */

+ 138
- 0
lzsd.c View File

@@ -0,0 +1,138 @@
1
+#include <stdio.h>
2
+#include <stdint.h>
3
+
4
+struct lzs_state {
5
+	uint8_t *srcblkstart;
6
+	uint8_t *src;
7
+	uint32_t srcsize;
8
+
9
+	uint8_t *dstblkstart;
10
+	uint8_t *dst;
11
+	uint32_t dstsize;
12
+
13
+	uint32_t bitbuf;
14
+	uint32_t bitcnt;
15
+};
16
+
17
+static uint32_t get_bits(struct lzs_state *state, int num)
18
+{
19
+	while (state->bitcnt < num) {
20
+		state->bitbuf = (state->bitbuf << 8) | *(state->src)++;
21
+		state->bitcnt += 8;
22
+	}
23
+
24
+	state->bitcnt -= num;
25
+	return (state->bitbuf >> state->bitcnt) & ((1 << num) -1);
26
+}
27
+
28
+static uint32_t get_len(struct lzs_state *state)
29
+{
30
+	uint32_t bits;
31
+	uint32_t length = 2;
32
+
33
+	do {
34
+		bits = get_bits(state, 2);
35
+		length += bits;
36
+	} while ((bits == 3) && (length < 8));
37
+
38
+	if (length == 8) {
39
+		do {
40
+			bits = get_bits(state, 4);
41
+			length += bits;
42
+		} while (bits == 15);
43
+	}
44
+
45
+	return length;
46
+}
47
+
48
+static int get_zyxel_header(struct lzs_state *state)
49
+{
50
+	uint8_t *p = state->srcblkstart;
51
+	uint32_t a = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
52
+
53
+	uint32_t b = ((state->dst - state->dstblkstart) << 16) & 0xFFFF0000;
54
+	b |= ((state->src - state->srcblkstart) & 0xFFFF);
55
+
56
+	/* remove own header */
57
+	b -= 4;
58
+
59
+	printf("header of previous block is=0x%08x expected=0x%08x %s\n", a, b, ((a == b) ? "OK" : "ERROR"));
60
+	return 0;
61
+}
62
+
63
+/*
64
+ * TODO: check src/dst sizes
65
+ */
66
+uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t dstsize)
67
+{
68
+	struct lzs_state state = {
69
+		.srcblkstart = srcbuf,
70
+		.src = srcbuf,
71
+		.srcsize = srcsize,
72
+
73
+		.dstblkstart = dstbuf,
74
+		.dst = dstbuf,
75
+		.dstsize = dstsize,
76
+
77
+		.bitbuf = 0,
78
+		.bitcnt = 0,
79
+	};
80
+
81
+	while (1) {
82
+		/* jump over header */
83
+		if (state.srcblkstart == state.src)
84
+			state.src += 4;
85
+
86
+		uint32_t tag = get_bits(&state, 1);
87
+
88
+		/* Uncompressed byte */
89
+		if (tag == 0) {
90
+			*(state.dst)++ = get_bits(&state, 8);
91
+			printf("uncompressed byte: 0x%02x\n", *(state.dst -1));
92
+
93
+		/* Compressed string */
94
+		} else {
95
+			/* read 7 or 11 bit offset */
96
+			tag = get_bits(&state, 1);
97
+			uint32_t offset = get_bits(&state, (tag == 1) ? 7 : 11);
98
+
99
+			/* end condition (7bit offset == 0x00) */
100
+			if (tag == 1 && offset == 0) {
101
+				/* align src to next byte */
102
+				if (state.bitcnt > 7)
103
+					printf("ERROR: alignment?\n");
104
+
105
+				state.bitcnt = 0;
106
+
107
+				printf("=== BLOCK END === \n");
108
+				get_zyxel_header(&state);
109
+				state.srcblkstart = state.src;
110
+				state.dstblkstart = state.dst;
111
+
112
+				/* all src bytes used? */
113
+				if (state.src >= srcbuf + srcsize)
114
+					break;
115
+
116
+				continue;
117
+			}
118
+
119
+			uint8_t *dict = state.dst - offset;
120
+			if (dict < dstbuf) {
121
+				printf("lzs_unpack: invalid dict: %p < %p (tag=%d, offset=0x%x)\n",
122
+					dict, dstbuf, tag, offset);
123
+				break;
124
+			}
125
+
126
+			uint32_t len = get_len(&state);
127
+			printf("compressed string, offset(%d)=0x%03x len=0x%04x\n", tag, offset, len);
128
+
129
+			while (len--)
130
+				*(state.dst)++ = *dict++;
131
+		}
132
+	}
133
+
134
+	printf("lzs_unpack: decompressed %d (%d) bytes to %d (%d) bytes\n",
135
+		(state.src - srcbuf), srcsize, (state.dst - dstbuf), dstsize);
136
+
137
+	return state.dst - dstbuf;
138
+}

+ 6
- 0
lzsd.h View File

@@ -0,0 +1,6 @@
1
+#ifndef _LZSD_H_
2
+#define _LZSD_H_
3
+
4
+uint32_t lzs_unpack(void *src, uint32_t srcsize, void *dst, uint32_t dstsize);
5
+
6
+#endif /* _LZSD_H_ */

+ 1
- 1
zyxel-revert.conf View File

@@ -1,5 +1,5 @@
1 1
 [global]
2
-configdata 350LI2C1.rom
2
+configdata 350LI2C1.rom.own
3 3
 
4 4
 [ports]
5 5
 serial /dev/ttyUSB0

Loading…
Cancel
Save