⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lst

📁 uPSD34xx Disk driver
💻 LST
字号:
C51 COMPILER V7.50   MAIN                                                                  09/13/2005 18:00:19 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN MAIN.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE MAIN.C BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*------------------------------------------------------------------------------
   2          main.c
   3          
   4          Version:
   5          September 13, 2005 - Version 2.1 - Updated to run on either the DK3400 or the 
   6          DK3420 by merely making a change to the #define in the upsd3400_hardware.h file
   7          and then rebuilding all target files.  Also, some files were renamed and the 
   8          disclaimers were updated.
   9          
  10          Description:  USB Reference Design - Flash Disk Application (read/write)
  11          This reference design enumerates as a USB flash disk making use of the USB Mass 
  12          Storage Device Class driver.  It will appear as an available drive on the system
  13          and files can be read from and written to the flash memory.  The flash memory used
  14          for file storage is the uPSD34xx's main flash.
  15          
  16          This reference design is intended to demonstrate USB functionality and provide
  17          example code on using the USB module within the uPSD34xx.
  18          
  19          Supported platforms:
  20          DK3400, DK3420
  21          
  22          Note:
  23          It is important to modify the #define setting in upsd3400_hardware.h to match 
  24          the platform (target board) being used.  The value of the #define is used in 
  25          several places to make appropriate settings for the target board and device 
  26          being used.
  27          
  28          
  29          
  30          Copyright (c) 2005 STMicroelectronics Inc.
  31          
  32          THIS INFORMATION (or THIS SOFTWARE or THIS DOCUMENT) IS FOR GUIDANCE ONLY. ST 
  33          MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS 
  34          SOFTWARE nor for any infringement of patents or other rights of third parties 
  35          which may result from its use. ST MICROELECTRONICS SHALL NOT BE HELD LIABLE FOR 
  36          ANY DIRECT, INDIRECT INCIDENTAL OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY 
  37          CLAIMS ARISING IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, 
  38          OR USE OF THIS SOFTWARE. Specifications mentioned in this publication are 
  39          subject to change without notice. This publication supersedes and replaces all 
  40          information previously supplied. STMicroelectronics products are not authorized 
  41          for use as critical components in life support devices or systems without the 
  42          express written approval of STMicroelectronics.
  43          
  44          ------------------------------------------------------------------------------*/
  45          
  46          
  47          #pragma NOAREGS
  48          
  49          #include "upsd3400.h"
  50          #include "upsd3400_hardware.h"
  51          #include "upsd3400_upsd_usb.h"
  52          #include "upsd3400_usb_desc.h"
  53          #include "upsd3400_usb.h"
  54          #include "upsd3400_usb_app.h"
  55          
