Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

118 linhas
3.9KB

  1. /* FatLib Library
  2. * Copyright (C) 2013 by William Greiman
  3. *
  4. * This file is part of the FatLib Library
  5. *
  6. * This Library is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This Library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with the FatLib Library. If not, see
  18. * <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file
  22. * \brief configuration definitions
  23. */
  24. #ifndef FatLibConfig_h
  25. #define FatLibConfig_h
  26. /** Use SdFatConfig.h if nonzero */
  27. #define USE_SDFAT_CONFIG 1
  28. #if USE_SDFAT_CONFIG
  29. #include "../SdFatConfig.h"
  30. #if !defined(USE_LONG_FILE_NAMES) || !defined(USE_SEPARATE_FAT_CACHE) || \
  31. !defined(USE_MULTI_BLOCK_IO) || !defined(DESTRUCTOR_CLOSES_FILE) || \
  32. !defined(ENDL_CALLS_FLUSH) || !defined(FAT12_SUPPORT)
  33. #error Undefined congiguration symbols.
  34. #endif // Configuration symbols
  35. #else // USE_SDFAT_CONFIG
  36. #include <stdint.h>
  37. #ifdef __AVR__
  38. #include <avr/io.h>
  39. #endif // __AVR__
  40. //------------------------------------------------------------------------------
  41. /**
  42. * Set USE_LONG_FILE_NAMES nonzero to use long file names (LFN).
  43. * Long File Name are limited to a maximum length of 255 characters.
  44. *
  45. * This implementation allows 7-bit characters in the range
  46. * 0X20 to 0X7E. The following characters are not allowed:
  47. *
  48. * < (less than)
  49. * > (greater than)
  50. * : (colon)
  51. * " (double quote)
  52. * / (forward slash)
  53. * \ (backslash)
  54. * | (vertical bar or pipe)
  55. * ? (question mark)
  56. * * (asterisk)
  57. *
  58. */
  59. #define USE_LONG_FILE_NAMES 1
  60. //------------------------------------------------------------------------------
  61. /**
  62. * Set USE_SEPARATE_FAT_CACHE non-zero to use a second 512 byte cache
  63. * for FAT table entries. Improves performance for large writes that
  64. * are not a multiple of 512 bytes.
  65. */
  66. #ifdef __arm__
  67. #define USE_SEPARATE_FAT_CACHE 1
  68. #else // __arm__
  69. #define USE_SEPARATE_FAT_CACHE 0
  70. #endif // __arm__
  71. //------------------------------------------------------------------------------
  72. /**
  73. * Set USE_MULTI_BLOCK_IO non-zero to use multi-block SD read/write.
  74. *
  75. * Don't use mult-block read/write on small AVR boards.
  76. */
  77. #if defined(RAMEND) && RAMEND < 3000
  78. #define USE_MULTI_BLOCK_IO 0
  79. #else
  80. #define USE_MULTI_BLOCK_IO 1
  81. #endif
  82. //------------------------------------------------------------------------------
  83. /**
  84. * Set DESTRUCTOR_CLOSES_FILE non-zero to close a file in its destructor.
  85. *
  86. * Causes use of lots of heap in ARM.
  87. */
  88. #define DESTRUCTOR_CLOSES_FILE 0
  89. //------------------------------------------------------------------------------
  90. /**
  91. * Call flush for endl if ENDL_CALLS_FLUSH is non-zero
  92. *
  93. * The standard for iostreams is to call flush. This is very costly for
  94. * SdFat. Each call to flush causes 2048 bytes of I/O to the SD.
  95. *
  96. * SdFat has a single 512 byte buffer for I/O so it must write the current
  97. * data block to the SD, read the directory block from the SD, update the
  98. * directory entry, write the directory block to the SD and read the data
  99. * block back into the buffer.
  100. *
  101. * The SD flash memory controller is not designed for this many rewrites
  102. * so performance may be reduced by more than a factor of 100.
  103. *
  104. * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
  105. * all data to be written to the SD.
  106. */
  107. #define ENDL_CALLS_FLUSH 0
  108. //------------------------------------------------------------------------------
  109. /**
  110. * Allow FAT12 volumes if FAT12_SUPPORT is non-zero.
  111. * FAT12 has not been well tested.
  112. */
  113. #define FAT12_SUPPORT 0
  114. #endif // USE_SDFAT_CONFIG
  115. #endif // FatLibConfig_h