📄 bulksrc.lst
字号:
C51 COMPILER V7.50 BULKSRC 05/10/2006 11:59:26 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE BULKSRC
OBJECT MODULE PLACED IN bulksrc.OBJ
COMPILER INVOKED BY: D:\Program Files\keil C\C51\BIN\C51.EXE bulksrc.c DEBUG OBJECTEXTEND
line level source
1 #pragma NOIV // Do not generate interrupt vectors
2 //-----------------------------------------------------------------------------
3 // File: bulksrc.c
4 // Contents: Hooks required to implement USB peripheral function.
5 //
6 // $Archive: /USB/Examples/Fx2/bulksrc/bulksrc.c $
7 // $Date: 11/10/01 11:41a $
8 // $Revision: 9 $
9 //
10 // Copyright (c) 2000 Cypress Semiconductor All rights reserved
11 //-----------------------------------------------------------------------------
12 #include "fx2.h"
13 #include "fx2regs.h"
14 #include "fx2sdly.h" // SYNCDELAY macro
15
16 extern BOOL GotSUD; // Received setup data flag
17 extern BOOL Sleep;
18 extern BOOL Rwuen;
19 extern BOOL Selfpwr;
20
21 BYTE Configuration; // Current configuration
22 BYTE AlternateSetting; // Alternate settings
23 //BYTE xdata myBuffer[512];
24 //WORD myBufferCount;
25
26 //-----------------------------------------------------------------------------
27 // Task Dispatcher hooks
28 // The following hooks are called by the task dispatcher.
29 //-----------------------------------------------------------------------------
30
31 void TD_Init(void) // Called once at startup
32 {
33 1 // int i;
34 1
35 1 // set the CPU clock to 48MHz
36 1 CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;
37 1
38 1 // set the slave FIFO interface to 48MHz
39 1 IFCONFIG = 0xCB;
40 1 PORTACFG&=0X7F;
41 1 REVCTL = 0x03;
42 1 // Registers which require a synchronization delay, see section 15.14
43 1 // FIFORESET FIFOPINPOLAR
44 1 // INPKTEND OUTPKTEND
45 1 // EPxBCH:L REVCTL
46 1 // GPIFTCB3 GPIFTCB2
47 1 // GPIFTCB1 GPIFTCB0
48 1 // EPxFIFOPFH:L EPxAUTOINLENH:L
49 1 // EPxFIFOCFG EPxGPIFFLGSEL
50 1 // PINFLAGSxx EPxFIFOIRQ
51 1 // EPxFIFOIE GPIFIRQ
52 1 // GPIFIE GPIFADRH:L
53 1 // UDMACRCH:L EPxGPIFTRIG
54 1 // GPIFTRIG
55 1
C51 COMPILER V7.50 BULKSRC 05/10/2006 11:59:26 PAGE 2
56 1 // Note: The pre-REVE EPxGPIFTCH/L register are affected, as well...
57 1 // ...these have been replaced by GPIFTC[B3:B0] registers
58 1
59 1 // default: all endpoints have their VALID bit set
60 1 // default: TYPE1 = 1 and TYPE0 = 0 --> BULK
61 1 // default: EP2 and EP4 DIR bits are 0 (OUT direction)
62 1 // default: EP6 and EP8 DIR bits are 1 (IN direction)
63 1 // default: EP2, EP4, EP6, and EP8 are double buffered
64 1
65 1 // we are just using the default values, yes this is not necessary...
66 1 EP1OUTCFG = 0xA0;
67 1 EP1INCFG = 0xA0;
68 1
69 1 SYNCDELAY;
70 1 EP2CFG = 0xE2; //EP2 IN BULK 1024BYTES qu
71 1
72 1 SYNCDELAY;
73 1 EP4CFG = 0xE2; //EP4 IN BULK 512BYTES double
74 1 SYNCDELAY;
75 1 EP6CFG = 0xE2; //EP6 IN BULK 512BYTES DOUBLE
76 1 SYNCDELAY;
77 1 EP8CFG = 0xE2; //EP8 IN BULK 512BYTES double
78 1
79 1
80 1 /*
81 1 SYNCDELAY;
82 1 PINFLAGSAB = 0x98; // FLAGA - fixed EP2EF, FLAGB - fixed EP4EF
83 1 SYNCDELAY;
84 1 PINFLAGSCD = 0xFE; // FLAGC - fixed EP6FF, FLAGD - fixed EP8FF
85 1 SYNCDELAY;
86 1 */
87 1 SYNCDELAY;
88 1 PINFLAGSAB = 0x00; // FLAGA - fixed EP2EF, FLAGB - fixed EP4EF
89 1 SYNCDELAY;
90 1 PINFLAGSCD = 0x00; // FLAGC - fixed EP6FF, FLAGD - fixed EP8FF
91 1 SYNCDELAY;
92 1 PORTACFG&=0X7F;
93 1 // PORTACFG |= 0x80; // FLAGD, set alt. func. of PA7 pin
94 1 SYNCDELAY;
95 1 FIFOPINPOLAR = 0x23; // ACTIVE SIGNAL PKTEND,EF,FF:HIGH;WR,RD,SLOE:LOW;
96 1
97 1 SYNCDELAY;
98 1
99 1
100 1 EP2FIFOCFG = 0x09; // AUTOIN=1, WORDWIDE=1
101 1 SYNCDELAY;
102 1 EP2AUTOINLENH =0X02;
103 1 SYNCDELAY;
104 1 EP2AUTOINLENL= 0X00;
105 1 SYNCDELAY;
106 1
107 1
108 1 EP4FIFOCFG = 0x09; // AUTOIN=1, WORDWIDE=1
109 1 SYNCDELAY;
110 1 EP4AUTOINLENH =0X02;
111 1 SYNCDELAY;
112 1 EP4AUTOINLENL= 0X00;
113 1 SYNCDELAY;
114 1
115 1
116 1 EP6FIFOCFG = 0x09; // AUTOIN=1, ZEROLENIN=0, WORDWIDE=1
117 1 SYNCDELAY;
C51 COMPILER V7.50 BULKSRC 05/10/2006 11:59:26 PAGE 3
118 1 EP6AUTOINLENH =0X02;
119 1 SYNCDELAY;
120 1 EP6AUTOINLENL= 0X00;
121 1 SYNCDELAY;
122 1
123 1
124 1
125 1 EP8FIFOCFG = 0x09; // AUTOIN=1, ZEROLENIN=0, WORDWIDE=1
126 1 SYNCDELAY;
127 1 EP8AUTOINLENH =0X02;
128 1 SYNCDELAY;
129 1 EP8AUTOINLENL= 0X00;
130 1 SYNCDELAY;
131 1
132 1 // EP2FIFOPFH=EP4FIFOPFH;
133 1 // SYNCDELAY;
134 1 // EP2FIFOPFH= EP4FIFOPFL;
135 1
136 1
137 1
138 1 // since the defaults are double buffered we must write dummy byte counts twice
139 1
140 1 SYNCDELAY; //
141 1 FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions
142 1 SYNCDELAY; //
143 1 FIFORESET = 0x02; // reset, FIFO 2
144 1 SYNCDELAY; //
145 1 FIFORESET = 0x04; // reset, FIFO 4
146 1 SYNCDELAY; //
147 1 FIFORESET = 0x06; // reset, FIFO 6
148 1 SYNCDELAY; //
149 1 FIFORESET = 0x08; // reset, FIFO 8
150 1 SYNCDELAY; //
151 1 FIFORESET = 0x00; // deactivate NAK-ALL
152 1 SYNCDELAY;
153 1
154 1
155 1
156 1 Rwuen = TRUE; // Enable remote-wakeup
157 1 }
158
159 void TD_Poll(void) // Called repeatedly while the device is idle
160 {
161 1
162 1 }
163
164 BOOL TD_Suspend(void) // Called before the device goes into suspend mode
165 {
166 1 return(TRUE);
167 1 }
168
169 BOOL TD_Resume(void) // Called after the device resumes
170 {
171 1 return(TRUE);
172 1 }
173
174 //-----------------------------------------------------------------------------
175 // Device Request hooks
176 // The following hooks are called by the end point 0 device request parser.
177 //-----------------------------------------------------------------------------
178
179 BOOL DR_GetDescriptor(void)
C51 COMPILER V7.50 BULKSRC 05/10/2006 11:59:26 PAGE 4
180 {
181 1 return(TRUE);
182 1 }
183
184 BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
185 {
186 1 Configuration = SETUPDAT[2];
187 1 return(TRUE); // Handled by user code
188 1 }
189
190 BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
191 {
192 1 EP0BUF[0] = Configuration;
193 1 EP0BCH = 0;
194 1 EP0BCL = 1;
195 1 return(TRUE); // Handled by user code
196 1 }
197
198 BOOL DR_SetInterface(void) // Called when a Set Interface command is received
199 {
200 1 AlternateSetting = SETUPDAT[2];
201 1 return(TRUE); // Handled by user code
202 1 }
203
204 BOOL DR_GetInterface(void) // Called when a Set Interface command is received
205 {
206 1 EP0BUF[0] = AlternateSetting;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -