dfs_uffs.h 2.2 KB

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