summaryrefslogtreecommitdiff
path: root/firmware/test
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-03 11:59:53 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-03 11:59:53 +0000
commitc7f7934e8f74be4b98abe83c2f6a2593fd294cf0 (patch)
treecdebbde186e8db107472c5a7b0775f050e7f4560 /firmware/test
parent86a59ecdf6e6bf3e45938c0ca305b892777b28e0 (diff)
downloadrockbox-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/Makefile13
-rw-r--r--firmware/test/fat/debug.h9
-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 @@
1FIRMWARE = ../..
1DRIVERS = ../../drivers 2DRIVERS = ../../drivers
2 3
3CFLAGS = -g -Wall -DTEST_FAT -I$(DRIVERS) -I. 4CFLAGS = -g -Wall -DTEST_FAT -I$(DRIVERS) -I$(FIRMWARE)/common -I$(FIRMWARE) -I. -DDEBUG -DCRT_DISPLAY
4 5
5TARGET = fat 6TARGET = 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
10fat.o: $(DRIVERS)/fat.c $(DRIVERS)/fat.h $(DRIVERS)/ata.h 11fat.o: $(DRIVERS)/fat.c $(DRIVERS)/fat.h $(DRIVERS)/ata.h
11 $(CC) $(CFLAGS) -c $< -o $@ 12 $(CC) $(CFLAGS) -c $< -o $@
12 13
14disk.o: $(FIRMWARE)/common/disk.c
15 $(CC) $(CFLAGS) -c $< -o $@
16
17debug.o: $(FIRMWARE)/debug.c
18 $(CC) $(CFLAGS) -c $< -o $@
19
13ata-sim.o: ata-sim.c $(DRIVERS)/ata.h 20ata-sim.o: ata-sim.c $(DRIVERS)/ata.h
14 21
15debug.o: debug.c debug.h $(DRIVERS)/ata.h 22main.o: main.c $(DRIVERS)/ata.h
16 23
17clean: 24clean:
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
4void dbg_dump_sector(int sec);
5void dbg_dump_buffer(unsigned char *buf);
6void dbg_print_bpb(struct bpb *bpb);
7void 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
9void dbg_dump_sector(int sec);
10void dbg_dump_buffer(unsigned char *buf);
11void dbg_print_bpb(struct bpb *bpb);
12void dbg_console(struct bpb *bpb);
7 13
8void dbg_dump_sector(int sec) 14void dbg_dump_sector(int sec)
9{ 15{
@@ -189,3 +195,25 @@ void dbg_console(struct bpb* bpb)
189 } 195 }
190 } 196 }
191} 197}
198
199int 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