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

📄 button.lst

📁 AT91M40800源码
💻 LST
📖 第 1 页 / 共 2 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    10/Sep/2008  16:20:43 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  E:\AT91EBxx\button.c                                 #
#    Command line    =  E:\AT91EBxx\button.c --fpu None -D RAMCODE=1 -lCN    #
#                       E:\AT91EBxx\ramcode-EBxx\List\ -o                    #
#                       E:\AT91EBxx\ramcode-EBxx\Obj\ -z3 --no_cse           #
#                       --no_unroll --no_inline --no_code_motion --no_tbaa   #
#                       --no_clustering --no_scheduling --debug --cpu_mode   #
#                       arm --endian little --cpu ARM7TDMI --stack_align 4   #
#                       --interwork -e --dlib_config "C:\Program Files\IAR   #
#                       Systems\Embedded Workbench 4.0                       #
#                       Evaluation\arm\LIB\dl4tpainl8n.h" -I "C:\Program     #
#                       Files\IAR Systems\Embedded Workbench 4.0             #
#                       Evaluation\arm\INC\"                                 #
#    List file       =  E:\AT91EBxx\ramcode-EBxx\List\button.lst             #
#    Object file     =  E:\AT91EBxx\ramcode-EBxx\Obj\button.r79              #
#                                                                            #
#                                                                            #
##############################################################################

E:\AT91EBxx\button.c
      1          
      2          /*
      3           * $Revision: 1.4 $
      4           */
      5          
      6          
      7          #include "config.h"
      8          #include "button.h"
      9          #include "uart.h"
     10          
     11          
     12          

   \                                 In segment DATA_Z, align 4, align-sorted
     13          static unsigned int(*button_function)();
   \                     button_function:
   \   00000000                      DS8 4
     14          

   \                                 In segment DATA_Z, align 4, align-sorted
     15          int led_slow_speed = 0; // LED moving pattern speed flag.
   \                     led_slow_speed:
   \   00000000                      DS8 4
     16          

   \                                 In segment CODE, align 4, keep-with-next
     17          static void button_event(int event)
     18          {
     19            if (event == BTN_SW1_DOWN)
   \                     button_event:
   \   00000000   010050E3           CMP      R0,#+1
   \   00000004   0200001A           BNE      ??button_event_0
     20            {
     21              led_slow_speed = 1;
   \   00000008   1C109FE5           LDR      R1,??button_event_1  ;; led_slow_speed
   \   0000000C   0120A0E3           MOV      R2,#+1
   \   00000010   002081E5           STR      R2,[R1, #+0]
     22            }
     23            if (event == BTN_SW2_DOWN)
   \                     ??button_event_0:
   \   00000014   030050E3           CMP      R0,#+3
   \   00000018   0200001A           BNE      ??button_event_2
     24            {
     25              led_slow_speed = 0;
   \   0000001C   08009FE5           LDR      R0,??button_event_1  ;; led_slow_speed
   \   00000020   0010A0E3           MOV      R1,#+0
   \   00000024   001080E5           STR      R1,[R0, #+0]
     26            }
     27          }
   \                     ??button_event_2:
   \   00000028   1EFF2FE1           BX       LR               ;; return
   \                     ??button_event_1:
   \   0000002C   ........           DC32     led_slow_speed
     28          

   \                                 In segment CODE, align 4, keep-with-next
     29          void ButtonInit(unsigned int(*button_func)())
     30          {
     31            button_function = button_func;
   \                     ButtonInit:
   \   00000000   ........           LDR      R1,??DataTable1  ;; button_function
   \   00000004   000081E5           STR      R0,[R1, #+0]
     32          }
   \   00000008   1EFF2FE1           BX       LR               ;; return
     33          
     34          
     35          /*-------------------------------------------------------------------
     36          
     37            INPUT HANDLERS
     38          
     39            SCAN_BUTTONS
     40            Scans buttons, checks for up/down and down/up transitions.
     41            Events are added to the event queue.
     42          
     43          --------------------------------------------------------------------*/

   \                                 In segment CODE, align 4, keep-with-next
     44          void ButtonScan(void)
     45          {
   \                     ButtonScan:
   \   00000000   10402DE9           PUSH     {R4,LR}
     46            static int first = 1;
     47            static unsigned int lastscan;
     48            unsigned int thisscan;
     49          
     50            thisscan = (*button_function)();
   \   00000004   ........           LDR      R0,??DataTable1  ;; button_function
   \   00000008   000090E5           LDR      R0,[R0, #+0]
   \   0000000C   0FE0A0E1           MOV      LR,PC
   \   00000010   10FF2FE1           BX       R0
   \   00000014   0040B0E1           MOVS     R4,R0
     51          
     52            if (first)
   \   00000018   80019FE5           LDR      R0,??ButtonScan_0  ;; ??first
   \   0000001C   000090E5           LDR      R0,[R0, #+0]
   \   00000020   000050E3           CMP      R0,#+0
   \   00000024   0400000A           BEQ      ??ButtonScan_1
     53            {
     54              lastscan = thisscan;
   \   00000028   74019FE5           LDR      R0,??ButtonScan_0+0x4  ;; ??lastscan
   \   0000002C   004080E5           STR      R4,[R0, #+0]
     55              first = 0;
   \   00000030   68019FE5           LDR      R0,??ButtonScan_0  ;; ??first
   \   00000034   0010A0E3           MOV      R1,#+0
   \   00000038   001080E5           STR      R1,[R0, #+0]
     56            }
     57            
     58            if (thisscan != lastscan)
   \                     ??ButtonScan_1:
   \   0000003C   60019FE5           LDR      R0,??ButtonScan_0+0x4  ;; ??lastscan
   \   00000040   000090E5           LDR      R0,[R0, #+0]
   \   00000044   000054E1           CMP      R4,R0
   \   00000048   5200000A           BEQ      ??ButtonScan_2
     59            {
     60              if ((thisscan ^ lastscan) & 0x01)
   \   0000004C   0400B0E1           MOVS     R0,R4
   \   00000050   010010E2           ANDS     R0,R0,#0x1
   \   00000054   48119FE5           LDR      R1,??ButtonScan_0+0x4  ;; ??lastscan
   \   00000058   001091E5           LDR      R1,[R1, #+0]
   \   0000005C   011011E2           ANDS     R1,R1,#0x1
   \   00000060   000031E0           EORS     R0,R1,R0
   \   00000064   FF0010E2           ANDS     R0,R0,#0xFF      ;; Zero extend
   \   00000068   000050E3           CMP      R0,#+0
   \   0000006C   0B00000A           BEQ      ??ButtonScan_3
     61              {
     62                  if (thisscan & 0x01)
   \   00000070   010014E3           TST      R4,#0x1
   \   00000074   0100000A           BEQ      ??ButtonScan_4
     63                  button_event(BTN_SW4_DOWN);     
   \   00000078   0700A0E3           MOV      R0,#+7
   \   0000007C   ........           BL       button_event
     64                  if (~thisscan & 0x01)
   \                     ??ButtonScan_4:
   \   00000080   010014E3           TST      R4,#0x1
   \   00000084   0100001A           BNE      ??ButtonScan_5
     65                  button_event(BTN_SW4_UP);
   \   00000088   0800A0E3           MOV      R0,#+8
   \   0000008C   ........           BL       button_event
     66                  SendLine("key1\r\n");
   \                     ??ButtonScan_5:
   \   00000090   10019FE5           LDR      R0,??ButtonScan_0+0x8  ;; `?<Constant "key1\\r\\n">`
   \   00000094   ........           _BLF     SendLine,??SendLine??rA
     67          //        (*putchar_function)(0x01);
     68                  AT91UartPutchar(0x01);
   \   00000098   0100A0E3           MOV      R0,#+1
   \   0000009C   ........           _BLF     AT91UartPutchar,??AT91UartPutchar??rA
     69              }
     70               
     71              if ((thisscan ^ lastscan) & 0x02)
   \                     ??ButtonScan_3:
   \   000000A0   0400B0E1           MOVS     R0,R4
   \   000000A4   F8109FE5           LDR      R1,??ButtonScan_0+0x4  ;; ??lastscan
   \   000000A8   001091E5           LDR      R1,[R1, #+0]
   \   000000AC   000031E0           EORS     R0,R1,R0
   \   000000B0   020010E3           TST      R0,#0x2
   \   000000B4   0D00000A           BEQ      ??ButtonScan_6
     72              {
     73                  if (thisscan & 0x02)
   \   000000B8   020014E3           TST      R4,#0x2
   \   000000BC   0100000A           BEQ      ??ButtonScan_7
     74                  button_event(BTN_SW3_DOWN);
   \   000000C0   0500A0E3           MOV      R0,#+5
   \   000000C4   ........           BL       button_event

⌨️ 快捷键说明

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