kernel.LST
资源名称:USB_2.0.rar [点击查看]
上传用户:ids068
上传日期:2013-04-04
资源大小:639k
文件大小:15k
源码类别:
USB编程
开发平台:
C/C++
- C51 COMPILER V7.06 KERNEL 07/02/2003 10:05:13 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 //***********************************************************************
- 2 // *
- 3 // P H I L I P S P R O P R I E T A R Y *
- 4 // *
- 5 // COPYRIGHT (c) 1999 BY PHILIPS SINGAPORE (APIC). *
- 6 // -- ALL RIGHTS RESERVED -- *
- 7 // *
- 8 // File Name : Kernel.c *
- 9 // Author : Albert Goh *
- 10 // Created : 3 March 2000 *
- 11 // *
- 12 //***********************************************************************
- 13 //***********************************************************************
- 14 // *
- 15 // Kernel.c is the control centre for this evaluation firmware. It will *
- 16 // control where should the firmware branch through via the selection *
- 17 // of the UART port of the 8051. if not via the UART, it will be from *
- 18 // the selection of the code defintion *
- 19 // *
- 20 //***********************************************************************
- 21 //***********************************************************************
- 22 // *
- 23 // Module History *
- 24 // ************** *
- 25 // *
- 26 // Date Version Author Changes *
- 27 // ==== ======= ====== ======= *
- 28 // 030300 0.1 Albert Created *
- 29 // *
- 30 // *
- 31 //***********************************************************************
- 32 //***********************************************************************
- 33 //* *
- 34 //* Include Files Definition *
- 35 //* *
- 36 //***********************************************************************
- 37
- 38 #include "standard.h"
- 39 #include "Kernel.h"
- 40 #include "D14.h"
- 41 #include "zlg7290.h"
- 42 #include "VIIC_C51.h"
- 43
- 44 #define uchar unsigned char
- 45
- 46 //***********************************************************************
- 47 //* *
- 48 //* External routine Definition *
- 49 //* *
- 50 //***********************************************************************
- 51
- 52 extern Init_Main();
- 53 extern USB_Debug_Mode();
- 54 extern DMA_Debug_Mode();
- 55 extern USB_INT_FLAG USB_Int_Flag;
- C51 COMPILER V7.06 KERNEL 07/02/2003 10:05:13 PAGE 2
- 56 extern DMA_INT_FLAG DMA_Int_Flag;
- 57 extern USB_DEVICE USB_Device;
- 58 extern D14_CNTRL_REG volatile xdata D14_Cntrl_Reg;
- 59 extern void Check_Busy(void);
- 60 extern void Init_D14(void);
- 61 extern void Init_Endpoint(void);
- 62 extern void Init_Device(void);
- 63 extern void Get_PIDVID(void);
- 64 //extern unsigned int read_endpoint(unsigned char endp,unsigned int len,unsigned char *buf);
- 65 //extern unsigned int write_endpoint(unsigned char endp,unsigned int len,unsigned char *buf);
- 66 extern UC VID[2],PID[2];
- 67 extern UC idata Endpt_FIFO[MAX_BUF];
- 68 extern Set_USB(void);
- 69 extern TIMER Timer;
- 70 extern UC timecouter;
- 71 //***********************************************************************
- 72 //* *
- 73 //* Prototype routine Definition *
- 74 //* *
- 75 //***********************************************************************
- 76
- 77 void Start_mSEC_Timer(Data);
- 78 void Start_SEC_Timer(Data);
- 79 uchar DelayNS(uchar no);
- 80
- 81 //***********************************************************************
- 82 //* *
- 83 //* Variable Definition *
- 84 //* *
- 85 //***********************************************************************
- 86
- 87 UI Temp;
- 88 KERNEL Kernel_Flag;
- 89 uchar code disp_buf[8]={0,0,0,0,0,0,0,0}; //LED初始化值
- 90 //UC key=0xff;
- 91 //***********************************************************************
- 92 //* *
- 93 //* Routine Definition *
- 94 //* *
- 95 //***********************************************************************
- 96
- 97 //***********************************************************************
- 98 //* *
- 99 //* Routine : Main *
- 100 //* Input : None *
- 101 //* Output : None *
- 102 //* Function : main loop *
- 103 //* *
- 104 //***********************************************************************
- 105
- 106 void Main(void)
- 107 {
- 108 1 DelayNS(5);
- 109 1
- 110 1 DelayNS(5);
- 111 1 //Initialization routine
- 112 1 //初始化子程序
- 113 1 ZLG7290_SendBuf(disp_buf,8);
- 114 1 Init_Main();
- 115 1
- 116 1 //enable device and reset the device address
- 117 1 D14_Cntrl_Reg.D14_MODE.BITS.SOFTCT = 1;
- C51 COMPILER V7.06 KERNEL 07/02/2003 10:05:13 PAGE 3
- 118 1
- 119 1 do
- 120 1 {
- 121 2 //USB routine
- 122 2 USB_Debug_Mode();
- 123 2
- 124 2 //Generic DMA routine
- 125 2 DMA_Debug_Mode();
- 126 2
- 127 2 }
- 128 1 while(1);
- 129 1 }
- 130
- 131 /*********************************************************************************************************
- 132 ** 函数名称: DelayNS
- 133 ** 功能描述: 长软件延时
- 134 ** 输 入: no : 延时参数,值越大时延时越久
- 135 **
- 136 ** 输 出: 0 : OK;
- 137 ** 1 : FAIL;
- 138 ** 全局变量: 无
- 139 ** 调用模块: 无
- 140 **
- 141 ** 作 者: 叶皓贲
- 142 ** 日 期: 2003-3-4
- 143 **-------------------------------------------------------------------------------------------------------
- 144 ** 修改人:
- 145 ** 日 期:
- 146 **------------------------------------------------------------------------------------------------------
- 147 ********************************************************************************************************/
- 148 uchar DelayNS(uchar no)
- 149 {
- 150 1 uchar i,j; //延时参数
- 151 1
- 152 1 for(; no>0; no--)
- 153 1 {
- 154 2 for(i=0; i<100; i++)
- 155 2 for(j=0; j<100; j++);
- 156 2 }
- 157 1 return 0;
- 158 1 }
- 159
- 160 //***********************************************************************
- 161 //* *
- 162 //* Routine : Start_mSEC_Timer(Delay) *
- 163 //* Input : Delay in milli second *
- 164 //* Output : Start timer operation *
- 165 //* Function : To start the timeout operation based on the delay i/p *
- 166 //* *
- 167 //***********************************************************************
- 168
- 169 void Start_mSEC_Timer(Data)
- 170 {
- 171 1
- 172 1
- 173 1 do
- 174 1 {
- 175 2
- 176 2 //calculate timer value
- 177 2 Temp = Timer.mSEC_Scale;
- 178 2 Temp = 0xffff - Temp;
- 179 2
- C51 COMPILER V7.06 KERNEL 07/02/2003 10:05:13 PAGE 4
- 180 2 ET0 = 1;
- 181 2
- 182 2 //calculate timer value
- 183 2 //initialize timer 0 counter
- 184 2 Temp >>= 8;
- 185 2 TH0 = (UC) Temp;
- 186 2 Temp = Timer.mSEC_Scale;
- 187 2 Temp = 0xffff - Temp;
- 188 2 TL0 = (UC) Temp;
- 189 2
- 190 2 //start timer count
- 191 2 TR0 = 1;
- 192 2
- 193 2 Kernel_Flag.BITS.Timer_Expired = 0;
- 194 2 while(!Kernel_Flag.BITS.Timer_Expired);
- 195 2 Kernel_Flag.BITS.Timer_Expired = 0;
- 196 2
- 197 2
- 198 2 //stop timer
- 199 2 TR0 = 0;
- 200 2 ET0 = 0;
- 201 2
- 202 2 Data--;
- 203 2 }
- 204 1 while(Data != 0);
- 205 1 }
- 206
- 207
- MODULE INFORMATION: STATIC OVERLAYABLE
- CODE SIZE = 195 ----
- CONSTANT SIZE = 8 ----
- XDATA SIZE = ---- ----
- PDATA SIZE = ---- ----
- DATA SIZE = 6 5
- IDATA SIZE = ---- ----
- BIT SIZE = ---- ----
- END OF MODULE INFORMATION.
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)