📄 d12sub.lst
字号:
C51 COMPILER V7.50 D12SUB 06/09/2006 09:16:53 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE D12SUB
OBJECT MODULE PLACED IN D12Sub.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE D12Sub.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg52.h>
2 #include <d12config.h>
3 #include <D12main.h>
4 #include "Descriptor.h"
5 #include "Chap_9.h"
6
7 EPPFLAGS bEPPflags;
8
9 void D12_SetMode(INT8U bConfig,INT8U bClkDiv)
10 {
11 1
12 1 D12_COMMAND_PORT = 0xF3;
13 1 D12_DATA_PORT = bConfig;
14 1 D12_DATA_PORT = bClkDiv;
15 1 }
16 void Disconnect(void)
17 {
18 1 D12_SetMode(D12_NOLazyClock,D12_SETTOONE | D12_CLOCK_12M);
19 1 }
20
21
22 void Connect(void)
23 {
24 1 D12_SetDMA(0x0);
25 1 D12_SetMode( D12_NOLazyClock | D12_SOFTCONNECT,D12_SETTOONE | D12_CLOCK_12M);
26 1 }
27 void delay(INT16U count0)
28 {
29 1 INT8U i;
30 1 while ((count0--))
31 1 {
32 2 for (i=0;i<125;i++) {};
33 2 }
34 1 }
35 void Reconnect(void)
36 {
37 1 Disconnect();
38 1 delay(2);
39 1 Connect();
40 1 }
41 INT8U Init_D12(void)
42 {
43 1 MCU_D12CS = True;
44 1 MCU_D12CS = False;
45 1 MCU_D12RST = False;
46 1 delay(1);
47 1 MCU_D12RST = True;
48 1 delay(2000);
49 1 MCU_D12SUSPD = False;
50 1
51 1 Reconnect();
52 1 if ( D12_Read_ID()!=0x1012 ) return(1);
53 1 return(0);
54 1 }
55 void D12_SetDMA(INT8U bMode)
C51 COMPILER V7.50 D12SUB 06/09/2006 09:16:53 PAGE 2
56 {
57 1 D12_COMMAND_PORT = 0xFB;
58 1 D12_DATA_PORT = bMode;
59 1 }
60 INT16U D12_Read_ID(void)
61 {
62 1 INT16U i,j;
63 1 D12_COMMAND_PORT = 0xFD;
64 1 i = D12_DATA_PORT;
65 1 j = D12_DATA_PORT;
66 1 //TXD_pc(i);
67 1 //TXD_pc(j);
68 1 i += (j<<8);
69 1 return i;
70 1 }
71 /****************************************/
72 /*************向计算机发数据*************/
73 /****************************************/
74 void TXD_pc(INT8U icode)
75 {
76 1 //uchar count1; /* 接收等待时间 */
77 1 //uchar i;
78 1 //RS485 = False;
79 1 EA = 0;
80 1 ES = 0;
81 1
82 1 SBUF = icode;
83 1 while (!TI);
84 1 TI = 0; /* 发数据请求 */
85 1 //RS485 = True;
86 1 EA = True;
87 1 ES = True;
88 1
89 1 }
90 /***********************************************************************
91 ** 函数名称: void Usb_Exception(void)
92 ** 功能描述: D12中断服务程序
93 *************************************************************************/
94 void Usb_Exception(void) interrupt 0
95 {
96 1 INT16U i_st;
97 1 INT8U i,j;
98 1
99 1 DISABLE(); //进入D12中断服务程序时关中断
100 1
101 1 bEPPflags.bits.in_isr = 1;
102 1 D12_COMMAND_PORT=0xF4; //读取中断寄存器命令
103 1 i=D12_DATA_PORT; //读取低8位字节
104 1 j=D12_DATA_PORT; //读取高8位字节
105 1 TXD_pc(i);
106 1 TXD_pc(j);
107 1 if(i_st != 0) {
108 2 if(i_st & D12_INT_BUSRESET)
109 2 bEPPflags.bits.bus_reset = True; //USB总线复位标志
110 2 if(i_st & D12_INT_EOT)
111 2 dma_eot(); //DMA传输技术处理
*** WARNING C206 IN LINE 111 OF D12SUB.C: 'dma_eot': missing function-prototype
112 2 if(i_st & D12_INT_SUSPENDCHANGE)
113 2 bEPPflags.bits.suspend = 1; //挂起改变标志置1
114 2 if(i_st & D12_INT_ENDP0IN)
115 2 ep0_txdone(); //控制端点发送数据处理
116 2 if(i_st & D12_INT_ENDP0OUT)
C51 COMPILER V7.50 D12SUB 06/09/2006 09:16:53 PAGE 3
117 2 ep0_rxdone(); //控制端点接收数据处理
118 2 if(i_st & D12_INT_ENDP1IN)
119 2 ep1_txdone(); //端点 1发送数据处理
*** WARNING C206 IN LINE 119 OF D12SUB.C: 'ep1_txdone': missing function-prototype
120 2 if(i_st & D12_INT_ENDP1OUT)
121 2 ep1_rxdone(); //端点 1接收数据处理
*** WARNING C206 IN LINE 121 OF D12SUB.C: 'ep1_rxdone': missing function-prototype
122 2 if(i_st & D12_INT_ENDP2IN)
123 2 ep2_txdone(); //端点 2发送数据处理
*** WARNING C206 IN LINE 123 OF D12SUB.C: 'ep2_txdone': missing function-prototype
124 2 if(i_st & D12_INT_ENDP2OUT)
125 2 ep2_rxdone(); //端点 2接收数据处理
*** WARNING C206 IN LINE 125 OF D12SUB.C: 'ep2_rxdone': missing function-prototype
126 2 }
127 1 bEPPflags.bits.in_isr = 0;
128 1 ENABLE(); //退出D12中断服务程序时开中断
129 1 }
130 void Usbserve()
131 {
132 1 if (bEPPflags.bits.setup_packet){ //Setup包处理
133 2 DISABLE();
134 2 bEPPflags.bits.setup_packet = 0;
135 2 control_handler(); //调用请求处理子程序
136 2 ENABLE();
137 2 }//if setup_packet
138 1 if (bEPPflags.bits.bus_reset){
139 2 DISABLE();
140 2 bEPPflags.bits.bus_reset = False;
141 2 ENABLE();
142 2 d12_busreset();
143 2 }
144 1 }
145 void d12_busreset(void)
146 {
147 1 //在此添加总线复位处理代码
148 1 }
149
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 394 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 2
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 5 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -