vendor.LST
资源名称:USB_2.0.rar [点击查看]
上传用户:ids068
上传日期:2013-04-04
资源大小:639k
文件大小:17k
源码类别:
USB编程
开发平台:
C/C++
- C51 COMPILER V7.06 VENDOR 07/02/2003 09:29:10 PAGE 1
- C51 COMPILER V7.06, COMPILATION OF MODULE VENDOR
- OBJECT MODULE PLACED IN vendor.OBJ
- COMPILER INVOKED BY: C:KEILC51BINC51.EXE vendor.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 : DMADebug.c *
- 9 // Author : Albert Goh *
- 10 // Created : 3 March 2000 *
- 11 // *
- 12 //***********************************************************************
- 13 //***********************************************************************
- 14 // *
- 15 // GDMADebug.c is the file that contain the routine for the GDMA debug *
- 16 // It will be able to configured as master for slave for the debugging *
- 17 // *
- 18 //***********************************************************************
- 19 //***********************************************************************
- 20 // *
- 21 // Module History *
- 22 // ************** *
- 23 // *
- 24 // Date Version Author Changes *
- 25 // ==== ======= ====== ======= *
- 26 // 030300 0.1 Albert Created *
- 27 // *
- 28 // *
- 29 //***********************************************************************
- 30
- 31 //***********************************************************************
- 32 //* *
- 33 //* Include Files Definition *
- 34 //* *
- 35 //***********************************************************************
- 36
- 37 #include "standard.h"
- 38 #include "Kernel.h"
- 39 #include "D14.h"
- 40
- 41
- 42
- 43
- 44 //***********************************************************************
- 45 //* *
- 46 //* External Variable Definition *
- 47 //* *
- 48 //***********************************************************************
- 49
- 50 extern USB_DEVICE USB_Device;
- 51 extern DMA_INT_FLAG DMA_Int_Flag;
- 52 extern USB_INT_FLAG USB_Int_Flag;
- 53 extern volatile D14_CNTRL_REG xdata D14_Cntrl_Reg;
- 54 extern void Start_mSEC_Timer(Data);
- 55 extern UC Data;
- C51 COMPILER V7.06 VENDOR 07/02/2003 09:29:10 PAGE 2
- 56 extern UI Temp,PIO_Count;
- 57 extern KERNEL Kernel_Flag;
- 58 extern ULI bytecount;
- 59 extern FILESIZE FileSize;
- 60 extern UI count;
- 61 extern UC idata Endpt_FIFO[MAX_BUF];
- 62 extern UC Type;
- 63
- 64 //***********************************************************************
- 65 //* *
- 66 //* Variable Definition *
- 67 //* *
- 68 //***********************************************************************
- 69
- 70 UI Count_PIO;
- 71
- 72 //***********************************************************************
- 73 //* *
- 74 //* Prototype Definition *
- 75 //* *
- 76 //***********************************************************************
- 77
- 78 void DMA_Debug_Mode(void);
- 79 void DMA_Init(void);
- 80 void DMA_Mode(Data);
- 81
- 82 //***********************************************************************
- 83 //* *
- 84 //* Routine Definition *
- 85 //* *
- 86 //***********************************************************************
- 87
- 88 //***********************************************************************
- 89 //* *
- 90 //* Routine : DMA Debug Mode *
- 91 //* Input : None *
- 92 //* Output : None *
- 93 //* Function : Generic DMA mode routine *
- 94 //* *
- 95 //***********************************************************************
- 96
- 97 void DMA_Debug_Mode(void)
- 98 {
- 99 1 if(Kernel_Flag.BITS.Transfer_Start)
- 100 1 {
- 101 2 if(FileSize.Size.Address[0] == 0 &&
- 102 2 FileSize.Size.Address[1] == 0 &&
- 103 2 FileSize.Size.Address[2] == 0)
- 104 2 {
- 105 3 Kernel_Flag.BITS.Out_Reset_Done = 0;
- 106 3 Kernel_Flag.BITS.In_Reset_Done = 0;
- 107 3 }
- 108 2
- 109 2 if(FileSize.Size.DIR == 0x00 || FileSize.Size.DIR == 0x80)
- 110 2 DMA_Mode(Write);
- 111 2 else
- 112 2 DMA_Mode(Read);
- 113 2 }
- 114 1 }
- 115
- 116
- 117 //***********************************************************************
- C51 COMPILER V7.06 VENDOR 07/02/2003 09:29:10 PAGE 3
- 118 //* *
- 119 //* Routine : DMA Mode *
- 120 //* Input : DMA Controller setting *
- 121 //* Output : None *
- 122 //* Function : to do GDMA data transfer *
- 123 //* *
- 124 //***********************************************************************
- 125
- 126 void DMA_Mode(Data)
- 127 {
- 128 1 UI Datcount;
- 129 1
- 130 1 if(Data)
- 131 1 {
- 132 2 //read
- 133 2 do
- 134 2 {
- 135 3 //Check for Out Token ACK interrupt
- 136 3 while(!USB_Int_Flag.BITS.EP2RX)
- 137 3 {
- 138 4 if(USB_Int_Flag.BITS.SUSP || Kernel_Flag.BITS.Bus_Reset || USB_Int_Flag.BITS.EP0SETUP)
- 139 4 break;
- 140 4 }
- 141 3 EA_DISABLE;
- 142 3 USB_Int_Flag.BITS.EP2RX = 0;
- 143 3 EA_ENABLE;
- 144 3 D14_Cntrl_Reg.D14_ENDPT_INDEX = 4;
- 145 3 D14_Cntrl_Reg.D14_DMA_ENDPOINT = 2;
- 146 3 //Read in FIFO data
- 147 3 if (bytecount > PIO_Count)
- 148 3 {
- 149 4 Datcount = PIO_Count;
- 150 4 }
- 151 3 else
- 152 3 {
- 153 4 Datcount = bytecount;
- 154 4 }
- 155 3 if(Kernel_Flag.BITS.HS_FS_State == FULL_SPEED)
- 156 3 {
- 157 4 for(Count_PIO = 0 ; Count_PIO < Datcount ; Count_PIO++)
- 158 4 Endpt_FIFO[Count_PIO] = D14_Cntrl_Reg.D14_DATA_PORT_LSB;
- 159 4 }
- 160 3 else
- 161 3 {
- 162 4 for(Count_PIO = 0 ; Count_PIO < Datcount; Count_PIO++)
- 163 4 Temp = D14_Cntrl_Reg.D14_DATA_PORT_LSB;
- 164 4 }
- 165 3 bytecount -= Datcount;
- 166 3 }while(bytecount);
- 167 2 }
- 168 1 else
- 169 1 {
- 170 2 //write
- 171 2 do
- 172 2 {
- 173 3 //initialize endpoint index
- 174 3 D14_Cntrl_Reg.D14_ENDPT_INDEX = 5;
- 175 3 D14_Cntrl_Reg.D14_DMA_ENDPOINT = 2;
- 176 3 //Write data to FIFO
- 177 3 if (bytecount>PIO_Count)
- 178 3 {
- 179 4 D14_Cntrl_Reg.D14_BUFFER_LENGTH_LSB =( unsigned char ) PIO_Count;
- C51 COMPILER V7.06 VENDOR 07/02/2003 09:29:10 PAGE 4
- 180 4 D14_Cntrl_Reg.D14_BUFFER_LENGTH_MSB = ( unsigned char ) (PIO_Count>>8);
- 181 4 Datcount = PIO_Count;
- 182 4 }
- 183 3 else
- 184 3 {
- 185 4 D14_Cntrl_Reg.D14_BUFFER_LENGTH_LSB =( unsigned char ) bytecount;
- 186 4 D14_Cntrl_Reg.D14_BUFFER_LENGTH_MSB = ( unsigned char ) (bytecount>>8);
- 187 4 Datcount = bytecount;
- 188 4 }
- 189 3
- 190 3 if(Kernel_Flag.BITS.HS_FS_State == FULL_SPEED)
- 191 3 {
- 192 4 for(Count_PIO = 0 ; Count_PIO < Datcount ; Count_PIO++)
- 193 4 D14_Cntrl_Reg.D14_DATA_PORT_LSB = Endpt_FIFO[Count_PIO];
- 194 4 }
- 195 3 else
- 196 3 {
- 197 4 for(Count_PIO = 0 ; Count_PIO < Datcount ; Count_PIO++)
- 198 4 D14_Cntrl_Reg.D14_DATA_PORT_LSB = Count_PIO % 256;
- 199 4 }
- 200 3 //Check for In Token ACK
- 201 3 while(!USB_Int_Flag.BITS.EP2TX)
- 202 3 {
- 203 4 if(USB_Int_Flag.BITS.SUSP || Kernel_Flag.BITS.Bus_Reset || USB_Int_Flag.BITS.EP0SETUP)
- 204 4 break;
- 205 4 }
- 206 3 EA_DISABLE;
- 207 3 USB_Int_Flag.BITS.EP2TX = 0;
- 208 3 EA_ENABLE;
- 209 3 bytecount -= Datcount;
- 210 3 }while(bytecount);
- 211 2 //stop DMA controller
- 212 2 DMA_Start = GDMA_Stop;
- 213 2 //transfewr done,reset internal variables
- 214 2 DMA_Int_Flag.BITS.DMA_DONE = 0;
- 215 2 Count_PIO = 0;
- 216 2 }
- 217 1 Kernel_Flag.BITS.Transfer_Start = 0;
- 218 1 }
- 219
- MODULE INFORMATION: STATIC OVERLAYABLE
- CODE SIZE = 619 ----
- CONSTANT SIZE = ---- ----
- XDATA SIZE = ---- ----
- PDATA SIZE = ---- ----
- DATA SIZE = 2 4
- IDATA SIZE = ---- ----
- BIT SIZE = ---- ----
- END OF MODULE INFORMATION.
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)