Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

part.h

Go to the documentation of this file.
00001 /*! \file part.h \brief Disk Partition Interface. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'part.h'
00005 // Title        : Disk Partition Interface
00006 // Author       : Pascal Stang (c) 2004
00007 // Date         : 8/13/2004
00008 // Revised      : 8/13/2004
00009 // Version      : 0.3
00010 // Target MCU   : any?
00011 // Editor Tabs  : 4
00012 //
00013 // NOTE: This code is currently below version 1.0, and therefore is considered
00014 // to be lacking in some functionality or documentation, or may not be fully
00015 // tested.  Nonetheless, you can expect most functions to work.
00016 //
00017 // This code is distributed under the GNU Public License
00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00019 //
00020 //*****************************************************************************
00021 
00022 #ifndef PART_H
00023 #define PART_H
00024 
00025 #include "global.h"
00026 
00027 // Partition Type used in the partition record
00028 #define PART_TYPE_UNKNOWN       0x00
00029 #define PART_TYPE_FAT12         0x01
00030 #define PART_TYPE_XENIX         0x02
00031 #define PART_TYPE_DOSFAT16      0x04
00032 #define PART_TYPE_EXTDOS        0x05
00033 #define PART_TYPE_FAT16         0x06
00034 #define PART_TYPE_NTFS          0x07
00035 #define PART_TYPE_FAT32         0x0B
00036 #define PART_TYPE_FAT32LBA      0x0C
00037 #define PART_TYPE_FAT16LBA      0x0E
00038 #define PART_TYPE_EXTDOSLBA     0x0F
00039 #define PART_TYPE_ONTRACK       0x33
00040 #define PART_TYPE_NOVELL        0x40
00041 #define PART_TYPE_PCIX          0x4B
00042 #define PART_TYPE_PHOENIXSAVE   0xA0
00043 #define PART_TYPE_CPM           0xDB
00044 #define PART_TYPE_DBFS          0xE0
00045 #define PART_TYPE_BBT           0xFF
00046 
00047 // partition record, length 16 bytes
00048 struct partrecord
00049 {           
00050     BYTE    prIsActive;                 // 0x80 indicates active partition
00051     BYTE    prStartHead;                // starting head for partition
00052     WORD    prStartCylSect;             // starting cylinder and sector
00053     BYTE    prPartType;                 // partition type (see above)
00054     BYTE    prEndHead;                  // ending head for this partition
00055     WORD    prEndCylSect;               // ending cylinder and sector
00056     DWORD   prStartLBA;                 // first LBA sector for this partition
00057     DWORD   prSize;                     // size of this partition (bytes or sectors ?)
00058 } GNUC_PACKED;
00059 
00060 struct partsector
00061 {
00062     CHAR    psPartCode[512-64-2];       // pad so struct is 512b
00063     struct partrecord psPartition[4];   // four partition records (64 bytes)
00064     BYTE    psBootSectSig0;             // first signature byte: 0x55
00065     BYTE    psBootSectSig1;             // second signature byte: 0xAA
00066 } GNUC_PACKED;
00067         
00068 struct partsector_byte
00069 {
00070     CHAR    psPartCode[512-64-2];       // pad so struct is 512b
00071     BYTE    psPart[64];                 // four partition records (64 bytes)
00072     BYTE    psBootSectSig0;             // first signature byte: 0x55
00073     BYTE    psBootSectSig1;             // second signature byte: 0xAA
00074 } GNUC_PACKED;
00075 
00076 #define PART_BOOTSIG0        0x55
00077 #define PART_BOOTSIG1        0xaa
00078 
00079 // interface
00080 struct PartInfo
00081 {
00082     DiskInfo_t disk;
00083     DevDisk_t dev;
00084     unsigned long start;
00085     unsigned long sizeinsectors;
00086 //};
00087 } GNUC_PACKED;
00088 
00089 typedef struct PartInfo PartInfo_t;
00090 
00091 extern PartInfo_t PartInfo;
00092 
00093 // Prototypes
00094 int partInit(DiskInfo_t* disk);
00095 
00096 void partPrintEntry(struct partrecord *partition);
00097 void partPrintTable(struct partsector *buffer);
00098 
00099 int partReadSector(unsigned long sector, int numsectors, u08* buffer);
00100 int partWriteSector(unsigned long sector, int numsectors, u08* buffer);
00101 
00102 #endif

Generated on Mon Nov 6 23:36:59 2006 for Procyon ARMlib by  doxygen 1.4.2