diff options
Diffstat (limited to 'include/fat32.h')
-rw-r--r-- | include/fat32.h | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/include/fat32.h b/include/fat32.h index 39d22f6..279b652 100644 --- a/include/fat32.h +++ b/include/fat32.h @@ -1,11 +1,36 @@ +/** + * @file fat32.h + * A very basic FAT32 reading implementation + * This only supports reading files in the root directory. Currently, the files + * must also have a name under eight characters, with no extension. + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef FAT32_H_ #define FAT32_H_ #include <stdint.h> +/** + * A structure to store important information for loading a file. + */ typedef struct { - uint32_t size; - uint32_t start; + uint32_t size; /**< The file's size in bytes */ + uint32_t start; /**< The file's first data cluster */ } file_t; /** @@ -22,10 +47,17 @@ int fat_find(void); file_t *fat_findfile(const char *name); /** - * + * Reads given file into an allocated buffer. + * @param file the file's data structure from fat_findfile() + * @return a malloc'd buffer containing the file's data */ char *fat_readfile(file_t *file); +/** + * Gets the name of the nth file in the root directory. + * @param index n, the index of the file + * @return the file's name, in a malloc'd buffer + */ char *fat_getname(uint32_t index); #endif // FAT32_H_ |