Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2019-01-05 02:23:36 +0300
committerChristopher Haster <chaster@utexas.edu>2019-01-14 08:56:50 +0300
commit66d751544d3b63d6650ed66ae2cdb0cdab25a0f3 (patch)
tree57aa9bcb8736d3f8bbf42f98ca18659fa078b6f1 /lfs_util.h
parentb989b4a89f6c69b0219b64404de89be63923ca44 (diff)
Modified global state format to work with new tag format
The main difference here is a change from encoding "hasorphans" and "hasmove" bits in the tag itself. This worked with the old format, but in the new format the space these bits take up must be consistent for each tag type. The tradeoff is that the new tag format allows for up to 256 different global states which may be useful in the future (for example, a global free list). The new format encodes this info in the data blob, using an additional word of storage. This word is actually formatted the same as though it was a tag, which simplified internal handling and may allow other tag types in the future. Format for global state: [---- 96 bits ----] [1|- 11 -|- 10 -|- 10 -|--- 64 ---] ^ ^ ^ ^ ^- move dir pair | | | \-------------------------- unused, must be 0s | | \--------------------------------- move id | \---------------------------------------- type, 0xfff for move \--------------------------------------------- has orphans This also included another iteration over globals (renamed to gstate) with some simplifications to how globals are handled.
Diffstat (limited to 'lfs_util.h')
-rw-r--r--lfs_util.h44
1 files changed, 0 insertions, 44 deletions
diff --git a/lfs_util.h b/lfs_util.h
index 6e2f002..1dc3b0f 100644
--- a/lfs_util.h
+++ b/lfs_util.h
@@ -164,28 +164,6 @@ static inline uint32_t lfs_tole32(uint32_t a) {
return lfs_fromle32(a);
}
-// Convert between 16-bit little-endian and native order
-static inline uint16_t lfs_fromle16(uint16_t a) {
-#if !defined(LFS_NO_INTRINSICS) && ( \
- (defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_LITTLE_ENDIAN ) || \
- (defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN ) || \
- (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
- return a;
-#elif !defined(LFS_NO_INTRINSICS) && ( \
- (defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \
- (defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_BIG_ENDIAN ) || \
- (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
- return __builtin_bswap16(a);
-#else
- return (((uint8_t*)&a)[0] << 0) |
- (((uint8_t*)&a)[1] << 8);
-#endif
-}
-
-static inline uint16_t lfs_tole16(uint16_t a) {
- return lfs_fromle16(a);
-}
-
// Convert between 32-bit big-endian and native order
static inline uint32_t lfs_frombe32(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && ( \
@@ -210,28 +188,6 @@ static inline uint32_t lfs_tobe32(uint32_t a) {
return lfs_frombe32(a);
}
-// Convert between 16-bit big-endian and native order
-static inline uint16_t lfs_frombe16(uint16_t a) {
-#if !defined(LFS_NO_INTRINSICS) && ( \
- (defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_LITTLE_ENDIAN ) || \
- (defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN ) || \
- (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
- return __builtin_bswap16(a);
-#elif !defined(LFS_NO_INTRINSICS) && ( \
- (defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \
- (defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_BIG_ENDIAN ) || \
- (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
- return a;
-#else
- return (((uint8_t*)&a)[0] << 8) |
- (((uint8_t*)&a)[1] << 0);
-#endif
-}
-
-static inline uint16_t lfs_tobe16(uint16_t a) {
- return lfs_frombe16(a);
-}
-
// Calculate CRC-32 with polynomial = 0x04c11db7
uint32_t lfs_crc(uint32_t crc, const void *buffer, size_t size);