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

📄 bulkloop.lst

📁 提供了usb接口fx2芯片的编程。从io输入到后来的差分信号输出。都给了详细的例子
💻 LST
📖 第 1 页 / 共 5 页
字号:
 201      =1  #define   OUT1BUF_USBVECT     (11 << 2)
 202      =1  #define   INOUT2BUF_USBVECT   (12 << 2)
 203      =1  #define   INOUT4BUF_USBVECT   (13 << 2)
 204      =1  #define   INOUT6BUF_USBVECT   (14 << 2)
 205      =1  #define   INOUT8BUF_USBVECT   (15 << 2)
 206      =1  #define   IBN_USBVECT         (16 << 2)
 207      =1  #define   SPARE1_USBVECT      (17 << 2)
 208      =1  #define   EP0PINGNAK_USBVECT  (18 << 2)
 209      =1  #define   EP1PINGNAK_USBVECT  (19 << 2)
 210      =1  #define   EP2PINGNAK_USBVECT  (20 << 2)
 211      =1  #define   EP4PINGNAK_USBVECT  (21 << 2)
 212      =1  #define   EP6PINGNAK_USBVECT  (22 << 2)
 213      =1  #define   EP8PINGNAK_USBVECT  (23 << 2)
 214      =1  #define   ERRLIM_USBVECT      (24 << 2)
 215      =1  #define   SPARE2_USBVECT      (25 << 2)
 216      =1  #define   SPARE3_USBVECT      (26 << 2)
 217      =1  #define   SPARE4_USBVECT      (27 << 2)
 218      =1  #define   EP2PIDERR_USBVECT   (28 << 2)
 219      =1  #define   EP4PIDERR_USBVECT   (29 << 2)
 220      =1  #define   EP6PIDERR_USBVECT   (30 << 2)
 221      =1  #define   EP8PIDERR_USBVECT   (31 << 2)
 222      =1  
 223      =1  typedef struct
 224      =1  {
 225      =1     BYTE   length;
 226      =1     BYTE   type;
 227      =1  }DSCR;
 228      =1  
 229      =1  typedef struct            // Device Descriptor
 230      =1  {
 231      =1     BYTE   length;         // Descriptor length ( = sizeof(DEVICEDSCR) )
 232      =1     BYTE   type;         // Decriptor type (Device = 1)
 233      =1     BYTE   spec_ver_minor;   // Specification Version (BCD) minor
C51 COMPILER V7.06   BULKLOOP                                                              12/29/2005 11:19:54 PAGE 5   

 234      =1     BYTE   spec_ver_major;   // Specification Version (BCD) major
 235      =1     BYTE   dev_class;      // Device class
 236      =1     BYTE   sub_class;      // Device sub-class
 237      =1     BYTE   protocol;      // Device sub-sub-class
 238      =1     BYTE   max_packet;      // Maximum packet size
 239      =1     WORD   vendor_id;      // Vendor ID
 240      =1     WORD   product_id;      // Product ID
 241      =1     WORD   version_id;      // Product version ID
 242      =1     BYTE   mfg_str;      // Manufacturer string index
 243      =1     BYTE   prod_str;      // Product string index
 244      =1     BYTE   serialnum_str;   // Serial number string index
 245      =1     BYTE   configs;      // Number of configurations
 246      =1  }DEVICEDSCR;
 247      =1  
 248      =1  typedef struct            // Device Qualifier Descriptor
 249      =1  {
 250      =1     BYTE   length;         // Descriptor length ( = sizeof(DEVICEQUALDSCR) )
 251      =1     BYTE   type;         // Decriptor type (Device Qualifier = 6)
 252      =1     BYTE   spec_ver_minor;   // Specification Version (BCD) minor
 253      =1     BYTE   spec_ver_major;   // Specification Version (BCD) major
 254      =1     BYTE   dev_class;      // Device class
 255      =1     BYTE   sub_class;      // Device sub-class
 256      =1     BYTE   protocol;      // Device sub-sub-class
 257      =1     BYTE   max_packet;      // Maximum packet size
 258      =1     BYTE   configs;      // Number of configurations
 259      =1     BYTE  reserved0;
 260      =1  }DEVICEQUALDSCR;
 261      =1  
 262      =1  typedef struct
 263      =1  {
 264      =1     BYTE   length;         // Configuration length ( = sizeof(CONFIGDSCR) )
 265      =1     BYTE   type;         // Descriptor type (Configuration = 2)
 266      =1     WORD   config_len;      // Configuration + End Points length
 267      =1     BYTE   interfaces;      // Number of interfaces
 268      =1     BYTE   index;         // Configuration number
 269      =1     BYTE   config_str;      // Configuration string
 270      =1     BYTE   attrib;         // Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu
 271      =1     BYTE   power;         // Power requirement (div 2 ma)
 272      =1  }CONFIGDSCR;
 273      =1  
 274      =1  typedef struct
 275      =1  {
 276      =1     BYTE   length;         // Interface descriptor length ( - sizeof(INTRFCDSCR) )
 277      =1     BYTE   type;         // Descriptor type (Interface = 4)
 278      =1     BYTE   index;         // Zero-based index of this interface
 279      =1     BYTE   alt_setting;   // Alternate setting
 280      =1     BYTE   ep_cnt;         // Number of end points 
 281      =1     BYTE   class;         // Interface class
 282      =1     BYTE   sub_class;      // Interface sub class
 283      =1     BYTE   protocol;      // Interface sub sub class
 284      =1     BYTE   interface_str;   // Interface descriptor string index
 285      =1  }INTRFCDSCR;
 286      =1  
 287      =1  typedef struct
 288      =1  {
 289      =1     BYTE   length;         // End point descriptor length ( = sizeof(ENDPNTDSCR) )
 290      =1     BYTE   type;         // Descriptor type (End point = 5)
 291      =1     BYTE   addr;         // End point address
 292      =1     BYTE   ep_type;      // End point type
 293      =1     BYTE   mp_L;         // Maximum packet size
 294      =1     BYTE   mp_H;
 295      =1     BYTE   interval;      // Interrupt polling interval
C51 COMPILER V7.06   BULKLOOP                                                              12/29/2005 11:19:54 PAGE 6   

 296      =1  }ENDPNTDSCR;
 297      =1  
 298      =1  typedef struct
 299      =1  {
 300      =1     BYTE   length;         // String descriptor length
 301      =1     BYTE   type;         // Descriptor type
 302      =1  }STRINGDSCR;
 303      =1  
 304      =1  typedef struct
 305      =1  {
 306      =1     BYTE   cntrl;         // End point control register
 307      =1     BYTE   bytes;         // End point buffer byte count
 308      =1  }EPIOC;
 309      =1  
 310      =1  typedef struct 
 311      =1  {
 312      =1     BYTE   length;
 313      =1     BYTE   *dat;
 314      =1     BYTE   count;
 315      =1     BYTE   status;
 316      =1  }I2CPCKT;
 317      =1  
 318      =1  //-----------------------------------------------------------------------------
 319      =1  // Globals
 320      =1  //-----------------------------------------------------------------------------
 321      =1  extern code BYTE   USB_AutoVector;
 322      =1  
 323      =1  extern WORD   pDeviceDscr;
 324      =1  extern WORD   pDeviceQualDscr;
 325      =1  extern WORD       pHighSpeedConfigDscr;
 326      =1  extern WORD       pFullSpeedConfigDscr; 
 327      =1  extern WORD   pConfigDscr;
 328      =1  extern WORD   pOtherConfigDscr;
 329      =1  extern WORD   pStringDscr;
 330      =1  
 331      =1  extern code DEVICEDSCR        DeviceDscr;
 332      =1  extern code DEVICEQUALDSCR    DeviceQualDscr;
 333      =1  extern code CONFIGDSCR        HighSpeedConfigDscr;
 334      =1  extern code CONFIGDSCR        FullSpeedConfigDscr;
 335      =1  extern code STRINGDSCR        StringDscr;
 336      =1  extern code DSCR              UserDscr;
 337      =1  
 338      =1  extern I2CPCKT   I2CPckt;
 339      =1  
 340      =1  //-----------------------------------------------------------------------------
 341      =1  // Function Prototypes
 342      =1  //-----------------------------------------------------------------------------
 343      =1  // fx2bug #ifdef CHIPREV_B
 344      =1  // fx2bug extern void EZUSB_IRQ_CLEAR(void);
 345      =1  // fx2bug #endif
 346      =1  
 347      =1  extern void EZUSB_Renum(void);
 348      =1  extern void EZUSB_Discon(BOOL renum);
 349      =1  
 350      =1  extern void EZUSB_Susp(void);
 351      =1  extern void EZUSB_Resume(void);
 352      =1  
 353      =1  extern void EZUSB_Delay1ms(void);
 354      =1  extern void EZUSB_Delay(WORD ms);
 355      =1  
 356      =1  extern CONFIGDSCR xdata*   EZUSB_GetConfigDscr(BYTE ConfigIdx);
 357      =1  extern INTRFCDSCR xdata*   EZUSB_GetIntrfcDscr(BYTE ConfigIdx, BYTE IntrfcIdx, BYTE AltSetting);
C51 COMPILER V7.06   BULKLOOP                                                              12/29/2005 11:19:54 PAGE 7   

 358      =1  extern STRINGDSCR xdata*   EZUSB_GetStringDscr(BYTE StrIdx);
 359      =1  extern DSCR xdata*      EZUSB_GetDscr(BYTE index, DSCR* dscr, BYTE type);
 360      =1  
 361      =1  extern void EZUSB_InitI2C(void);
 362      =1  extern BOOL EZUSB_WriteI2C_(BYTE addr, BYTE length, BYTE xdata *dat);
 363      =1  extern BOOL EZUSB_ReadI2C_(BYTE addr, BYTE length, BYTE xdata *dat);
 364      =1  extern BOOL EZUSB_WriteI2C(BYTE addr, BYTE length, BYTE xdata *dat);
 365      =1  extern BOOL EZUSB_ReadI2C(BYTE addr, BYTE length, BYTE xdata *dat);
 366      =1  extern void EZUSB_WaitForEEPROMWrite(BYTE addr);
 367      =1  
 368      =1  extern void modify_endpoint_stall(BYTE epid, BYTE stall);
 369      =1  
 370      =1  #endif   // FX2_H
   9          #include "fx2regs.h"
   1      =1  //-----------------------------------------------------------------------------
   2      =1  //   File:      FX2regs.h
   3      =1  //   Contents:   EZ-USB FX2 register declarations and bit mask definitions.
   4      =1  //
   5      =1  // $Archive: /USB/Target/Inc/fx2regs.h $
   6      =1  // $Date: 4/19/02 9:53a $
   7      =1  // $Revision: 35 $
   8      =1  //
   9      =1  //
  10      =1  //   Copyright (c) 2000 Cypress Semiconductor, All rights reserved
  11      =1  //-----------------------------------------------------------------------------
  12      =1  
  13      =1  #ifndef FX2REGS_H   /* Header Sentry */
  14      =1  #define FX2REGS_H
  15      =1  
  16      =1  //-----------------------------------------------------------------------------
  17      =1  // FX2 Related Register Assignments
  18      =1  //-----------------------------------------------------------------------------
  19      =1  
  20      =1  // The Ez-USB FX2 registers are defined here. We use FX2regs.h for register 
  21      =1  // address allocation by using "#define ALLOCATE_EXTERN". 
  22      =1  // When using "#define ALLOCATE_EXTERN", you get (for instance): 
  23      =1  // xdata volatile BYTE OUT7BUF[64]   _at_   0x7B40;
  24      =1  // Such lines are created from FX2.h by using the preprocessor. 
  25      =1  // Incidently, these lines will not generate any space in the resulting hex 
  26      =1  // file; they just bind the symbols to the addresses for compilation. 
  27      =1  // You just need to put "#define ALLOCATE_EXTERN" in your main program file; 
  28      =1  // i.e. fw.c or a stand-alone C source file. 
  29      =1  // Without "#define ALLOCATE_EXTERN", you just get the external reference: 
  30      =1  // extern xdata volatile BYTE OUT7BUF[64]   ;//   0x7B40;
  31      =1  // This uses the concatenation operator "##" to insert a comment "//" 
  32      =1  // to cut off the end of the line, "_at_   0x7B40;", which is not wanted.
  33      =1  
  34      =1  #ifdef ALLOCATE_EXTERN
           =1 #define EXTERN
           =1 #define _AT_ _at_
           =1 #else
  38      =1  #define EXTERN extern
  39      =1  #define _AT_ ;/ ## /
  40      =1  #endif
  41      =1  
  42      =1  EXTERN xdata volatile BYTE GPIF_WAVE_DATA    _AT_ 0xE400;
  43      =1  EXTERN xdata volatile BYTE RES_WAVEDATA_END  _AT_ 0xE480;
  44      =1  
  45      =1  // General Configuration
  46      =1  

⌨️ 快捷键说明

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