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

📄 f34x_msd_usb_isr.lst

📁 USB读写SD卡例程
💻 LST
📖 第 1 页 / 共 5 页
字号:
 115      =1  
 116      =1  // CMIE
 117      =1  #define  rbSOFE         0x08
 118      =1  #define  rbRSTINTE      0x04
 119      =1  #define  rbRSUINTE      0x02
 120      =1  #define  rbSUSINTE      0x01
 121      =1  
 122      =1  // E0CSR
 123      =1  #define  rbSSUEND       0x80
 124      =1  #define  rbSOPRDY       0x40
 125      =1  #define  rbSDSTL        0x20
 126      =1  #define  rbSUEND        0x10
 127      =1  #define  rbDATAEND      0x08
 128      =1  #define  rbSTSTL        0x04
 129      =1  #define  rbINPRDY       0x02
 130      =1  #define  rbOPRDY        0x01
 131      =1  
 132      =1  // EINCSR1
 133      =1  #define  rbInCLRDT      0x40
 134      =1  #define  rbInSTSTL      0x20
 135      =1  #define  rbInSDSTL      0x10
 136      =1  #define  rbInFLUSH      0x08
 137      =1  #define  rbInUNDRUN     0x04
 138      =1  #define  rbInFIFONE     0x02
 139      =1  #define  rbInINPRDY     0x01
 140      =1  
 141      =1  // EINCSR2
 142      =1  #define  rbInDBIEN      0x80
 143      =1  #define  rbInISO        0x40
 144      =1  #define  rbInDIRSEL     0x20
 145      =1  #define  rbInFCDT       0x08
 146      =1  #define  rbInSPLIT      0x04  
 147      =1  
 148      =1  // EOUTCSR1
 149      =1  #define  rbOutCLRDT     0x80
 150      =1  #define  rbOutSTSTL     0x40
 151      =1  #define  rbOutSDSTL     0x20
 152      =1  #define  rbOutFLUSH     0x10
 153      =1  #define  rbOutDATERR    0x08
 154      =1  #define  rbOutOVRUN     0x04
C51 COMPILER V7.50   F34X_MSD_USB_ISR              11/28/2006 10:54:34 PAGE 18  

 155      =1  #define  rbOutFIFOFUL   0x02
 156      =1  #define  rbOutOPRDY     0x01
 157      =1  
 158      =1  // EOUTCSR2
 159      =1  #define  rbOutDBOEN     0x80
 160      =1  #define  rbOutISO       0x40 
 161      =1  
 162      =1  // INDEX IDENTIFIERS
 163      =1  #define  EP0_IDX                0x00
 164      =1  #ifdef __F326_VER__
           =1 #define  EP2_OUT_IDX    0x01
           =1 #else
 167      =1  #define   EP2_OUT_IDX   0x02
 168      =1  #endif
 169      =1  #define  EP1_IN_IDX             0x01
 170      =1  
 171      =1  // Register read/write macros
 172      =1  
 173      =1  // These first two macros do not poll for busy, and can be used to
             - increase program speed where
 174      =1  // neccessary, but should never be used for successive reads or wr
             -ites.
 175      =1  #define READ_BYTE(addr, target) USB0ADR = (0x80 | addr); while(USB
             -0ADR & 0x80); target = USB0DAT
 176      =1  #define WRITE_BYTE(addr, data) USB0ADR = (addr); USB0DAT = data
 177      =1  
 178      =1  // These two macros are polling versions of the above macros, and 
             -can be used for successive reads/
 179      =1  // writes without taking the chance that the Interface Engine is b
             -usy from the last register access.
 180      =1  #define POLL_READ_BYTE(addr, target) while(USB0ADR & 0x80); READ_B
             -YTE(addr, target);
 181      =1  #define POLL_WRITE_BYTE(addr, data) while(USB0ADR & 0x80); WRITE_B
             -YTE(addr, data);
 182      =1  
 183      =1  #endif /* _USB_REGS_H_ */
  37          #include "F34x_MSD_USB_Main.h"
   1      =1  //----------------------------------------------------------------
             --------------
   2      =1  // F34x_MSD_USB_Main.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  // Main header file for USB firmware. Includes function prototypes
             -,
  10      =1  // standard constants, and configuration constants.//
  11      =1  //
  12      =1  // FID:            34X000063
  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
