summaryrefslogtreecommitdiff
path: root/fs/ubifs/crc16.h
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2009-03-19 15:35:05 +0100
committerWolfgang Denk <wd@denx.de>2009-03-20 22:39:15 +0100
commit9eefe2a2b37a838558e3d213a9f5519503d0c180 (patch)
treecd6ce359f020615d685d353fc3a20e7e07ac05fc /fs/ubifs/crc16.h
parentb1b4e89a0f3b75854c39a62cae41bad56d210adf (diff)
downloadu-boot-imx-9eefe2a2b37a838558e3d213a9f5519503d0c180.zip
u-boot-imx-9eefe2a2b37a838558e3d213a9f5519503d0c180.tar.gz
u-boot-imx-9eefe2a2b37a838558e3d213a9f5519503d0c180.tar.bz2
UBIFS: Implement read-only UBIFS support in U-Boot
The U-Boot UBIFS implementation is largely a direct copy from the current Linux version (2.6.29-rc6). As already done in the UBI version we have an "abstraction layer" to redefine or remove some OS calls (e.g. mutex_lock() ...). This makes it possible to use the original Linux code with very little changes. And by this we can better update to later Linux versions. I removed some of the Linux features that are not used in the U-Boot version (e.g. garbage-collection, write support). Signed-off-by: Stefan Roese <sr@denx.de> CC: Artem Bityutskiy <dedekind@infradead.org> CC: Adrian Hunter <ext-Adrian.Hunter@nokia.com>
Diffstat (limited to 'fs/ubifs/crc16.h')
-rw-r--r--fs/ubifs/crc16.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/ubifs/crc16.h b/fs/ubifs/crc16.h
new file mode 100644
index 0000000..9443c08
--- /dev/null
+++ b/fs/ubifs/crc16.h
@@ -0,0 +1,30 @@
+/*
+ * crc16.h - CRC-16 routine
+ *
+ * Implements the standard CRC-16:
+ * Width 16
+ * Poly 0x8005 (x^16 + x^15 + x^2 + 1)
+ * Init 0
+ *
+ * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2. See the file COPYING for more details.
+ */
+
+#ifndef __CRC16_H
+#define __CRC16_H
+
+#include <linux/types.h>
+
+extern u16 const crc16_table[256];
+
+extern u16 crc16(u16 crc, const u8 *buffer, size_t len);
+
+static inline u16 crc16_byte(u16 crc, const u8 data)
+{
+ return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff];
+}
+
+#endif /* __CRC16_H */
+