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

📄 f34x_msd_msd.lst

📁 USB读写SD卡例程
💻 LST
📖 第 1 页 / 共 5 页
字号:
           =2 // Define device states
           =2 #define  DEV_ATTACHED            0x00        // Device is in Attac
             -hed State
           =2 #define  DEV_POWERED             0x01        // Device is in Power
             -ed State
           =2 #define  DEV_DEFAULT             0x02        // Device is in Defau
             -lt State
           =2 #define  DEV_ADDRESS             0x03        // Device is in Addre
             -ssed State
           =2 #define  DEV_CONFIGURED          0x04        // Device is in Confi
             -gured State
           =2 #define  DEV_SUSPENDED           0x05        // Device is in Suspe
             -nded State
           =2 
           =2 // Define bmRequestType bitmaps
           =2 #define  IN_DEVICE               0x00        // Request made to de
             -vice, direction is IN 
           =2 #define  OUT_DEVICE              0x80        // Request made to de
             -vice, direction is OUT
           =2 #define  IN_INTERFACE            0x01        // Request made to in
             -terface, direction is IN
           =2 #define  OUT_INTERFACE           0x81        // Request made to in
             -terface, direction is OUT
           =2 #define  IN_ENDPOINT             0x02        // Request made to en
             -dpoint, direction is IN
           =2 #define  OUT_ENDPOINT            0x82        // Request made to en
             -dpoint, direction is OUT
           =2 
           =2 // Define wIndex bitmaps
           =2 #define  IN_EP1                  0x81        // Index values used 
             -by Set and Clear feature
           =2 #define  OUT_EP1                 0x01        // commands for Endpo
             -int_Halt
           =2 #define  IN_EP2                  0x82
           =2 #ifdef __F326_VER__
           =2 #define  OUT_EP2                                 0x01           
C51 COMPILER V7.50   F34X_MSD_MSD                  11/28/2006 10:54:20 PAGE 18  

           =2 #else
           =2 #define  OUT_EP2                                 0x01           
           =2 #endif
           =2 
           =2 // Define wValue bitmaps for Standard Feature Selectors
           =2 #define  DEVICE_REMOTE_WAKEUP    0x01        // Remote wakeup feat
             -ure(not used)
           =2 #define  ENDPOINT_HALT           0x00        // Endpoint_Halt feat
             -ure selector
           =2 
           =2 // Define Endpoint States
           =2 #define  EP_IDLE                 0x00        // This signifies End
             -point Idle State
           =2 #define  EP_TX                   0x01        // Endpoint Transmit 
             -State
           =2 #define  EP_RX                   0x02        // Endpoint Receive S
             -tate
           =2 #define  EP_HALT                 0x03        // Endpoint Halt Stat
             -e (return stalls)
           =2 #define  EP_STALL                0x04        // Endpoint Stall (se
             -nd procedural stall next status phase)
           =2 #define  EP_ADDRESS              0x05        // Endpoint Address (
             -change FADDR during next status phase)
           =2 
           =2 // Function prototypes
           =2 // USB Routines
           =2 void USB_Resume(void);                       // This routine resum
             -es USB operation
           =2 void USB_Reset(void);                        // Called after USB b
             -us reset
           =2 void Handle_Setup(void);                     // Handle setup packe
             -t on Endpoint 0
           =2 void Handle_In1(BYTE* ptr_buf);                       // Handle in
             - packet on Endpoint 1
           =2 void Handle_Out2(void);                      // Handle out packet 
             -on Endpoint 2
           =2 void USB_Suspend(void);                      // This routine calle
             -d when suspend signalling on bus
           =2 void Out2_Get_Data(BYTE* ptr_buf);                               // Copies from FIFO to ptr_
             -buf, clears FIFO-full flag.
           =2 void Out2_Done(void);                                            // Call this when finished with the d
             -ata
           =2 
           =2 // Standard Requests
           =2 void Get_Status(void);                       // These are called f
             -or each specific standard request
           =2 void Clear_Feature(void);
           =2 void Set_Feature(void);
           =2 void Set_Address(void);
           =2 void Get_Descriptor(void);
           =2 void Get_Configuration(void);
           =2 void Set_Configuration(void);
           =2 void Get_Interface(void);
           =2 void Set_Interface(void);
           =2 
           =2 // MSD Specific Requests
           =2 // void Reset_Msd(void);
           =2 // void Get_MaxLUN(void);
           =2 
           =2 // Initialization Routines
           =2 void Sys_Clk_Init(void);                      // Initialize the sy
             -stem clock(depends on Full/Low speed)
C51 COMPILER V7.50   F34X_MSD_MSD                  11/28/2006 10:54:20 PAGE 19  

           =2 void Port_Init(void);                        // Configure ports fo
             -r this specific application
           =2 void USB0_Init(void);                        // Configure USB core
             - for either Full/Low speed
           =2 void Timer_Init(void);                       // Start timer 2 for 
             -use by ADC and to check switches
           =2 void Adc_Init(void);                         // Configure ADC for 
             -continuous conversion, low-power mode
           =2 
           =2 // Other Routines
           =2 void Timer2_ISR(void);                       // Called when Timer 
             -2 overflows, see if switches are pressed
           =2 void Adc_ConvComple_ISR(void);               // When a conversion 
             -completes, switch ADC multiplexor
           =2 void USB_ISR(void);                          // Called to determin
             -e type of USB interrupt
           =2 void Fifo_ReadC(BYTE, unsigned int, BYTE *) ;
           =2 extern void Fifo_Read (BYTE, unsigned int, BYTE *) ; // Used for m
             -ultiple byte reads of Endpoint fifos
           =2 extern void Fifo_Write (BYTE, unsigned int, BYTE *) reentrant;// U
             -sed for multiple byte writes of Endpoint fifos
           =2 void Force_Stall(void);                      // Forces a procedura
             -l stall on Endpoint 0
           =2 void Delay(void);                            // Approximately 80 u
             -s/1 ms on Full/Low Speed
           =2 
           =2 void USB_In(BYTE* ptr_buf,unsigned count);
           =2 
           =2 void USB_Bulk_Init(void);
           =2 
           =2 extern unsigned xdata Out_Count;
           =2 extern BYTE xdata Out_Packet[EP2_PACKET_SIZE];
           =2 extern BYTE xdata In_count;
           =2 extern BYTE xdata In_Packet[EP1_PACKET_SIZE];
           =2 //extern BYTE xdata In_Overrun;
           =2 
           =2 #endif      /* _USB_MAIN_H_ */
 217      =2  
  35      =1  
  36      =1  //----------------------------------------------------------------
             --------------
  37      =1  // Structure Prototypes
  38      =1  //----------------------------------------------------------------
             --------------
  39      =1  
  40      =1  typedef struct _CBW {
  41      =1          DWORD dCBWSignature;
  42      =1          DWORD dCBWTag;
  43      =1          DWORD dCBWDataTransferLength;
  44      =1          BYTE  bmCBWFlags;
  45      =1          BYTE  bCBWLUN;
  46      =1          BYTE  bCBWCBLength;
  47      =1          BYTE  CBWCB[16];
  48      =1  } CBW;
  49      =1  
  50      =1  typedef struct _CSW {
  51      =1          DWORD dCSWSignature;
  52      =1          DWORD dCSWTag;
  53      =1          DWORD dCSWDataResidue;
  54      =1          BYTE  bCSWStatus;
  55      =1  } CSW;
  56      =1  
C51 COMPILER V7.50   F34X_MSD_MSD                  11/28/2006 10:54:20 PAGE 20  

  57      =1  extern CBW xdata cbw;
  58      =1  extern CSW xdata csw;
  59      =1  
  60      =1  //----------------------------------------------------------------
             --------------
  61      =1  // Function Prototypes
  62      =1  //----------------------------------------------------------------
             --------------
  63      =1  
  64      =1  void Msd_Step(void);
  65      =1  
  66      =1  #endif
  42          #include "F34x_MSD_Scsi.h"
   1      =1  //----------------------------------------------------------------
             --------------
   2      =1  // F34x_MSD_Scsi.h
   3      =1  //----------------------------------------------------------------
             --------------
   4      =1  // Copyright 2006 Silicon Laboratories, Inc.
   5      =1  // http://www.silabs.com
   6      =1  //
   7      =1  // Program Description:
   8      =1  //
   9      =1  // Header file with function prototypes relevant to F34x_Scsi.c
  10      =1  //
  11      =1  //
  12      =1  // FID:            34X000052
  13      =1  // Target:         C8051F34x
  14      =1  // Tool chain:     Keil
  15      =1  // Command Line:   See Readme.txt
  16      =1  // Project Name:   F34x_USB_MSD
  17      =1  //
  18      =1  // Release 1.1
  19      =1  //    -All changes by PKC
  20      =1  //    -09 JUN 2006
  21      =1  //    -No changes; incremented revision number to match project re
             -vision
  22      =1  //
  23      =1  // Release 1.0
  24      =1  //    -Initial Release
  25      =1  //
  26      =1  
  27      =1  //----------------------------------------------------------------
             --------------
  28      =1  // Header File Preprocessor Directive
  29      =1  //----------------------------------------------------------------
             --------------
  30      =1  
  31      =1  #ifndef _SCSI_H_
  32      =1  #define _SCSI_H_
  33      =1  
  34      =1  #include "F34x_MSD_USB_Main.h"
   1      =2  //----------------------------------------------------------------
             --------------
   2      =2  // F34x_MSD_USB_Main.h
   3      =2  //----------------------------------------------------------------
             --------------
   4      =2  // Copyright 2006 Silicon Laboratories, Inc.
   5      =2  // http://www.silabs.com
   6      =2  //
   7      =2  // Program Description:
   8      =2  //
C51 COMPILER V7.50   F34X_MSD_MSD                  11/28/2006 10:54:20 PAGE 21  

   9      =2  // Main header file for USB firmware. Includes function prototypes
             -,
  10      =2  // standard constants, and configuration constants.//
  11      =2  //
  12      =2  // FID:            34X000063
  13      =2  // Target:         C8051F34x
  14      =2  // Tool chain:     Keil
  15      =2  // Command Line:   See Readme.txt
  16      =2  // Project Name:   F34x_USB_MSD
  17      =2  //
  18      =2  // Release 1.1
  19      =2  //    -All changes by PKC
  20      =2  //    -09 JUN 2006
  21      =2  //    -No changes; incremented revision number to match project re
             -vision
  22      =2  //
  23      =2  // Release 1.0
  24      =2  //    -Initial Release
  25      =2  //
  26      =2  // 11/22/02 - DM: 1. Updated function prototypes and added constan
             -ts
  27      =2  //                to F34x_USB_Main.h with sample interrupt firmwar
             -e.
  28      =2  
  29      =2  //----------------------------------------------------------------
             --------------
  30      =2  // Header File Preprocessor Directive
  31      =2  //----------------------------------------------------------------
             --------------
  32      =2  
  33 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -