📄 mouse.lst
字号:
ARM COMPILER V2.53, mouse 27/04/07 16:47:01 PAGE 1
ARM COMPILER V2.53, COMPILATION OF MODULE mouse
OBJECT MODULE PLACED IN .\Obj\mouse.obj
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe mouse.c THUMB DEBUG PRINT(.\LST\MOUSE.LST) TABS(4) OBJECT(.\Obj\mouse.obj)
stmt level source
1 /*----------------------------------------------------------------------------
2 * Name: MOUSE.C
3 * Purpose: USB Mouse Demo
4 * Version: V1.10
5 *----------------------------------------------------------------------------
6 * This file is part of the uVision/ARM development tools.
7 * Copyright (c) 2005-2006 Keil Software. All rights reserved.
8 * This software may only be used under the terms of a valid, current,
9 * end user licence from KEIL for a compatible version of KEIL software
10 * development tools. Nothing else gives you the right to use it.
11 *---------------------------------------------------------------------------*/
12
13 #include <AT91SAM7A3.H> /* AT91SAM7A3 definitions */
14
15 #include "..\..\Board.h"
16
17 #include "type.h"
18
19 #include "usb.h"
20 #include "usbcfg.h"
21 #include "usbhw.h"
22 #include "usbcore.h"
23
24 #include "mouse.h"
25
26
27 AT91S_PIO * pPIOA = AT91C_BASE_PIOA; /* Global Pointer to PIOA */
28 AT91S_PIO * pPIOB = AT91C_BASE_PIOB; /* Global Pointer to PIOB */
29
30
31 BYTE MouseInReport[4]; /* Mouse Input Report */
32 /* Byte0.0: 1st Button (Left) */
33 /* Byte0.1: 2nd Button (Right) */
34 /* Byte0.2: 3rd Button */
35 /* Byte1: Relative X Pos */
36 /* Byte2: Relative Y Pos */
37 /* Byte3: Relative Wheel Pos */
38
39 /*
40 * Get Mouse Input Report -> MouseInReport
41 * Parameters: None
42 * Return Value: None
43 */
44
45 void GetMouseInReport (void) {
46 1 DWORD key;
47 1
48 1 MouseInReport[0] = 0x00; /* Default: No Click */
49 1 MouseInReport[1] = 0; /* Default: No X Movement */
50 1 MouseInReport[2] = 0; /* Default: No Y Movement */
51 1 MouseInReport[3] = 0; /* Wheel not used */
52 1
53 1 key = pPIOB->PIO_PDSR; /* Read Pin Data */
54 1
55 1 if ((key & JS_LEFT) == 0) { /* Check if Left is pressed */
56 2 MouseInReport[1] = -4; /* -X: Left Movement */
57 2 }
58 1 if ((key & JS_RIGHT) == 0) { /* Check if Left is pressed */
59 2 MouseInReport[1] = +4; /* +X: Right Movement */
ARM COMPILER V2.53, mouse 27/04/07 16:47:01 PAGE 2
60 2 }
61 1 if ((key & JS_UP) == 0) { /* Check if Up is pressed */
62 2 MouseInReport[2] = -4; /* -Y: Up Movement */
63 2 }
64 1 if ((key & JS_DOWN) == 0) { /* Check if Down is pressed */
65 2 MouseInReport[2] = +4; /* +Y: Down Movement */
66 2 }
67 1 if ((key & JS_PUSH) == 0) { /* Check if Push is pressed */
68 2 MouseInReport[0] = 0x01; /* Left Click */
69 2 }
70 1 }
71
72
73 /* Main Program */
74
75 int main (void) {
76 1
77 1 *AT91C_PMC_PCER = (1 << AT91C_ID_PIOA) | /* Enable Clock for PIOA */
78 1 (1 << AT91C_ID_PIOB); /* Enable Clock for PIOB */
79 1
80 1 pPIOA->PIO_PER = LED_MASK; /* Enable PIO for LED's */
81 1 pPIOA->PIO_OER = LED_MASK; /* LED's are Outputs */
82 1 pPIOA->PIO_SODR = LED_MASK; /* Turn Off LED's ("1") */
83 1
84 1 USB_Init(); /* USB Initialization */
85 1 USB_Connect(TRUE); /* USB Connect */
86 1
87 1 while (1); /* Loop forever */
88 1 }
ARM COMPILER V2.53, mouse 27/04/07 16:47:01 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN CODE16 (USB_Init?T)
EXTERN CODE16 (USB_Connect?T)
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC GetMouseInReport?T
PUBLIC main
PUBLIC MouseInReport
PUBLIC pPIOA
PUBLIC pPIOB
*** DATA SEGMENT '?DT0?mouse':
00000000 pPIOA:
00000000 BEGIN_INIT
00000000 FFFFF400 DD 0xFFFFF400
00000004 END_INIT
00000004 pPIOB:
00000004 BEGIN_INIT
00000004 FFFFF600 DD 0xFFFFF600
00000008 END_INIT
00000008 MouseInReport:
00000008 DS 4
*** CODE SEGMENT '?PR?GetMouseInReport?T?mouse':
45: void GetMouseInReport (void) {
00000000 ; SCOPE-START
48: MouseInReport[0] = 0x00; /* Default: No Click */
00000000 2100 MOV R1,#0x0
00000002 4800 LDR R0,=MouseInReport ; MouseInReport
00000004 7001 STRB R1,[R0,#0x0] ; MouseInReport
49: MouseInReport[1] = 0; /* Default: No X Movement */
00000006 4800 LDR R0,=MouseInReport + 0x1 ; MouseInReport+1
00000008 7001 STRB R1,[R0,#0x0] ; MouseInReport+1
50: MouseInReport[2] = 0; /* Default: No Y Movement */
0000000A 4800 LDR R0,=MouseInReport + 0x2 ; MouseInReport+2
0000000C 7001 STRB R1,[R0,#0x0] ; MouseInReport+2
51: MouseInReport[3] = 0; /* Wheel not used */
0000000E 4800 LDR R0,=MouseInReport + 0x3 ; MouseInReport+3
00000010 7001 STRB R1,[R0,#0x0] ; MouseInReport+3
53: key = pPIOB->PIO_PDSR; /* Read Pin Data */
00000012 4800 LDR R0,=pPIOB ; pPIOB
00000014 6800 LDR R0,[R0,#0x0] ; pPIOB
00000016 6BC2 LDR R2,[R0,#0x3C]
00000018 ---- Variable 'key' assigned to Register 'R2' ----
55: if ((key & JS_LEFT) == 0) { /* Check if Left is pressed */
00000018 1C10 MOV R0,R2 ; key
0000001A 4800 LDR R1,=0x1000
0000001C 4208 TST R0,R1 ; key
0000001E D102 BNE L_1 ; T=0x00000026
56: MouseInReport[1] = -4; /* -X: Left Movement */
00000020 21FC MOV R1,#0xFC
00000022 4800 LDR R0,=MouseInReport + 0x1 ; MouseInReport+1
00000024 7001 STRB R1,[R0,#0x0] ; MouseInReport+1
57: }
00000026 L_1:
58: if ((key & JS_RIGHT) == 0) { /* Check if Left is pressed */
00000026 1C10 MOV R0,R2 ; key
00000028 4800 LDR R1,=0x2000
0000002A 4208 TST R0,R1 ; key
0000002C D102 BNE L_2 ; T=0x00000034
59: MouseInReport[1] = +4; /* +X: Right Movement */
0000002E 2104 MOV R1,#0x4
ARM COMPILER V2.53, mouse 27/04/07 16:47:01 PAGE 4
00000030 4800 LDR R0,=MouseInReport + 0x1 ; MouseInReport+1
00000032 7001 STRB R1,[R0,#0x0] ; MouseInReport+1
60: }
00000034 L_2:
61: if ((key & JS_UP) == 0) { /* Check if Up is pressed */
00000034 1C10 MOV R0,R2 ; key
00000036 4940 LDR R1,=0x100
00000038 4208 TST R0,R1 ; key
0000003A D102 BNE L_3 ; T=0x00000042
62: MouseInReport[2] = -4; /* -Y: Up Movement */
0000003C 21FC MOV R1,#0xFC
0000003E 4800 LDR R0,=MouseInReport + 0x2 ; MouseInReport+2
00000040 7001 STRB R1,[R0,#0x0] ; MouseInReport+2
63: }
00000042 L_3:
64: if ((key & JS_DOWN) == 0) { /* Check if Down is pressed */
00000042 1C10 MOV R0,R2 ; key
00000044 4980 LDR R1,=0x200
00000046 4208 TST R0,R1 ; key
00000048 D102 BNE L_4 ; T=0x00000050
65: MouseInReport[2] = +4; /* +Y: Down Movement */
0000004A 2104 MOV R1,#0x4
0000004C 4800 LDR R0,=MouseInReport + 0x2 ; MouseInReport+2
0000004E 7001 STRB R1,[R0,#0x0] ; MouseInReport+2
66: }
00000050 L_4:
67: if ((key & JS_PUSH) == 0) { /* Check if Push is pressed */
00000050 1C10 MOV R0,R2 ; key
00000052 4800 LDR R1,=0x4000
00000054 4208 TST R0,R1 ; key
00000056 D102 BNE L_5 ; T=0x0000005E
68: MouseInReport[0] = 0x01; /* Left Click */
00000058 2101 MOV R1,#0x1
0000005A 4800 LDR R0,=MouseInReport ; MouseInReport
0000005C 7001 STRB R1,[R0,#0x0] ; MouseInReport
69: }
0000005E L_5:
0000005E ; SCOPE-END
70: }
0000005E 4770 BX R14
00000060 ENDP ; 'GetMouseInReport?T'
*** CODE SEGMENT '?PR?main?mouse':
75: int main (void) {
00000000 B500 PUSH {LR}
78: (1 << AT91C_ID_PIOB); /* Enable Clock for PIOB */
00000002 210C MOV R1,#0xC
00000004 4800 LDR R0,=0xFFFFFC10
00000006 6001 STR R1,[R0,#0x0]
80: pPIOA->PIO_PER = LED_MASK; /* Enable PIO for LED's */
00000008 4800 LDR R1,=0x3300000
0000000A 4800 LDR R0,=pPIOA ; pPIOA
0000000C 6800 LDR R0,[R0,#0x0] ; pPIOA
0000000E 6001 STR R1,[R0,#0x0]
81: pPIOA->PIO_OER = LED_MASK; /* LED's are Outputs */
00000010 4800 LDR R0,=0x3300000
00000012 4800 LDR R1,=pPIOA ; pPIOA
00000014 6809 LDR R1,[R1,#0x0] ; pPIOA
00000016 6108 STR R0,[R1,#0x10]
82: pPIOA->PIO_SODR = LED_MASK; /* Turn Off LED's ("1") */
00000018 4800 LDR R0,=0x3300000
0000001A 4800 LDR R1,=pPIOA ; pPIOA
0000001C 6809 LDR R1,[R1,#0x0] ; pPIOA
0000001E 6308 STR R0,[R1,#0x30]
84: USB_Init(); /* USB Initialization */
00000020 F7FF BL USB_Init?T ; T=0x0001 (1)
00000022 FFEE BL USB_Init?T ; T=0x0001 (2)
ARM COMPILER V2.53, mouse 27/04/07 16:47:01 PAGE 5
85: USB_Connect(TRUE); /* USB Connect */
00000024 2001 MOV R0,#0x1
00000026 F7FF BL USB_Connect?T ; T=0x0001 (1)
00000028 FFEB BL USB_Connect?T ; T=0x0001 (2)
87: while (1); /* Loop forever */
0000002A L_6:
0000002A E7FE B L_6 ; T=0x0000002A
88: }
0000002C BC08 POP {R3}
0000002E 4718 BX R3
00000030 ENDP ; 'main'
Module Information Static
----------------------------------
code size = ------
data size = 12
const size = ------
End of Module Information.
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -