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

📄 util.lst

📁 lpc2138读写SD卡的fat文件系统
💻 LST
📖 第 1 页 / 共 2 页
字号:
ARM COMPILER V2.00d,  util                                                                 23/10/05  18:16:18  PAGE 1   


ARM COMPILER V2.00d, COMPILATION OF MODULE util
OBJECT MODULE PLACED IN .\Flash\util.obj
COMPILER INVOKED BY: C:\KEIL\ARM\BIN\CA.EXE util.c THUMB OPTIMIZE(7,SPEED) BROWSE DEBUG PRINT(.\FLASH\UTIL.LST) TABS(4) 
                    -OBJECT(.\Flash\util.obj) 

stmt  level    source

    1          // Utility functions
    2          #include <LPC213x.H>                     // LPC21xx definitions
    3          #include <bsp.h>                         // include board support package
    4          #include <stdio.h>
    5          
    6          void set_LED(char led_no, char led_cmd) {
    7   1        if (led_cmd == ON) {
    8   2          if (led_no == ALL) IOSET1 = 0x00FF0000;
    9   2          else IOSET1 = (0x00010000 << led_no);
   10   2        }
   11   1        if (led_cmd == OFF) {
   12   2          if (led_no == ALL) IOCLR1 = 0x00FF0000;
   13   2          else IOCLR1 = (0x00010000 << led_no);
   14   2        }
   15   1      }
   16          
   17          int kp_printf(const char *fmt) {
   18   1        if ((U1SCR & 0x04) == 0x04) printf(fmt);
   19   1        return(0);
   20   1      }
   21          
   22          char ntoc(unsigned char x)  //given a single digit, return a character for that
   23          {           //digit.            
   24   1        switch (x)
   25   1        {
   26   2        case 9 : return('9');
   27   2        case 8 : return('8');
   28   2        case 7 : return('7');
   29   2        case 6 : return('6');
   30   2        case 5 : return('5');
   31   2        case 4 : return('4');
   32   2        case 3 : return('3');
   33   2        case 2 : return('2');
   34   2        case 1 : return('1');
   35   2        case 0 : return('0');
   36   2        }
   37   1        return('?');      //return an "F" if if digit is grater than 9
   38   1      }
   39           
   40          char htoc(unsigned char x)  //given a single digit, return a character for that
   41          {           //digit.            
   42   1        switch (x)
   43   1        {
   44   2        case 15 : return('F');
   45   2        case 14 : return('E');
   46   2        case 13 : return('D');
   47   2        case 12 : return('C');
   48   2        case 11 : return('B');
   49   2        case 10 : return('A');
   50   2        case 9 : return('9');
   51   2        case 8 : return('8');
   52   2        case 7 : return('7');
   53   2        case 6 : return('6');
   54   2        case 5 : return('5');
   55   2        case 4 : return('4');
   56   2        case 3 : return('3');
   57   2        case 2 : return('2');
   58   2        case 1 : return('1');
ARM COMPILER V2.00d,  util                                                                 23/10/05  18:16:18  PAGE 2   

   59   2        case 0 : return('0');
   60   2        }
   61   1        return('?');      //return an "F" if if digit is grater than 9
   62   1      }
   63          
   64          void wr_byte(unsigned char d, unsigned char x)  //d is the number of digits (leading zeros)
   65          {                           //routine writes a 3 position digit for the
   66   1        char a,b;                 //byte value "X".
   67   1        a = x/100;                //find the 100's
   68   1        if (d == 3) putchar(ntoc(a)); //write out ASCII for the 100's
   69   1        b = x - a*100;            //adjust value to the tens
   70   1        a = b/10;                 //find the number of 10's
   71   1        if (d >= 2) putchar(ntoc(a)); //write out the 10's
   72   1        a = b - a*10;             //adjust numbers for one's
   73   1        putchar(ntoc(a));         //write out the one's
   74   1      }
   75          
   76          void wr_hex(unsigned char x)    //hex number with leading zeros
   77          {                           //routine writes a 2 position digit for the
   78   1        unsigned int a;           //byte value "X".
   79   1        a = x/16;                 //find the number of 16's
   80   1        putchar(htoc(a));         //write out the 16's
   81   1        a = x - a*16;             //adjust numbers for one's
   82   1        putchar(htoc(a));         //write out the one's
   83   1      }
   84          
   85          void wr_32hex(unsigned int x)   //hex number for 32 bit value
   86          {
   87   1        unsigned int i;       // loop index
   88   1        unsigned char a;
   89   1        for (i=4;i>0;i--) {   // There is a bug in the compiler... for (i=3;i>=0;i--) doesn't work
   90   2          a = x >> (8*(i-1)); // get next byte
   91   2          wr_hex(a);          // print ASCII representation of the byte
   92   2        }
   93   1      
   94   1      }
   95          unsigned int read_reg(unsigned int x) {
   96   1        return(x);
   97   1      }
