赞助论坛
  • 11416阅读
  • 0回复

來個高級點的...修改USB讀取容量至2T [复制链接]

楼层直达
发帖
22
精华
1
金币
88
威望
3
贡献
0
好评
12
注册
2009-02-10
楼主    yinglung 发表于: 2010-04-13 10:17:52 
修改 Cardfs.h

typedef struct _CARD_INFO {
     UINT32      sAddBootSec;   //boot sector start address(in LBA)
     UINT32      sAddFAT;     //FAT start address(in LBA)
     UINT32      sAddFDB;     //root FDB start address, FAT16 only(in LBA)
     UINT32      sAddData;     //data start address(in LBA)
     #ifdef    NEW_PLAYMSF
     UINT32      bytePerSec;   //bytes/sector
     UINT8      secPerClus;   //sectors/Cluster    
     UINT32      secPerFAT;     //sectors/FAT          
   #else
     UINT16      bytePerSec;   //bytes/sector
     UINT16      secPerClus;   //sectors/Cluster    
     UINT16      secPerFAT;     //sectors/FAT      
   #endif
     UINT16      nFDBinRoot;   //#FDB in root dir
     BYTE      nHeadMax;     //max head
     BYTE      nSecMax;     //max sector
     BYTE      typeFAT;     //FAT16/FAT32
     BYTE      nItemSizeFAT;   //2x item size in FAT(in Bytes)
     int        bFATCacheCluster;//1:cache in cluster, 0:cache in LBA
     UINT32    totalClus;        // total cluster in FAT
} CARD_INFO;

修改fs_fat.c

typedef struct {
     fs_mem_handle_t h1;
     fs_mem_handle_t h2;
     fs_mem_handle_t h3;
 
     disk_t *pDisk;   //disk where this partition resides
 
     UINT32 sAddFAT;     //FAT start address(in LBA)
     UINT32 sAddFDB;     //root FDB start address, FAT16 only(in LBA)
     UINT32 sAddData;     //data start address(in LBA)
     UINT16 typeFAT;     //FAT type
     #ifdef NEW_PLAYMSF
   UINT32   secPerClus;   //sectors/Cluster
   #else
     UINT8   secPerClus;   //sectors/Cluster
     #endif
     UINT32 bytePerClus;   //bytes/Cluster
     //UINT16 secPerFAT;     //sectors/FAT
     UINT32 secPerFAT;     //sectors/FAT
     UINT16 nFDBinRoot;   //maximum root directory entries
     UINT32 totalClus;     //clusters/Partition
 
   //pages -- a cached region of the FAT
   UINT16 clusPerPage;   //clusters per page
   UINT16 bytePerPage;   //bytes per page
   UINT32 pagePerPart;   //number of pages in partition

     fat_page_t fatPage1;   //primary page -- can read/write
     fat_page_t fatPage2;   //secondary page -- read only
 
     //page table -- mark pages with free clusters
     UINT8 *sPageTable;     //memory location of free list
     UINT32 pageTableSize;   //number of pages

} fat_partition_t;

修改Util.c
#ifdef NEW_PLAYMSF
UINT32 HDD_MSF = 0;
#endif
UINT32    l2msf(UINT32 l)
{
     UINT32 ss, ff;
     UINT32 l_75, l_4500;

     l     += 150;
     l_75   = l/75;
     l_4500 = l_75/60;


     ff = l - 75*l_75;
     ss = l_75 - 60*l_4500;

   #ifdef NEW_PLAYMSF
          if(storage_type==USB_DEVICE)
        HDD_MSF = l_4500&0xFFFF0000;
   #endif
   
     return (l_4500<<16) | (ss<<8) | (ff);
}

UINT32    msf2l(UINT32 msf)
{
     UINT32 iMM;

     //Jeff replace, 20030814
     //return MSF2l(msf_mm(msf), msf_ss(msf), msf_ff(msf));
     //JSLin 20040915    //added CDDVD

   #ifdef NEW_PLAYMSF
   if(storage_type==USB_DEVICE)
   {
       iMM =((msf>>16)&0xFFFF)|HDD_MSF;
       return (iMM*60*75+msf_ss(msf)*75+msf_ff(msf)-150);
   }
   #endif
       
     if ((cd_type_loaded==CDROM) || (cd_type_loaded==CDDVD))
   {
         iMM = (((msf)>>16) & 0xffff);
     }
   else
   {
         iMM = msf_mm(msf);
     }

     return MSF2l(iMM, msf_ss(msf), msf_ff(msf));
}
本帖最近评分记录: 2 条评分