📄 kisr.lst
字号:
131 =1 //extern void D12_SetMode(unsigned char bConfig, unsigned char bClkDiv);
132 =1 //extern void D12_SetDMA(unsigned char bMode);
133 =1 //extern unsigned char D12_GetDMA(void);
134 =1 //extern unsigned char D12_ReadEndpointStatus(unsigned char bEndp);
135 =1 //extern void D12_SetEndpointStatus(unsigned char bEndp, unsigned char bStalled);
136 =1 //extern void single_transmit(unsigned char * pData, unsigned char len);
C51 COMPILER V7.06 KISR 11/11/2003 20:11:03 PAGE 10
137 =1 //extern void stall_ep0(void);
138 =1 //void D12_SendResume(void);
139 =1
140 =1 //#define IN_TOKEN_DMA 1
141 =1 //#define OUT_TOKEN_DMA 0
142 =1
143 =1 #define DMA_BUFFER_SIZE 256
144 =1
145 =1 #define DMA_IDLE 0
146 =1 #define DMA_RUNNING 1
147 =1 #define DMA_PENDING 2
148 =1
149 =1 #define SETUP_DMA_REQUEST 0x0471
150 =1 #define GET_FIRMWARE_VERSION 0x0472
151 =1 //#define GET_SET_TWAIN_REQUEST 0x0473
152 =1 #define GET_BUFFER_SIZE 0x0474
153 =1 /*
154 =1 typedef struct _TWAIN_FILEINFO {
155 =1 unsigned char bPage; // bPage bit 7 - 5 map to uSize bit 18 - 16
156 =1 unsigned char uSizeH; // uSize bit 15 - 8
157 =1 unsigned char uSizeL; // uSize bit 7 - 0
158 =1 } TWAIN_FILEINFO, *PTWAIN_FILEINFO;
159 =1 */
160 =1
161 =1
162 =1
8 #include "kUSB100.h"
1 =1 #include "kprotodma.h"
1 =2 void read_write_register(void);
2 =1 #define MAXIMUM_USB_STRING_LENGTH 255
3 =1
4 =1 // values for the bits returned by the USB GET_STATUS command
5 =1 #define USB_GETSTATUS_SELF_POWERED 0x01
6 =1 #define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02
7 =1
8 =1
9 =1 #define USB_DEVICE_DESCRIPTOR_TYPE 0x01
10 =1 #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
11 =1 #define USB_STRING_DESCRIPTOR_TYPE 0x03
12 =1 #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
13 =1 #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
14 =1 #define USB_POWER_DESCRIPTOR_TYPE 0x06
15 =1
16 =1 #define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT)((USHORT)d<<8 | i))
17 =1
18 =1 //
19 =1 // Values for bmAttributes field of an
20 =1 // endpoint descriptor
21 =1 //
22 =1
23 =1 #define USB_ENDPOINT_TYPE_MASK 0x03
24 =1
25 =1 #define USB_ENDPOINT_TYPE_CONTROL 0x00
26 =1 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
27 =1 #define USB_ENDPOINT_TYPE_BULK 0x02
28 =1 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
29 =1
30 =1
31 =1 //
32 =1 // definitions for bits in the bmAttributes field of a
33 =1 // configuration descriptor.
34 =1 //
C51 COMPILER V7.06 KISR 11/11/2003 20:11:03 PAGE 11
35 =1 #define USB_CONFIG_POWERED_MASK 0xc0
36 =1
37 =1 #define USB_CONFIG_BUS_POWERED 0x80
38 =1 #define USB_CONFIG_SELF_POWERED 0x40
39 =1 #define USB_CONFIG_REMOTE_WAKEUP 0x20
40 =1
41 =1 //
42 =1 // Endpoint direction bit, stored in address
43 =1 //
44 =1
45 =1 #define USB_ENDPOINT_DIRECTION_MASK 0x80
46 =1
47 =1 // test direction bit in the bEndpointAddress field of
48 =1 // an endpoint descriptor.
49 =1 #define USB_ENDPOINT_DIRECTION_OUT(addr) (!((addr) & USB_ENDPOINT_DIRECTION_MASK))
50 =1 #define USB_ENDPOINT_DIRECTION_IN(addr) ((addr) & USB_ENDPOINT_DIRECTION_MASK)
51 =1
52 =1 //
53 =1 // USB defined request codes
54 =1 // see chapter 9 of the USB 1.0 specifcation for
55 =1 // more information.
56 =1 //
57 =1
58 =1 // These are the correct values based on the USB 1.0
59 =1 // specification
60 =1
61 =1 #define USB_REQUEST_GET_STATUS 0x00
62 =1 #define USB_REQUEST_CLEAR_FEATURE 0x01
63 =1
64 =1 #define USB_REQUEST_SET_FEATURE 0x03
65 =1
66 =1 #define USB_REQUEST_SET_ADDRESS 0x05
67 =1 #define USB_REQUEST_GET_DESCRIPTOR 0x06
68 =1 #define USB_REQUEST_SET_DESCRIPTOR 0x07
69 =1 #define USB_REQUEST_GET_CONFIGURATION 0x08
70 =1 #define USB_REQUEST_SET_CONFIGURATION 0x09
71 =1 #define USB_REQUEST_GET_INTERFACE 0x0A
72 =1 #define USB_REQUEST_SET_INTERFACE 0x0B
73 =1 #define USB_REQUEST_SYNC_FRAME 0x0C
74 =1
75 =1
76 =1 //
77 =1 // defined USB device classes
78 =1 //
79 =1
80 =1
81 =1 #define USB_DEVICE_CLASS_RESERVED 0x00
82 =1 #define USB_DEVICE_CLASS_AUDIO 0x01
83 =1 #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
84 =1 #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
85 =1 #define USB_DEVICE_CLASS_MONITOR 0x04
86 =1 #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
87 =1 #define USB_DEVICE_CLASS_POWER 0x06
88 =1 #define USB_DEVICE_CLASS_PRINTER 0x07
89 =1 #define USB_DEVICE_CLASS_STORAGE 0x08
90 =1 #define USB_DEVICE_CLASS_HUB 0x09
91 =1 #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
92 =1
93 =1 //
94 =1 // USB defined Feature selectors
95 =1 //
96 =1
C51 COMPILER V7.06 KISR 11/11/2003 20:11:03 PAGE 12
97 =1 #define USB_FEATURE_ENDPOINT_STALL 0x0000
98 =1 #define USB_FEATURE_REMOTE_WAKEUP 0x0001
99 =1 #define USB_FEATURE_POWER_D0 0x0002
100 =1 #define USB_FEATURE_POWER_D1 0x0003
101 =1 #define USB_FEATURE_POWER_D2 0x0004
102 =1 #define USB_FEATURE_POWER_D3 0x0005
103 =1
104 =1 typedef struct _USB_DEVICE_DESCRIPTOR {
105 =1 UCHAR bLength;
106 =1 UCHAR bDescriptorType;
107 =1 USHORT bcdUSB;
108 =1 UCHAR bDeviceClass;
109 =1 UCHAR bDeviceSubClass;
110 =1 UCHAR bDeviceProtocol;
111 =1 UCHAR bMaxPacketSize0;
112 =1 USHORT idVendor;
113 =1 USHORT idProduct;
114 =1 USHORT bcdDevice;
115 =1 UCHAR iManufacturer;
116 =1 UCHAR iProduct;
117 =1 UCHAR iSerialNumber;
118 =1 UCHAR bNumConfigurations;
119 =1 } USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
120 =1
121 =1 typedef struct _USB_ENDPOINT_DESCRIPTOR {
122 =1 UCHAR bLength;
123 =1 UCHAR bDescriptorType;
124 =1 UCHAR bEndpointAddress;
125 =1 UCHAR bmAttributes;
126 =1 USHORT wMaxPacketSize;
127 =1 UCHAR bInterval;
128 =1 } USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
129 =1
130 =1 //
131 =1 // values for bmAttributes Field in
132 =1 // USB_CONFIGURATION_DESCRIPTOR
133 =1 //
134 =1
135 =1 #define BUS_POWERED 0x80
136 =1 #define SELF_POWERED 0x40
137 =1 #define REMOTE_WAKEUP 0x20
138 =1
139 =1 typedef struct _USB_CONFIGURATION_DESCRIPTOR {
140 =1 UCHAR bLength;
141 =1 UCHAR bDescriptorType;
142 =1 USHORT wTotalLength;
143 =1 UCHAR bNumInterfaces;
144 =1 UCHAR bConfigurationValue;
145 =1 UCHAR iConfiguration;
146 =1 UCHAR bmAttributes;
147 =1 UCHAR MaxPower;
148 =1 } USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
149 =1
150 =1 typedef struct _USB_INTERFACE_DESCRIPTOR {
151 =1 UCHAR bLength;
152 =1 UCHAR bDescriptorType;
153 =1 UCHAR bInterfaceNumber;
154 =1 UCHAR bAlternateSetting;
155 =1 UCHAR bNumEndpoints;
156 =1 UCHAR bInterfaceClass;
157 =1 UCHAR bInterfaceSubClass;
158 =1 UCHAR bInterfaceProtocol;
C51 COMPILER V7.06 KISR 11/11/2003 20:11:03 PAGE 13
159 =1 UCHAR iInterface;
160 =1 } USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
161 =1
162 =1 typedef struct _USB_STRING_DESCRIPTOR {
163 =1 UCHAR bLength;
164 =1 UCHAR bDescriptorType;
165 =1 UCHAR bString[1];
166 =1 } USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;
167 =1
168 =1 //
169 =1 // USB power descriptor added to core specification
170 =1 //
171 =1
172 =1 #define USB_SUPPORT_D0_COMMAND 0x01
173 =1 #define USB_SUPPORT_D1_COMMAND 0x02
174 =1 #define USB_SUPPORT_D2_COMMAND 0x04
175 =1 #define USB_SUPPORT_D3_COMMAND 0x08
176 =1
177 =1 #define USB_SUPPORT_D1_WAKEUP 0x10
178 =1 #define USB_SUPPORT_D2_WAKEUP 0x20
179 =1
180 =1
181 =1 typedef struct _USB_POWER_DESCRIPTOR {
182 =1 UCHAR bLength;
183 =1 UCHAR bDescriptorType;
184 =1 UCHAR bCapabilitiesFlags;
185 =1 USHORT EventNotification;
186 =1 USHORT D1LatencyTime;
187 =1 USHORT D2LatencyTime;
188 =1 USHORT D3LatencyTime;
189 =1 UCHAR PowerUnit;
190 =1 USHORT D0PowerConsumption;
191 =1 USHORT D1PowerConsumption;
192 =1 USHORT D2PowerConsumption;
193 =1 } USB_POWER_DESCRIPTOR, *PUSB_POWER_DESCRIPTOR;
194 =1
195 =1
196 =1 typedef struct _USB_COMMON_DESCRIPTOR {
197 =1 UCHAR bLength;
198 =1 UCHAR bDescriptorType;
199 =1 } USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;
200 =1
201 =1
202 =1 //
203 =1 // Standard USB HUB definitions
204 =1 //
205 =1 // See Chapter 11
206 =1 //
207 =1
208 =1 typedef struct _USB_HUB_DESCRIPTOR {
209 =1 UCHAR bDescriptorLength; // Length of this descriptor
210 =1 UCHAR bDescriptorType; // Hub configuration type
211 =1 UCHAR bNumberOfPorts; // number of ports on this hub
212 =1 USHORT wHubCharacteristics; // Hub Charateristics
213 =1 UCHAR bPowerOnToPowerGood; // port power on till power good in 2ms
214 =1 UCHAR bHubControlCurrent; // max current in mA
215 =1 //
216 =1 // room for 255 ports power control and removable bitmask
217 =1 UCHAR bRemoveAndPowerMask[64];
218 =1 } USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
219 =1
9
C51 COMPILER V7.06 KISR 11/11/2003 20:11:03 PAGE 14
10 void bus_reset(void);
11
12 void ep0_txdone(void);
13 void ep0_rxdone(void);
14 void ep1_txdone(void);
15 void ep1_rxdone(void);
16 void main_txdone(void);
17 void main_rxdone(void);
18
19 void dma_eot(void);
20
21 /*
22 //*************************************************************************
23 // Public static data
24 //*************************************************************************
25 */
26 EPPFLAGS bEPPflags;
27
28 /* Control endpoint TX/RX buffers */
29 extern CONTROL_XFER ControlData;
30
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -