⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hpi32.lst

📁 USB接口程序
💻 LST
📖 第 1 页 / 共 4 页
字号:
 677   1                      return FALSE;
 678   1              if((len+32)>DeviceInfo.BPB_BytesPerSec)
 679   1                      return FALSE;
 680   1      
 681   1              ThisFile.bFileOpen=0;
 682   1              ThisFile.FatSectorPointer=0;
 683   1      
 684   1              cnum=GetFreeCusterNum32();
 685   1              if(cnum<0x02)
 686   1                      return FALSE;   
 687   1              
 688   1              pBuffer[11]=0x10;
 689   1              pBuffer[21]=(unsigned char)(cnum>>24);
 690   1              pBuffer[20]=(unsigned char)(cnum>>16);
 691   1              pBuffer[27]=(unsigned char)(cnum>>8);
 692   1              pBuffer[26]=(unsigned char)(cnum);
 693   1              pBuffer[28]=0;pBuffer[29]=0;pBuffer[30]=0;pBuffer[31]=0;
 694   1              bstop=0;
 695   1      
 696   1              NowCluster32=DirStartCluster32;         
 697   1                      do
 698   1                      {
 699   2                              NowSector=FirstSectorofCluster32(NowCluster32);
 700   2                              ClusterPointer=NowCluster32;
 701   2                              for(sector=0;sector<DeviceInfo.BPB_SecPerClus;sector++)
 702   2                      {   
 703   3                                      if(!RBC_Read(NowSector+sector,1,DBUF))
 704   3                                              return FALSE;
 705   3                                      DirCount=0;bwrite=0;
 706   3                                      for(i=0;i<DeviceInfo.BPB_BytesPerSec;i=i+32)
 707   3                                      {
 708   4                                      if(len==0)
 709   4                                              {
 710   5                                              if((DBUF[i]==0x00)||(DBUF[i]==0xE5))
 711   5                                              {
 712   6                                              for(j=0;j<32;j++)
 713   6                                                      DBUF[i+j]=*(pBuffer+j);
 714   6                                              if(!RBC_Write(NowSector+sector,1,DBUF))
 715   6                                                      return FALSE;                                   
 716   6                                              bstop=1;
 717   6                                              break;
 718   6                                              }               
 719   5                                              }
 720   4                                      else
 721   4                                      {
 722   5                                      if(DirCount==0)
 723   5                                              InByte=i;
 724   5                                      if(DBUF[i]==0xE5)                               
 725   5                                              DirCount++;                             
 726   5                                      else if(DBUF[i]==0x00)
 727   5                                              {       
 728   6                                              DirCount++;     
 729   6                                              DBUF[i]=0xE5;
 730   6                                              bwrite=1;                                       
 731   6                                              }
 732   5                                      else
 733   5                                              DirCount=0;
 734   5      
 735   5                                      if((DirCount*32)>=(len+32))
 736   5                                              {
C51 COMPILER V7.06   HPI32                                                                 08/10/2005 23:36:35 PAGE 13  

 737   6                                              for(j=0;j<len;j++)
 738   6                                                      DBUF[InByte+j]=*(pName+j);
 739   6                                              for(j=0;j<32;j++)
 740   6                                                      DBUF[InByte+len+j]=*(pBuffer+j);
 741   6                                              if(!RBC_Write(NowSector+sector,1,DBUF))
 742   6                                                      return FALSE;                                   
 743   6                                              bstop=1;
 744   6                                              break;
 745   6                                              }
 746   5                                       }                      
 747   4                                      }
 748   3                                      if(bstop==1)break;
 749   3                                      if((len!=0)&&(bwrite==1))
 750   3                                      {
 751   4                                      if(!RBC_Write(NowSector+sector,1,DBUF))
 752   4                                              return FALSE;
 753   4                              }
 754   3                      }
 755   2                              if(bstop==1)break;
 756   2              
 757   2                              NowCluster32=GetNextClusterNum32(NowCluster32);
 758   2                              if(NowCluster32>DeviceInfo.TotCluster)
 759   2                      {
 760   3                              NowCluster32=CreateClusterLink32(ClusterPointer);
 761   3                              if(NowCluster32==0x00)
 762   3                                       return FALSE;
 763   3                              NowSector=FirstSectorofCluster32(NowCluster32);
 764   3                              for(i=0;i<DeviceInfo.BPB_BytesPerSec;i++) DBUF[i]=0x00;
 765   3                              for(sector=0;sector<DeviceInfo.BPB_SecPerClus;sector++)
 766   3                                      {
 767   4                                      if(!RBC_Write(NowSector+sector,1,DBUF))
 768   4                                              return FALSE;
 769   4                                      }
 770   3                              }
 771   2                      }while(NowCluster32<=DeviceInfo.TotCluster);
 772   1              
 773   1              if(NowCluster32>DeviceInfo.TotCluster)
 774   1                  return FALSE;
 775   1      ////////////////////////////////////////////////////////////////
 776   1              for(i=64;i<DeviceInfo.BPB_BytesPerSec;i++)      DBUF[i]=0x00;
 777   1              
 778   1              for(i=0;i<43;i++) DBUF[i]=0x20;
 779   1              
 780   1              DBUF[0]=0x2e;
 781   1              for(i=11;i<32;i++) DBUF[i]=pBuffer[i];
 782   1      
 783   1              DBUF[32]=0x2e;DBUF[33]=0x2e;
 784   1              for(i=43;i<64;i++) DBUF[i]=pBuffer[i-32];
 785   1      
 786   1              if(DirStartCluster32==DeviceInfo.RootStartCluster)      //Root Dir
 787   1                      {
 788   2                      DBUF[53]=0;DBUF[52]=0;DBUF[59]=0;DBUF[58]=0;
 789   2                      }
 790   1              else
 791   1                      {
 792   2                      DBUF[53]=(unsigned char)(DirStartCluster32>>24);
 793   2                      DBUF[52]=(unsigned char)(DirStartCluster32>>16);
 794   2                      DBUF[59]=(unsigned char)(DirStartCluster32>>8);
 795   2                      DBUF[58]=(unsigned char)(DirStartCluster32);
 796   2                      }
 797   1      
 798   1              NowSector=FirstSectorofCluster32(cnum);
C51 COMPILER V7.06   HPI32                                                                 08/10/2005 23:36:35 PAGE 14  

 799   1              if(!RBC_Write(NowSector,1,DBUF))
 800   1                      return FALSE;   
 801   1      
 802   1              DirStartCluster32=cnum;
 803   1      //      ThisFile.ClusterPointer=DirStartCluster32;
 804   1              ThisFile.ClusterPointer=0;              
 805   1              return TRUE;    
 806   1      }
 807          
 808          unsigned char DownDir32(unsigned char *pBuffer)
 809          {
 810   1              unsigned int i;
 811   1              unsigned char j,bstop,sector;   
 812   1                      
 813   1              if(!bFlags.bits.SLAVE_IS_ATTACHED)
 814   1                      return FALSE;   
 815   1              
 816   1              ThisFile.bFileOpen=0;
 817   1              bstop=0;
 818   1      
 819   1              NowCluster32=DirStartCluster32;         
 820   1                      do
 821   1                      {
 822   2                              NowSector=FirstSectorofCluster32(NowCluster32);
 823   2                              for(sector=0;sector<DeviceInfo.BPB_SecPerClus;sector++)
 824   2                      {   
 825   3                                      if(!RBC_Read(NowSector+sector,1,DBUF))
 826   3                                              return FALSE;                           
 827   3                                      for(i=0;i<DeviceInfo.BPB_BytesPerSec;i=i+32)
 828   3                                      {
 829   4                                              if(DBUF[i]==0x00)
 830   4                                                      return FALSE;
 831   4                                              j=0;
 832   4                                              while(DBUF[i+j]==*(pBuffer+j))
 833   4                                              {
 834   5                                                       j=j+1;
 835   5                                                       if(j>10)
 836   5                                                              break;
 837   5                                              }
 838   4                                              if(j>10&&(DBUF[i+11]&0x10))
 839   4                                              {bstop=1;break;}
 840   4                                      }
 841   3                                      if(bstop==1)break;              
 842   3                      }
 843   2                              if(bstop==1)break;      
 844   2                              NowCluster32=GetNextClusterNum32(NowCluster32);                 
 845   2                      }while(NowCluster32<=DeviceInfo.TotCluster);
 846   1                      
 847   1              if(NowCluster32>DeviceInfo.TotCluster)
 848   1                      return FALSE;
 849   1      
 850   1              DirStartCluster32=LSwapINT32(DBUF[i+26],DBUF[i+27],DBUF[i+20],DBUF[i+21]);      
 851   1      //      ThisFile.ClusterPointer=DirStartCluster32;
 852   1              ThisFile.ClusterPointer=0;              
 853   1              return TRUE;
 854   1      }
 855          
 856          unsigned char UpDir32()
 857          {
 858   1              if(!bFlags.bits.SLAVE_IS_ATTACHED)
 859   1                      return FALSE;   
 860   1              if(DirStartCluster32==DeviceInfo.RootStartCluster)      //Root Dir
C51 COMPILER V7.06   HPI32                                                                 08/10/2005 23:36:35 PAGE 15  

 861   1                      return TRUE;    
 862   1              
 863   1              ThisFile.bFileOpen=0;
 864   1      
 865   1              NowSector=FirstSectorofCluster32(DirStartCluster32);
 866   1              if(!RBC_Read(NowSector,1,DBUF))
 867   1                              return FALSE;
 868   1              if(DBUF[32]!=0x2e&&DBUF[33]!=0x2e)      //..
 869   1                              return FALSE;
 870   1      
 871   1              DirStartCluster32=LSwapINT32(DBUF[58],DBUF[59],DBUF[52],DBUF[53]);
 872   1              if(DirStartCluster32==0)        //Root Dir
 873   1                      DirStartCluster32=DeviceInfo.RootStartCluster;  
 874   1      //      ThisFile.ClusterPointer=DirStartCluster32;
 875   1              ThisFile.ClusterPointer=0;              
 876   1              return TRUE;
 877   1      }
 878          
 879          unsigned char UpRootDir32()
 880          {
 881   1              if(!bFlags.bits.SLAVE_IS_ATTACHED)
 882   1                      return FALSE;
 883   1      
 884   1              ThisFile.bFileOpen=0;
 885   1              DirStartCluster32=DeviceInfo.RootStartCluster;  //Root Dir
 886   1                              
 887   1              return TRUE;
 888   1      }
 889          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   8711    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =      8       6
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----     136
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -