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

📄 temp_gpif.lst

📁 EZ USB GPIF的控制器的源代码
💻 LST
📖 第 1 页 / 共 3 页
字号:
 348          
 349          #define GPIF_FLGSELPF 0
 350          #define GPIF_FLGSELEF 1
 351          #define GPIF_FLGSELFF 2
 352          
 353          // Set EP2GPIF Decision Point FIFO Flag Select (PF, EF, FF)
 354          void SetEP2GPIFFLGSEL( WORD DP_FIFOFlag )
 355          {
 356   1        EP2GPIFFLGSEL = DP_FIFOFlag;
 357   1      }
 358          
 359          // Set EP4GPIF Decision Point FIFO Flag Select (PF, EF, FF)
 360          void SetEP4GPIFFLGSEL( WORD DP_FIFOFlag )
 361          {
 362   1        EP4GPIFFLGSEL = DP_FIFOFlag;
 363   1      }
 364          
 365          // Set EP6GPIF Decision Point FIFO Flag Select (PF, EF, FF)
C51 COMPILER V8.05a   TEMP_GPIF                                                            01/17/2009 11:23:18 PAGE 7   

 366          void SetEP6GPIFFLGSEL( WORD DP_FIFOFlag )
 367          {
 368   1        EP6GPIFFLGSEL = DP_FIFOFlag;
 369   1      }
 370          
 371          // Set EP8GPIF Decision Point FIFO Flag Select (PF, EF, FF)
 372          void SetEP8GPIFFLGSEL( WORD DP_FIFOFlag )
 373          {
 374   1        EP8GPIFFLGSEL = DP_FIFOFlag;
 375   1      }
 376          
 377          // Set EP2GPIF Programmable Flag STOP, overrides Transaction Count
 378          void SetEP2GPIFPFSTOP( void )
 379          {
 380   1        EP2GPIFPFSTOP = 0x01;
 381   1      }
 382          
 383          // Set EP4GPIF Programmable Flag STOP, overrides Transaction Count
 384          void SetEP4GPIFPFSTOP( void )
 385          {
 386   1        EP4GPIFPFSTOP = 0x01;
 387   1      }
 388          
 389          // Set EP6GPIF Programmable Flag STOP, overrides Transaction Count
 390          void SetEP6GPIFPFSTOP( void )
 391          {
 392   1        EP6GPIFPFSTOP = 0x01;
 393   1      }
 394          
 395          // Set EP8GPIF Programmable Flag STOP, overrides Transaction Count
 396          void SetEP8GPIFPFSTOP( void )
 397          {
 398   1        EP8GPIFPFSTOP = 0x01;
 399   1      }
 400          
 401          // write single byte to PERIPHERAL, using GPIF
 402          void Peripheral_SingleByteWrite( BYTE gdata )
 403          {
 404   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 405   1        {
 406   2           ;
 407   2        }
 408   1      
 409   1        XGPIFSGLDATLX = gdata;        // trigger GPIF 
 410   1                                      // ...single byte write transaction
 411   1      }
 412          
 413          // write single word to PERIPHERAL, using GPIF
 414          void Peripheral_SingleWordWrite( WORD gdata )
 415          {
 416   1        while( !( GPIFTRIG & 0x80 ) )  // poll GPIFTRIG.7 Done bit
 417   1        {
 418   2          ;
 419   2        }
 420   1      
 421   1      // using register(s) in XDATA space
 422   1        XGPIFSGLDATH = gdata >> 8;              
 423   1        XGPIFSGLDATLX = gdata;        // trigger GPIF 
 424   1                                      // ...single word write transaction
 425   1      }
 426          
 427          // read single byte from PERIPHERAL, using GPIF
C51 COMPILER V8.05a   TEMP_GPIF                                                            01/17/2009 11:23:18 PAGE 8   

 428          void Peripheral_SingleByteRead( BYTE xdata *gdata )
 429          {
 430   1        static BYTE g_data = 0x00;
 431   1      
 432   1        while( !( GPIFTRIG & 0x80 ) )  // poll GPIFTRIG.7 Done bit
 433   1        {
 434   2           ;
 435   2        }
 436   1      
 437   1      // using register(s) in XDATA space, dummy read
 438   1        g_data = XGPIFSGLDATLX;       // trigger GPIF 
 439   1                                      // ...single byte read transaction
 440   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 441   1        {
 442   2           ;
 443   2        }
 444   1      
 445   1      // using register(s) in XDATA space, 
 446   1        *gdata = XGPIFSGLDATLNOX;     // ...GPIF reads byte from PERIPHERAL
 447   1      }
 448          
 449          // read single word from PERIPHERAL, using GPIF
 450          void Peripheral_SingleWordRead( WORD xdata *gdata )
 451          {
 452   1        BYTE g_data = 0x00;
 453   1      
 454   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 455   1        {
 456   2           ;
 457   2        }
 458   1      
 459   1      // using register(s) in XDATA space, dummy read
 460   1        g_data = XGPIFSGLDATLX;       // trigger GPIF 
 461   1                                      // ...single word read transaction
 462   1      
 463   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 464   1        {
 465   2           ;
 466   2        }
 467   1      
 468   1      // using register(s) in XDATA space, GPIF reads word from PERIPHERAL
 469   1        *gdata = ( ( WORD )XGPIFSGLDATH << 8 ) | ( WORD )XGPIFSGLDATLNOX;
 470   1      }
 471          
 472          #define GPIFTRIGWR 0
 473          #define GPIFTRIGRD 4
 474          
 475          #define GPIF_EP2 0
 476          #define GPIF_EP4 1
 477          #define GPIF_EP6 2
 478          #define GPIF_EP8 3
 479          
 480          // write byte(s)/word(s) to PERIPHERAL, using GPIF and EPxFIFO
 481          // if EPx WORDWIDE=0 then write byte(s)
 482          // if EPx WORDWIDE=1 then write word(s)
 483          void Peripheral_FIFOWrite( BYTE FIFO_EpNum )
 484          {
 485   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 Done bit
 486   1        {
 487   2           ;
 488   2        }
 489   1      
C51 COMPILER V8.05a   TEMP_GPIF                                                            01/17/2009 11:23:18 PAGE 9   

 490   1        // trigger FIFO write transaction(s), using SFR
 491   1        GPIFTRIG = FIFO_EpNum;  // R/W=0, EP[1:0]=FIFO_EpNum for EPx write(s)
 492   1      }
 493          
 494          // read byte(s)/word(s) from PERIPHERAL, using GPIF and EPxFIFO
 495          // if EPx WORDWIDE=0 then read byte(s)
 496          // if EPx WORDWIDE=1 then read word(s)
 497          void Peripheral_FIFORead( BYTE FIFO_EpNum )
 498          {
 499   1        while( !( GPIFTRIG & 0x80 ) ) // poll GPIFTRIG.7 GPIF Done bit
 500   1        {
 501   2           ;
 502   2        }
 503   1      
 504   1        // trigger FIFO read transaction(s), using SFR
 505   1        GPIFTRIG = GPIFTRIGRD | FIFO_EpNum; // R/W=1, EP[1:0]=FIFO_EpNum for EPx read(s)
 506   1      }
 507          
 508          
 509          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    454    ----
   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 + -