📄 chap_9.lst
字号:
C51 COMPILER V7.01 CHAP_9 03/17/2003 15:18:55 PAGE 1
C51 COMPILER V7.01, COMPILATION OF MODULE CHAP_9
OBJECT MODULE PLACED IN chap_9.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE chap_9.c OPTIMIZE(2,SPEED) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /****************************************Copyright (c)**************************************************
2 ** 广州周立功单片机发展有限公司
3 ** 研 究 所
4 ** http://www.zlgmcu.com
5 **--------------当前版本修订------------------------------------------------------------------------------
6 ** 修改人: 刘英斌
7 ** 日 期:2003-03-13
8 ** 描 述:ISP1581 V1.0
9 **------------------------------------------------------------------------------------------------------
10 ********************************************************************************************************/
11
12 #include "standard.h"
13 #include "Kernel.h"
14 #include "D14.h"
15 #include "usb.h"
16
17 extern volatile D14_CNTRL_REG xdata D14_Cntrl_Reg;
18 extern void Init_D14(void);
19 extern UC code Standard_Device_Descriptor[];
20 extern UC code Bulk_Interface_Descriptor[];
21 extern UC code Iso_Interface_Descriptor[];
22 extern UC code Standard_Config_Descriptor[];
23 extern UC code Standard_Manufacturer_String[];
24 extern UC code Standard_Product_String[];
25 extern UC code Standard_String_ID[];
26 extern UC code Bulk_In_Descriptor[];
27 extern UC code Bulk_Out_Descriptor[];
28 extern UC code Int_In_Descriptor[];
29 extern UC code Int_Out_Descriptor[];
30 extern UC code Iso_In_Descriptor[];
31 extern UC code Iso_Out_Descriptor[];
32 extern UC code Iso_In_Zero_Descriptor[];
33 extern UC code Iso_Out_Zero_Descriptor[];
34 extern UC code HS_Device_Descriptor[];
35 extern UC code HS_Device_Qualifier[];
36 extern UC code HS_Bulk_Interface_Descriptor[];
37 extern UC code HS_Bulk_In_Descriptor[];
38 extern UC code HS_Bulk_Out_Descriptor[];
39 extern UC code HS_Int_In_Descriptor[];
40 extern UC code HS_Int_Out_Descriptor[];
41 extern UC code Other_Speed_Config_Descriptor[];
42 extern UI count;
43 extern void Start_mSEC_Timer(Data);
44 extern void Start_SEC_Timer(Data);
45 extern void Check_Busy(void);
46 extern void TaskFile_Update(void);
47 extern UI Temp;
48 extern UC Device_Config_Value;
49 extern KERNEL Kernel_Flag;
50 extern DMA_INT_FLAG DMA_Int_Flag;
51 extern USB_INT_FLAG USB_Int_Flag;
52 extern USBCBW USB_CBW;
53 extern void Init_Device(void);
54 extern UC code Test_Packet[];
55 extern void Init_Endpoint(void);
C51 COMPILER V7.01 CHAP_9 03/17/2003 15:18:55 PAGE 2
56 extern void Init_Device(void);
57 extern void Set_USB(void);
58
59 //***********************************************************************
60 //* *
61 //* Prototype Routine Definition *
62 //* *
63 //***********************************************************************
64
65 void USB_Setup(void);
66 void reserved(void);
67 void Send_Device_Status(void);
68 void Send_Interface_Status(void);
69 void Send_Endpoint_Status(void);
70
71 void Vendor_Specific_Command(void);
72 void Send_Status(unsigned char tran_status);
73
74 void Set_Interface_Value(void);
75 void Get_Interface_Value(void);
76 void Process_Synch_Frame(void);
77
78 void get_status(void);
79 void clear_feature(void);
80 void set_feature(void);
81 void set_address(void);
82 void get_descriptor(void);
83 void get_config(void);
84 void set_config(void);
85 void get_interface(void);
86 void set_interface(void);
87
88 void Set_Descriptor(void);
89 void reserved(void);
90
91 void ep0in_ack(void);
92 void ep0out_ack(void);
93 void wait_ep0tx(void);
94 void wait_ep0rx(void);
95 unsigned int read_endpoint(unsigned char endp,unsigned int len,unsigned char *buf);
96 unsigned int write_endpoint(unsigned char endp,unsigned int len,unsigned char *buf);
97
98
99
100 //***********************************************************************
101 //* *
102 //* Variable Definition *
103 //* *
104 //***********************************************************************
105
106 USB_INT_FLAG USB_Int_Flag;
107 USB_DEVICE_REQ idata USB_Device_Request;
108 USB_DEVICE USB_Device;
109
110 UC code *Descriptor_Ptr;
111
112 UC idata Endpt_FIFO[MAX_BUF];
113 UI FIFO_Count;
114 UC VID[2],PID[2];
115 FILESIZE FileSize;
116 UI PIO_Count;
117 UC File_Number;
C51 COMPILER V7.01 CHAP_9 03/17/2003 15:18:55 PAGE 3
118 UC Current_File;
119 ULI bytecount;
120
121 //USB标准请求
122 code void (*StandardDeviceRequest[])(void) =
123 {
124 get_status,
125 clear_feature,
126 reserved,
127 set_feature,
128 reserved,
129 set_address,
130 get_descriptor,
131 reserved,
132 get_config,
133 set_config,
134 get_interface,
135 set_interface,
136 reserved,
137 reserved,
138 reserved,
139 reserved
140 };
141
142
143
144 //***********************************************************************
145 //* *
146 //* Routine Definition *
147 //* *
148 //***********************************************************************
149
150 //***********************************************************************
151 //* *
152 //* Routine : USB Debug Mode *
153 //* Input : USB Interrupt Register *
154 //* Output : None *
155 //* Function : Branch to respective ISR *
156 //* *
157 //***********************************************************************
158
159 void USB_Debug_Mode(void)
160 {
161 1 //端点0接收到setup包处理
162 1 if(USB_Int_Flag.BITS.EP0SETUP)
163 1 {
164 2 EA_DISABLE;
165 2 USB_Setup();
166 2 EA_ENABLE;
167 2 }
168 1
169 1 //挂起处理
170 1 if(USB_Int_Flag.BITS.SUSP)
171 1 {
172 2 //清除挂起标志
173 2 EA_DISABLE;
174 2 USB_Int_Flag.BITS.SUSP = 0;
175 2 EA_ENABLE;
176 2 //ISP1581进入挂起状态
177 2 D14_Cntrl_Reg.D14_MODE.BITS.GOSUSP = 1;
178 2 D14_Cntrl_Reg.D14_MODE.BITS.GOSUSP = 0;
179 2 }
C51 COMPILER V7.01 CHAP_9 03/17/2003 15:18:55 PAGE 4
180 1
181 1 //挂起恢复处理
182 1 if(USB_Int_Flag.BITS.RESUME)
183 1 {
184 2 //清除恢复标志
185 2 EA_DISABLE;
186 2 USB_Int_Flag.BITS.RESUME = 0;
187 2 EA_ENABLE;
188 2 //产生一个恢复信号
189 2 D14_Cntrl_Reg.D14_MODE.BITS.SNDRSU = 1;
190 2 D14_Cntrl_Reg.D14_MODE.BITS.SNDRSU = 0;
191 2 }
192 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -