f34x_msd_util.lst

来自「PC机通过USB识别仪器上的SD卡!可以满足仪器存储大量数据的要求!」· LST 代码 · 共 1,297 行 · 第 1/5 页

LST
1,297
字号
 104      =2  #define  CLEAR_FEATURE          0x01        // Code for Clear Feat
             -ure
 105      =2  #define  SET_FEATURE            0x03        // Code for Set Featur
             -e
 106      =2  #define  SET_ADDRESS            0x05        // Code for Set Addres
             -s
 107      =2  #define  GET_DESCRIPTOR         0x06        // Code for Get Descri
             -ptor
 108      =2  #define  SET_DESCRIPTOR         0x07        // Code for Set Descri
             -ptor(not used)
 109      =2  #define  GET_CONFIGURATION      0x08        // Code for Get Config
             -uration
 110      =2  #define  SET_CONFIGURATION      0x09        // Code for Set Config
             -uration
 111      =2  #define  GET_INTERFACE          0x0A        // Code for Get Interf
             -ace
 112      =2  #define  SET_INTERFACE          0x0B        // Code for Set Interf
             -ace
 113      =2  #define  SYNCH_FRAME            0x0C        // Code for Synch Fram
             -e(not used)
 114      =2  #define  MSD_RESET                              0xFF            // Mass-storage device Reset
 115      =2  #define  MSD_GET_MAX_LUN                0xFE            // Mass-storage device Get Max LU
             -N
 116      =2  
 117      =2  // HID Request Codes
 118      =2  #define GET_REPORT                              0x01            // Code for Get Report
 119      =2  #define GET_IDLE                                0x02            // Code for Get Idle
 120      =2  #define GET_PROTOCOL                    0x03            // Code for Get Protocol
 121      =2  #define SET_REPORT                              0x09            // Code for Set Report
 122      =2  #define SET_IDLE                                0x0A            // Code for Set Idle
 123      =2  #define SET_PROTOCOL                    0x0B            // Code for Set Protocol
 124      =2  
 125      =2  // Define device states
 126      =2  #define  DEV_ATTACHED            0x00        // Device is in Attac
             -hed State
 127      =2  #define  DEV_POWERED             0x01        // Device is in Power
             -ed State
 128      =2  #define  DEV_DEFAULT             0x02        // Device is in Defau
             -lt State
 129      =2  #define  DEV_ADDRESS             0x03        // Device is in Addre
             -ssed State
 130      =2  #define  DEV_CONFIGURED          0x04        // Device is in Confi
             -gured State
 131      =2  #define  DEV_SUSPENDED           0x05        // Device is in Suspe
             -nded State
 132      =2  
 133      =2  // Define bmRequestType bitmaps
 134      =2  #define  IN_DEVICE               0x00        // Request made to de
             -vice, direction is IN 
 135      =2  #define  OUT_DEVICE              0x80        // Request made to de
             -vice, direction is OUT
 136      =2  #define  IN_INTERFACE            0x01        // Request made to in
C51 COMPILER V7.50   F34X_MSD_UTIL                 11/28/2006 10:54:41 PAGE 14  

             -terface, direction is IN
 137      =2  #define  OUT_INTERFACE           0x81        // Request made to in
             -terface, direction is OUT
 138      =2  #define  IN_ENDPOINT             0x02        // Request made to en
             -dpoint, direction is IN
 139      =2  #define  OUT_ENDPOINT            0x82        // Request made to en
             -dpoint, direction is OUT
 140      =2  
 141      =2  // Define wIndex bitmaps
 142      =2  #define  IN_EP1                  0x81        // Index values used 
             -by Set and Clear feature
 143      =2  #define  OUT_EP1                 0x01        // commands for Endpo
             -int_Halt
 144      =2  #define  IN_EP2                  0x82
 145      =2  #ifdef __F326_VER__
           =2 #define  OUT_EP2                                 0x01           
           =2 #else
 148      =2  #define  OUT_EP2                                 0x01           
 149      =2  #endif
 150      =2  
 151      =2  // Define wValue bitmaps for Standard Feature Selectors
 152      =2  #define  DEVICE_REMOTE_WAKEUP    0x01        // Remote wakeup feat
             -ure(not used)
 153      =2  #define  ENDPOINT_HALT           0x00        // Endpoint_Halt feat
             -ure selector
 154      =2  
 155      =2  // Define Endpoint States
 156      =2  #define  EP_IDLE                 0x00        // This signifies End
             -point Idle State
 157      =2  #define  EP_TX                   0x01        // Endpoint Transmit 
             -State
 158      =2  #define  EP_RX                   0x02        // Endpoint Receive S
             -tate
 159      =2  #define  EP_HALT                 0x03        // Endpoint Halt Stat
             -e (return stalls)
 160      =2  #define  EP_STALL                0x04        // Endpoint Stall (se
             -nd procedural stall next status phase)
 161      =2  #define  EP_ADDRESS              0x05        // Endpoint Address (
             -change FADDR during next status phase)
 162      =2  
 163      =2  // Function prototypes
 164      =2  // USB Routines
 165      =2  void USB_Resume(void);                       // This routine resum
             -es USB operation
 166      =2  void USB_Reset(void);                        // Called after USB b
             -us reset
 167      =2  void Handle_Setup(void);                     // Handle setup packe
             -t on Endpoint 0
 168      =2  void Handle_In1(BYTE* ptr_buf);                       // Handle in
             - packet on Endpoint 1
 169      =2  void Handle_Out2(void);                      // Handle out packet 
             -on Endpoint 2
 170      =2  void USB_Suspend(void);                      // This routine calle
             -d when suspend signalling on bus
 171      =2  void Out2_Get_Data(BYTE* ptr_buf);                               // Copies from FIFO to ptr_
             -buf, clears FIFO-full flag.
 172      =2  void Out2_Done(void);                                            // Call this when finished with the d
             -ata
 173      =2  
 174      =2  // Standard Requests
 175      =2  void Get_Status(void);                       // These are called f
             -or each specific standard request
C51 COMPILER V7.50   F34X_MSD_UTIL                 11/28/2006 10:54:41 PAGE 15  

 176      =2  void Clear_Feature(void);
 177      =2  void Set_Feature(void);
 178      =2  void Set_Address(void);
 179      =2  void Get_Descriptor(void);
 180      =2  void Get_Configuration(void);
 181      =2  void Set_Configuration(void);
 182      =2  void Get_Interface(void);
 183      =2  void Set_Interface(void);
 184      =2  
 185      =2  // MSD Specific Requests
 186      =2  // void Reset_Msd(void);
 187      =2  // void Get_MaxLUN(void);
 188      =2  
 189      =2  // Initialization Routines
 190      =2  void Sys_Clk_Init(void);                      // Initialize the sy
             -stem clock(depends on Full/Low speed)
 191      =2  void Port_Init(void);                        // Configure ports fo
             -r this specific application
 192      =2  void USB0_Init(void);                        // Configure USB core
             - for either Full/Low speed
 193      =2  void Timer_Init(void);                       // Start timer 2 for 
             -use by ADC and to check switches
 194      =2  void Adc_Init(void);                         // Configure ADC for 
             -continuous conversion, low-power mode
 195      =2  
 196      =2  // Other Routines
 197      =2  void Timer2_ISR(void);                       // Called when Timer 
             -2 overflows, see if switches are pressed
 198      =2  void Adc_ConvComple_ISR(void);               // When a conversion 
             -completes, switch ADC multiplexor
 199      =2  void USB_ISR(void);                          // Called to determin
             -e type of USB interrupt
 200      =2  void Fifo_ReadC(BYTE, unsigned int, BYTE *) ;
 201      =2  extern void Fifo_Read (BYTE, unsigned int, BYTE *) ; // Used for m
             -ultiple byte reads of Endpoint fifos
 202      =2  extern void Fifo_Write (BYTE, unsigned int, BYTE *) reentrant;// U
             -sed for multiple byte writes of Endpoint fifos
 203      =2  void Force_Stall(void);                      // Forces a procedura
             -l stall on Endpoint 0
 204      =2  void Delay(void);                            // Approximately 80 u
             -s/1 ms on Full/Low Speed
 205      =2  
 206      =2  void USB_In(BYTE* ptr_buf,unsigned count);
 207      =2  
 208      =2  void USB_Bulk_Init(void);
 209      =2  
 210      =2  extern unsigned xdata Out_Count;
 211      =2  extern BYTE xdata Out_Packet[EP2_PACKET_SIZE];
 212      =2  extern BYTE xdata In_count;
 213      =2  extern BYTE xdata In_Packet[EP1_PACKET_SIZE];
 214      =2  //extern BYTE xdata In_Overrun;
 215      =2  
 216      =2  #endif      /* _USB_MAIN_H_ */
 217      =2  
  36      =1  
  37      =1  //----------------------------------------------------------------
             --------------
  38      =1  // Function Prototypes
  39      =1  //----------------------------------------------------------------
             --------------
  40      =1  
  41      =1  extern DWORD htonl(DWORD d);
C51 COMPILER V7.50   F34X_MSD_UTIL                 11/28/2006 10:54:41 PAGE 16  

  42      =1  extern unsigned htons(unsigned w);
  43      =1  #define ntohs htons
  44      =1  #define ntohl htonl
  45      =1  
  46      =1  //----------------------------------------------------------------
             --------------
  47      =1  // Variable Prototype
  48      =1  //----------------------------------------------------------------
             --------------
  49      =1  
  50      =1  char* Str_Token(char* str);
  51      =1  
  52      =1  //----------------------------------------------------------------
             --------------
  53      =1  // Macros Prototypes
  54      =1  //----------------------------------------------------------------
             --------------
  55      =1  
  56      =1  #define min(a,b) (((a)<(b))?(a):(b))
  57      =1  #define max(a,b) (((a)>(b))?(a):(b))
  58      =1  
  59      =1  #define msb(x) (((x)>>8)&0x000000FFul)
  60      =1  #define lsb(x) ((x)&0x000000FFul)
  61      =1  
  62      =1  #endif
  39          #include <string.h>
   1      =1  /*----------------------------------------------------------------
             -----------
   2      =1  STRING.H
   3      =1  
   4      =1  String functions.
   5      =1  Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, In
             -c.
   6      =1  All rights reserved.
   7      =1  ------------------------------------------------------------------
             ---------*/
   8      =1  
   9      =1  #ifndef __STRING_H__
  10      =1  #define __STRING_H__
  11      =1  
  12      =1  #ifndef _SIZE_T
  13      =1   #define _SIZE_T
  14      =1   typedef unsigned int size_t;
  15      =1  #endif
  16      =1  
  17      =1  #ifndef NULL
  18      =1   #define NULL ((void *) 0L)
  19      =1  #endif
  20      =1  
  21      =1  #pragma SAVE
  22      =1  #pragma REGPARMS
  23      =1  extern char *strcat (char *s1, char *s2);
  24      =1  extern char *strncat (char *s1, char *s2, int n);
  25      =1  
  26      =1  extern char strcmp (char *s1, char *s2);
  27      =1  extern char strncmp (char *s1, char *s2, int n);
  28      =1  
  29      =1  extern char *strcpy (char *s1, char *s2);
  30      =1  extern char *strncpy (char *s1, char *s2, int n);
  31      =1  
  32      =1  extern int strlen (char *);
  33      =1  
C51 COMPILER V7.50   F34X_MSD_UTIL                 11/28/2006 10:54:41 PAGE 17  

  34      =1  extern char *strchr (const char *s, char c);
  35      =1  extern int strpos (const char *s, char c);
  36      =1  extern char *strrchr (const char *s, char c);
  37      =1  extern int strrpos (const char *s, char c);
  38      =1  
  39      =1  extern int strspn (char *s, char *set);
  40      =1  extern int strcspn (char *s, char *set);
  41      =1  extern char *strpbrk (char *s, char *set);
  42      =1  extern char *strrpbrk (char *s, char *set);
  43      =1  extern char *strstr  (char *s, char *sub);
  44      =1  extern char *strtok  (char *str, const char *set);
  45      =1  
  46      =1  extern char memcmp (void *s1, void *s2, int n);
  47      =1  extern void *memcpy (void *s1, void *s2, int n);

⌨️ 快捷键说明

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