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

📄 fat16.lst

📁 at91sam7x256 FREERTOS sd卡的读写程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.31A/W32 EVALUATION    17/Dec/2007  11:18:45 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  G:\AT91_ENERGY\ATMEL_ARM\mmssys\mmc_sd\fat16.c       #
#    Command line    =  G:\AT91_ENERGY\ATMEL_ARM\mmssys\mmc_sd\fat16.c -D    #
#                       AT91SAM7X256 -D PULL_UP_USB -D USE_LED -lC           #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\RAM_Debug\List\" --remarks -o         #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\RAM_Debug\Obj\" -z9 --debug           #
#                       --cpu_mode thumb --endian little --cpu ARM7TDMI      #
#                       --stack_align 4 --interwork -e --fpu None            #
#                       --dlib_config "C:\Program Files\IAR                  #
#                       Systems\Embedded Workbench 4.0                       #
#                       Evaluation\ARM\LIB\dl4tptinl8f.h" -I                 #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\srcIAR\" -I                           #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\src\" -I                           #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\..\" -I                            #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\..\FILESYSTEM\inc\" -I             #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\..\MASSSTORAGE\inc\" -I            #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\..\AT91SAM7X256\" -I               #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\inc\" -I                           #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\..\mmc_sd\" -I                     #
#                       "G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass      #
#                       Storage\compil\..\..\COMMON_FS_MS\" -I "C:\Program   #
#                       Files\IAR Systems\Embedded Workbench 4.0             #
#                       Evaluation\ARM\INC\"                                 #
#    List file       =  G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass       #
#                       Storage\compil\RAM_Debug\List\fat16.lst              #
#    Object file     =  G:\AT91_ENERGY\ATMEL_ARM\mmssys\AT91SAM7X-Mass       #
#                       Storage\compil\RAM_Debug\Obj\fat16.r79               #
#                                                                            #
#                                                                            #
##############################################################################

G:\AT91_ENERGY\ATMEL_ARM\mmssys\mmc_sd\fat16.c
      1          #include <string.h>
      2          #include "fat16.h"

   #endif
         ^
