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

📄 isp1581.lst

📁 at89c51+isp1581控制程序(c语言源代码).包含快速模式和高速模式
💻 LST
📖 第 1 页 / 共 2 页
字号:
 323   1      }
 324          
 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 V6.20c  ISP1581                                                               05/19/2003 01:04:58 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 V6.20c  ISP1581                                                               05/19/2003 01:04:58 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 V6.20c  ISP1581                                                               05/19/2003 01:04:58 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   1      	USHORT i;
 531   1      	if(bZBoardFlags.bits.At_IRQL1 == 0)
 532   1      		RaiseIRQL();
 533   1      
 534   1      	//outport(aport, rega_dmacfg);
 535   1      	i = inport(rega_dmacfg);
 536   1      
 537   1      	if(bZBoardFlags.bits.At_IRQL1 == 0)
 538   1      		LowerIRQL();
 539   1      	return i;
 540   1      }
 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 V6.20c  ISP1581                                                               05/19/2003 01:04:58 PAGE 10  

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

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


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