summaryrefslogtreecommitdiff
path: root/arm9/lib/include/MATH_crc.h
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/lib/include/MATH_crc.h')
-rw-r--r--arm9/lib/include/MATH_crc.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/arm9/lib/include/MATH_crc.h b/arm9/lib/include/MATH_crc.h
new file mode 100644
index 00000000..800b738b
--- /dev/null
+++ b/arm9/lib/include/MATH_crc.h
@@ -0,0 +1,38 @@
+#ifndef GUARD_MATH_CRC_H
+#define GUARD_MATH_CRC_H
+
+#include "types.h"
+
+typedef u8 MATHCRC8Context;
+typedef u16 MATHCRC16Context;
+typedef u32 MATHCRC32Context;
+
+struct MATHCRC8Table {
+ u8 table[256];
+};
+
+struct MATHCRC16Table {
+ u16 table[256];
+};
+
+struct MATHCRC32Table {
+ u32 table[256];
+};
+
+u32 MATH_CalcCRC32(const struct MATHCRC32Table *table, const void *data, u32 dataLength);
+void MATHi_CRC32UpdateRev(const struct MATHCRC32Table *table, MATHCRC32Context *context, const void *input, u32 length);
+u16 MATH_CalcCRC16CCITT(const struct MATHCRC16Table *table, const void *data, u32 dataLength);
+void MATHi_CRC16Update(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+u16 MATH_CalcCRC16(const struct MATHCRC16Table *table, const void *data, u32 dataLength);
+void MATHi_CRC16UpdateRev(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+u8 MATH_CalcCRC8(const struct MATHCRC8Table *table, const void *data, u32 dataLength);
+void MATHi_CRC8Update(const struct MATHCRC8Table *table, MATHCRC8Context *context, const void *input, u32 length);
+void MATHi_CRC32InitTableRev(struct MATHCRC32Table *table, u32 poly);
+void MATHi_CRC16UpdateRev(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+void MATHi_CRC16Update(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+void MATHi_CRC16InitTableRev(struct MATHCRC16Table *table, u16 poly);
+void MATHi_CRC16InitTable(struct MATHCRC16Table *table, u16 poly);
+void MATHi_CRC8Update(const struct MATHCRC8Table *table, MATHCRC8Context *context, const void *input, u32 length);
+void MATHi_CRC8InitTable(struct MATHCRC8Table *table, u8 poly);
+
+#endif