📄 f326_usb0_reporthandler.lst
字号:
C51 COMPILER V7.50 F326_USB0_REPORTHANDLER 12/29/2007 16:03:24 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE F326_USB0_REPORTHANDLER
OBJECT MODULE PLACED IN F326_USB0_ReportHandler.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\c51.exe F326_USB0_ReportHandler.c DB OE
line level source
1 //-----------------------------------------------------------------------------
2 // USB0_ReportHandler.c
3 //-----------------------------------------------------------------------------
4 //
5 // Contains functions and variables dealing with Input and Output
6 // HID reports.
7 //
8
9 #include "F326_USB0_Touch.h"
10 #include "F326_USB0_Uart.h"
11 #include "F326_USB0_ReportHandler.h"
12 #include "F326_USB0_InterruptServiceRoutine.h"
13
14
15 // ****************************************************************************
16 // Add custom Report Handler Prototypes Here
17 // ****************************************************************************
18
19 void IN_Report(void);
20 void OUT_Report(void);
21
22
23 // ****************************************************************************
24 // Set Definitions to sizes corresponding to the number of reports
25 // ****************************************************************************
26
27 #define IN_VECTORTABLESize 1
28 #define OUT_VECTORTABLESize 1
29
30
31 // ****************************************************************************
32 // Link all Report Handler functions to corresponding Report IDs
33 // ****************************************************************************
34
35 const VectorTableEntry code IN_VECTORTABLE[IN_VECTORTABLESize] =
36 {
37 // FORMAT: Report ID, Report Handler
38 0, IN_Report
39 };
40
41 // ****************************************************************************
42 // Link all Report Handler functions to corresponding Report IDs
43 // ****************************************************************************
44 const VectorTableEntry code OUT_VECTORTABLE[OUT_VECTORTABLESize] =
45 {
46 // FORMAT: Report ID, Report Handler
47 0, OUT_Report
48 };
49
50
51 BufferStructure IN_BUFFER, OUT_BUFFER;
52
53
54 // ****************************************************************************
55 // For Input Reports:
C51 COMPILER V7.50 F326_USB0_REPORTHANDLER 12/29/2007 16:03:24 PAGE 2
56 // Point IN_BUFFER.Ptr to the buffer containing the report
57 // Set IN_BUFFER.Length to the number of bytes that will be
58 // transmitted.
59 //
60 // REMINDER:
61 // Systems using more than one report must define Report IDs
62 // for each report. These Report IDs must be included as the first
63 // byte of an IN report.
64 // Systems with Report IDs should set the FIRST byte of their buffer
65 // to the value for the Report ID
66 // AND
67 // must transmit Report Size + 1 to include the full report PLUS
68 // the Report ID.
69 //
70 // ****************************************************************************
71
72
73 void IN_Report(void){
74 1
75 1
76 1 IN_PACKET[0] = Uart_Buffer[0];
77 1 IN_PACKET[1] = Uart_Buffer[1];
78 1 IN_PACKET[2] = Uart_Buffer[2];
79 1 IN_PACKET[3] = Uart_Buffer[3];
80 1 IN_PACKET[4] = Uart_Buffer[4];
81 1 IN_PACKET[5] = Uart_Buffer[5];
82 1 IN_PACKET[6] = Uart_Buffer[6];
83 1 IN_PACKET[7] = Uart_Buffer[7];
84 1
85 1 }
86
87
88
89 // ****************************************************************************
90 // For Output Reports:
91 // Data contained in the buffer OUT_BUFFER.Ptr will not be
92 // preserved after the Report Handler exits.
93 // Any data that needs to be preserved should be copyed from
94 // the OUT_BUFFER.Ptr and into other user-defined memory.
95 //
96 // ****************************************************************************
97
98 void OUT_Report(void)
99 {
100 1 }
101
102 // ****************************************************************************
103 // Configure Setup_OUT_BUFFER
104 //
105 // Reminder:
106 // This function should set OUT_BUFFER.Ptr so that it
107 // points to an array in data space big enough to store
108 // any output report.
109 // It should also set OUT_BUFFER.Length to the size of
110 // this buffer.
111 //
112 // ****************************************************************************
113
114 void Setup_OUT_BUFFER(void)
115 {
116 1 }
117
C51 COMPILER V7.50 F326_USB0_REPORTHANDLER 12/29/2007 16:03:24 PAGE 3
118 // ----------------------------------------------------------------------------
119 // ReportHandler_IN...
120 // ----------------------------------------------------------------------------
121 //
122 // Return Value - None
123 // Parameters - Report ID
124 //
125 // These functions match the Report ID passed as a parameter
126 // to an Input Report Handler.
127 // the ...FG function is called in the SendPacket foreground routine,
128 // while the ...ISR function is called inside the USB ISR. A lock
129 // is set whenever one function is called to prevent a call from the
130 // other from disrupting the routine.
131 // However, this should never occur, as interrupts are disabled by SendPacket
132 // before USB operation begins.
133 // ----------------------------------------------------------------------------
134 void ReportHandler_IN_ISR(unsigned char R_ID)
135 {
136 1 unsigned char index;
137 1
138 1 index = 0;
139 1
140 1 while(index <= IN_VECTORTABLESize)
141 1 {
142 2 // check to see if Report ID passed into function
143 2 // matches the Report ID for this entry in the Vector Table
144 2 if(IN_VECTORTABLE[index].ReportID == R_ID)
145 2 {
146 3 IN_VECTORTABLE[index].hdlr();
147 3 break;
148 3 }
149 2
150 2 // if Report IDs didn't match, increment the index pointer
151 2 index++;
152 2 }
153 1
154 1 }
155 void ReportHandler_IN_Foreground(unsigned char R_ID)
156 {
157 1 unsigned char index;
158 1
159 1 index = 0;
160 1
161 1 while(index <= IN_VECTORTABLESize)
162 1 {
163 2 // check to see if Report ID passed into function
164 2 // matches the Report ID for this entry in the Vector Table
165 2 if(IN_VECTORTABLE[index].ReportID == R_ID)
166 2 {
167 3 IN_VECTORTABLE[index].hdlr();
168 3 break;
169 3 }
170 2
171 2 // if Report IDs didn't match, increment the index pointer
172 2 index++;
173 2 }
174 1
175 1 }
176
177 // ----------------------------------------------------------------------------
178 // ReportHandler_OUT
179 // ----------------------------------------------------------------------------
C51 COMPILER V7.50 F326_USB0_REPORTHANDLER 12/29/2007 16:03:24 PAGE 4
180 //
181 // Return Value - None
182 // Parameters - None
183 //
184 // This function matches the Report ID passed as a parameter
185 // to an Output Report Handler.
186 //
187 // ----------------------------------------------------------------------------
188 void ReportHandler_OUT(unsigned char R_ID){
189 1
190 1 unsigned char index;
191 1
192 1 index = 0;
193 1
194 1 while(index <= OUT_VECTORTABLESize)
195 1 {
196 2 // check to see if Report ID passed into function
197 2 // matches the Report ID for this entry in the Vector Table
198 2 if(OUT_VECTORTABLE[index].ReportID == R_ID)
199 2 {
200 3 OUT_VECTORTABLE[index].hdlr();
201 3 break;
202 3 }
203 2
204 2 // if Report IDs didn't match, increment the index pointer
205 2 index++;
206 2 }
207 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 220 ----
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 + -