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

📄 isp1581.lst

📁 DSP通过双口RAM和ISP1581实现下位机的USB固件程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 325          USHORT ISP1581_ReadInterruptRegisterLow(void) 
 326          {
 327   1              USHORT idata i = 0;
 328   1                      
 329   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 330   1                      RaiseIRQL();
 331   1              
 332   1              i = inport(rega_interrupt_low);
 333   1              
 334   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 335   1                      LowerIRQL();
 336   1      
 337   1              return i;
 338   1      }
 339          
 340          USHORT ISP1581_ReadInterruptRegisterHigh(void) 
 341          {
 342   1              USHORT idata i = 0;
 343   1              
 344   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 345   1                      RaiseIRQL();
 346   1      
 347   1              i = inport(rega_interrupt_high);
 348   1              
 349   1      
 350   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 351   1                      LowerIRQL();
 352   1      
 353   1              return i;
 354   1      }
 355          
 356          void ISP1581_IntClearl(USHORT wIntlow) //OK
 357          {
 358   1              outport(rega_interrupt_low,wIntlow);
 359   1      }
 360          
 361          void ISP1581_IntClearh(USHORT wInthigh) //OK
 362          {
 363   1              outport(rega_interrupt_high,wInthigh);
C51 COMPILER V7.06   ISP1581                                                               09/09/2005 13:57:31 PAGE 7   

 364   1              
 365   1      }
 366          UCHAR ISP1581_GetMode(void)
 367          {
 368   1              UCHAR c;
 369   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 370   1                      RaiseIRQL();
 371   1      
 372   1              //outport(aport, rega_mode);
 373   1              c = inportb(rega_mode);
 374   1      
 375   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 376   1                      LowerIRQL();
 377   1              return c;
 378   1      }
 379          
 380          void ISP1581_SetMode(UCHAR bMode)  //OK
 381          {
 382   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 383   1                      RaiseIRQL();
 384   1      
 385   1              outportb(rega_mode, bMode);
 386   1      
 387   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 388   1                      LowerIRQL();
 389   1      }
 390          void ISP1581_SetTestMode(unsigned char testmode) //OK
 391          {
 392   1              outportb(rega_testmode,testmode);
 393   1      }
 394          
 395          void ISP1581_SetIntConfig(unsigned char IntConfig) //OK
 396          {
 397   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 398   1                      RaiseIRQL();
 399   1      
 400   1              outportb(rega_intcfg,IntConfig);
 401   1      
 402   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 403   1                      LowerIRQL();
 404   1      }
 405          USHORT ISP1581_GetIntEnableLow(void)
 406          {
 407   1              USHORT i;
 408   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 409   1                      RaiseIRQL();
 410   1      
 411   1              i = inport(rega_intmask_low);
 412   1      
 413   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 414   1                      LowerIRQL();
 415   1              return i;
 416   1      }
 417          void ISP1581_SetIntEnableLow(USHORT int_vector)//OK
 418          {
 419   1              //unsigned short temp2;
 420   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 421   1                      RaiseIRQL();
 422   1      
 423   1              outport(rega_intmask_low,int_vector);
 424   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 425   1                      LowerIRQL();
C51 COMPILER V7.06   ISP1581                                                               09/09/2005 13:57:31 PAGE 8   

 426   1      }
 427          
 428          USHORT ISP1581_GetIntEnableHigh(void)   //OK
 429          {
 430   1              USHORT i;
 431   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 432   1                      RaiseIRQL();
 433   1      
 434   1              //outport(aport, rega_intmask_high); // assigned interrupt register address;
 435   1              i = inport(rega_intmask_high);
 436   1              
 437   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 438   1                      LowerIRQL();
 439   1              return i;
 440   1      }
 441          
 442          void ISP1581_SetIntEnableHigh(USHORT int_vector)        //OK
 443          {
 444   1      
 445   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 446   1                      RaiseIRQL();
 447   1      
 448   1              outport(rega_intmask_high,int_vector);
 449   1      
 450   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 451   1                      LowerIRQL();
 452   1      }
 453          
 454          void ISP1581_SetEndpointConfig(UCHAR bEPIndex, UCHAR bEPConfig) //OK
 455          {
 456   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 457   1                      RaiseIRQL();
 458   1      
 459   1              ISP1581_SetEPIndex(bEPIndex);
 460   1      
 461   1              outportb(rega_eptype,bEPConfig);
 462   1      
 463   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 464   1                      LowerIRQL();
 465   1      }
 466          
 467          void ISP1581_ClearBuffer(UCHAR bEPIndex)
 468          {
 469   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 470   1                      RaiseIRQL();
 471   1      
 472   1          /* Select Endpoint */
 473   1              ISP1581_SetEPIndex(bEPIndex);
 474   1              outportb(rega_epctlfc, epctlfc_clbuf);
 475   1         
 476   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 477   1                      LowerIRQL();
 478   1      }
 479          
 480          void ISP1581_SetEPMAXSize(unsigned char bEPIndex, unsigned short epmaxsize) //OK
 481          {
 482   1              ISP1581_SetEPIndex(bEPIndex);
 483   1              outport(rega_epmaxsize,epmaxsize);
 484   1              
 485   1      }
 486          
 487          
C51 COMPILER V7.06   ISP1581                                                               09/09/2005 13:57:31 PAGE 9   

 488          void ISP1581_UnlockDevice(void)
 489          {
 490   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 491   1                      RaiseIRQL();
 492   1      
 493   1              outport(rega_unlock, 0xaa37);
 494   1      
 495   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 496   1                      LowerIRQL();
 497   1      }
 498          
 499          unsigned short ISP1581_ReadChipID(void)
 500          {
 501   1              unsigned short i;
 502   1      
 503   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 504   1                      RaiseIRQL();
 505   1      
 506   1              i = inport(rega_chipid+1);
 507   1              
 508   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 509   1                      LowerIRQL();
 510   1      
 511   1              return i;
 512   1      }
 513          
 514          
 515          /////////////////////////////////////////////////////
 516          void ISP1581_SetDMAConfig(USHORT wDMACnfg)
 517          {
 518   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 519   1                      RaiseIRQL();
 520   1      
 521   1              //outport(aport, rega_dmacfg);
 522   1              outport(rega_dmacfg, wDMACnfg);
 523   1      
 524   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 525   1                      LowerIRQL();
 526   1      }
 527          
 528          /*USHORT ISP1581_GetDMAConfig(void)
 529          {
 530                  USHORT i;
 531                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 532                          RaiseIRQL();
 533          
 534                  //outport(aport, rega_dmacfg);
 535                  i = inport(rega_dmacfg);
 536          
 537                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 538                          LowerIRQL();
 539                  return i;
 540          }
 541          */
 542          void ISP1581_SetDMAHDCfg(unsigned char dmahdcfg)
 543          {
 544   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
 545   1                      RaiseIRQL();
 546   1      
 547   1              outportb(rega_dmahdcfg,dmahdcfg);
 548   1      
 549   1              if(bZBoardFlags.bits.At_IRQL1 == 0)
C51 COMPILER V7.06   ISP1581                                                               09/09/2005 13:57:31 PAGE 10  

 550   1                      LowerIRQL();
 551   1      }
 552          /*
 553          unsigned char ISP1581_GetDMAHDCfg(void)
 554          {
 555                  unsigned char i;
 556                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 557                          RaiseIRQL();
 558          
 559                  i = inportb(rega_dmahdcfg);
 560                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 561                          LowerIRQL();
 562                  return i;
 563          }
 564          */
 565          /*
 566          void ISP1581_SetDMACMD(unsigned char bCMD)
 567          {
 568                  outportb(rega_dmacmd, bCMD);
 569          }
 570          
 571          void ISP1581_SetDMACounterLow(USHORT wDMACounter)
 572          {
 573                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 574                          RaiseIRQL();
 575          
 576                  outport(rega_dmacount, wDMACounter);
 577          
 578                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 579                          LowerIRQL();
 580          }
 581          
 582          void ISP1581_SetDMACounterHigh(USHORT wDMACounter)
 583          {
 584                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 585                          RaiseIRQL();
 586          
 587                  outport(rega_dmacount+0x2, wDMACounter);
 588          
 589                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 590                          LowerIRQL();
 591          }
 592          
 593          USHORT ISP1581_GetDMACounterLow(void)
 594          {
 595                  USHORT i;
 596                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 597                          RaiseIRQL();
 598          
 599                  i = inport(rega_dmacount);
 600          
 601                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 602                          LowerIRQL();
 603                  return i;
 604          }
 605          
 606          USHORT ISP1581_GetDMACounterHigh(void)
 607          {
 608                  USHORT i;
 609                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 610                          RaiseIRQL();
 611          
C51 COMPILER V7.06   ISP1581                                                               09/09/2005 13:57:31 PAGE 11  

 612                  i = inport(rega_dmacount+0x2);
 613          
 614                  if(bZBoardFlags.bits.At_IRQL1 == 0)
 615                          LowerIRQL();
 616                  return i;
 617          }
 618          */
 619          /*void ISP1581_SetDMAIntMask(unsigned short dmaintmask)
 620          {
 621                  //outport(aport, rega_dmaintmask);
 622                  outport(rega_dmaintmask, dmaintmask);
 623          }
 624          unsigned short ISP1581_GetDMAIntMask(void)
 625          {
 626                  return inport(rega_dmaintmask);
 627          }*/
 628          USHORT ISP1581_GetDMAInt(void)
 629          {
 630   1              return inport(rega_dmaint);
 631   1      }
 632          
 633          void ISP1581_SetDMAInt(USHORT dma_int)
 634          {
 635   1              outport(rega_dmaint, dma_int);
 636   1      }
 637          
 638          
 639          //void ISP1581_SetDMAEP(unsigned char dmaep)
 640          //{
 641          //      outportb(rega_dmaep,dmaep);
 642          //}
 643          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1343    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      41
   IDATA SIZE       =   ----       9
   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 + -