CHGame 0.3.0
Libraries for the CHGame handheld
Loading...
Searching...
No Matches
Fat.h File Reference

FAT16/FAT32 files on the SD card: find a file by its 8.3 name and read its blocks. More...

#include <stdint.h>

Go to the source code of this file.

Classes

struct  fat::Run
 A run of consecutive card blocks holding part of a file (see runs()). More...
 
struct  fat::File
 A file or folder found in a directory: where it starts and how long it is. More...
 

Namespaces

namespace  fat
 The FAT16/FAT32 reader (CHSd).
 

Typedefs

typedef bool(* fat::ListFn) (const char *name, const File &f, bool isDir, void *ctx)
 What list() calls for each entry of a directory.
 

Enumerations

enum  fat::Err : int8_t {
  fat::OK = 0 ,
  fat::E_READ = -1 ,
  fat::E_NOFS = -10 ,
  fat::E_EXFAT = -11 ,
  fat::E_NOTFOUND = -12 ,
  fat::E_FRAG = -13 ,
  fat::E_CHAIN = -14
}
 What the functions that return an int8_t report: OK (0) or a negative error. More...
 

Functions

int8_t fat::mount (uint8_t *buf)
 Finds the FAT volume on the card and remembers where its parts are.
 
int8_t fat::find (const char *name, File &f, uint8_t *buf)
 Finds a file in the root directory.
 
int8_t fat::folder (const char *name, File &dir, uint8_t *buf)
 Finds a folder in the root directory, for match() and list().
 
int8_t fat::match (const File &dir, const char *pattern, uint8_t skip, File &f, char *nameOut, uint8_t *buf)
 Finds the (skip + 1)th file in a folder whose name fits a pattern.
 
int8_t fat::root (File &dir)
 The root directory as a folder, for match() and list().
 
int8_t fat::list (const File &dir, ListFn fn, void *ctx, uint8_t *buf)
 Walks a directory, handing every file and folder in it to fn, in directory order.
 
int8_t fat::runs (const File &f, Run *out, uint8_t maxRuns, uint8_t *buf)
 Walks a file's cluster chain once and returns its extents: the runs of consecutive card blocks that hold it.
 
uint8_t fat::open (const char *name, Run *out, uint8_t maxRuns, uint8_t *buf)
 The usual way in: sd::init(), mount(), find() and runs() in one go.
 
bool fat::read (const Run *run, uint32_t nRuns, uint32_t k, uint8_t *dst)
 Reads block k of a file through its runs.
 

Detailed Description

FAT16/FAT32 files on the SD card: find a file by its 8.3 name and read its blocks.