1 /* 2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 ** Distributed under the terms of the MIT License. 4 */ 5 #ifndef FATFS_H 6 #define FATFS_H 7 8 9 #include <SupportDefs.h> 10 #include <ByteOrder.h> 11 12 namespace FATFS { 13 14 class Volume; 15 16 // mode bits 17 #define FAT_READ_ONLY 1 18 #define FAT_HIDDEN 2 19 #define FAT_SYSTEM 4 20 #define FAT_VOLUME 8 21 #define FAT_SUBDIR 16 22 #define FAT_ARCHIVE 32 23 24 #define read32(buffer,off) \ 25 B_LENDIAN_TO_HOST_INT32(*(uint32 *)&buffer[off]) 26 27 #define read16(buffer,off) (buffer[off] + (buffer[off + 1] << 8)) 28 29 #define write32(buffer, off, value) \ 30 *(uint32*)&buffer[off] = B_HOST_TO_LENDIAN_INT32(value) 31 32 #define write16(buffer, off, value) \ 33 *(uint16*)&buffer[off] = B_HOST_TO_LENDIAN_INT16(value) 34 35 enum name_lengths { 36 FATFS_BASENAME_LENGTH = 8, 37 FATFS_EXTNAME_LENGTH = 3, 38 FATFS_NAME_LENGTH = 12, 39 }; 40 41 status_t get_root_block(int fDevice, char *buffer, int32 blockSize, off_t partitionSize); 42 43 44 } // namespace FATFS 45 46 #endif /* FATFS_H */ 47 48