ff_fatdef.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * FreeRTOS+FAT V2.3.3
  3. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  6. * this software and associated documentation files (the "Software"), to deal in
  7. * the Software without restriction, including without limitation the rights to
  8. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  9. * the Software, and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * https://www.FreeRTOS.org
  23. * https://github.com/FreeRTOS
  24. *
  25. */
  26. #ifndef _FF_FATDEF_H_
  27. #define _FF_FATDEF_H_
  28. /*
  29. * This file defines offsets to various data for the FAT specification.
  30. */
  31. /* MBR / PBR Offsets. */
  32. #define FF_FAT_BYTES_PER_SECTOR 0x00B
  33. #define FF_FAT_SECTORS_PER_CLUS 0x00D
  34. #define FF_FAT_RESERVED_SECTORS 0x00E
  35. #define FF_FAT_NUMBER_OF_FATS 0x010
  36. #define FF_FAT_ROOT_ENTRY_COUNT 0x011
  37. #define FF_FAT_16_TOTAL_SECTORS 0x013
  38. #define FF_FAT_MEDIA_TYPE 0x015
  39. #define FF_FAT_32_TOTAL_SECTORS 0x020
  40. #define FF_FAT_16_SECTORS_PER_FAT 0x016
  41. #define FF_FAT_32_SECTORS_PER_FAT 0x024
  42. #define FF_FAT_ROOT_DIR_CLUSTER 0x02C
  43. #define FF_FAT_EXT_BOOT_SIGNATURE 0x042
  44. #define FF_FAT_16_VOL_LABEL 0x02B
  45. #define FF_FAT_32_VOL_LABEL 0x047
  46. #define FF_FAT_PTBL 0x1BE
  47. #define FF_FAT_PTBL_LBA 0x008
  48. #define FF_FAT_PTBL_SECT_COUNT 0x00C
  49. #define FF_FAT_PTBL_ACTIVE 0x000
  50. #define FF_FAT_PTBL_ID 0x004
  51. #define FF_DOS_EXT_PART 0x05
  52. #define FF_LINUX_EXT_PART 0x85
  53. #define FF_WIN98_EXT_PART 0x0f
  54. #define FF_FAT_MBR_SIGNATURE 0x1FE
  55. #define FF_FAT_DELETED 0xE5
  56. /* Directory Entry Offsets. */
  57. #define FF_FAT_DIRENT_SHORTNAME 0x000
  58. #define FF_FAT_DIRENT_ATTRIB 0x00B
  59. #define FF_FAT_DIRENT_CREATE_TIME 0x00E /* Creation Time. */
  60. #define FF_FAT_DIRENT_CREATE_DATE 0x010 /* Creation Date. */
  61. #define FF_FAT_DIRENT_LASTACC_DATE 0x012 /* Date of Last Access. */
  62. #define FF_FAT_DIRENT_CLUS_HIGH 0x014
  63. #define FF_FAT_DIRENT_LASTMOD_TIME 0x016 /* Time of Last modification. */
  64. #define FF_FAT_DIRENT_LASTMOD_DATE 0x018 /* Date of Last modification. */
  65. #define FF_FAT_DIRENT_CLUS_LOW 0x01A
  66. #define FF_FAT_DIRENT_FILESIZE 0x01C
  67. #define FF_FAT_LFN_ORD 0x000
  68. #define FF_FAT_LFN_NAME_1 0x001
  69. #define FF_FAT_LFN_CHECKSUM 0x00D
  70. #define FF_FAT_LFN_NAME_2 0x00E
  71. #define FF_FAT_LFN_NAME_3 0x01C
  72. /* Dirent Attributes. */
  73. #define FF_FAT_ATTR_READONLY 0x01
  74. #define FF_FAT_ATTR_HIDDEN 0x02
  75. #define FF_FAT_ATTR_SYSTEM 0x04
  76. #define FF_FAT_ATTR_VOLID 0x08
  77. #define FF_FAT_ATTR_DIR 0x10
  78. #define FF_FAT_ATTR_ARCHIVE 0x20
  79. #define FF_FAT_ATTR_LFN 0x0F
  80. /**
  81. * -- Hein_Tibosch additions for mixed case in shortnames --
  82. *
  83. * Specifically, bit 4 means lowercase extension and bit 3 lowercase basename,
  84. * which allows for combinations such as "example.TXT" or "HELLO.txt" but not "Mixed.txt"
  85. */
  86. #define FF_FAT_CASE_OFFS 0x0C /* After NT/XP : 2 case bits. */
  87. #define FF_FAT_CASE_ATTR_BASE 0x08
  88. #define FF_FAT_CASE_ATTR_EXT 0x10
  89. #if ( ffconfigLFN_SUPPORT != 0 ) && ( ffconfigINCLUDE_SHORT_NAME != 0 )
  90. #define FF_FAT_ATTR_IS_LFN 0x40 /* artificial attribute, for debugging only. */
  91. #endif
  92. #endif /* ifndef _FF_FATDEF_H_ */