00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef PARTITION_H
00019 #define PARTITION_H
00020
00021 #include <stdint.h>
00022
00038 #define PARTITION_TYPE_FREE 0x00
00039
00042 #define PARTITION_TYPE_FAT12 0x01
00043
00046 #define PARTITION_TYPE_FAT16_32MB 0x04
00047
00050 #define PARTITION_TYPE_EXTENDED 0x05
00051
00054 #define PARTITION_TYPE_FAT16 0x06
00055
00058 #define PARTITION_TYPE_FAT32 0x0b
00059
00062 #define PARTITION_TYPE_FAT32_LBA 0x0c
00063
00066 #define PARTITION_TYPE_FAT16_LBA 0x0e
00067
00070 #define PARTITION_TYPE_EXTENDED_LBA 0x0f
00071
00074 #define PARTITION_TYPE_UNKNOWN 0xff
00075
00083 typedef uint8_t (*device_read_t)(uint32_t offset, uint8_t* buffer, uint16_t length);
00092 typedef uint8_t (*device_read_callback_t)(uint8_t* buffer, uint32_t offset, void* p);
00111 typedef uint8_t (*device_read_interval_t)(uint32_t offset, uint8_t* buffer, uint16_t interval, uint16_t length, device_read_callback_t callback, void* p);
00119 typedef uint8_t (*device_write_t)(uint32_t offset, const uint8_t* buffer, uint16_t length);
00129 typedef uint16_t (*device_write_callback_t)(uint8_t* buffer, uint32_t offset, void* p);
00148 typedef uint8_t (*device_write_interval_t)(uint32_t offset, uint8_t* buffer, uint16_t length, device_write_callback_t callback, void* p);
00149
00153 struct partition_struct
00154 {
00161 device_read_t device_read;
00168 device_read_interval_t device_read_interval;
00175 device_write_t device_write;
00182 device_write_interval_t device_write_interval;
00183
00189 uint8_t type;
00193 uint32_t offset;
00197 uint32_t length;
00198 };
00199
00200 struct partition_struct* partition_open(device_read_t device_read, device_read_interval_t device_read_interval, device_write_t device_write, device_write_interval_t device_write_interval, int8_t index);
00201 uint8_t partition_close(struct partition_struct* partition);
00202
00207 #endif
00208