diff options
Diffstat (limited to 'firmware/include/inflate.h')
-rw-r--r-- | firmware/include/inflate.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/firmware/include/inflate.h b/firmware/include/inflate.h new file mode 100644 index 0000000000..b0685e8fbb --- /dev/null +++ b/firmware/include/inflate.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2021 by James Buren (libflate adaptations for RockBox) | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef _INFLATE_H_ | ||
23 | #define _INFLATE_H_ | ||
24 | |||
25 | #include <stdint.h> | ||
26 | |||
27 | enum { | ||
28 | INFLATE_RAW, | ||
29 | INFLATE_ZLIB, | ||
30 | INFLATE_GZIP, | ||
31 | }; | ||
32 | |||
33 | struct inflate; | ||
34 | |||
35 | typedef uint32_t inflate_reader(void* block, uint32_t block_size, void* ctx); | ||
36 | typedef uint32_t inflate_writer(const void* block, uint32_t block_size, void* ctx); | ||
37 | |||
38 | extern const uint32_t inflate_size; | ||
39 | extern const uint32_t inflate_align; | ||
40 | |||
41 | // 'it' must be allocated by the caller. it must be at least 'inflate_size' bytes | ||
42 | // and aligned at 'inflate_align' bytes. 'st' is the type of stream to decompress; | ||
43 | // see above enum for possible options. | ||
44 | int inflate(struct inflate* it, int st, inflate_reader read, void* rctx, inflate_writer write, void* wctx); | ||
45 | |||
46 | #endif | ||