diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-23 22:58:00 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-07 08:44:48 +0200 |
commit | 551b412b16fa5e22d040cc49cd97cac1cc8029fc (patch) | |
tree | cef72eb2d5379865f26864267caaf00b85020e13 /fs/ubifs/crc16.h | |
parent | 50e8902c0ef0154c707377238473b4d917507e4b (diff) | |
download | barebox-551b412b16fa5e22d040cc49cd97cac1cc8029fc.tar.gz barebox-551b412b16fa5e22d040cc49cd97cac1cc8029fc.tar.xz |
fs: Add ubifs support
This adds ubifs support from u-boot-2013.07. This is taken
mostly as-is, only the necessary adjustments to attach to the
barebox fs layer have been made.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/ubifs/crc16.h')
-rw-r--r-- | fs/ubifs/crc16.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/ubifs/crc16.h b/fs/ubifs/crc16.h new file mode 100644 index 0000000000..052fd3311a --- /dev/null +++ b/fs/ubifs/crc16.h @@ -0,0 +1,29 @@ +/* + * 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 */ |