?? protodma.lst
字號:
C51 COMPILER V7.06 PROTODMA 04/14/2004 12:09:04 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE PROTODMA
OBJECT MODULE PLACED IN Protodma.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Protodma.c OPTIMIZE(2,SPEED) DEBUG OBJECTEXTEND
stmt level source
1 #include <stdio.h>
2 #include <string.h>
3
4 #include <reg51.h> /* special function register declarations */
5 #include "epphal.h"
6
7 #include "d12ci.h"
8 #include "mainloop.h"
9 #include "usb100.h"
10 #include "chap_9.h"
11
12 extern CONTROL_XFER ControlData;
13 extern IO_REQUEST idata ioRequest;
14 extern EPPFLAGS bEPPflags;
15 extern BOOL bNoRAM;
16 extern unsigned char idata EpBuf[EP2_PACKET_SIZE];
17
18 //獲取固件版本號
19 void get_firmware_version()
20 {
21 1 unsigned char i;
22 1
23 1 i = 0x30; // firmware version number
24 1 single_transmit((unsigned char *)&i, 1);
25 1 }
26
27 //獲取端點2緩存區大小
28 void get_buffer_size()
29 {
30 1 unsigned char i[4];
31 1
32 1 if(bNoRAM == TRUE) {
33 2 i[0] = EP2_PACKET_SIZE;
34 2 i[1] = 0;
35 2 i[2] = 0;
36 2 i[3] = 0;
37 2 } else {
38 2 i[0] = 0;
39 2 i[1] = 1;
40 2 i[2] = 0;
41 2 i[3] = 0;
42 2 }
43 1 single_transmit((unsigned char *)&i, 4);
44 1 }
45
46 //DMA請求響應子程序
47 void setup_dma_request()
48 {
49 1 memcpy((unsigned char *)&ioRequest + ControlData.DeviceRequest.wValue,
50 1 ControlData.dataBuffer,
51 1 ControlData.DeviceRequest.wLength);
52 1
53 1 ioRequest.uSize = SWAP(ioRequest.uSize);
54 1 ioRequest.uAddressL = SWAP(ioRequest.uAddressL);
55 1
C51 COMPILER V7.06 PROTODMA 04/14/2004 12:09:04 PAGE 2
56 1 if(ioRequest.uSize > DMA_BUFFER_SIZE) { // Unaccepted request
57 2 stall_ep0();//DMA設置出錯
58 2 }
59 1 else if(bNoRAM == TRUE && ioRequest.uSize > EP2_PACKET_SIZE) {
60 2 stall_ep0();//DMA緩沖區出錯
61 2 }
62 1 else {
63 2 if(bEPPflags.bits.dma_state == DMA_IDLE) {
64 3 DISABLE;
65 3 bEPPflags.bits.setup_dma ++;
66 3 ENABLE;
67 3 }
68 2 else {
69 3 DISABLE;
70 3 bEPPflags.bits.dma_state = DMA_PENDING;
71 3 ENABLE;
72 3 }
73 2
74 2 } // else if accepted request
75 1 }
76
77 //廠商請求處理
78 void read_write_register(void)
79 {
80 1 unsigned char i,len,epstatus;
81 1
82 1 if(ControlData.DeviceRequest.bmRequestType & (unsigned char)USB_ENDPOINT_DIRECTION_MASK) {
83 2
84 2 if(bEPPflags.bits.verbose)
85 2 printf("Read Registers: Offset = 0x%x, Length = 0x%x, Index = 0x%x.\n",
86 2 ControlData.DeviceRequest.wValue,
87 2 ControlData.DeviceRequest.wLength,
88 2 ControlData.DeviceRequest.wIndex);
89 2
90 2 if(ControlData.DeviceRequest.wIndex == GET_FIRMWARE_VERSION &&
91 2 ControlData.DeviceRequest.wValue == 0 &&
92 2 ControlData.DeviceRequest.wLength == 1)
93 2 get_firmware_version();//獲取固件版本號
94 2 else
95 2 if(ControlData.DeviceRequest.wIndex == GET_BUFFER_SIZE &&
96 2 ControlData.DeviceRequest.wValue == 0 &&
97 2 ControlData.DeviceRequest.wLength == 4)
98 2 get_buffer_size();//獲取緩沖區大小
99 2 else
100 2 stall_ep0();
101 2
102 2 } // if read register
103 1 else{
104 2 if(bEPPflags.bits.verbose) {
105 3
106 3 printf("Write Registers: Offset = 0x%x, Length = 0x%x, Index = 0x%x.\n",
107 3 ControlData.DeviceRequest.wValue,
108 3 ControlData.DeviceRequest.wLength,
109 3 ControlData.DeviceRequest.wIndex);
110 3
111 3 printf("Data: ");
112 3 for(i = 0; i < ControlData.DeviceRequest.wLength; i ++)
113 3 printf("0x%bx, ", *((ControlData.dataBuffer)+i));
114 3 printf("\n");
115 3 }
116 2
117 2 if(ControlData.DeviceRequest.wIndex == SETUP_DMA_REQUEST &&
C51 COMPILER V7.06 PROTODMA 04/14/2004 12:09:04 PAGE 3
118 2 ControlData.DeviceRequest.wValue == 0 &&
119 2 ControlData.DeviceRequest.wLength == 6)
120 2 {
121 3 if(ControlData.dataBuffer[5]==0x81)
122 3 {
123 4 D12_WriteEndpoint(5, ControlData.dataBuffer[3], EpBuf);//發送數據
124 4 }
125 3 if(ControlData.dataBuffer[5]==0x80)
126 3 {
127 4 epstatus=D12_ReadEndpointStatus(4);
128 4 epstatus &= 0x60;
129 4 if (epstatus == 0x60)
130 4 len = D12_ReadEndpoint(4, 64, EpBuf);//讀取雙緩沖區數據
131 4 }
132 3 single_transmit(0, 0);
133 3 //setup_dma_request();//DMA設置處理,因為未使用DMA所以屏蔽掉
134 3 }
135 2 else
136 2 stall_ep0();
137 2 } // if write register
138 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 590 ----
CONSTANT SIZE = 140 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 8
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 + -