C51 COMPILER V7.50   F34X_MSD_USB_ISR              11/28/2006 10:54:34 PAGE 19  

  22      =1  //
  23      =1  // Release 1.0
  24      =1  //    -Initial Release
  25      =1  //
  26      =1  // 11/22/02 - DM: 1. Updated function prototypes and added constan
             -ts
  27      =1  //                to F34x_USB_Main.h with sample interrupt firmwar
             -e.
  28      =1  
  29      =1  //----------------------------------------------------------------
             --------------
  30      =1  // Header File Preprocessor Directive
  31      =1  //----------------------------------------------------------------
             --------------
  32      =1  
  33      =1  #ifndef _USB_MAIN_H_
  34      =1  #define _USB_MAIN_H_
  35      =1  
  36      =1  #include "F34x_MSD_Definitions.h"
   1      =2  //----------------------------------------------------------------
             --------------
   2      =2  // F34x_MSD_Definitions.h
   3      =2  //----------------------------------------------------------------
             --------------
   4      =2  // Copyright 2006 Silicon Laboratories, Inc.
   5      =2  // http://www.silabs.com
   6      =2  //
   7      =2  // Program Description:
   8      =2  //
   9      =2  // Header file with all definitions.
  10      =2  //
  11      =2  //
  12      =2  // FID:            34X000032
  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  //    -Replaced SFR definitions file "c8051f320.h" with "c8051f340
             -.h"
  22      =2  //
  23      =2  // Release 1.0
  24      =2  //    -Initial Release
  25      =2  //
  26      =2  
  27      =2  //----------------------------------------------------------------
             --------------
  28      =2  // Header File Preprocessor Directive
  29      =2  //----------------------------------------------------------------
             --------------
  30      =2  
  31      =2  #ifndef __DEFINITIONS_H__
           =2 #define __DEFINITIONS_H__
           =2 
           =2 #define DEBUG_TIMEOUTS
           =2 #include "c8051f340.h"
           =2 #ifdef DEBUG_TIMEOUTS
           =2 sbit START_STOP_SPI = P3^0 ;
           =2 sbit START_STOP_READ_TO = P3^1;
C51 COMPILER V7.50   F34X_MSD_USB_ISR              11/28/2006 10:54:34 PAGE 20  

           =2 sbit START_STOP_WRITE_TO = P3^2;
           =2 
           =2 #define START_SPI_TIMEOUT (START_STOP_SPI = 1)
           =2 #define STOP_SPI_TIME_OUT (START_STOP_SPI = 0)
           =2 #define START_READ_COPY (START_STOP_READ_TO = 1)
           =2 #define STOP_READ_COPY (START_STOP_READ_TO = 0)
           =2 #define START_WRITE_COPY (START_STOP_WRITE_TO = 1)
           =2 #define STOP_WRITE_COPY (START_STOP_WRITE_TO = 0)
           =2 #else
           =2 
           =2 #define START_SPI_TIMEOUT /\
           =2 /
           =2 #define STOP_SPI_TIME_OUT /\
           =2 /
           =2 #define START_READ_COPY /\
           =2 /
           =2 #define STOP_READ_COPY /\
           =2 /
           =2 #define START_WRITE_COPY /\
           =2 /
           =2 #define STOP_WRITE_COPY /\
           =2 /
           =2 
           =2 #endif
           =2 
           =2 #define ENDLINE         "\r\n"
           =2 #define ENDLINE_SGN '\r'
           =2 
           =2 #endif
  37      =1  //#define _USB_LOW_SPEED_                      // Change this comm
             -ent to make Full/Low speed
  38      =1  
  39      =1  #define SYSCLK                   12000000    // SYSCLK frequency i
             -n Hz
  40      =1  
  41      =1  // USB clock selections (SFR CLKSEL)
  42      =1  #define USB_4X_CLOCK             0x00        // Select 4x clock mu
             -ltiplier, for USB Full Speed
  43      =1  #define USB_INT_OSC_DIV_2        0x10        // See Data Sheet sec
             -tion 13. Oscillators
  44      =1  #define USB_EXT_OSC              0x20
  45      =1  #define USB_EXT_OSC_DIV_2        0x30
  46      =1  #define USB_EXT_OSC_DIV_3        0x40
  47      =1  #define USB_EXT_OSC_DIV_4        0x50
  48      =1  
  49      =1  // System clock selections (SFR CLKSEL)
  50      =1  #define SYS_INT_OSC              0x00        // Select to use inte
             -rnal oscillator
  51      =1  #define SYS_4X_MUL               0x03        // Select to use inte
             -rnal oscillator
  52      =1  #define SYS_EXT_OSC              0x01        // Select to use an e
             -xternal oscillator
  53      =1  #define SYS_4X_DIV_2             0x02
  54      =1  
  55      =1  // BYTE type definition
  56      =1  #ifndef _BYTE_DEF_
           =1 #define _BYTE_DEF_
           =1 typedef unsigned char BYTE;
           =1 #endif   /* _BYTE_DEF_ */
  60      =1  
  61      =1  // WORD type definition, for KEIL Compiler
  62      =1  #ifndef _WORD_DEF_                           // Compiler Specific,
C51 COMPILER V7.50   F34X_MSD_USB_ISR              11/28/2006 10:54:34 PAGE 21  

             - written for Little Endian
  63      =1  #define _WORD_DEF_
  64      =1  typedef union {unsigned int i; unsigned char c[2];} WORD;
  65      =1  #define LSB 1                                // All words sent to 
             -and received from the host are
  66      =1  #define MSB 0                                // little endian, thi
             -s is switched by software when
  67      =1                                               // neccessary.  These
             - sections of code have been marked
  68      =1                                                                                           // with "Compiler Specific" as above for easier modifi
             -cation
  69      =1  #endif   /* _WORD_DEF_ */
  70      =1  
  71      =1  // DWORD type definition
  72      =1  #ifndef _DWORD_DEF_
  73      =1  #define _DWORD_DEF_
  74      =1  typedef unsigned long DWORD;
  75      =1  #endif /* _DWORD_DEF_ */
  76      =1  
  77      =1  extern volatile DWORD xdata tickcount;
  78      =1  
  79      =1  // Define Endpoint Packet Sizes
  80      =1  #ifdef _USB_LOW_SPEED_
           =1 #define  EP0_P

⌨️ 快捷键说明

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