Sean Cross
aa387e176d
On real hardwareit will use memory-mapped io. Rework pang-io so that it more closely aligns with this paradigm. Signed-off-by: Sean Cross <sean@xobs.io>
36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
#ifndef PANG_O_LIN_FAT12_H__
|
|
#define PANG_O_LIN_FAT12_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
struct pang_io;
|
|
struct fat12_partition;
|
|
struct fat12_dirent {
|
|
char filename[256];
|
|
uint32_t first_cluster;
|
|
uint32_t size;
|
|
uint32_t file_attributes;
|
|
uint32_t ctime;
|
|
uint32_t mtime;
|
|
};
|
|
|
|
struct fat12_partition * fat12_alloc(void);
|
|
int fat12_open(struct fat12_partition *part, const char *filename);
|
|
int fat12_close(struct fat12_partition *part);
|
|
void fat12_free(struct fat12_partition **part);
|
|
|
|
int fat12_ls_foreach(struct fat12_partition *part, uint32_t dir_cluster, void *data, int (*callback)(void *data, const struct fat12_dirent *dirent));
|
|
|
|
void fat12_write_u8(void *ptr, uint8_t val);
|
|
uint8_t fat12_read_u8(void *ptr);
|
|
void fat12_write_u16(void *ptr, uint16_t val);
|
|
uint16_t fat12_read_u16(void *ptr);
|
|
void fat12_write_u32(void *ptr, uint32_t val);
|
|
uint32_t fat12_read_u32(void *ptr);
|
|
void fat12_set_cluster(void *fat, uint32_t cluster, uint32_t value);
|
|
uint32_t fat12_get_cluster(void *fat, uint32_t cluster);
|
|
|
|
int fat12_defrag(struct pang_io *io);
|
|
int fat12_mkfs(struct pang_io *io, uint32_t bytes);
|
|
|
|
#endif /* PANG_O_LIN_FAT12_H__ */ |