?? bulktest.lst
字號:
C51 COMPILER V6.10 BULKTEST 04/10/2008 17:21:57 PAGE 1
C51 COMPILER V6.10, COMPILATION OF MODULE BULKTEST
OBJECT MODULE PLACED IN .\bulkTest.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\bulkTest.c DEBUG OBJECTEXTEND
stmt level source
1 #pragma NOIV // Do not generate interrupt vectors
2 //-----------------------------------------------------------------------------
3 // File: bulkloop.c
4 // Contents: Hooks required to implement USB peripheral function.
5 //
6 // Copyright (c) 2000 Cypress Semiconductor All rights reserved
7 //-----------------------------------------------------------------------------
8 #include "fx2.h"
9 #include "fx2regs.h"
10 #include "fx2sdly.h" // SYNCDELAY macro
11
12 extern BOOL GotSUD; // Received setup data flag
13 extern BOOL Sleep;
14 extern BOOL Rwuen;
15 extern BOOL Selfpwr;
16
17 BYTE Configuration; // Current configuration
18 BYTE AlternateSetting; // Alternate settings
19
20 #define VR_NAKALL_ON 0xD0
21 #define VR_NAKALL_OFF 0xD1
22
23 //-----------------------------------------------------------------------------
24 // Task Dispatcher hooks
25 // The following hooks are called by the task dispatcher.
26 //-----------------------------------------------------------------------------
27
28 void TD_Init(void) // Called once at startup
29 {
30 1 // set the CPU clock to 48MHz
31 1 CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;
32 1
33 1 // set the slave FIFO interface to 48MHz
34 1 IFCONFIG |= 0x40;
35 1
36 1 EPIE |= 0x10;
37 1
38 1
39 1 EP1OUTCFG = 0xA0;
40 1 SYNCDELAY;
41 1 EP1INCFG = 0xA3;
42 1 SYNCDELAY;
43 1 //EP2CFG Endpoint 2 Configuration VALID DIR TYPE1 TYPE0 SIZE 0 BUF1 BUF0
44 1 //端點2配置,OUT,雙緩沖,BULK
45 1 //0xA0 四緩沖
46 1 //0xA2 雙緩沖
47 1 //0xA3 三緩沖
48 1 SYNCDELAY;
49 1 EP2CFG = 0xA2; // EP2OUT, bulk, size 512, 2x buffered
50 1 SYNCDELAY;
51 1 EP6CFG = 0xE2;; // EP6CFG = 1110 0010 : valid IN bulk 512bytes Double Burrering
52 1 //EP4 EP8暫時不用
53 1 SYNCDELAY;
54 1 EP4CFG = 0x00; // EP4 not valid
55 1 SYNCDELAY;
C51 COMPILER V6.10 BULKTEST 04/10/2008 17:21:57 PAGE 2
56 1 EP8CFG = 0x00; // EP8 not valid
57 1
58 1
59 1 //根據端點2緩沖區數目多少來確定裝載端點計數器的次數
60 1 SYNCDELAY;
61 1 EP2BCL = 0x80;
62 1 SYNCDELAY;
63 1 EP2BCL = 0x80;
64 1
65 1 // 使能自動指針
66 1 AUTOPTRSETUP |= 0x01;
67 1
68 1 Rwuen = TRUE; // Enable remote-wakeup
69 1 }
70
71
72 void TD_Poll(void) // Called repeatedly while the device is idle
73 {
74 1 /*
75 1 WORD count;
76 1 // unsigned char temp;
77 1 WORD i;
78 1 if(!(EP2468STAT & bmEP2EMPTY))//ENDPOINT2非空,則開始接收數據
79 1 {
80 1
81 1 APTR1H = MSB( &EP2FIFOBUF );
82 1 APTR1L = LSB( &EP2FIFOBUF );
83 1
84 1 AUTOPTRH2 = MSB( &EP6FIFOBUF );
85 1 AUTOPTRL2 = LSB( &EP6FIFOBUF );
86 1
87 1 count = (EP2BCH << 8) + EP2BCL;
88 1
89 1 // 循環將EP2中的數據取出,復制到EP6中
90 1 for( i = 0x0000; i < count; i++ )
91 1 {
92 1 // setup to transfer EP2OUT buffer to EP6IN buffer using AUTOPOINTER(s)
93 1
94 1 EXTAUTODAT2 = EXTAUTODAT1 + 0x0004;
95 1 }
96 1
97 1 EP6BCH = EP2BCH;
98 1 SYNCDELAY;
99 1 EP6BCL = EP2BCL; // arm EP6IN
100 1 SYNCDELAY;
101 1
102 1 //根據端點2緩沖區數目多少來確定裝載端點計數器的次數次數
103 1 SYNCDELAY;
104 1 EP2BCL = 0x80; // re(arm) EP2OUT
105 1 SYNCDELAY;
106 1 EP2BCL = 0x80; // re(arm) EP2OU
107 1 }
108 1 */
109 1 }
110
111 BOOL TD_Suspend(void) // Called before the device goes into suspend mode
112 {
113 1 return(TRUE);
114 1 }
115
116 BOOL TD_Resume(void) // Called after the device resumes
117 {
C51 COMPILER V6.10 BULKTEST 04/10/2008 17:21:57 PAGE 3
118 1 return(TRUE);
119 1 }
120
121 //-----------------------------------------------------------------------------
122 // Device Request hooks
123 // The following hooks are called by the end point 0 device request parser.
124 //-----------------------------------------------------------------------------
125
126 BOOL DR_GetDescriptor(void)
127 {
128 1 return(TRUE);
129 1 }
130
131 BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
132 {
133 1 Configuration = SETUPDAT[2];
134 1 return(TRUE); // Handled by user code
135 1 }
136
137 BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
138 {
139 1 EP0BUF[0] = Configuration;
140 1 EP0BCH = 0;
141 1 EP0BCL = 1;
142 1 return(TRUE); // Handled by user code
143 1 }
144
145 BOOL DR_SetInterface(void) // Called when a Set Interface command is received
146 {
147 1 AlternateSetting = SETUPDAT[2];
148 1 return(TRUE); // Handled by user code
149 1 }
150
151 BOOL DR_GetInterface(void) // Called when a Set Interface command is received
152 {
153 1 EP0BUF[0] = AlternateSetting;
154 1 EP0BCH = 0;
155 1 EP0BCL = 1;
156 1 return(TRUE); // Handled by user code
157 1 }
158
159 BOOL DR_GetStatus(void)
160 {
161 1 return(TRUE);
162 1 }
163
164 BOOL DR_ClearFeature(void)
165 {
166 1 return(TRUE);
167 1 }
168
169 BOOL DR_SetFeature(void)
170 {
171 1 return(TRUE);
172 1 }
173
174
175 #define VX_B2 0xB2 // get ENP2 CFG
176 #define VX_B3 0xB3 // get ENP4 CFG
177 #define VX_B4 0xB4 // get ENP6 CFG
178 #define VX_B5 0xB5 // get ENP8 CFG
179 #define VX_B6 0xB6 // get status
C51 COMPILER V6.10 BULKTEST 04/10/2008 17:21:57 PAGE 4
180 //#define VX_B6 0xB6 //get ENP2 CFG
181 BYTE xdata Digit[] = { 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, 0x88, 0x83, 0xc6, 0xa1,
- 0x86, 0x8e };
182
183
184 BOOL DR_VendorCmnd(void)
185 {
186 1 BYTE tmp;
187 1
188 1 switch (SETUPDAT[1])
189 1 {
190 2 case VX_B2:
191 2 EP0BUF[0] = VX_B2;
192 2 SYNCDELAY;
193 2 EP0BUF[1] = EP2CFG;
194 2 SYNCDELAY;
195 2 EP0BCH = 0;
196 2 EP0BCL = 2;
197 2 EP0CS |= bmHSNAK;
198 2 break;
199 2 case VX_B3:
200 2 EP0BUF[0] = VX_B3;
201 2 SYNCDELAY;
202 2 EP0BUF[1] = EP4CFG;
203 2 SYNCDELAY;
204 2 EP0BCH = 0;
205 2 EP0BCL = 2;
206 2 EP0CS |= bmHSNAK;
207 2 break;
208 2 case VX_B4:
209 2 EP0BUF[0] = VX_B4;
210 2 SYNCDELAY;
211 2 EP0BUF[1] = EP6CFG;
212 2 SYNCDELAY;
213 2 EP0BCH = 0;
214 2 EP0BCL = 2;
215 2 EP0CS |= bmHSNAK;
216 2 break;
217 2 case VX_B5:
218 2 EP0BUF[0] = VX_B5;
219 2 SYNCDELAY;
220 2 EP0BUF[1] = EP8CFG;
221 2 SYNCDELAY;
222 2 EP0BCH = 0;
223 2 EP0BCL = 2;
224 2 EP0CS |= bmHSNAK;
225 2 break;
226 2
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -