📄 combi.lst
字号:
C51 COMPILER V7.01 COMBI 04/14/2008 22:57:43 PAGE 1
C51 COMPILER V7.01, COMPILATION OF MODULE COMBI
OBJECT MODULE PLACED IN .\combi.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\..\Usb-Mouse\src\combi.c BROWSE DEBUG OBJECTEXTEND PRINT(.\combi.lst)
- OBJECT(.\combi.obj)
stmt level source
1 /*
2 **
3 ** FILE: combi.c
4 **
5 **
6 ** purpose: USB firmware for Cypress USB/PS2 mouse reference design
7 **
8 **
9 ** revision history:
10 ** 6/27/00 bth : modified ps2 scaling algorithm
11 ** 7/11/00 sea : modified ps2 resolution constants and
12 ** ps2_send() start bit inhibit response
13 **
14 */
15
16
17
18 #pragma option INSTRUCTIONTIMING //needed for Cypress debugger to work properly
*** WARNING C245 IN LINE 18 OF ..\..\..\USB-MOUSE\SRC\COMBI.C: unknown #pragma, line ignored
19 #pragma option f0 //do not insert page breaks in listing file
*** WARNING C245 IN LINE 19 OF ..\..\..\USB-MOUSE\SRC\COMBI.C: unknown #pragma, line ignored
20 #pragma option REGSAVEOFF; //do not automatically save AC and IX in interrupts
*** WARNING C245 IN LINE 20 OF ..\..\..\USB-MOUSE\SRC\COMBI.C: unknown #pragma, line ignored
21 #pragma option NOINIT;
*** WARNING C245 IN LINE 21 OF ..\..\..\USB-MOUSE\SRC\COMBI.C: unknown #pragma, line ignored
22 #define DEBUG
23
24
25 #include "chip.h"
*** WARNING C245 IN LINE 10 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: unknown #pragma, line ignored
*** ERROR C129 IN LINE 12 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: missing ';' before 'AC'
*** ERROR C302 IN LINE 178 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C302 IN LINE 179 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C302 IN LINE 181 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C302 IN LINE 182 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C303 IN LINE 183 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: formal argument expected
*** ERROR C302 IN LINE 185 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C302 IN LINE 186 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C302 IN LINE 187 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C302 IN LINE 188 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
*** ERROR C302 IN LINE 189 OF ..\..\..\USB-MOUSE\SRC\CHIP.H: misused # operator
26 #include "usbdefs.h"
27 #include "ps2defs.h"
28
29 #define BIT0 1
30 #define BIT1 2
31 #define BIT2 4
32 #define BIT3 8
33 #define BIT4 0x10
34 #define BIT5 0x20
35 #define BIT6 0x40
36 #define BIT7 0x80
37
38
C51 COMPILER V7.01 COMBI 04/14/2008 22:57:43 PAGE 2
39 //*************************************************************************************************
40 //USER_DEFINES
41 /*
42 **
43 ** the following defines can be changed to accomodate different I/O pinouts. It is assumed that
44 ** all 6 quadrature inputs (optics) are connected to the same port.
45 **
46 */
47
48 #define OPTICS_PORT PORT0 //optics port
49 #define OPTICS_MASK 0x3f //mask of all optics inputs
50 /*
51 ** for each set of x,y, and z optics, define a macro that will move the corresponding 2 quadrature bits
52 ** into bit1 and bit0. For instance, in the reference design
53 ** the y- quadrature inputs are at bits 3 and 2, so the macro shifts the bits by 2 and
54 ** masks them.
55 */
56
57 #define GET_X_OPTICS(x) ((x >> 0) & 0x3) //no shift necessary
58 #define GET_Y_OPTICS(x) ((x >> 2) & 0x3) //shift bits [3:2] into [1:0]
59 #define GET_Z_OPTICS(x) ((x >> 4) & 0x3) //shift bits [5:4] into [1:0]
60
61
62 /*
63 ** define each switch's port and bit position
64 */
65 #define LEFT_SWITCH_PORT PORT0
66 #define LEFT_SWITCH_MASK BIT7
67 #define RIGHT_SWITCH_PORT PORT1
68 #define RIGHT_SWITCH_MASK BIT0
69 #define MIDDLE_SWITCH_PORT PORT1
70 #define MIDDLE_SWITCH_MASK BIT1
71
72
73 /*
74 **define masks for the port pin functions. This information is used to establish the mode
75 **settings for the GPIO pins
76 **
77 */
78 #define PORT0_OPTICS_MASK 0b00111111 //optics pins [5:0] on port 0
79 #define PORT1_OPTICS_MASK 0b00000000 //no optics on port 1
80 #define PORT0_LED_MASK 0b01000000 //led drive at pin [6] on port 0
81 #define PORT1_LED_MASK 0b00000000 //no led drive on port 1
82 #define PORT0_SWITCH_MASK 0b10000000 //switch input at pin [7] on port 0
83 #define PORT1_SWITCH_MASK 0b00000011 //switch inputs at [1:0] on port 1
84
85
86
87
88 //comment the following lines if you do not want PS2 resolution and scaling commands to be implemented
89 //in the code.
90 #define ENABLE_RESOLUTION
91 #define ENABLE_SCALING
92 //END OF USER DEFINES
93 //*************************************************************************************************
94
95
96
97
98
99 //*************************************************************************************************
100 //COMMON DECLARATIONS USED BY BOTH INTERFACES
C51 COMPILER V7.01 COMBI 04/14/2008 22:57:43 PAGE 3
101 #include "macros.h" //include macro definitions
*** ERROR C315 IN LINE 1 OF ..\..\..\USB-MOUSE\SRC\MACROS.H: unknown #directive 'asm'
*** ERROR C315 IN LINE 67 OF ..\..\..\USB-MOUSE\SRC\MACROS.H: unknown #directive 'endasm'
102
103 /*
104 ** define port data and mode initial values for the 3 operating states -- normal, suspend, and suspend wit
-h remote
105 ** wakeup -- based on the masks provided by the user
106 */
107 /*
108 **normal operating mode
109 */
110 #define PORT0_INIT PORT0_SWITCH_MASK
111 #define PORT1_INIT PORT1_SWITCH_MASK
112 #define PORT0_MODE1_INIT PORT0_SWITCH_MASK
113 #define PORT1_MODE1_INIT PORT1_SWITCH_MASK
114 #define PORT0_MODE0_INIT PORT0_LED_MASK
115 #define PORT1_MODE0_INIT PORT1_LED_MASK
116
117 /*
118 ** suspend mode (no remote wakeup)
119 */
120
121
122 #define PORT0_SUSPEND PORT0_LED_MASK
123 #define PORT1_SUSPEND PORT1_LED_MASK
124 #define PORT0_MODE1_SUSPEND PORT0_LED_MASK
125 #define PORT1_MODE1_SUSPEND PORT1_LED_MASK
126 #define PORT0_MODE0_SUSPEND PORT0_SWITCH_MASK
127 #define PORT1_MODE0_SUSPEND PORT1_SWITCH_MASK
128 /*
129 ** remote wakeup
130 */
131 #define PORT0_RW (PORT0_LED_MASK | PORT0_SWITCH_MASK)
132 #define PORT1_RW (PORT1_LED_MASK | PORT1_SWITCH_MASK)
133 #define PORT0_MODE1_RW (PORT0_SWITCH_MASK | PORT0_LED_MASK)
134 #define PORT1_MODE1_RW (PORT1_SWITCH_MASK | PORT1_LED_MASK)
135 #define PORT0_MODE0_RW 0
136 #define PORT1_MODE0_RW 0
137
138
139 #define LEFT_SWITCH_ASSERTED (!(LEFT_SWITCH_PORT & LEFT_SWITCH_MASK))
140 #define MIDDLE_SWITCH_ASSERTED (!(MIDDLE_SWITCH_PORT & MIDDLE_SWITCH_MASK))
141 #define RIGHT_SWITCH_ASSERTED (!(RIGHT_SWITCH_PORT & RIGHT_SWITCH_MASK))
142
143
144 /*
145 ** switches are debounced in a routine that is called every 4 msec. 10
146 ** successive stable samples are required for a switch change to be reported.
147 */
148 #define DEBOUNCE_COUNT 10 //10 identical samples must be taken to recognize switch changes
149
150
151
152
153
154 /*
155 ** define a structure containing variables updated in the 1-msec interrupt
156 */
157
158 typedef struct
159 {
C51 COMPILER V7.01 COMBI 04/14/2008 22:57:43 PAGE 4
160 char b1msCounter; //incremented inside 1msec interrupt for general timing
161 char b1msFlags; //flag set inside 1msec interrupt
162 }ONE_MSEC_STATUS;
163 #define ONE_MSEC_FLAG 1
164
165
166 /*
167 ** Quadrature inputs are sampled inside the 128 usec interrupt and placed in a queue for later
168 ** processing in the main loop.
169 **
170 */
171 typedef struct
172 {
173 char near *headP; //head of queue
174 char near *tailP; //tail of queue
175 char bLen; //length of queue
176 }QUEUE_STRUCT;
177
178
179 /*
180 ** current state of each quadrature pair is stored to compare with the next sample.
181 **
182 */
183
184 typedef struct
185 {
186 char bXstate; //current state of X optics
187 char bYstate; //current state of Y optics
188 char bZstate; //current state of Z optics
189
190 }OPTICS_STATE;
191
192
193
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -