dfs_uffs.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. //#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_NONE
  14. /* enable this ,you need provide a mark_badblock/check_block funciton */
  15. //#define RT_UFFS_USE_CHECK_MARK_FUNCITON
  16. #if RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_SOFT /* let uffs do soft ecc */
  17. #define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_UFFS /* UFFS_LAYOUT_FLASH */
  18. #define RT_CONFIG_UFFS_ECC_SIZE 0 /* if 0, then uffs will caculate a proper ecc size */
  19. #elif RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_HW_AUTO /* nand driver make ecc and do ecc correct */
  20. #define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_FLASH
  21. #define RT_CONFIG_UFFS_ECC_SIZE 4 /* if 0, then uffs will caculate a proper ecc size */
  22. #elif RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_NONE
  23. #define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_UFFS /* UFFS_LAYOUT_FLASH */
  24. #define RT_CONFIG_UFFS_ECC_SIZE 0 /* if 0, then uffs will caculate a proper ecc size */
  25. #else
  26. #error "uffs under rt-thread do not support this ECC mode"
  27. #endif
  28. #if (!CONFIG_USE_STATIC_MEMORY_ALLOCATOR) && (CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR)
  29. #define RT_UFFS_MEMORY_ALLOCATOR 1 /* use system memory allocator */
  30. #elif (CONFIG_USE_STATIC_MEMORY_ALLOCATOR) && (!CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR)
  31. #define RT_UFFS_MEMORY_ALLOCATOR 0 /* use static memory allocator */
  32. #else
  33. #error "UFFS: CONFIG_USE_STATIC_MEMORY_ALLOCATOR ,CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR are invalid!"
  34. #endif
  35. #if CONFIG_USE_STATIC_MEMORY_ALLOCATOR > 0
  36. #error "dfs_uffs only support CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR"
  37. #endif
  38. #if defined(CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME)
  39. #error "dfs_uffs not support CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME"
  40. #endif
  41. #if (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_HW_AUTO) && (RT_CONFIG_UFFS_LAYOUT != UFFS_LAYOUT_FLASH)
  42. #error "when use UFFS_ECC_HW_AUTO, you must use UFFS_LAYOUT_FLASH"
  43. #elif (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_SOFT) && (RT_CONFIG_UFFS_LAYOUT != UFFS_LAYOUT_UFFS)
  44. #warning "when use UFFS_ECC_SOFT, it is recommended to use UFFS_LAYOUT_UFFS"
  45. #endif
  46. extern const uffs_FlashOps nand_ops;
  47. extern void uffs_setup_storage(
  48. struct uffs_StorageAttrSt *attr,
  49. struct rt_mtd_nand_device * nand);
  50. #endif /* DFS_UFFS_H_ */