/firmware/src/Motherboard/lib_sd/fat_config.h

http://github.com/makerbot/G3Firmware · C Header · 128 lines · 28 code · 19 blank · 81 comment · 0 complexity · b02be891412b688222b9dc106fdf4242 MD5 · raw file

  1. /*
  2. * Copyright (c) 2006-2010 by Roland Riegel <feedback@roland-riegel.de>
  3. *
  4. * This file is free software; you can redistribute it and/or modify
  5. * it under the terms of either the GNU General Public License version 2
  6. * or the GNU Lesser General Public License version 2.1, both as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef FAT_CONFIG_H
  10. #define FAT_CONFIG_H
  11. #include <stdint.h>
  12. #include "sd_raw_config.h"
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. #endif
  17. /**
  18. * \addtogroup fat
  19. *
  20. * @{
  21. */
  22. /**
  23. * \file
  24. * FAT configuration (license: GPLv2 or LGPLv2.1)
  25. */
  26. /**
  27. * \ingroup fat_config
  28. * Controls FAT write support.
  29. *
  30. * Set to 1 to enable FAT write support, set to 0 to disable it.
  31. */
  32. #define FAT_WRITE_SUPPORT SD_RAW_WRITE_SUPPORT
  33. /**
  34. * \ingroup fat_config
  35. * Controls FAT long filename (LFN) support.
  36. *
  37. * Set to 1 to enable LFN support, set to 0 to disable it.
  38. */
  39. #define FAT_LFN_SUPPORT 1
  40. /**
  41. * \ingroup fat_config
  42. * Controls FAT date and time support.
  43. *
  44. * Set to 1 to enable FAT date and time stamping support.
  45. */
  46. #define FAT_DATETIME_SUPPORT 0
  47. /**
  48. * \ingroup fat_config
  49. * Controls FAT32 support.
  50. *
  51. * Set to 1 to enable FAT32 support.
  52. */
  53. #define FAT_FAT32_SUPPORT SD_RAW_SDHC
  54. /**
  55. * \ingroup fat_config
  56. * Controls updates of directory entries.
  57. *
  58. * Set to 1 to delay directory entry updates until the file is closed.
  59. * This can boost performance significantly, but may cause data loss
  60. * if the file is not properly closed.
  61. */
  62. #define FAT_DELAY_DIRENTRY_UPDATE 1
  63. /**
  64. * \ingroup fat_config
  65. * Determines the function used for retrieving current date and time.
  66. *
  67. * Define this to the function call which shall be used to retrieve
  68. * current date and time.
  69. *
  70. * \note Used only when FAT_DATETIME_SUPPORT is 1.
  71. *
  72. * \param[out] year Pointer to a \c uint16_t which receives the current year.
  73. * \param[out] month Pointer to a \c uint8_t which receives the current month.
  74. * \param[out] day Pointer to a \c uint8_t which receives the current day.
  75. * \param[out] hour Pointer to a \c uint8_t which receives the current hour.
  76. * \param[out] min Pointer to a \c uint8_t which receives the current minute.
  77. * \param[out] sec Pointer to a \c uint8_t which receives the current sec.
  78. */
  79. #define fat_get_datetime(year, month, day, hour, min, sec) \
  80. get_datetime(year, month, day, hour, min, sec)
  81. /* forward declaration for the above */
  82. void get_datetime(uint16_t* year, uint8_t* month, uint8_t* day, uint8_t* hour, uint8_t* min, uint8_t* sec);
  83. /**
  84. * \ingroup fat_config
  85. * Maximum number of filesystem handles.
  86. */
  87. #define FAT_FS_COUNT 1
  88. /**
  89. * \ingroup fat_config
  90. * Maximum number of file handles.
  91. */
  92. #define FAT_FILE_COUNT 1
  93. /**
  94. * \ingroup fat_config
  95. * Maximum number of directory handles.
  96. */
  97. #define FAT_DIR_COUNT 2
  98. /**
  99. * @}
  100. */
  101. #if FAT_FAT32_SUPPORT
  102. typedef uint32_t cluster_t;
  103. #else
  104. typedef uint16_t cluster_t;
  105. #endif
  106. #ifdef __cplusplus
  107. }
  108. #endif
  109. #endif