C51 COMPILER V7.50   MAIN                                                                  09/13/2005 18:00:19 PAGE 2   

  56          #define RemoteWakeupEnable   0
  57          
  58          pdata unsigned char   PageDataBuffer[64];
  59          data  unsigned char   BankCurrent;
  60          
  61          xdata PSD_REGS UPSD_xreg _at_ PSD_REG_ADDR;
  62          data unsigned char ReconnectDemand;
  63          extern unsigned char data usbState;
  64          static data unsigned int  g_debugUSB_INT_CNT = 0;
  65          
  66          extern unsigned char volatile gbBulkPipeStage;
  67          
  68          #define GREEN_LED P4_0                  // GREEN LED Indicator on the DK3420 board
  69                                                                                          //  - Not present on the DK3400
  70          extern unsigned char USB_ISR_Counter;
  71          unsigned char Aux_USB_ISR_Counter;
  72          
  73          data unsigned int GREEN_LED_CNT;
  74          
  75          //PC7
  76          #define PC7_OUT UPSD_xreg.DIRECTION_C   |=0x80             // PC7=Out (D7 = 1)
  77          #define PC7_IN UPSD_xreg.DIRECTION_C    &=0x7F             // PC7=In  (D7 = 0)
  78          #define PC7_PUSHPULL UPSD_xreg.DRIVE_C  &=0x7F             // PC7=Push/Pull (D7 = 0)
  79          #define PC7_OPENDRAIN UPSD_xreg.DRIVE_C |=0x80             // PC7=open drain (D7 = 1)
  80          #define PC7_HIGH UPSD_xreg.DATAOUT_C    |=0x80             // PC7=1 (D7 = 1)
  81          #define PC7_LOW UPSD_xreg.DATAOUT_C     &=0x7F             // PC7=0 (D7 = 0)
  82          
  83          
  84          void UsbDisconnectOnDemand(void)
  85          /******************************************************************************
  86           Function   : UsbDisconnectOnDemand(void)
  87           Parameters : none
  88           Description: USB disconnect on demand routine
  89           ******************************************************************************/
  90           {
  91   1      #ifdef DK3400
  92   1      //DK3400
  93   1      // Set PC7 for USB Disconnect
  94   1         PC7_OUT;
  95   1         PC7_OPENDRAIN;
  96   1         PC7_LOW;
  97   1         
  98   1      
  99   1      #else
              //DK3420
              // Set PC7 for USB Disconnect
                 PC7_IN; 
              #endif
 104   1      }
 105          
 106          void UsbConnectOnDemand(void)
 107          /******************************************************************************
 108           Function   : UsbDisconnectOnDemand(void)
 109           Parameters : none
 110           Description: USB disconnect on demand routine
 111           ******************************************************************************/
 112           {
 113   1      #ifdef DK3400
 114   1      //DK3400
 115   1      // Set PC7 for USB Connect
 116   1         PC7_OUT;
 117   1         PC7_OPENDRAIN;                  //PC7 set for open drain, high value effectively
C51 COMPILER V7.50   MAIN                                                                  09/13/2005 18:00:19 PAGE 3   

 118   1         PC7_HIGH;               // releases the D+ line to be pulled high through 
 119   1                                 // external transistor/resistor.
 120   1      #else
              //DK3420
              // Set PC7 for USB Connect
                 PC7_OUT;                //PC7 set to output mode.
                 PC7_PUSHPULL;                   //PC7 set for push-pull type when in output mode.
                 PC7_HIGH;               //Output high value to apply 3.3V to pull-up resistor on D+ 
              
              #endif
 128   1      }
 129          
 130          void Initialize(void)
 131          /******************************************************************************
 132           Function   : void Initialize()
 133           Parameters : none
 134           Description: Module initialization routine.
 135           ******************************************************************************/
 136          {
 137   1        UsbInitialize();
 138   1        UsbConnectOnDemand();
 139   1       }
 140          
 141          
 142          void T0ISR (void) interrupt TF0_VECTOR using 1
 143          /******************************************************************************
 144           Function   : void T0ISR ()
 145           Parameters : (void)
 146           Description: LED effects routine
 147           ******************************************************************************/
 148           {
 149   1      
 150   1        if (Aux_USB_ISR_Counter != USB_ISR_Counter)
 151   1         {
 152   2          Aux_USB_ISR_Counter = USB_ISR_Counter;   // USB Activity
 153   2          GREEN_LED = 1;                           //GREEN LED OFF
 154   2          GREEN_LED_CNT = 500;
 155   2         }
 156   1      
 157   1      /* ***** GREEN LED service ***** */
 158   1        if (GREEN_LED_CNT>0)
 159   1         {
 160   2          GREEN_LED_CNT--;
 161   2          if (GREEN_LED_CNT == 0)
 162   2           {
 163   3            GREEN_LED = 0;                         //GREEN LED ON after some time
 164   3           }
 165   2         }
 166   1       }
 167          
 168          
 169          void main(void)
 170          /******************************************************************************
 171           Function   : void main()
 172           Parameters : (void)
 173           Description: The main routine
 174           ******************************************************************************/
 175           {
 176   1        UsbDisconnectOnDemand();
 177   1      
 178   1        GREEN_LED = 0;
 179   1      
C51 COMPILER V7.50   MAIN                                                                  09/13/2005 18:00:19 PAGE 4   

 180   1        Initialize();
 181   1      
 182   1        UPSD_xreg.DIRECTION_D |= 2;                // RED LED ON
 183   1        UPSD_xreg.OUTENABLE_D |= 2;
 184   1        UPSD_xreg.DATAOUT_D    = 0;
 185   1      
 186   1        UPSD_xreg.DATAOUT_D    = 255;              // RED LED OFF
 187   1      
 188   1        GREEN_LED = 1;
 189   1      
 190   1        GREEN_LED_CNT = 1;                         // GREEN LED ON
 191   1      
 192   1      //Timer0, blinking LEDs and SW PWM service
 193   1        TR0   = 0;                                 // stop timer 0
 194   1        TMOD &= 0xF0;                              // clear timer 0 mode bits
 195   1        TMOD |= 0x02;                              // put timer 0 into right mode
 196   1        TH0   = 0;                                 // 12MHz/12/-x
 197   1      
 198   1        ET0   = 1;                                 // enable timer 0 interrupt
 199   1        TR0   = 1;                                 // start timer 0
 200   1      
 201   1      
 202   1        while (1)
 203   1         {
 204   2         }
 205   1      
 206   1       }
 207          
 208          
 209          
 210          /* *************************************************************************
 211            ***                                                                      ***
 212            **                         *** End of File ***                            **
 213            ***                                                                      ***
 214             *************************************************************************  */


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    158    ----
   CONSTANT SIZE    =    201    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =     64    ----
   DATA SIZE        =      7    ----
   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 + -