summaryrefslogtreecommitdiffstats
path: root/firmware/include
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2021-08-05 15:57:07 +0000
committerWilliam Wilgus <me.theuser@yahoo.com>2021-08-07 03:03:27 +0000
commit60933d98c629ee96cb09bbaafe4be7cfa50358ed (patch)
tree5f726d6e24a63861ceef8069e8fe4a08f7383402 /firmware/include
parent603e749c1dd61c9d396a6a5521ff626d923b5692 (diff)
downloadrockbox-60933d98c629ee96cb09bbaafe4be7cfa50358ed.tar.gz
rockbox-60933d98c629ee96cb09bbaafe4be7cfa50358ed.zip
inflate: import initial module for deflate decompression
This will eventually be used by the ZIP module and other things that support DEFLATE based streams. Change-Id: I4acc9561eb56c9c368d1defab9c14e0454d105e1
Diffstat (limited to 'firmware/include')
-rw-r--r--firmware/include/inflate.h46
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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 by James Buren (libflate adaptations for RockBox)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef _INFLATE_H_
+#define _INFLATE_H_
+
+#include <stdint.h>
+
+enum {
+ INFLATE_RAW,
+ INFLATE_ZLIB,
+ INFLATE_GZIP,
+};
+
+struct inflate;
+
+typedef uint32_t inflate_reader(void* block, uint32_t block_size, void* ctx);
+typedef uint32_t inflate_writer(const void* block, uint32_t block_size, void* ctx);
+
+extern const uint32_t inflate_size;
+extern const uint32_t inflate_align;
+
+// 'it' must be allocated by the caller. it must be at least 'inflate_size' bytes
+// and aligned at 'inflate_align' bytes. 'st' is the type of stream to decompress;
+// see above enum for possible options.
+int inflate(struct inflate* it, int st, inflate_reader read, void* rctx, inflate_writer write, void* wctx);
+
+#endif