📄 bfsa_api.lst
字号:
\ 00000066 301C MOV R0,R6
\ 00000068 ........ _BLF fprintf,??fprintf??rT
95 TRACE_INFO( "FATSectStrt: 0x%X\n\r",BFSA_media.FATSectStart);
\ 0000006C E288 LDRH R2,[R4, #+6]
\ 0000006E 391C MOV R1,R7
\ 00000070 7C31 ADD R1,#+124
\ 00000072 301C MOV R0,R6
\ 00000074 ........ _BLF fprintf,??fprintf??rT
96 TRACE_INFO( "SectPerFAT : 0x%X\n\r",BFSA_media.SectPerFAT);
\ 00000078 2289 LDRH R2,[R4, #+8]
\ 0000007A 391C MOV R1,R7
\ 0000007C 9031 ADD R1,#+144
\ 0000007E 301C MOV R0,R6
\ 00000080 ........ _BLF fprintf,??fprintf??rT
97 TRACE_INFO( "numFAT : 0x%X\n\r",BFSA_media.numFAT);
\ 00000084 6289 LDRH R2,[R4, #+10]
\ 00000086 391C MOV R1,R7
\ 00000088 A431 ADD R1,#+164
\ 0000008A 301C MOV R0,R6
\ 0000008C ........ _BLF fprintf,??fprintf??rT
98 TRACE_INFO( "RootStart : 0x%X\n\r",BFSA_media.RootStart);
\ 00000090 A289 LDRH R2,[R4, #+12]
\ 00000092 391C MOV R1,R7
\ 00000094 B831 ADD R1,#+184
\ 00000096 301C MOV R0,R6
\ 00000098 ........ _BLF fprintf,??fprintf??rT
99 TRACE_INFO( "numRootSctr: 0x%X\n\r",BFSA_media.numRootSectors);
\ 0000009C E289 LDRH R2,[R4, #+14]
\ 0000009E 391C MOV R1,R7
\ 000000A0 CC31 ADD R1,#+204
\ 000000A2 301C MOV R0,R6
\ 000000A4 ........ _BLF fprintf,??fprintf??rT
100 TRACE_INFO( "ClusterStrt: 0x%X\n\r",BFSA_media.ClusterStart);
\ 000000A8 228A LDRH R2,[R4, #+16]
\ 000000AA 391C MOV R1,R7
\ 000000AC E031 ADD R1,#+224
\ 000000AE 301C MOV R0,R6
\ 000000B0 ........ _BLF fprintf,??fprintf??rT
101 TRACE_INFO( "MaxCluster : 0x%X\n\r",BFSA_media.MaxCluster);
\ 000000B4 6269 LDR R2,[R4, #+20]
\ 000000B6 391C MOV R1,R7
\ 000000B8 F431 ADD R1,#+244
\ 000000BA 301C MOV R0,R6
\ 000000BC ........ _BLF fprintf,??fprintf??rT
102 //对大于大于65535的扇区,BFSA_media.MaxCluster 字段为0 , 而使用大扇区数来代替它
103 //而相应的磁盘容量的计算也不相同
104 if(BFSA_media.MaxCluster==0)
\ 000000C0 6069 LDR R0,[R4, #+20]
\ 000000C2 8421 MOV R1,#+132
\ 000000C4 4900 LSL R1,R1,#+1 ;; #+264
\ 000000C6 7918 ADD R1,R7,R1
\ 000000C8 0028 CMP R0,#+0
\ 000000CA 03D1 BNE ??BFSA_init_5
105 {
106 TRACE_INFO( "DiskSize : %d Kb\n\r",BFSA_media.bytesPerSector*BFSA_media.SectPerFAT);
\ 000000CC 6288 LDRH R2,[R4, #+2]
\ 000000CE 2089 LDRH R0,[R4, #+8]
\ 000000D0 4243 MUL R2,R0
\ 000000D2 01E0 B ??BFSA_init_6
107 }
108 else
109 TRACE_INFO( "DiskSize : %d Kb\n\r",(BFSA_media.MaxCluster*512)/1024);
\ ??BFSA_init_5:
\ 000000D4 4002 LSL R0,R0,#+9
\ 000000D6 820A LSR R2,R0,#+10
\ ??BFSA_init_6:
\ 000000D8 301C MOV R0,R6
\ 000000DA ........ _BLF fprintf,??fprintf??rT
110
111 // Update currentdir
112 BFSA_current_dir.absolutePath[0] = '\\';
\ 000000DE .... LDR R0,??DataTable4 ;; BFSA_current_dir
\ 000000E0 5C21 MOV R1,#+92
\ 000000E2 0170 STRB R1,[R0, #+0]
113 BFSA_current_dir.absolutePath[1] = '\0';
\ 000000E4 0021 MOV R1,#+0
\ 000000E6 4170 STRB R1,[R0, #+1]
114 BFSA_current_dir.DirStart = BFSA_media.RootStart;
\ 000000E8 6630 ADD R0,#+102
\ 000000EA A189 LDRH R1,[R4, #+12]
\ 000000EC 0180 STRH R1,[R0, #+0]
115 BFSA_current_dir.IsRoot = TRUE;
\ 000000EE 0121 MOV R1,#+1
\ 000000F0 8170 STRB R1,[R0, #+2]
\ 000000F2 06E0 B ??BFSA_init_7
116 }
117 else
118 {
119 TRACE_INFO( "not a fat filesystem,please formated it\n\r");
\ ??BFSA_init_4:
\ 000000F4 9020 MOV R0,#+144
\ 000000F6 4000 LSL R0,R0,#+1 ;; #+288
\ 000000F8 3918 ADD R1,R7,R0
\ 000000FA 301C MOV R0,R6
\ 000000FC ........ _BLF fprintf,??fprintf??rT
120 _status = NOT_A_FAT_FILESYSTEM;
\ 00000100 .... LDR R5,??DataTable5 ;; 0x80000002
121 }
122 return _status;
\ ??BFSA_init_7:
\ 00000102 281C MOV R0,R5
\ 00000104 .... B ?Subroutine12
\ 00000106 C046 NOP
\ ??BFSA_init_2:
\ 00000108 ........ DC32 `?<Constant "MMC disk initialized .\\r\\n">`
123 } // end BFSA_init
\ In segment CODE, align 4, keep-with-next
\ ?Subroutine12:
\ 00000000 F0BC POP {R4-R7}
\ 00000002 02BC POP {R1}
\ 00000004 0847 BX R1 ;; return
\ 00000006 C046 NOP
\ ??Subroutine12_0:
\ 00000008 ........ DC32 BFSABuffer
124
125 /*****************************************************************
126 *
127 *
128 * S U B - R O U T I N E : BFSA_format
129 *
130 *-----------------------------------------------------------------
131 *
132 * Object :
133 *
134 *
135 * Argument :
136 *
137 * Return value :
138 *
139 *****************************************************************/
\ In segment CODE, align 4, keep-with-next
140 ULONG BFSA_format( void )
141 {
\ BFSA_format:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 FFB0 SUB SP,#+508
\ 00000004 83B0 SUB SP,#+12
142 ULONG BPB_FATSz16; //每fat的扇区数
143 USHORT Number_of_sector;
144 unsigned int value;
145 ULONG _status = MMC_ACCESS_ERROR;
\ 00000006 .... LDR R0,??DataTable6 ;; 0x80000100
\ 00000008 0190 STR R0,[SP, #+4]
\ 0000000A 0020 MOV R0,#+0
\ 0000000C 8024 MOV R4,#+128
\ 0000000E E400 LSL R4,R4,#+3 ;; #+1024
\ 00000010 .... LDR R5,??Subroutine12_0 ;; BFSABuffer
\ 00000012 0021 MOV R1,#+0
146 ULONG count;
147
148 // FLASH_HD size (NB_BLOCK_HB*256+NB_BLOCK_LB)*SIZEONESECTOR Ko
149 // 512 (MBR) - 512 (MBR2) - 512*2 (FAT1) - 512*2 (FAT2) - 512x32 (RootDirectory)
150 // 512x38 = 19456 = 19 Ko LOST // 18Ko lost with AT91SAM7S64
151
152 // Erase table BFSA_fatBuff
153 // for (count=0; count < sizeof(BFSA_fatBuff); count++)
154 for (count=0; count < sizeofBFSA_fatBuff; count++)
155 {
156 BFSABuffer.BFSA_fatBuff[count] = (unsigned char)0x00;
\ ??BFSA_format_0:
\ 00000014 2954 STRB R1,[R5, R0]
157 }
\ 00000016 401C ADD R0,R0,#+1
\ 00000018 A042 CMP R0,R4
\ 0000001A FBD3 BCC ??BFSA_format_0
158
159 // ************* [0x1BE] First partition ************* 祥见sd卡文件系统表:2.3-2
160 // [0x1BE][00] Boot Indicator, Not active (0x80: active)
161 BFSABuffer.BFSA_fatBuff[0x1BE] = 0x00;
\ 0000001C DF20 MOV R0,#+223
\ 0000001E 4000 LSL R0,R0,#+1 ;; #+446
\ 00000020 2818 ADD R0,R5,R0
\ 00000022 0180 STRH R1,[R0, #+0]
162 // [0x1BF][01] Head partition start
163 BFSABuffer.BFSA_fatBuff[0x1BF] = 0x00;
164 // [0x1C0][02] Sector and cylinder of partition start
165 BFSABuffer.BFSA_fatBuff[0x1C0] = 0x01; BFSABuffer.BFSA_fatBuff[0x1C1] = 0x00;
\ 00000024 0121 MOV R1,#+1
\ 00000026 8170 STRB R1,[R0, #+2]
\ 00000028 0021 MOV R1,#+0
\ 0000002A C170 STRB R1,[R0, #+3]
166 // [0x1C2][04] Partition type 0x01 FAT12 < 10M ,syatemID ,0x01,0x04,or 0x06
167 BFSABuffer.BFSA_fatBuff[0x1C2] = 0x01;
\ 0000002C 0121 MOV R1,#+1
\ 0000002E 0171 STRB R1,[R0, #+4]
168 // [0x1C3][05] Head of partition end
169 BFSABuffer.BFSA_fatBuff[0x1C3] = 0x00;
\ 00000030 0021 MOV R1,#+0
\ 00000032 4171 STRB R1,[R0, #+5]
170 // [0x1C4][06] Sector and cylinder of partition end
171 Number_of_sector = NB_BLOCK-1;
^
Warning[Pe069]: integer conversion resulted in truncation
172 BFSABuffer.BFSA_fatBuff[0x1C4] = (UCHAR) Number_of_sector;
\ 00000034 7F21 MOV R1,#+127
\ 00000036 8171 STRB R1,[R0, #+6]
173 BFSABuffer.BFSA_fatBuff[0x1C5] = ((UCHAR)(Number_of_sector>>8));
\ 00000038 8426 MOV R6,#+132
\ 0000003A C671 STRB R6,[R0, #+7]
174 // [0x1C6][08] Relative Sectors. The offset from the beginning of the disk to the beginning of the volume, counting by sectors.
175 BFSABuffer.BFSA_fatBuff[0x1C6] = 0x01; BFSABuffer.BFSA_fatBuff[0x1C7] = 0x00; BFSABuffer.BFSA_fatBuff[0x1C8] = 0x00; BFSABuffer.BFSA_fatBuff[0x1C9] = 0x00;
\ 0000003C 0121 MOV R1,#+1
\ 0000003E 0172 STRB R1,[R0, #+8]
\ 00000040 0021 MOV R1,#+0
\ 00000042 4172 STRB R1,[R0, #+9]
\ 00000044 4181 STRH R1,[R0, #+10]
\ 00000046 8021 MOV R1,#+128
\ 00000048 0173 STRB R1,[R0, #+12]
176 // FORMAT PB BFSA_fatBuff[0x1C6] = 0x00; BFSA_fatBuff[0x1C7] = 0x00; BFSA_fatBuff[0x1C8] = 0x00; BFSA_fatBuff[0x1C9] = 0x00;
177 // [0x1CA][0C] Total Sectors. The total number of sectors in the volume.
178 BFSABuffer.BFSA_fatBuff[0x1CA] = (UCHAR) NB_BLOCK;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -