kernel.LST
资源名称:USB_2.0.rar [点击查看]
上传用户:ids068
上传日期:2013-04-04
资源大小:639k
文件大小:11k
源码类别:
USB编程
开发平台:
C/C++
- C51 COMPILER V7.06 KERNEL 07/02/2003 10:27:49 PAGE 1
- C51 COMPILER V7.06, COMPILATION OF MODULE KERNEL
- OBJECT MODULE PLACED IN kernel.OBJ
- COMPILER INVOKED BY: C:KEILC51BINC51.EXE kernel.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
- 16 //***********************************************************************
- 17 //* *
- 18 //* External routine Definition *
- 19 //* *
- 20 //***********************************************************************
- 21
- 22 extern Init_Main();
- 23 extern USB_Debug_Mode();
- 24 extern DMA_Debug_Mode();
- 25 extern USB_INT_FLAG USB_Int_Flag;
- 26 extern DMA_INT_FLAG DMA_Int_Flag;
- 27 extern USB_DEVICE USB_Device;
- 28 extern volatile D14_CNTRL_REG xdata D14_Cntrl_Reg;
- 29 extern void Check_Busy(void);
- 30 extern void Init_D14(void);
- 31 extern void Init_Endpoint(void);
- 32 extern void Init_Device(void);
- 33 extern void Get_PIDVID(void);
- 34 extern unsigned int read_endpoint(unsigned char endp,unsigned int len,unsigned char *buf);
- 35 extern unsigned int write_endpoint(unsigned char endp,unsigned int len,unsigned char *buf);
- 36
- 37
- 38 extern UC VID[2],PID[2];
- 39 extern UC idata Endpt_FIFO[MAX_BUF];
- 40 extern Set_USB(void);
- 41 extern TIMER Timer;
- 42
- 43 //***********************************************************************
- 44 //* *
- 45 //* Prototype routine Definition *
- 46 //* *
- 47 //***********************************************************************
- 48
- 49 void Start_mSEC_Timer(Data);
- 50 void Start_SEC_Timer(Data);
- 51
- 52 //***********************************************************************
- 53 //* *
- 54 //* Variable Definition *
- 55 //* *
- C51 COMPILER V7.06 KERNEL 07/02/2003 10:27:49 PAGE 2
- 56 //***********************************************************************
- 57
- 58 UI Temp;
- 59 KERNEL Kernel_Flag;
- 60
- 61
- 62 //***********************************************************************
- 63 //* *
- 64 //* Routine Definition *
- 65 //* *
- 66 //***********************************************************************
- 67
- 68 //***********************************************************************
- 69 //* *
- 70 //* Routine : Main *
- 71 //* Input : None *
- 72 //* Output : None *
- 73 //* Function : main loop *
- 74 //* *
- 75 //***********************************************************************
- 76
- 77 void Main(void)
- 78 {
- 79 1 unsigned int a;
- 80 1 unsigned char b[16];
- 81 1
- 82 1 //Initialization routine
- 83 1 //初始化子程序
- 84 1 Init_Main();
- 85 1
- 86 1 //enable device and reset the device address
- 87 1 D14_Cntrl_Reg.D14_MODE.BITS.SOFTCT = 1;
- 88 1
- 89 1 do
- 90 1 {
- 91 2
- 92 2
- 93 2 //USB routine
- 94 2 USB_Debug_Mode();
- 95 2
- 96 2 //Generic DMA routine
- 97 2 DMA_Debug_Mode();
- 98 2
- 99 2 if (USB_Int_Flag.BITS.EP1RX)
- 100 2 {
- 101 3 USB_Int_Flag.BITS.EP1RX = 0;
- 102 3 a=read_endpoint(0x02,8,b);
- 103 3 b[0]=0;
- 104 3 b[1]=0x12;
- 105 3 b[2]=0x12;
- 106 3 b[3]=0x12;
- 107 3 }
- 108 2 a=write_endpoint(0x03,4,b);
- 109 2
- 110 2
- 111 2
- 112 2 }
- 113 1 while(1);
- 114 1
- 115 1 }
- 116
- 117
- C51 COMPILER V7.06 KERNEL 07/02/2003 10:27:49 PAGE 3
- 118
- 119 //***********************************************************************
- 120 //* *
- 121 //* Routine : Start_mSEC_Timer(Delay) *
- 122 //* Input : Delay in milli second *
- 123 //* Output : Start timer operation *
- 124 //* Function : To start the timeout operation based on the delay i/p *
- 125 //* *
- 126 //***********************************************************************
- 127
- 128 void Start_mSEC_Timer(Data)
- 129 {
- 130 1
- 131 1
- 132 1 do
- 133 1 {
- 134 2
- 135 2 //calculate timer value
- 136 2 Temp = Timer.mSEC_Scale;
- 137 2 Temp = 0xffff - Temp;
- 138 2
- 139 2 ET0 = 1;
- 140 2
- 141 2 //calculate timer value
- 142 2 //initialize timer 0 counter
- 143 2 Temp >>= 8;
- 144 2 TH0 = (UC) Temp;
- 145 2 Temp = Timer.mSEC_Scale;
- 146 2 Temp = 0xffff - Temp;
- 147 2 TL0 = (UC) Temp;
- 148 2
- 149 2 //start timer count
- 150 2 TR0 = 1;
- 151 2
- 152 2 Kernel_Flag.BITS.Timer_Expired = 0;
- 153 2 while(!Kernel_Flag.BITS.Timer_Expired);
- 154 2 Kernel_Flag.BITS.Timer_Expired = 0;
- 155 2
- 156 2
- 157 2 //stop timer
- 158 2 TR0 = 0;
- 159 2 ET0 = 0;
- 160 2
- 161 2 Data--;
- 162 2 }
- 163 1 while(Data != 0);
- 164 1 }
- 165
- 166
- MODULE INFORMATION: STATIC OVERLAYABLE
- CODE SIZE = 198 ----
- CONSTANT SIZE = ---- ----
- XDATA SIZE = ---- ----
- PDATA SIZE = ---- ----
- DATA SIZE = 6 20
- IDATA SIZE = ---- ----
- BIT SIZE = ---- ----
- END OF MODULE INFORMATION.
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)