diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-28 22:16:07 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-28 22:16:07 +0000 |
commit | da848576312800dc229624e928d132d0702c1854 (patch) | |
tree | 38cd01b8a9c1069a1de734e0f7eb478436715573 /firmware/export | |
parent | ae45d970d874217b779071b414dcd5edbf5647da (diff) | |
download | rockbox-da848576312800dc229624e928d132d0702c1854.tar.gz rockbox-da848576312800dc229624e928d132d0702c1854.zip |
prepared to mount multiple partitions into one logical file system (most useful for Ondio, internal memory + external MMC)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5514 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/ata.h | 19 | ||||
-rw-r--r-- | firmware/export/disk.h | 4 | ||||
-rw-r--r-- | firmware/export/fat.h | 23 |
3 files changed, 36 insertions, 10 deletions
diff --git a/firmware/export/ata.h b/firmware/export/ata.h index 06de33a8f2..fb604a120d 100644 --- a/firmware/export/ata.h +++ b/firmware/export/ata.h | |||
@@ -20,6 +20,21 @@ | |||
20 | #define __ATA_H__ | 20 | #define __ATA_H__ |
21 | 21 | ||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "config.h" /* for HAVE_MULTIVOLUME or not */ | ||
24 | |||
25 | /* FixMe: These macros are a bit nasty and perhaps misplaced here. | ||
26 | We'll get rid of them once decided on how to proceed with multivolume. */ | ||
27 | #ifdef HAVE_MULTIVOLUME | ||
28 | #define IF_MV(x) x /* optional volume/drive parameter */ | ||
29 | #define IF_MV2(x,y) x,y /* same, for a list of arguments */ | ||
30 | #define IF_MV_NONVOID(x) x /* for prototype with sole volume parameter */ | ||
31 | #define NUM_VOLUMES 2 | ||
32 | #else /* empty definitions if no multi-volume */ | ||
33 | #define IF_MV(x) | ||
34 | #define IF_MV2(x,y) | ||
35 | #define IF_MV_NONVOID(x) void | ||
36 | #define NUM_VOLUMES 1 | ||
37 | #endif | ||
23 | 38 | ||
24 | /* | 39 | /* |
25 | ata_spindown() time values: | 40 | ata_spindown() time values: |
@@ -41,8 +56,8 @@ extern bool ata_disk_is_active(void); | |||
41 | extern int ata_hard_reset(void); | 56 | extern int ata_hard_reset(void); |
42 | extern int ata_soft_reset(void); | 57 | extern int ata_soft_reset(void); |
43 | extern int ata_init(void); | 58 | extern int ata_init(void); |
44 | extern int ata_read_sectors(unsigned long start, int count, void* buf); | 59 | extern int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); |
45 | extern int ata_write_sectors(unsigned long start, int count, const void* buf); | 60 | extern int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); |
46 | extern void ata_delayed_write(unsigned long sector, const void* buf); | 61 | extern void ata_delayed_write(unsigned long sector, const void* buf); |
47 | extern void ata_flush(void); | 62 | extern void ata_flush(void); |
48 | extern void ata_spin(void); | 63 | extern void ata_spin(void); |
diff --git a/firmware/export/disk.h b/firmware/export/disk.h index 7a9697aa13..70b73c6547 100644 --- a/firmware/export/disk.h +++ b/firmware/export/disk.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef _DISK_H_ | 19 | #ifndef _DISK_H_ |
20 | #define _DISK_H_ | 20 | #define _DISK_H_ |
21 | 21 | ||
22 | #include "ata.h" /* for volume definitions */ | ||
23 | |||
22 | struct partinfo { | 24 | struct partinfo { |
23 | unsigned long start; /* first sector (LBA) */ | 25 | unsigned long start; /* first sector (LBA) */ |
24 | unsigned long size; /* number of sectors */ | 26 | unsigned long size; /* number of sectors */ |
@@ -30,7 +32,7 @@ struct partinfo { | |||
30 | #define PARTITION_TYPE_FAT16 0x06 | 32 | #define PARTITION_TYPE_FAT16 0x06 |
31 | 33 | ||
32 | /* returns a pointer to an array of 8 partinfo structs */ | 34 | /* returns a pointer to an array of 8 partinfo structs */ |
33 | struct partinfo* disk_init(void); | 35 | struct partinfo* disk_init(IF_MV_NONVOID(int volume)); |
34 | struct partinfo* disk_partinfo(int partition); | 36 | struct partinfo* disk_partinfo(int partition); |
35 | 37 | ||
36 | #endif | 38 | #endif |
diff --git a/firmware/export/fat.h b/firmware/export/fat.h index 6f9c9c5d11..7150d2b09f 100644 --- a/firmware/export/fat.h +++ b/firmware/export/fat.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define FAT_H | 21 | #define FAT_H |
22 | 22 | ||
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include "ata.h" /* for volume definitions */ | ||
24 | 25 | ||
25 | #define SECTOR_SIZE 512 | 26 | #define SECTOR_SIZE 512 |
26 | 27 | ||
@@ -45,6 +46,7 @@ struct fat_direntry | |||
45 | #define FAT_ATTR_VOLUME_ID 0x08 | 46 | #define FAT_ATTR_VOLUME_ID 0x08 |
46 | #define FAT_ATTR_DIRECTORY 0x10 | 47 | #define FAT_ATTR_DIRECTORY 0x10 |
47 | #define FAT_ATTR_ARCHIVE 0x20 | 48 | #define FAT_ATTR_ARCHIVE 0x20 |
49 | #define FAT_ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ | ||
48 | 50 | ||
49 | struct fat_file | 51 | struct fat_file |
50 | { | 52 | { |
@@ -57,6 +59,9 @@ struct fat_file | |||
57 | unsigned int direntries; /* number of dir entries used by this file */ | 59 | unsigned int direntries; /* number of dir entries used by this file */ |
58 | unsigned int dircluster; /* first cluster of dir */ | 60 | unsigned int dircluster; /* first cluster of dir */ |
59 | bool eof; | 61 | bool eof; |
62 | #ifdef HAVE_MULTIVOLUME | ||
63 | int volume; /* file resides on which volume */ | ||
64 | #endif | ||
60 | }; | 65 | }; |
61 | 66 | ||
62 | struct fat_dir | 67 | struct fat_dir |
@@ -69,14 +74,16 @@ struct fat_dir | |||
69 | }; | 74 | }; |
70 | 75 | ||
71 | 76 | ||
72 | extern int fat_mount(int startsector); | 77 | extern void fat_init(void); |
73 | extern void fat_size(unsigned int* size, unsigned int* free); | 78 | extern int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) int startsector); |
74 | extern void fat_recalc_free(void); | 79 | extern void fat_size(IF_MV2(int volume,) unsigned int* size, unsigned int* free); // public for info |
80 | extern void fat_recalc_free(IF_MV_NONVOID(int volume)); // public for debug info screen | ||
75 | extern int fat_create_dir(const char* name, | 81 | extern int fat_create_dir(const char* name, |
76 | struct fat_dir* newdir, | 82 | struct fat_dir* newdir, |
77 | struct fat_dir* dir); | 83 | struct fat_dir* dir); |
78 | extern int fat_startsector(void); | 84 | extern int fat_startsector(IF_MV_NONVOID(int volume)); // public for config sector |
79 | extern int fat_open(unsigned int cluster, | 85 | extern int fat_open(IF_MV2(int volume,) |
86 | unsigned int cluster, | ||
80 | struct fat_file* ent, | 87 | struct fat_file* ent, |
81 | const struct fat_dir* dir); | 88 | const struct fat_dir* dir); |
82 | extern int fat_create_file(const char* name, | 89 | extern int fat_create_file(const char* name, |
@@ -93,9 +100,11 @@ extern int fat_rename(struct fat_file* file, | |||
93 | const unsigned char* newname, | 100 | const unsigned char* newname, |
94 | int size, int attr); | 101 | int size, int attr); |
95 | 102 | ||
96 | extern int fat_opendir(struct fat_dir *ent, unsigned int currdir, | 103 | extern int fat_opendir(IF_MV2(int volume,) |
104 | struct fat_dir *ent, unsigned int currdir, | ||
97 | const struct fat_dir *parent_dir); | 105 | const struct fat_dir *parent_dir); |
98 | extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry); | 106 | extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry); |
99 | extern int fat_get_cluster_size(void); | 107 | extern int fat_get_cluster_size(IF_MV_NONVOID(int volume)); |
108 | extern bool fat_ismounted(int volume); | ||
100 | 109 | ||
101 | #endif | 110 | #endif |