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

📄 gpif-maxsingle.lst

📁 一个有关EZ-USB FX2 系列CY7C68013的应用实例
💻 LST
📖 第 1 页 / 共 3 页
字号:
 365   1        EP6GPIFTCHX = xfrcnt >> 8;  // setup transaction count
 366   1        SYNCDELAY;                    // 
 367   1        EP6GPIFTCLX = ( BYTE )xfrcnt;
 368   1      }
 369          
 370          // Set EP8GPIF Transaction Count
 371          void Peripheral_SetEP8GPIFTC( WORD xfrcnt )
 372          {
 373   1        SYNCDELAY;                    // 
 374   1        EP8GPIFTCH = xfrcnt >> 8;  // setup transaction count
 375   1        SYNCDELAY;                    // 
 376   1        EP8GPIFTCL = ( BYTE )xfrcnt;
 377   1      }
 378          
 379          #define GPIF_FLGSELPF 0
 380          #define GPIF_FLGSELEF 1
 381          #define GPIF_FLGSELFF 2
 382          
 383          // Set EP2GPIF Decision Point FIFO Flag Select (PF, EF, FF)
 384          void SetEP2GPIFFLGSEL( WORD DP_FIFOFlag )
 385          {
 386   1        EP2GPIFFLGSEL = DP_FIFOFlag;
 387   1      }
 388          
 389          // Set EP4GPIF Decision Point FIFO Flag Select (PF, EF, FF)
 390          void SetEP4GPIFFLGSEL( WORD DP_FIFOFlag )
 391          {
 392   1        EP4GPIFFLGSEL = DP_FIFOFlag;
 393   1      }
 394          
 395          // Set EP6GPIF Decision Point FIFO Flag Select (PF, EF, FF)
 396          void SetEP6GPIFFLGSEL( WORD DP_FIFOFlag )
 397          {
 398   1        EP6GPIFFLGSEL = DP_FIFOFlag;
 399   1      }
 400          
 401          // Set EP8GPIF Decision Point FIFO Flag Select (PF, EF, FF)
 402          void SetEP8GPIFFLGSEL( WORD DP_FIFOFlag )
 403          {
 404   1        EP8GPIFFLGSEL = DP_FIFOFlag;
 405   1      }
 406          
 407          // Set EP2GPIF Programmable Flag STOP, overrides Transaction Count
 408          void SetEP2GPIFPFSTOP( void )
 409          {
 410   1        EP2GPIFPFSTOP = 0x01;
 411   1      }
 412          
 413          // Set EP4GPIF Programmable Flag STOP, overrides Transaction Count
 414          void SetEP4GPIFPFSTOP( void )
 415          {
 416   1        EP4GPIFPFSTOP = 0x01;
 417   1      }
 418          
 419          // Set EP6GPIF Programmable Flag STOP, overrides Transaction Count
 420          void SetEP6GPIFPFSTOP( void )
 421          {
 422   1        EP6GPIFPFSTOP = 0x01;
 423   1      }
 424          
 425          // Set EP8GPIF Programmable Flag STOP, overrides Transaction Count
 426          void SetEP8GPIFPFSTOP( void )
C51 COMPILER V7.10   GPIF_MAXSINGLE                                                        09/25/2005 16:17:29 PAGE 8   

 427          {
 428   1        EP8GPIFPFSTOP = 0x01;
 429   1      }
 430          
 431          // write single byte to PERIPHERAL, using GPIF
 432          void Peripheral_SingleByteWrite( BYTE gdata )
 433          {
 434   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 435   1        {
 436   2           ;
 437   2        }
 438   1      
 439   1        XGPIFSGLDATLX = gdata;        // trigger GPIF 
 440   1                                      // ...single byte write transaction
 441   1      }
 442          
 443          // write single word to PERIPHERAL, using GPIF
 444          void Peripheral_SingleWordWrite( WORD gdata )
 445          {
 446   1        while( !( GPIFTRIG & 0x80 ) )  // poll GPIFTRIG.7 Done bit
 447   1        {
 448   2          ;
 449   2        }
 450   1      
 451   1      // using register(s) in XDATA space
 452   1        XGPIFSGLDATH = gdata >> 8;              
 453   1        XGPIFSGLDATLX = gdata;        // trigger GPIF 
 454   1                                      // ...single word write transaction
 455   1      }
 456          
 457          // read single byte from PERIPHERAL, using GPIF
 458          void Peripheral_SingleByteRead( BYTE xdata *gdata )
 459          {
 460   1        static BYTE g_data = 0x00;
 461   1      
 462   1        while( !( GPIFTRIG & 0x80 ) )  // poll GPIFTRIG.7 Done bit
 463   1        {
 464   2           ;
 465   2        }
 466   1      
 467   1      // using register(s) in XDATA space, dummy read
 468   1        g_data = XGPIFSGLDATLX;       // trigger GPIF 
 469   1                                      // ...single byte read transaction
 470   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 471   1        {
 472   2           ;
 473   2        }
 474   1      
 475   1      // using register(s) in XDATA space, 
 476   1        *gdata = XGPIFSGLDATLNOX;     // ...GPIF reads byte from PERIPHERAL
 477   1      }
 478          
 479          // read single word from PERIPHERAL, using GPIF
 480          void Peripheral_SingleWordRead( WORD xdata *gdata )
 481          {
 482   1        BYTE g_data = 0x00;
 483   1      
 484   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 485   1        {
 486   2           ;
 487   2        }
 488   1      
C51 COMPILER V7.10   GPIF_MAXSINGLE                                                        09/25/2005 16:17:29 PAGE 9   

 489   1      // using register(s) in XDATA space, dummy read
 490   1        g_data = XGPIFSGLDATLX;       // trigger GPIF 
 491   1                                      // ...single word read transaction
 492   1      
 493   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 494   1        {
 495   2           ;
 496   2        }
 497   1      
 498   1      // using register(s) in XDATA space, GPIF reads word from PERIPHERAL
 499   1        *gdata = ( ( WORD )XGPIFSGLDATH << 8 ) | ( WORD )XGPIFSGLDATLNOX;
 500   1      }
 501          
 502          #define GPIFTRIGWR 0
 503          #define GPIFTRIGRD 4
 504          
 505          #define GPIF_EP2 0
 506          #define GPIF_EP4 1
 507          #define GPIF_EP6 2
 508          #define GPIF_EP8 3
 509          
 510          // write byte(s)/word(s) to PERIPHERAL, using GPIF and EPxFIFO
 511          // if EPx WORDWIDE=0 then write byte(s)
 512          // if EPx WORDWIDE=1 then write word(s)
 513          void Peripheral_FIFOWrite( BYTE FIFO_EpNum )
 514          {
 515   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 516   1        {
 517   2           ;
 518   2        }
 519   1      
 520   1        // trigger FIFO write transaction(s), using SFR
 521   1        GPIFTRIG = FIFO_EpNum;  // R/W=0, EP[1:0]=FIFO_EpNum for EPx write(s)
 522   1      }
 523          
 524          // read byte(s)/word(s) from PERIPHERAL, using GPIF and EPxFIFO
 525          // if EPx WORDWIDE=0 then read byte(s)
 526          // if EPx WORDWIDE=1 then read word(s)
 527          void Peripheral_FIFORead( BYTE FIFO_EpNum )
 528          {
 529   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
 530   1        {
 531   2           ;
 532   2        }
 533   1      
 534   1        // trigger FIFO read transaction(s), using SFR
 535   1        GPIFTRIG = GPIFTRIGRD | FIFO_EpNum; // R/W=1, EP[1:0]=FIFO_EpNum for EPx read(s)
 536   1      }
 537          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    473    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =    171    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      1    ----
   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 + -