📄 ep_pair.lst
字号:
C51 COMPILER V7.06 EP_PAIR 08/21/2004 11:22:41 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE EP_PAIR
OBJECT MODULE PLACED IN ep_pair.OBJ
COMPILER INVOKED BY: e:\Keil\C51\BIN\C51.EXE ep_pair.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #pragma NOIV // Do not generate interrupt vectors
2 //-----------------------------------------------------------------------------
3 // File: periph.c
4 // Contents: Hooks required to implement USB peripheral function.
5 //
6 // Copyright (c) 1997 AnchorChips, Inc. All rights reserved
7 //-----------------------------------------------------------------------------
8 #include "ezusb.h"
9 #include "ezregs.h"
10
11 extern BOOL GotSUD; // Received setup data flag
12 extern BOOL Sleep;
13
14 void TD_Poll(void);
15
16 BYTE Configuration; // Current configuration
17 BYTE AlternateSetting; // Alternate settings
18
19 //-----------------------------------------------------------------------------
20 // Task Dispatcher hooks
21 // The following hooks are called by the task dispatcher.
22 //-----------------------------------------------------------------------------
23
24 void TD_Init(void) // Called once at startup
25 {
26 1 // Enable endpoint 2 in, and endpoint 2 out
27 1 IN07VAL = bmEP2; // Validate all EP's
28 1 OUT07VAL = bmEP2;
29 1
30 1 // Enable double buffering on endpoint 2 in, and endpoint 2 out
31 1 USBPAIR = 0x09;
32 1
33 1 // Arm Endpoint 2 out to recieve data
34 1 EPIO[OUT2BUF_ID].bytes = 0;
35 1
36 1 // Setup breakpoint to trigger on TD_Poll()
37 1 BPADDR = (WORD)TD_Poll;
38 1 USBBAV |= bmBPEN; // Enable the breakpoint
39 1 USBBAV &= ~bmBPPULSE;
40 1 }
41
42 void TD_Poll(void) // Called repeatedly while the device is idle
43 {
44 1 BYTE count, i;
45 1
46 1 if( !(EPIO[OUT2BUF_ID].cntrl & bmEPBUSY) ) // Is there something in the OUT2BUF buffer,
47 1 if( !(EPIO[IN2BUF_ID].cntrl & bmEPBUSY) ) // Is the IN2BUF available,
48 1 {
49 2 count = EPIO[OUT2BUF_ID].bytes; // Then loopback the data
50 2 for(i=0;i<count;++i)
51 2 IN2BUF[i] = OUT2BUF[i];
52 2 EPIO[OUT2BUF_ID].bytes = 0;
53 2 EPIO[IN2BUF_ID].bytes = count;
54 2 }
55 1 }
C51 COMPILER V7.06 EP_PAIR 08/21/2004 11:22:41 PAGE 2
56
57 BOOL TD_Suspend(void) // Called before the device goes into suspend mode
58 {
59 1 // Turn off breakpoint light before entering suspend
60 1 USBBAV |= bmBREAK; // Clear the breakpoint
61 1 return(TRUE);
62 1 }
63
64 BOOL TD_Resume(void) // Called after the device resumes
65 {
66 1 return(TRUE);
67 1 }
68
69 //-----------------------------------------------------------------------------
70 // Device Request hooks
71 // The following hooks are called by the end point 0 device request parser.
72 //-----------------------------------------------------------------------------
73
74 BOOL DR_GetDescriptor(void)
75 {
76 1 return(TRUE);
77 1 }
78
79 BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
80 {
81 1 Configuration = SETUPDAT[2];
82 1 return(TRUE); // Handled by user code
83 1 }
84
85 BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
86 {
87 1 IN0BUF[0] = Configuration;
88 1 EZUSB_SET_EP_BYTES(IN0BUF_ID,1);
89 1 return(TRUE); // Handled by user code
90 1 }
91
92 BOOL DR_SetInterface(void) // Called when a Set Interface command is received
93 {
94 1 AlternateSetting = SETUPDAT[2];
95 1 return(TRUE); // Handled by user code
96 1 }
97
98 BOOL DR_GetInterface(void) // Called when a Set Interface command is received
99 {
100 1 IN0BUF[0] = AlternateSetting;
101 1 EZUSB_SET_EP_BYTES(IN0BUF_ID,1);
102 1 return(TRUE); // Handled by user code
103 1 }
104
105 BOOL DR_GetStatus(void)
106 {
107 1 return(TRUE);
108 1 }
109
110 BOOL DR_ClearFeature(void)
111 {
112 1 return(TRUE);
113 1 }
114
115 BOOL DR_SetFeature(void)
116 {
117 1 return(TRUE);
C51 COMPILER V7.06 EP_PAIR 08/21/2004 11:22:41 PAGE 3
118 1 }
119
120 BOOL DR_VendorCmnd(void)
121 {
122 1 return(TRUE);
123 1 }
124
125 //-----------------------------------------------------------------------------
126 // USB Interrupt Handlers
127 // The following functions are called by the USB interrupt jump table.
128 //-----------------------------------------------------------------------------
129
130 // Setup Data Available Interrupt Handler
131 void ISR_Sudav(void) interrupt 0
132 {
133 1 GotSUD = TRUE; // Set flag
134 1 EZUSB_IRQ_CLEAR();
135 1 USBIRQ = bmSUDAV; // Clear SUDAV IRQ
136 1 }
137
138 // Setup Token Interrupt Handler
139 void ISR_Sutok(void) interrupt 0
140 {
141 1 EZUSB_IRQ_CLEAR();
142 1 USBIRQ = bmSUTOK; // Clear SUTOK IRQ
143 1 }
144
145 void ISR_Sof(void) interrupt 0
146 {
147 1 EZUSB_IRQ_CLEAR();
148 1 USBIRQ = bmSOF; // Clear SOF IRQ
149 1 }
150
151 void ISR_Ures(void) interrupt 0
152 {
153 1 EZUSB_IRQ_CLEAR();
154 1 USBIRQ = bmURES; // Clear URES IRQ
155 1 }
156
157 void ISR_IBN(void) interrupt 0
158 {
159 1 // ISR for the IN Bulk NAK (IBN) interrupt.
160 1 }
161
162 void ISR_Susp(void) interrupt 0
163 {
164 1 Sleep = TRUE;
165 1 EZUSB_IRQ_CLEAR();
166 1 USBIRQ = bmSUSP;
167 1 }
168
169 void ISR_Ep0in(void) interrupt 0
170 {
171 1 }
172
173 void ISR_Ep0out(void) interrupt 0
174 {
175 1 }
176
177 void ISR_Ep1in(void) interrupt 0
178 {
179 1 }
C51 COMPILER V7.06 EP_PAIR 08/21/2004 11:22:41 PAGE 4
180
181 void ISR_Ep1out(void) interrupt 0
182 {
183 1 }
184
185 void ISR_Ep2in(void) interrupt 0
186 {
187 1 }
188
189 void ISR_Ep2out(void) interrupt 0
190 {
191 1 }
192
193 void ISR_Ep3in(void) interrupt 0
194 {
195 1 }
196
197 void ISR_Ep3out(void) interrupt 0
198 {
199 1 }
200
201 void ISR_Ep4in(void) interrupt 0
202 {
203 1 }
204
205 void ISR_Ep4out(void) interrupt 0
206 {
207 1 }
208
209 void ISR_Ep5in(void) interrupt 0
210 {
211 1 }
212
213 void ISR_Ep5out(void) interrupt 0
214 {
215 1 }
216
217 void ISR_Ep6in(void) interrupt 0
218 {
219 1 }
220
221 void ISR_Ep6out(void) interrupt 0
222 {
223 1 }
224
225 void ISR_Ep7in(void) interrupt 0
226 {
227 1 }
228
229 void ISR_Ep7out(void) interrupt 0
230 {
231 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 303 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
C51 COMPILER V7.06 EP_PAIR 08/21/2004 11:22:41 PAGE 5
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -