📄 f3xx_usb0_reporthandler.lst
字号:
C51 COMPILER V7.06 F3XX_USB0_REPORTHANDLER 09/12/2006 16:12:59 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE F3XX_USB0_REPORTHANDLER
OBJECT MODULE PLACED IN F3xx_USB0_ReportHandler.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\c51.exe F3xx_USB0_ReportHandler.c DB OE
stmt level source
1 //-----------------------------------------------------------------------------
2 // F3xx_USB0_ReportHandler.c
3 //-----------------------------------------------------------------------------
4 // Copyright 2005 Silicon Laboratories, Inc.
5 // http://www.silabs.com
6 //
7 // Program Description:
8 //
9 // Contains functions and variables dealing with Input and Output
10 // HID reports.
11 //
12 // How To Test: See Readme.txt
13 //
14 //
15 // FID: 3XX000038
16 // Target: C8051F340
17 // Tool chain: Keil C51 7.50 / Keil EVAL C51
18 // Silicon Laboratories IDE version 2.6
19 // Command Line: See Readme.txt
20 // Project Name: F3xx_MouseExample
21 //
22 // Release 1.0
23 // -Initial Revision (PD)
24 // -07 DEC 2005
25 //
26
27
28 // ----------------------------------------------------------------------------
29 // Header files
30 // ----------------------------------------------------------------------------
31
32 #include "F3xx_USB0_ReportHandler.h"
33 #include "F3xx_USB0_InterruptServiceRoutine.h"
34 #include "F3xx_USB0_Mouse.h"
35
36
37 // ----------------------------------------------------------------------------
38 // Local Function Prototypes
39 // ----------------------------------------------------------------------------
40
41 // ****************************************************************************
42 // Add custom Report Handler Prototypes Here
43 // ****************************************************************************
44
45 void IN_Report(void);
46 void OUT_Report(void);
47
48 // ----------------------------------------------------------------------------
49 // Local Definitions
50 // ----------------------------------------------------------------------------
51
52 // ****************************************************************************
53 // Set Definitions to sizes corresponding to the number of reports
54 // ****************************************************************************
55
C51 COMPILER V7.06 F3XX_USB0_REPORTHANDLER 09/12/2006 16:12:59 PAGE 2
56 #define IN_VECTORTABLESize 1
57 #define OUT_VECTORTABLESize 1
58
59 // ----------------------------------------------------------------------------
60 // Global Constant Declaration
61 // ----------------------------------------------------------------------------
62
63
64 // ****************************************************************************
65 // Link all Report Handler functions to corresponding Report IDs
66 // ****************************************************************************
67
68 const VectorTableEntry code IN_VECTORTABLE[IN_VECTORTABLESize] =
69 {
70 // FORMAT: Report ID, Report Handler
71 0, IN_Report
72 };
73
74 // ****************************************************************************
75 // Link all Report Handler functions to corresponding Report IDs
76 // ****************************************************************************
77 const VectorTableEntry code OUT_VECTORTABLE[OUT_VECTORTABLESize] =
78 {
79 // FORMAT: Report ID, Report Handler
80 0, OUT_Report
81 };
82
83
84 // ----------------------------------------------------------------------------
85 // Global Variable Declaration
86 // ----------------------------------------------------------------------------
87
88 BufferStructure IN_BUFFER, OUT_BUFFER;
89
90 // ----------------------------------------------------------------------------
91 // Local Functions
92 // ----------------------------------------------------------------------------
93
94 // ****************************************************************************
95 // Add all Report Handler routines here
96 // ****************************************************************************
97
98
99 // ****************************************************************************
100 // For Input Reports:
101 // Point IN_BUFFER.Ptr to the buffer containing the report
102 // Set IN_BUFFER.Length to the number of bytes that will be
103 // transmitted.
104 //
105 // REMINDER:
106 // Systems using more than one report must define Report IDs
107 // for each report. These Report IDs must be included as the first
108 // byte of an IN report.
109 // Systems with Report IDs should set the FIRST byte of their buffer
110 // to the value for the Report ID
111 // AND
112 // must transmit Report Size + 1 to include the full report PLUS
113 // the Report ID.
114 //
115 // ****************************************************************************
116
117
C51 COMPILER V7.06 F3XX_USB0_REPORTHANDLER 09/12/2006 16:12:59 PAGE 3
118 void IN_Report(void){
119 1
120 1 // save left mouse button stat to bit 0 of first data byte
121 1 IN_PACKET[0] = MOUSE_BUTTON;
122 1
123 1 // determine whether X-Axis or Y-Axis is active, then
124 1 // set MOUSE_VECTOR to active axis
125 1 if(MOUSE_AXIS == X_Axis) IN_PACKET[1] = MOUSE_VECTOR;
126 1 else IN_PACKET[1] = 0;
127 1
128 1 if(MOUSE_AXIS == Y_Axis) IN_PACKET[2] = MOUSE_VECTOR;
129 1 else IN_PACKET[2] = 0;
130 1
131 1 // point IN_BUFFER pointer to data packet and set
132 1 // IN_BUFFER length to transmit correct report size
133 1 IN_BUFFER.Ptr = IN_PACKET;
134 1 IN_BUFFER.Length = 3;
135 1
136 1 }
137
138
139 // ****************************************************************************
140 // For Output Reports:
141 // Data contained in the buffer OUT_BUFFER.Ptr will not be
142 // preserved after the Report Handler exits.
143 // Any data that needs to be preserved should be copyed from
144 // the OUT_BUFFER.Ptr and into other user-defined memory.
145 //
146 // ****************************************************************************
147
148 void OUT_Report(void)
149 {
150 1 }
151
152 // ----------------------------------------------------------------------------
153 // Global Functions
154 // ----------------------------------------------------------------------------
155
156 // ****************************************************************************
157 // Configure Setup_OUT_BUFFER
158 //
159 // Reminder:
160 // This function should set OUT_BUFFER.Ptr so that it
161 // points to an array in data space big enough to store
162 // any output report.
163 // It should also set OUT_BUFFER.Length to the size of
164 // this buffer.
165 //
166 // ****************************************************************************
167
168 void Setup_OUT_BUFFER(void)
169 {
170 1 }
171
172 // ----------------------------------------------------------------------------
173 // Vector Routines
174 // ----------------------------------------------------------------------------
175
176 // ----------------------------------------------------------------------------
177 // ReportHandler_IN...
178 // ----------------------------------------------------------------------------
179 //
C51 COMPILER V7.06 F3XX_USB0_REPORTHANDLER 09/12/2006 16:12:59 PAGE 4
180 // Return Value - None
181 // Parameters - Report ID
182 //
183 // These functions match the Report ID passed as a parameter
184 // to an Input Report Handler.
185 // the ...FG function is called in the SendPacket foreground routine,
186 // while the ...ISR function is called inside the USB ISR. A lock
187 // is set whenever one function is called to prevent a call from the
188 // other from disrupting the routine.
189 // However, this should never occur, as interrupts are disabled by SendPacket
190 // before USB operation begins.
191 // ----------------------------------------------------------------------------
192 void ReportHandler_IN_ISR(unsigned char R_ID)
193 {
194 1 unsigned char index;
195 1
196 1 index = 0;
197 1
198 1 while(index <= IN_VECTORTABLESize)
199 1 {
200 2 // check to see if Report ID passed into function
201 2 // matches the Report ID for this entry in the Vector Table
202 2 if(IN_VECTORTABLE[index].ReportID == R_ID)
203 2 {
204 3 IN_VECTORTABLE[index].hdlr();
205 3 break;
206 3 }
207 2
208 2 // if Report IDs didn't match, increment the index pointer
209 2 index++;
210 2 }
211 1
212 1 }
213 void ReportHandler_IN_Foreground(unsigned char R_ID)
214 {
215 1 unsigned char index;
216 1
217 1 index = 0;
218 1
219 1 while(index <= IN_VECTORTABLESize)
220 1 {
221 2 // check to see if Report ID passed into function
222 2 // matches the Report ID for this entry in the Vector Table
223 2 if(IN_VECTORTABLE[index].ReportID == R_ID)
224 2 {
225 3 IN_VECTORTABLE[index].hdlr();
226 3 break;
227 3 }
228 2
229 2 // if Report IDs didn't match, increment the index pointer
230 2 index++;
231 2 }
232 1
233 1 }
234
235 // ----------------------------------------------------------------------------
236 // ReportHandler_OUT
237 // ----------------------------------------------------------------------------
238 //
239 // Return Value - None
240 // Parameters - None
241 //
C51 COMPILER V7.06 F3XX_USB0_REPORTHANDLER 09/12/2006 16:12:59 PAGE 5
242 // This function matches the Report ID passed as a parameter
243 // to an Output Report Handler.
244 //
245 // ----------------------------------------------------------------------------
246 void ReportHandler_OUT(unsigned char R_ID){
247 1
248 1 unsigned char index;
249 1
250 1 index = 0;
251 1
252 1 while(index <= OUT_VECTORTABLESize)
253 1 {
254 2 // check to see if Report ID passed into function
255 2 // matches the Report ID for this entry in the Vector Table
256 2 if(OUT_VECTORTABLE[index].ReportID == R_ID)
257 2 {
258 3 OUT_VECTORTABLE[index].hdlr();
259 3 break;
260 3 }
261 2
262 2 // if Report IDs didn't match, increment the index pointer
263 2 index++;
264 2 }
265 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 226 ----
CONSTANT SIZE = 8 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 8 6
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -