📄 d12ci.lst
字号:
C51 COMPILER V7.07 D12CI 06/04/2004 18:36:45 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE D12CI
OBJECT MODULE PLACED IN D12CI.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE D12CI.c DB OE SMALL ROM(LARGE)
stmt level source
1 //**********************************************************************************************//
2 /* */
3 /* USB to Serial V1.0版 */
4 /* */
5 /* FirmWare Files */
6 /* COPYRIGHT (c) 2004 BY GARY 应用物理学 物理实验中心 */
7 /* */
8 /* Files Name: D12CI.C */
9 /* Author: Gary Zou LuDing */
10 /* Created: March 2004 */
11 /* Modified: */
12 /* Revision: 1.0 */
13 /* Other Details: */
14 /* */
15 /* */
16 /* */
17 //**********************************************************************************************//
18
19 #include <stdio.h>
20 #include <string.h>
21
22 #include "usb100.h"
23 #include "reg52.h"
24 #include "hal.h"
25 #include "d12ci.h"
26 #include "isr.h"
27 #include "chap_9.h"
28 #include "vendor.h"
29 #include "main.h"
30
31
32
33 void d12_set_mode(unsigned char config,unsigned clkdiv)
34 {
35 1 d12_outport(D12_COMM,0xF3);
36 1 d12_outport(D12_DATA,config);
37 1 d12_outport(D12_DATA,clkdiv);
38 1 }
39
40 void d12_set_dma(unsigned char dma_mode)
41 {
42 1 d12_outport(D12_COMM,0xFB);
43 1 d12_outport(D12_DATA,dma_mode);
44 1 }
45
46 unsigned int d12_read_interrupt_status()
47 {
48 1 unsigned char temp;
49 1 unsigned int result;
50 1
51 1 d12_outport(D12_COMM,0xF4);
52 1 temp=d12_inport(D12_DATA);
53 1 result=d12_inport(D12_DATA);
54 1
55 1 result<<=8;
C51 COMPILER V7.07 D12CI 06/04/2004 18:36:45 PAGE 2
56 1 result+=temp;
57 1
58 1 return result;
59 1 }
60
61 unsigned char d12_read_last_transaction_status(unsigned char endpoint)
62 {
63 1 d12_outport(D12_COMM,0x40+endpoint);
64 1 return d12_inport(D12_DATA);
65 1 }
66
67 void d12_set_endpoint_enable(unsigned char bEnable)
68 {
69 1 d12_outport(D12_COMM,0xD8);
70 1 if(bEnable)
71 1 d12_outport(D12_DATA,1);
72 1 else
73 1 d12_outport(D12_DATA,0);
74 1 }
75
76 void d12_set_address_enable(unsigned char bAddress,unsigned char bEnable)
77 {
78 1 d12_outport(D12_COMM,0xD0);
79 1 if(bEnable)
80 1 bAddress|=0x80;
81 1 d12_outport(D12_DATA,bAddress);
82 1 }
83
84 void d12_set_endpoint_status(unsigned char endpoint,unsigned char value)
85 {
86 1 d12_outport(D12_COMM,0x40+endpoint);
87 1 d12_outport(D12_DATA,value);
88 1 }
89
90 unsigned char d12_read_endpoint_status(unsigned char endpoint)
91 {
92 1 d12_outport(D12_COMM,0x80+endpoint);
93 1 return d12_inport(D12_DATA);
94 1 }
95
96
97 unsigned char d12_select_endpoint(unsigned char endpoint)
98 {
99 1
100 1 d12_outport(D12_COMM,endpoint);
101 1 return d12_inport(D12_DATA);
102 1 }
103
104 void d12_ack_endpoint(unsigned char endpoint)
105 {
106 1 d12_outport(D12_COMM,endpoint);
107 1 d12_outport(D12_COMM,0xF1);
108 1 if(endpoint==0)
109 1 d12_outport(D12_COMM,0xF2);
110 1 }
111
112 //void d12_send_resume()
113 //{
114 // d12_outport(D12_COMM,0xF6);
115 //}
116
117 /*
C51 COMPILER V7.07 D12CI 06/04/2004 18:36:45 PAGE 3
118 unsigned short d12_read_current_frame_number()
119 {
120 unsigned short result;
121 unsigned char temp;
122 d12_outport(D12_COMM,0xF5);
123 temp=d12_inport(D12_DATA);
124 result=d12_inport(D12_DATA);
125 result<<8;
126 result+=temp;
127 return result;
128 }
129 */
130
131
132 //void d12_clear_buf(unsigned char endp)
133 //{
134 // d12_outport(D12_COMM,endp);
135 // d12_inport(D12_DATA);
136 // d12_outport(D12_COMM,0xF2);
137 //}
138
139 unsigned char d12_read_endpoint(unsigned char endp,unsigned char *buf,unsigned char len)
140 {
141 1 unsigned char i,j;
142 1 d12_outport(D12_COMM,endp);
143 1 if((d12_inport(D12_DATA))&D12_FULLEMPTY_MASK==0)
144 1 return 0;//
145 1 else
146 1 d12_outport(D12_COMM,0xF0);
147 1 j=d12_inport(D12_DATA);
148 1 j=d12_inport(D12_DATA);
149 1 if(j>len)
150 1 j=len;
151 1 for(i=0;i<j;i++)
152 1 *(buf+i)=d12_inport(D12_DATA);
153 1 d12_outport(D12_COMM,0xF2);
154 1 return j;
155 1 }
156
157 unsigned char d12_write_endpoint(unsigned char endp,unsigned char *buf,unsigned char len)
158 {
159 1 unsigned char i;
160 1 d12_outport(D12_COMM,endp);
161 1 d12_inport(D12_DATA);
162 1
163 1 d12_outport(D12_COMM,0xF0);
164 1 d12_outport(D12_DATA,0);
165 1 d12_outport(D12_DATA,len);
166 1
167 1 for(i=0;i<len;i++)
168 1 d12_outport(D12_DATA,*(buf+i));
169 1
170 1 d12_outport(D12_COMM,0xFA);
171 1 return len;
172 1 }
173
174
175
176
177
178
179
C51 COMPILER V7.07 D12CI 06/04/2004 18:36:45 PAGE 4
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
C51 COMPILER V7.07 D12CI 06/04/2004 18:36:45 PAGE 5
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 386 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 23
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 + -