ARM COMPILER V2.00d,  util                                                                 23/10/05  18:16:18  PAGE 3   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN CODE16 (putchar?T)
 EXTERN CODE16 (printf?T)
 EXTERN CODE16 (?C?UDIV?T)
 EXTERN CODE16 (?C?SDIV?T)



*** PUBLICS:
 PUBLIC         set_LED?T
 PUBLIC         kp_printf?T
 PUBLIC         ntoc?T
 PUBLIC         htoc?T
 PUBLIC         wr_byte?T
 PUBLIC         wr_hex?T
 PUBLIC         wr_32hex?T
 PUBLIC         read_reg?T



*** CODE SEGMENT '?PR?set_LED?T?util':
    6: void set_LED(char led_no, char led_cmd) {
 00000000  B430      PUSH        {R4-R5}
 00000002  1C0D      MOV         R5,R1 ; led_cmd
 00000004  ---- Variable 'led_cmd' assigned to Register 'R5' ----
 00000004  1C03      MOV         R3,R0 ; led_no
 00000006  ---- Variable 'led_no' assigned to Register 'R3' ----
    7:   if (led_cmd == ON) {
 00000006  0629      LSL         R1,R5,#0x18 ; led_cmd
 00000008  0E09      LSR         R1,R1,#0x18 ; led_cmd
 0000000A  2901      CMP         R1,#0x1 ; led_cmd
 0000000C  D10B      BNE         L_1  ; T=0x00000026
    8:     if (led_no == ALL) IOSET1 = 0x00FF0000;
 0000000E  0618      LSL         R0,R3,#0x18 ; led_no
 00000010  0E00      LSR         R0,R0,#0x18 ; led_no
 00000012  2808      CMP         R0,#0x8 ; led_no
 00000014  D103      BNE         L_2  ; T=0x0000001E
 00000016  4800      LDR         R4,=0xFF0000
 00000018  4800      LDR         R2,=0xE0028014
 0000001A  6014      STR         R4,[R2,#0x0]
 0000001C  E003      B           L_1  ; T=0x00000026
 0000001E          L_2:
    9:     else IOSET1 = (0x00010000 << led_no);
 0000001E  4800      LDR         R2,=0x10000
 00000020  4082      LSL         R2,R0
 00000022  4800      LDR         R0,=0xE0028014
 00000024  6002      STR         R2,[R0,#0x0]
   10:   }
 00000026          L_1:
   11:   if (led_cmd == OFF) {
 00000026  2900      CMP         R1,#0x0 ; led_cmd
 00000028  D10B      BNE         L_4  ; T=0x00000042
   12:     if (led_no == ALL) IOCLR1 = 0x00FF0000;
 0000002A  0618      LSL         R0,R3,#0x18 ; led_no
 0000002C  0E00      LSR         R0,R0,#0x18 ; led_no
 0000002E  2808      CMP         R0,#0x8 ; led_no
 00000030  D103      BNE         L_5  ; T=0x0000003A
 00000032  4800      LDR         R2,=0xFF0000
 00000034  4800      LDR         R1,=0xE002801C
 00000036  600A      STR         R2,[R1,#0x0]
 00000038  E003      B           L_4  ; T=0x00000042
 0000003A          L_5:
   13:     else IOCLR1 = (0x00010000 << led_no);
 0000003A  4800      LDR         R1,=0x10000
 0000003C  4081      LSL         R1,R0
 0000003E  4800      LDR         R0,=0xE002801C
 00000040  6001      STR         R1,[R0,#0x0]
ARM COMPILER V2.00d,  util                                                                 23/10/05  18:16:18  PAGE 4   

   14:   }
 00000042          L_4:
   15: }
 00000042  BC30      POP         {R4-R5}
 00000044  4770      BX          R14
 00000046          ENDP ; 'set_LED?T'


*** CODE SEGMENT '?PR?kp_printf?T?util':
   17: int kp_printf(const char *fmt) {
 00000000  B500      PUSH        {LR}
 00000002  ---- Variable 'fmt' assigned to Register 'R0' ----
   18:   if ((U1SCR & 0x04) == 0x04) printf(fmt);
 00000002  4800      LDR         R1,=0xE001001C
 00000004  7809      LDRB        R1,[R1,#0x0]
 00000006  2204      MOV         R2,#0x4
 00000008  4211      TST         R1,R2
 0000000A  D001      BEQ         L_7  ; T=0x00000010
 0000000C  F7FF      BL          printf?T  ; T=0x0001  (1)
 0000000E  FFF8      BL          printf?T  ; T=0x0001  (2)
 00000012          L_7:
   19:   return(0);
 00000012  2000      MOV         R0,#0x0
   20: }
 00000014  BC08      POP         {R3}
 00000016  4718      BX          R3
 00000018          ENDP ; 'kp_printf?T'


*** CODE SEGMENT '?PR?ntoc?T?util':
   22: char ntoc(unsigned char x)  //given a single digit, return a character for that
 00000000  ---- Variable 'x' assigned to Register 'R0' ----
   24:   switch (x)
 00000000  1C01      MOV         R1,R0 ; x
 00000002  3900      SUB         R1,#0x0
 00000004  D023      BEQ         L_10  ; T=0x0000004E
 00000006  3901      SUB         R1,#0x1
 00000008  D01F      BEQ         L_11  ; T=0x0000004A
 0000000A  3901      SUB         R1,#0x1
 0000000C  D01B      BEQ         L_12  ; T=0x00000046
 0000000E  3901      SUB         R1,#0x1
 00000010  D017      BEQ         L_13  ; T=0x00000042
 00000012  3901      SUB         R1,#0x1
 00000014  D013      BEQ         L_14  ; T=0x0000003E
 00000016  3901      SUB         R1,#0x1
 00000018  D00F      BEQ         L_15  ; T=0x0000003A
 0000001A  3901      SUB         R1,#0x1
 0000001C  D00B      BEQ         L_16  ; T=0x00000036
 0000001E  3901      SUB         R1,#0x1
 00000020  D007      BEQ         L_17  ; T=0x00000032
 00000022  3901      SUB         R1,#0x1
 00000024  D003      BEQ         L_18  ; T=0x0000002E
 00000026  3901      SUB         R1,#0x1
 00000028  D113      BNE         L_9  ; T=0x00000052
   26:   case 9 : return('9');
 0000002A          L_19:
 0000002A  2039      MOV         R0,#0x39
 0000002C  E012      B           L_20  ; T=0x00000054
   27:   case 8 : return('8');
 0000002E          L_18:
 0000002E  2038      MOV         R0,#0x38
 00000030  E010      B           L_20  ; T=0x00000054
   28:   case 7 : return('7');
 00000032          L_17:
 00000032  2037      MOV         R0,#0x37
 00000034  E00E      B           L_20  ; T=0x00000054
   29:   case 6 : return('6');
 00000036          L_16:
 00000036  2036      MOV         R0,#0x36
 00000038  E00C      B           L_20  ; T=0x00000054
ARM COMPILER V2.00d,  util                                                                 23/10/05  18:16:18  PAGE 5   

   30:   case 5 : return('5');
 0000003A          L_15:
 0000003A  2035      MOV         R0,#0x35
 0000003C  E00A      B           L_20  ; T=0x00000054
   31:   case 4 : return('4');
 0000003E          L_14:
 0000003E  2034      MOV         R0,#0x34
 00000040  E008      B           L_20  ; T=0x00000054
   32:   case 3 : return('3');
 00000042          L_13:
 00000042  2033      MOV         R0,#0x33
 00000044  E006      B           L_20  ; T=0x00000054
   33:   case 2 : return('2');
 00000046          L_12:
 00000046  2032      MOV         R0,#0x32
 00000048  E004      B           L_20  ; T=0x00000054
   34:   case 1 : return('1');
 0000004A          L_11:
 0000004A  2031      MOV         R0,#0x31
 0000004C  E002      B           L_20  ; T=0x00000054
   35:   case 0 : return('0');
 0000004E          L_10:
 0000004E  2030      MOV         R0,#0x30
 00000050  E000      B           L_20  ; T=0x00000054
   36:   }
 00000052          L_9:
   37:   return('?');      //return an "F" if if digit is grater than 9
 00000052  203F      MOV         R0,#0x3F
   38: }
 00000054          L_20:
 00000054  4770      BX          R14
 00000056          ENDP ; 'ntoc?T'


*** CODE SEGMENT '?PR?htoc?T?util':
   40: char htoc(unsigned char x)  //given a single digit, return a character for that
 00000000  ---- Variable 'x' assigned to Register 'R0' ----
   42:   switch (x)
 00000000  1C01      MOV         R1,R0 ; x
 00000002  3900      SUB         R1,#0x0
 00000004  D03B      BEQ         L_22  ; T=0x0000007E
 00000006  3901      SUB         R1,#0x1

⌨️ 快捷键说明

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