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

📄 partition.lst

📁 Philips LPC2138 Demo Application with Keil C
💻 LST
📖 第 1 页 / 共 2 页
字号:
ARM COMPILER V2.42,  partition                                                             27/03/06  10:45:51  PAGE 1   


ARM COMPILER V2.42, COMPILATION OF MODULE partition
OBJECT MODULE PLACED IN .\obj\partition.obj
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe src\partition.c THUMB DEBUG PRINT(.\LST\PARTITION.LST) TABS(4) OBJECT(.\obj\
                    -partition.obj) 

stmt  level    source

    1          /*****************************************************************************\
    2          *              efs - General purpose Embedded Filesystem library              *
    3          *          --------------------- -----------------------------------          *
    4          *                                                                             *
    5          * Filename : partition.c                                                      *
    6          * Description : These functions are partition specific. Searching FAT type    *
    7          *               partitions and read/write functions to partitions.            *
    8          *                                                                             *
    9          * This library is free software; you can redistribute it and/or               *
   10          * modify it under the terms of the GNU Lesser General Public                  *
   11          * License as published by the Free Software Foundation; either                *
   12          * version 2.1 of the License, or (at your option) any later version.          *
   13          *                                                                             *
   14          * This library is distributed in the hope that it will be useful,             *
   15          * but WITHOUT ANY WARRANTY; without even the implied warranty of              *
   16          * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           *
   17          * Lesser General Public License for more details.                             *
   18          *                                                                             *
   19          *                                                    (c)2004 Lennart Yseboodt *
   20          *                                                    (c)2004 Michael De Nil   *
   21          \*****************************************************************************/
   22          
   23          /*****************************************************************************/
   24          #include "partition.h"
   25          /*****************************************************************************/
   26          
   27          /* ****************************************************************************  
   28           * void part_initPartition(Partition *part,Disc* refDisc)
   29           * Description: This function searches the 4 partitions for a FAT class partition
   30           * and marks the first one found as the active to be used partition.
   31          */
   32          void part_initPartition(Partition *part,Disc* refDisc)
   33          {
   34   1          eint16 c;
   35   1          
   36   1          part->disc=refDisc;
   37   1          part->activePartition=-1; /* No partition selected */
   38   1          part_setError(part,PART_NOERROR);
   39   1          for(c=3;c>=0;c--){
   40   2              if(part_isFatPart(part->disc->partitions[c].type))
   41   2                  part->activePartition=c;
   42   2          } 
   43   1      }
   44          /*****************************************************************************/ 
   45          
   46          
   47          /* ****************************************************************************  
   48           * eint16 part_isFatPart(euint8 type)
   49           * Description: This functions checks if a partitiontype (eint8) is of the FAT
   50           * type in the broadest sense. I
   51           * Return value: If it is FAT, returns 1, otherwise 0.
   52          */
   53          eint16 part_isFatPart(euint8 type)
   54          {
   55   1          if(type == PT_FAT12  ||
   56   1             type == PT_FAT16A ||
   57   1             type == PT_FAT16  ||
   58   1             type == PT_FAT32  ||
ARM COMPILER V2.42,  partition                                                             27/03/06  10:45:51  PAGE 2   

   59   1             type == PT_FAT32A ||
   60   1             type == PT_FAT16B   )
   61   1          {
   62   2              return(1);
   63   2          }
   64   1          return(0);
   65   1      }
   66          /*****************************************************************************/ 
   67          
   68          esint8 part_readBuf(Partition *part, euint32 address, euint8* buf)
   69          {
   70   1          return(if_readBuf(part->disc->ioman->iface,part_getRealLBA(part,address), buf));
   71   1      }
   72          
   73          /* ****************************************************************************  
   74           * eint16 part_writeBuf(Partition *part,euint32 address,euint8* buf)
   75           * Description: This function writes 512 bytes, from buf. It's offset is address
   76           * sectors from the beginning of the partition.
   77           * Return value: It returns whatever the hardware function returns. (-1=error)
   78          */
   79          eint16 part_writeBuf(Partition *part,euint32 address,euint8* buf)
   80          {
   81   1          /*DBG((TXT("part_writeBuf :: %li\n"),address));*/
   82   1          return(if_writeBuf(part->disc->ioman->iface,part_getRealLBA(part,address),buf));
   83   1      }
   84          /*****************************************************************************/ 
   85          
   86          
   87          /* ****************************************************************************  
   88           * euint32 part_getRealLBA(Partition *part,euint32 address)
   89           * Description: This function calculates what the partition offset for
   90           * a partition is + the address.
   91           * Return value: Sector address.
   92          */
   93          euint32 part_getRealLBA(Partition *part,euint32 address)
   94          {
   95   1          return(part->disc->partitions[part->activePartition].LBA_begin+address);
   96   1      }
   97          /*****************************************************************************/ 
   98          
   99          /* ****************************************************************************  
  100           * euint8* part_getSect(Partition *part, euint32 address, euint8 mode)
  101           * Description: This function calls ioman_getSector, but recalculates the sector
  102           * address to be partition relative.
  103           * Return value: Whatever getSector returns. (pointer or 0)
  104          */
  105          euint8* part_getSect(Partition *part, euint32 address, euint8 mode)
  106          {
  107   1          return(ioman_getSector(part->disc->ioman,part_getRealLBA(part,address),mode));
  108   1      }
  109          
  110          /* ****************************************************************************  
  111           * esint8 part_relSect(Partition *part, euint8* buf)
  112           * Description: This function calls ioman_releaseSector.
  113           * Return value: Whatever releaseSector returns.
  114          */
  115          esint8 part_relSect(Partition *part, euint8* buf)
  116          {
  117   1          return(ioman_releaseSector(part->disc->ioman,buf));
  118   1      }
  119          
  120          esint8 part_flushPart(Partition *part,euint32 addr_l, euint32 addr_h)
  121          {
  122   1          return( 
  123   1              ioman_flushRange(part->disc->ioman,part_getRealLBA(part,addr_l),part_getRealLBA(part,addr_h)) 
  124   1          );  
ARM COMPILER V2.42,  partition                                                             27/03/06  10:45:51  PAGE 3   

  125   1      }
  126          
  127          esint8 part_directSectorRead(Partition *part,euint32 address, euint8* buf)
  128          {
  129   1          return(
  130   1              ioman_directSectorRead(part->disc->ioman,part_getRealLBA(part,address),buf)
  131   1          );
  132   1      }
  133          
  134          esint8 part_directSectorWrite(Partition *part,euint32 address, euint8* buf)
  135          {
  136   1          return(
  137   1              ioman_directSectorWrite(part->disc->ioman,part_getRealLBA(part,address),buf)
  138   1          );
  139   1      }
  140          
  141          
ARM COMPILER V2.42,  partition                                                             27/03/06  10:45:51  PAGE 4   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN CODE16 (if_readBuf?T)
 EXTERN CODE16 (if_writeBuf?T)
 EXTERN CODE16 (ioman_getSector?T)
 EXTERN CODE16 (ioman_releaseSector?T)
 EXTERN CODE16 (ioman_directSectorRead?T)
 EXTERN CODE16 (ioman_directSectorWrite?T)
 EXTERN CODE16 (ioman_flushRange?T)



*** PUBLICS:
 PUBLIC         part_initPartition?T
 PUBLIC         part_isFatPart?T
 PUBLIC         part_readBuf?T
 PUBLIC         part_writeBuf?T
 PUBLIC         part_getSect?T
 PUBLIC         part_relSect?T
 PUBLIC         part_flushPart?T
 PUBLIC         part_directSectorRead?T
 PUBLIC         part_directSectorWrite?T
 PUBLIC         part_getRealLBA?T



*** CODE SEGMENT '?PR?part_initPartition?T?partition':
   32: void part_initPartition(Partition *part,Disc* refDisc)
 00000000  B530      PUSH        {R4-R5,LR}
 00000002  1C0A      MOV         R2,R1 ; refDisc
 00000004  ---- Variable 'refDisc' assigned to Register 'R2' ----
 00000004  1C05      MOV         R5,R0 ; part
 00000006  ---- Variable 'part' assigned to Register 'R5' ----
   33: {
 00000006            ; SCOPE-START
   36:     part->disc=refDisc;
 00000006  1C11      MOV         R1,R2 ; refDisc
 00000008  1C28      MOV         R0,R5 ; part
 0000000A  6001      STR         R1,[R0,#0x0] ; part
   37:     part->activePartition=-1; /* No partition selected */
 0000000C  21FF      MOV         R1,#0xFF
 0000000E  1C28      MOV         R0,R5 ; part
 00000010  7101      STRB        R1,[R0,#0x4]
   39:     for(c=3;c>=0;c--){
 00000012  2403      MOV         R4,#0x3
 00000014  ---- Variable 'c' assigned to Register 'R4' ----
 00000014  E013      B           L_3  ; T=0x0000003E
 00000016          L_4:
   40:         if(part_isFatPart(part->disc->partitions[c].type))
 00000016  1C20      MOV         R0,R4 ; c
 00000018  0401      LSL         R1,R0,#0x10 ; c
 0000001A  1409      ASR         R1,R1,#0x10
 0000001C  0109      LSL         R1,R1,#0x4
 0000001E  1C28      MOV         R0,R5 ; part
 00000020  6800      LDR         R0,[R0,#0x0] ; part
 00000022  1840      ADD         R0,R1
 00000024  7B00      LDRB        R0,[R0,#0xC]
 00000026  F7FF      BL          part_isFatPart?T  ; T=0x0001  (1)
 00000028  FFEB      BL          part_isFatPart?T  ; T=0x0001  (2)
 0000002A  2800      CMP         R0,#0x0 ; part_isFatPart?T
 0000002C  D004      BEQ         L_1  ; T=0x00000038
   41:             part->activePartition=c;
 0000002E  1C21      MOV         R1,R4 ; c
 00000030  0609      LSL         R1,R1,#0x18 ; c
 00000032  0E09      LSR         R1,R1,#0x18
 00000034  1C28      MOV         R0,R5 ; part
 00000036  7101      STRB        R1,[R0,#0x4]
   42:     } 
ARM COMPILER V2.42,  partition                                                             27/03/06  10:45:51  PAGE 5   

 00000038          L_1:
 00000038  3C01      SUB         R4,#0x1
 0000003A  0424      LSL         R4,R4,#0x10
 0000003C  1424      ASR         R4,R4,#0x10
 0000003E          L_3:
 0000003E  1C20      MOV         R0,R4 ; c
 00000040  0400      LSL         R0,R0,#0x10 ; c
 00000042  1400      ASR         R0,R0,#0x10
 00000044  2800      CMP         R0,#0x0
 00000046  DAE6      BGE         L_4  ; T=0x00000016
 00000048            ; SCOPE-END
   43: }
 00000048  BC30      POP         {R4-R5}
 0000004A  BC08      POP         {R3}
 0000004C  4718      BX          R3
 0000004E          ENDP ; 'part_initPartition?T'


*** CODE SEGMENT '?PR?part_isFatPart?T?partition':
   53: eint16 part_isFatPart(euint8 type)
 00000000  1C01      MOV         R1,R0 ; type
 00000002  ---- Variable 'type' assigned to Register 'R1' ----
   55:     if(type == PT_FAT12  ||
 00000002  1C08      MOV         R0,R1 ; type
 00000004  0600      LSL         R0,R0,#0x18 ; type
 00000006  0E00      LSR         R0,R0,#0x18
 00000008  2801      CMP         R0,#0x1
 0000000A  D018      BEQ         L_8  ; T=0x0000003E
 0000000C  1C08      MOV         R0,R1 ; type
 0000000E  0600      LSL         R0,R0,#0x18 ; type
 00000010  0E00      LSR         R0,R0,#0x18
 00000012  2804      CMP         R0,#0x4
 00000014  D013      BEQ         L_8  ; T=0x0000003E
 00000016  1C08      MOV         R0,R1 ; type
 00000018  0600      LSL         R0,R0,#0x18 ; type
 0000001A  0E00      LSR         R0,R0,#0x18
 0000001C  2806      CMP         R0,#0x6
 0000001E  D00E      BEQ         L_8  ; T=0x0000003E
 00000020  1C08      MOV         R0,R1 ; type
 00000022  0600      LSL         R0,R0,#0x18 ; type
 00000024  0E00      LSR         R0,R0,#0x18
 00000026  280B      CMP         R0,#0xB
 00000028  D009      BEQ         L_8  ; T=0x0000003E
 0000002A  1C08      MOV         R0,R1 ; type
 0000002C  0600      LSL         R0,R0,#0x18 ; type

⌨️ 快捷键说明

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