diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-05-03 11:59:53 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-05-03 11:59:53 +0000 |
commit | c7f7934e8f74be4b98abe83c2f6a2593fd294cf0 (patch) | |
tree | cdebbde186e8db107472c5a7b0775f050e7f4560 /firmware/test | |
parent | 86a59ecdf6e6bf3e45938c0ca305b892777b28e0 (diff) | |
download | rockbox-c7f7934e8f74be4b98abe83c2f6a2593fd294cf0.tar.gz rockbox-c7f7934e8f74be4b98abe83c2f6a2593fd294cf0.zip |
Added disk/partition handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@405 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test')
-rw-r--r-- | firmware/test/fat/Makefile | 13 | ||||
-rw-r--r-- | firmware/test/fat/debug.h | 9 | ||||
-rw-r--r-- | firmware/test/fat/main.c (renamed from firmware/test/fat/debug.c) | 28 |
3 files changed, 38 insertions, 12 deletions
diff --git a/firmware/test/fat/Makefile b/firmware/test/fat/Makefile index 8b60aba99c..6b253fe16c 100644 --- a/firmware/test/fat/Makefile +++ b/firmware/test/fat/Makefile | |||
@@ -1,18 +1,25 @@ | |||
1 | FIRMWARE = ../.. | ||
1 | DRIVERS = ../../drivers | 2 | DRIVERS = ../../drivers |
2 | 3 | ||
3 | CFLAGS = -g -Wall -DTEST_FAT -I$(DRIVERS) -I. | 4 | CFLAGS = -g -Wall -DTEST_FAT -I$(DRIVERS) -I$(FIRMWARE)/common -I$(FIRMWARE) -I. -DDEBUG -DCRT_DISPLAY |
4 | 5 | ||
5 | TARGET = fat | 6 | TARGET = fat |
6 | 7 | ||
7 | $(TARGET): fat.o ata-sim.o debug.o | 8 | $(TARGET): fat.o ata-sim.o debug.o main.o disk.o |
8 | gcc -g -o fat $+ -lfl | 9 | gcc -g -o fat $+ -lfl |
9 | 10 | ||
10 | fat.o: $(DRIVERS)/fat.c $(DRIVERS)/fat.h $(DRIVERS)/ata.h | 11 | fat.o: $(DRIVERS)/fat.c $(DRIVERS)/fat.h $(DRIVERS)/ata.h |
11 | $(CC) $(CFLAGS) -c $< -o $@ | 12 | $(CC) $(CFLAGS) -c $< -o $@ |
12 | 13 | ||
14 | disk.o: $(FIRMWARE)/common/disk.c | ||
15 | $(CC) $(CFLAGS) -c $< -o $@ | ||
16 | |||
17 | debug.o: $(FIRMWARE)/debug.c | ||
18 | $(CC) $(CFLAGS) -c $< -o $@ | ||
19 | |||
13 | ata-sim.o: ata-sim.c $(DRIVERS)/ata.h | 20 | ata-sim.o: ata-sim.c $(DRIVERS)/ata.h |
14 | 21 | ||
15 | debug.o: debug.c debug.h $(DRIVERS)/ata.h | 22 | main.o: main.c $(DRIVERS)/ata.h |
16 | 23 | ||
17 | clean: | 24 | clean: |
18 | rm -f *.o $(TARGET) | 25 | rm -f *.o $(TARGET) |
diff --git a/firmware/test/fat/debug.h b/firmware/test/fat/debug.h deleted file mode 100644 index ff786ab2b1..0000000000 --- a/firmware/test/fat/debug.h +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #ifndef DEBUG_H | ||
2 | #define DEBUG_H | ||
3 | |||
4 | void dbg_dump_sector(int sec); | ||
5 | void dbg_dump_buffer(unsigned char *buf); | ||
6 | void dbg_print_bpb(struct bpb *bpb); | ||
7 | void dbg_console(struct bpb *bpb); | ||
8 | |||
9 | #endif | ||
diff --git a/firmware/test/fat/debug.c b/firmware/test/fat/main.c index fa7ff8651a..ffe3dd8764 100644 --- a/firmware/test/fat/debug.c +++ b/firmware/test/fat/main.c | |||
@@ -4,6 +4,12 @@ | |||
4 | #include "fat.h" | 4 | #include "fat.h" |
5 | #include "ata.h" | 5 | #include "ata.h" |
6 | #include "debug.h" | 6 | #include "debug.h" |
7 | #include "disk.h" | ||
8 | |||
9 | void dbg_dump_sector(int sec); | ||
10 | void dbg_dump_buffer(unsigned char *buf); | ||
11 | void dbg_print_bpb(struct bpb *bpb); | ||
12 | void dbg_console(struct bpb *bpb); | ||
7 | 13 | ||
8 | void dbg_dump_sector(int sec) | 14 | void dbg_dump_sector(int sec) |
9 | { | 15 | { |
@@ -189,3 +195,25 @@ void dbg_console(struct bpb* bpb) | |||
189 | } | 195 | } |
190 | } | 196 | } |
191 | } | 197 | } |
198 | |||
199 | int main(int argc, char *argv[]) | ||
200 | { | ||
201 | struct bpb bpb; | ||
202 | |||
203 | if(ata_init()) { | ||
204 | DEBUGF("*** Warning! The disk is uninitialized\n"); | ||
205 | return -1; | ||
206 | } | ||
207 | if (disk_init()) { | ||
208 | DEBUGF("*** Failed reading partitions\n"); | ||
209 | return -1; | ||
210 | } | ||
211 | |||
212 | if(fat_mount(&bpb,part[0].start)) { | ||
213 | DEBUGF("*** Failed mounting fat\n"); | ||
214 | } | ||
215 | |||
216 | dbg_console(&bpb); | ||
217 | return 0; | ||
218 | } | ||
219 | |||