You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.0KB

  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. #else // USE_SDFAT_CONFIG
  31. #include <stdint.h>
  32. #ifdef __AVR__
  33. #include <avr/io.h>
  34. #endif // __AVR__
  35. //------------------------------------------------------------------------------
  36. /**
  37. * Set USE_SEPARATE_FAT_CACHE non-zero to use a second 512 byte cache
  38. * for FAT table entries. Improves performance for large writes that
  39. * are not a multiple of 512 bytes.
  40. */
  41. #ifdef __arm__
  42. #define USE_SEPARATE_FAT_CACHE 1
  43. #else // __arm__
  44. #define USE_SEPARATE_FAT_CACHE 0
  45. #endif // __arm__
  46. //------------------------------------------------------------------------------
  47. /**
  48. * Set USE_MULTI_BLOCK_IO non-zero to use multi-block SD read/write.
  49. *
  50. * Don't use mult-block read/write on small AVR boards.
  51. */
  52. #if defined(RAMEND) && RAMEND < 3000
  53. #define USE_MULTI_BLOCK_IO 0
  54. #else
  55. #define USE_MULTI_BLOCK_IO 1
  56. #endif
  57. //------------------------------------------------------------------------------
  58. /**
  59. * Set DESTRUCTOR_CLOSES_FILE non-zero to close a file in its destructor.
  60. *
  61. * Causes use of lots of heap in ARM.
  62. */
  63. #define DESTRUCTOR_CLOSES_FILE 0
  64. //------------------------------------------------------------------------------
  65. /**
  66. * Call flush for endl if ENDL_CALLS_FLUSH is non-zero
  67. *
  68. * The standard for iostreams is to call flush. This is very costly for
  69. * SdFat. Each call to flush causes 2048 bytes of I/O to the SD.
  70. *
  71. * SdFat has a single 512 byte buffer for I/O so it must write the current
  72. * data block to the SD, read the directory block from the SD, update the
  73. * directory entry, write the directory block to the SD and read the data
  74. * block back into the buffer.
  75. *
  76. * The SD flash memory controller is not designed for this many rewrites
  77. * so performance may be reduced by more than a factor of 100.
  78. *
  79. * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
  80. * all data to be written to the SD.
  81. */
  82. #define ENDL_CALLS_FLUSH 0
  83. //------------------------------------------------------------------------------
  84. /**
  85. * Allow FAT12 volumes if FAT12_SUPPORT is non-zero.
  86. * FAT12 has not been well tested.
  87. */
  88. #define FAT12_SUPPORT 0
  89. #endif // USE_SDFAT_CONFIG
  90. #endif // FatLibConfig_h