dfs_uffs.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * dfs_uffs.h
  3. *
  4. * Created on: 2012-3-30
  5. * Author: prife
  6. */
  7. #ifndef DFS_UFFS_H_
  8. #define DFS_UFFS_H_
  9. #include "uffs_config.h"
  10. #include "uffs/uffs_public.h"
  11. #define UFFS_BLOCK_MARK_SPARE_OFFSET 4 /* indicate block bad or good, offset in spare */
  12. #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_SOFT
  13. /* enable this ,you need provide a mark_badblock/check_block funciton */
  14. #define RT_UFFS_USE_CHECK_MARK_FUNCITON
  15. #if RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_SOFT /* let uffs do soft ecc */
  16. #define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_UFFS /* UFFS_LAYOUT_FLASH */
  17. #define RT_CONFIG_UFFS_ECC_SIZE 0 /* if 0, then uffs will caculate a proper ecc size */
  18. #elif RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_HW_AUTO /* nand driver make ecc and do ecc correct */
  19. #define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_FLASH
  20. #define RT_CONFIG_UFFS_ECC_SIZE 4 /* if 0, then uffs will caculate a proper ecc size */
  21. #elif RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_NONE
  22. #define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_UFFS /* UFFS_LAYOUT_FLASH */
  23. #define RT_CONFIG_UFFS_ECC_SIZE 0 /* if 0, then uffs will caculate a proper ecc size */
  24. #else
  25. #error "uffs under rt-thread do not support this ECC mode"
  26. #endif
  27. #if (!CONFIG_USE_STATIC_MEMORY_ALLOCATOR) && (CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR)
  28. #define RT_UFFS_MEMORY_ALLOCATOR 1 /* use system memory allocator */
  29. #elif (CONFIG_USE_STATIC_MEMORY_ALLOCATOR) && (!CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR)
  30. #define RT_UFFS_MEMORY_ALLOCATOR 0 /* use static memory allocator */
  31. #else
  32. #error "UFFS: CONFIG_USE_STATIC_MEMORY_ALLOCATOR ,CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR are invalid!"
  33. #endif
  34. #if CONFIG_USE_STATIC_MEMORY_ALLOCATOR > 0
  35. #error "dfs_uffs only support CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR"
  36. #endif
  37. #if defined(CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME)
  38. #error "dfs_uffs not support CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME"
  39. #endif
  40. #if (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_HW_AUTO) && (RT_CONFIG_UFFS_LAYOUT != UFFS_LAYOUT_FLASH)
  41. #error "when use UFFS_ECC_HW_AUTO, you must use UFFS_LAYOUT_FLASH"
  42. #elif (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_SOFT) && (RT_CONFIG_UFFS_LAYOUT != UFFS_LAYOUT_UFFS)
  43. #warning "when use UFFS_ECC_SOFT, it is recommended to use UFFS_LAYOUT_UFFS"
  44. #endif
  45. extern const uffs_FlashOps nand_ops;
  46. extern void uffs_setup_storage(
  47. struct uffs_StorageAttrSt *attr,
  48. struct rt_mtd_nand_device * nand);
  49. #endif /* DFS_UFFS_H_ */