"G:\AT91_ENERGY\ATMEL_ARM\mmssys\mmc_sd\fat16.h",326  Warning[Pe001]: last
          line of file ends without a newline
      3          
      4          
      5          #define SEEK_SET 0
      6          #define SEEK_CUR 1
      7          #define SEEK_END 2
      8          
      9          #define DISK_32M  32
     10          #define DISK_16M  16
     11          #define DISK_4M  4
     12          #define DISK_1M  1
     13          #define DEBUG_FAT        1
     14          #define FAT_SIZEOFWORD   8*256
     15          //请注意每个扇区实际为528个字节,最后还有16个字节

   \                                 In segment DATA_Z, align 4, align-sorted
     16          BYTE SectorBuffer[512];   //SectorBuffer
     17          BYTE SectorSpare[16];//Nandflash的备用区,防止sectorbuffer与clusterbuffer冲突
     18          BYTE ClusterBuffer[32][512];//ClusterBuffer
   \                     ClusterBuffer:
   \   00000000                      DS8 16384
   \                     SectorBuffer:
   \   00004000                      DS8 512

   \                                 In segment DATA_Z, align 4, align-sorted
   \                     SectorSpare:
   \   00000000                      DS8 16

   \                                 In segment DATA_Z, align 4, align-sorted
     19          WORD FatCache[FAT_SIZEOFWORD];
   \                     FatCache:
   \   00000000                      DS8 8192
     20          
     21          
     22          extern unsigned char Erase_MMC_Cluster(unsigned int cluster) ;
     23          extern void mmc_read_page(unsigned int block,unsigned int page, unsigned char * s);
     24          extern int mmc_write_page(unsigned int block,unsigned int page, unsigned char * s);
     25          
     26          //--------------该函数用于将磁盘格式化----------------------------//

   \                                 In segment CODE, align 4, keep-with-next
     27          int fat_format(unsigned char Media,unsigned char Sizeofdisk_M,unsigned char FilesysType)
     28          {
   \                     fat_format:
   \   00000000   F3B5               PUSH        {R0,R1,R4-R7,LR}
   \   00000002   82B0               SUB         SP,#+8
   \   00000004   161C               MOV         R6,R2
   \   00000006   7048               LDR         R0,??fat_format_0  ;; `?<Constant "-LiTai- ">`
   \   00000008   0090               STR         R0,[SP, #+0]
     29          	//PARTSECTOR   *partsector;
     30          	//PARTRECORD   *partrecord;
     31          	int i,j,fatsec,temp,blocknum;
     32          	//unsigned char buf[512];
     33          	BOOTSECTOR50 *bootsector; 
     34          	BPB50 *bpb;
     35          	EXTBOOT *ext;
     36          	
     37          	const CHAR *litai_str="-LiTai- ";
     38          	const CHAR *armsys_str="ARMSYS44B0 ";
   \   0000000A   7048               LDR         R0,??fat_format_0+0x4  ;; `?<Constant "-LiTai- ">` + 12
   \   0000000C   0190               STR         R0,[SP, #+4]
     39          	const CHAR *fat16_str="FAT16   ";
   \   0000000E   704D               LDR         R5,??fat_format_0+0x8  ;; `?<Constant "-LiTai- ">` + 24
     40          	blocknum=((Sizeofdisk_M<<20)>>9)>>5;
     41          	
     42          	
     43              /*for(i=0;i<blocknum;i++){
     44          	if(!(Erase_MMC_Cluster(i)))
     45          	{
     46          		AT91F_DBGU_Printk("\nErase Nand-flash failed!%d block,it can be omitted.",i);
     47          		//return 0;
     48          	}
     49          	//for(j=0;j<255;j++);
     50              	}*/
     51          	AT91F_DBGU_Printk("\nErase Nand-flash successfully!");
                 	^
Warning[Pe223]: function "AT91F_DBGU_Printk" declared implicitly
   \   00000010   7048               LDR         R0,??fat_format_0+0xC  ;; `?<Constant "-LiTai- ">` + 36
   \   00000012   ........           _BLF        AT91F_DBGU_Printk,??AT91F_DBGU_Printk??rT
   \   00000016   0027               MOV         R7,#+0
   \   00000018   FF22               MOV         R2,#+255
   \   0000001A   ....               LDR         R4,??DataTable6    ;; ClusterBuffer
     52          
     53          	for(i=0;i<512;i++)
     54          	SectorBuffer[i]=0xff;
   \                     ??fat_format_1:
   \   0000001C   8020               MOV         R0,#+128
   \   0000001E   C001               LSL         R0,R0,#+7          ;; #+16384
   \   00000020   E119               ADD         R1,R4,R7
   \   00000022   0A54               STRB        R2,[R1, R0]
   \   00000024   7F1C               ADD         R7,R7,#+1
   \   00000026   4009               LSR         R0,R0,#+5
   \   00000028   8742               CMP         R7,R0
   \   0000002A   F7DB               BLT         ??fat_format_1
     55          	
     56          	if(Media==NAND_FLASH_Drv)//对Nand-flash进行格式化
   \   0000002C   6846               MOV         R0,SP
   \   0000002E   007A               LDRB        R0,[R0, #+8]
   \   00000030   0128               CMP         R0,#+1
   \   00000032   ....               BEQ         .+5
   \   00000034   BCE0               B           ??fat_format_2
     57          	{
     58          		 //第0个扇区为DBR
     59          		 bootsector = (BOOTSECTOR50 *)SectorBuffer;
     60          		 bpb = (BPB50 *)(bootsector->bsBPB);
     61          		 ext = (EXTBOOT *)(bootsector->bsExt);
     62          		 
     63          		 bootsector->bsJump[0] = 0xeb;
   \   00000036   8020               MOV         R0,#+128
   \   00000038   C001               LSL         R0,R0,#+7          ;; #+16384
   \   0000003A   2018               ADD         R0,R4,R0
   \   0000003C   EB21               MOV         R1,#+235
   \   0000003E   0170               STRB        R1,[R0, #+0]
     64          		 bootsector->bsJump[1] = 0x03;
   \   00000040   0321               MOV         R1,#+3
   \   00000042   4170               STRB        R1,[R0, #+1]
     65          		 bootsector->bsJump[2] = 0x90;
   \   00000044   9021               MOV         R1,#+144
   \   00000046   8170               STRB        R1,[R0, #+2]
     66          		 for(i=0;i<7;i++)
   \   00000048   0021               MOV         R1,#+0
     67          		   bootsector->bsOemName[i] = *litai_str++;
   \                     ??fat_format_3:
   \   0000004A   634A               LDR         R2,??fat_format_0+0x10  ;; 0x4003
   \   0000004C   6318               ADD         R3,R4,R1
   \   0000004E   009F               LDR         R7,[SP, #+0]
   \   00000050   3F78               LDRB        R7,[R7, #+0]
   \   00000052   9F54               STRB        R7,[R3, R2]
   \   00000054   009A               LDR         R2,[SP, #+0]
   \   00000056   521C               ADD         R2,R2,#+1
   \   00000058   0092               STR         R2,[SP, #+0]
   \   0000005A   491C               ADD         R1,R1,#+1
   \   0000005C   0729               CMP         R1,#+7
   \   0000005E   F4DB               BLT         ??fat_format_3
     68          		 bootsector->bsOemName[7]='\0'; 
   \   00000060   0021               MOV         R1,#+0
   \   00000062   8172               STRB        R1,[R0, #+10]
     69          		 bootsector->bsBootSectSig0 = BOOTSIG0;
   \   00000064   5D48               LDR         R0,??fat_format_0+0x14  ;; 0x41fe
   \   00000066   2018               ADD         R0,R4,R0
   \   00000068   5521               MOV         R1,#+85
   \   0000006A   0170               STRB        R1,[R0, #+0]
     70          		 bootsector->bsBootSectSig1 = BOOTSIG1;
   \   0000006C   AA21               MOV         R1,#+170
   \   0000006E   4170               STRB        R1,[R0, #+1]
     71          		 
     72          		 bpb->bpbBytesPerSec = 512;
   \   00000070   5B48               LDR         R0,??fat_format_0+0x18  ;; 0x400b
   \   00000072   2218               ADD         R2,R4,R0
   \   00000074   4009               LSR         R0,R0,#+5
   \   00000076   1060               STR         R0,[R2, #+0]
     73          		 bpb->bpbSecPerClust = 32;
   \   00000078   2020               MOV         R0,#+32
   \   0000007A   1071               STRB        R0,[R2, #+4]
     74          		 if(FilesysType==PART_TYPE_FAT12||FilesysType==PART_TYPE_DOSFAT16
     75          		 ||FilesysType==PART_TYPE_FAT16||FilesysType==PART_TYPE_FAT16LBA)
   \   0000007C   012E               CMP         R6,#+1
   \   0000007E   05D0               BEQ         ??fat_format_4
   \   00000080   042E               CMP         R6,#+4
   \   00000082   03D0               BEQ         ??fat_format_4
   \   00000084   062E               CMP         R6,#+6
   \   00000086   01D0               BEQ         ??fat_format_4

⌨️ 快捷键说明

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