1
0

dfs_config.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. +------------------------------------------------------------------------------
  3. | Project : Device Filesystem
  4. +------------------------------------------------------------------------------
  5. | Copyright 2004, 2005 www.fayfayspace.org.
  6. | All rights reserved.
  7. |------------------------------------------------------------------------------
  8. | File : dfs_opts.h, the option definitions of Device FileSystem
  9. |------------------------------------------------------------------------------
  10. | Chang Logs:
  11. | Date Author Notes
  12. | 2005-01-22 ffxz The first version.
  13. +------------------------------------------------------------------------------
  14. */
  15. #ifndef __DFS_CONFIG_H__
  16. #define __DFS_CONFIG_H__
  17. /*
  18. +------------------------------------------------------------------------------
  19. | Device Manager options
  20. +------------------------------------------------------------------------------
  21. */
  22. /* Device Options parameters */
  23. #define DEVICES_MAX 8
  24. #define DEVICE_NAME_MAX 8
  25. /*
  26. +------------------------------------------------------------------------------
  27. | Device Filesystem options
  28. +------------------------------------------------------------------------------
  29. */
  30. /* the max length of filesystem name */
  31. #define DFS_FS_NAME_MAX 4
  32. /* the max type of filesystem */
  33. #define DFS_FILESYSTEM_TYPES_MAX 2
  34. /* the max length of path name */
  35. #define DFS_PATH_MAX 256
  36. /* the max length of file name */
  37. #define DFS_FILE_MAX 256
  38. /* options for server task */
  39. #define DFS_MBOX_NUMBER 32
  40. #define DFS_SERVER_STACK 1024
  41. #define DFS_SERVER_PRI 110
  42. #define DFS_SERVER_SLICE 20
  43. /*
  44. +------------------------------------------------------------------------------
  45. | FAT filesystem options
  46. +------------------------------------------------------------------------------
  47. */
  48. /* file name max length */
  49. #define FAT_NAME_MAX 256
  50. /* max number of FAT filesystem */
  51. #define FATFS_MAX 2
  52. /* the size of sector */
  53. #define SECTOR_SIZE 512
  54. /* FAT table sector cache options */
  55. #define FAT_CACHE_SIZE 0x10 /* config parameter */
  56. #define FAT_CACHE_MASK (FAT_CACHE_SIZE-1)
  57. #define GET16(x) (*(x)) | (*((x)+1) << 8)
  58. #define GET32(x) (*(x)) | (*((x)+1) << 8) | (*((x)+2) << 16) | (*((x)+3) << 24)
  59. #define SET16(x, v) \
  60. do \
  61. { \
  62. *(x) = (v) & 0x00ff; \
  63. (*((x)+1)) = (v) >> 8; \
  64. } while ( 0 )
  65. #define SET32(x, v) \
  66. do \
  67. { \
  68. *(x) = (v) & 0x000000ff; \
  69. (*((x)+1)) = ((v) >> 8) & 0x000000ff; \
  70. (*((x)+2)) = ((v) >> 16) & 0x000000ff; \
  71. (*((x)+3)) = ((v) >> 24); \
  72. } while ( 0 )
  73. #define DFS_DEBUG_INFO 0x01
  74. #define DFS_DEBUG_WARNING 0x02
  75. #define DFS_DEBUG_ERROR 0x04
  76. #define DFS_DEBUG_LEVEL (DFS_DEBUG_INFO | DFS_DEBUG_WARNING | DFS_DEBUG_ERROR)
  77. /* #define DFS_DEBUG */
  78. #ifdef DFS_DEBUG
  79. #define dfs_log(level, x) do { if (level & DFS_DEBUG_LEVEL) \
  80. {rt_kprintf("DFS %s, %d:", __FILE__, __LINE__); rt_kprintf x; \
  81. rt_kprintf ("\n");}}while (0)
  82. #else
  83. #define dfs_log(level, x)
  84. #endif
  85. #endif