diff options
author | Alan Korr <alkorr@rockbox.org> | 2002-04-19 12:16:19 +0000 |
---|---|---|
committer | Alan Korr <alkorr@rockbox.org> | 2002-04-19 12:16:19 +0000 |
commit | 6dd637f44c0523958012f3c28068c631a73b0569 (patch) | |
tree | 73f926f81d05617869da14a40f9613909e7f2dee /firmware/test/fat/fat-mbr_sector.h | |
parent | b41596560eed4f805d19931eec3d37b3bad06e61 (diff) | |
download | rockbox-6dd637f44c0523958012f3c28068c631a73b0569.tar.gz rockbox-6dd637f44c0523958012f3c28068c631a73b0569.zip |
adding files... nothin working... a lot of thing missing
not speaking about possible drastic changes...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@144 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/fat/fat-mbr_sector.h')
-rw-r--r-- | firmware/test/fat/fat-mbr_sector.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/firmware/test/fat/fat-mbr_sector.h b/firmware/test/fat/fat-mbr_sector.h new file mode 100644 index 0000000000..11f131e440 --- /dev/null +++ b/firmware/test/fat/fat-mbr_sector.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Alan Korr | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef __LIBRARY_FAT_MBR_SECTOR_H__ | ||
20 | #define __LIBRARY_FAT_MBR_SECTOR_H__ | ||
21 | #include "fat-partition.h" | ||
22 | |||
23 | // [Alan]: | ||
24 | // I would like to draw your attention about the fact that SH1 | ||
25 | // cannot use misaligned address access so you must be very cautious | ||
26 | // with structures stored in FAT32 partition because they come from | ||
27 | // PC world where misaligned address accesses are usual and not | ||
28 | // problematic. To avoid such a trouble, I decide to use special | ||
29 | // structures where fields are moved in such a way they can be | ||
30 | // accessed by SH1. It is possible thanks to the callback mechanism | ||
31 | // I use for reading or writing from/to an ATA device in ata.h/c. | ||
32 | // So don't be puzzled if those structures seem odd compared | ||
33 | // with the usual ones from PC world. I use this mechanism for structures | ||
34 | // 'partition_info', 'mbr_sector' and 'fsi_sector' for instance, but | ||
35 | // not for structure 'bpb_sector' which is too much complex to handle | ||
36 | // that way, I think. | ||
37 | // By the way, SH1 is big endian, not little endian as PC is. | ||
38 | |||
39 | /////////////////////////////////////////////////////////////////////////////////// | ||
40 | // MBR SECTOR : | ||
41 | /////////////// | ||
42 | // | ||
43 | // | ||
44 | |||
45 | struct __fat_mbr_sector /* Master Boot Record Sector */ | ||
46 | { | ||
47 | struct | ||
48 | __fat_partition_info partition_table[4]; | ||
49 | short | ||
50 | data[0x1BE/2]; | ||
51 | short | ||
52 | end[0]; | ||
53 | short | ||
54 | signature; | ||
55 | }; | ||
56 | |||
57 | int __fat_get_mbr_sector_callback (struct __fat_mbr_sector *mbr_sector); | ||
58 | int __fat_put_mbr_sector_callback (struct __fat_mbr_sector *mbr_sector); | ||
59 | |||
60 | static inline int __fat_get_mbr_sector (struct mbr_sector *__fat_mbr_sector) | ||
61 | { return ata_read_sectors (0,1,mbr_sector,(int(*)(void *))__fat_get_mbr_sector_callback); } | ||
62 | |||
63 | static inline int __fat_put_mbr_sector (struct mbr_sector *__fat_mbr_sector) | ||
64 | { return ata_write_sectors (0,1,mbr_sector,(int(*)(void *))__fat_put_mbr_sector_callback); } | ||
65 | |||
66 | // | ||
67 | /////////////////////////////////////////////////////////////////////////////////// | ||
68 | |||
69 | #endif \ No newline at end of file | ||