Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fat_begin_lba = 0x00;
- cluster_begin_lba = 0x00;
- sectors_per_cluster= 0x00;
- root_dir_first_cluster = 0x00;
- readSector(0x00, Cluster);
- for (i = 0;i < 4;i++){
- Partition_LBA_Begin <<= 8;
- Partition_LBA_Begin |= Cluster[457 - i];
- }
- readSector(Partition_LBA_Begin,Cluster);//Read VolumeID Partition1
- for (i = 0;i < 2;i++){
- Number_of_Reserved_Sectors <<= 8;
- Number_of_Reserved_Sectors |= Cluster[15 - i];
- }
- fat_begin_lba = Partition_LBA_Begin + Number_of_Reserved_Sectors;
- for (i = 0;i < 4;i++){
- Sectors_Per_FAT <<= 8;
- Sectors_Per_FAT |= Cluster[39 - i];
- }
- cluster_begin_lba = Partition_LBA_Begin + Number_of_Reserved_Sectors + (2 * Sectors_Per_FAT);
- sectors_per_cluster = Cluster[13];
- for (i = 0;i < 4;i++){
- root_dir_first_cluster <<= 8;
- root_dir_first_cluster |= Cluster[47 - i];
- }
- if (sectors_per_cluster > 8){
- return 1; //Format Unsupported
- }
- else{
- Cluster = (uint8_t*)realloc(Cluster, 512 * sectors_per_cluster);
- FAT = (uint32_t*)realloc(FAT, 128);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement