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

📄 led.asm

📁 ADI 公司的DSP ADSP21262 EZ-KIT LITE开发板的全部源代码
💻 ASM
字号:

//input - value to write to LED's is passed in via R4
//output - none - writes lower 8 bits of R4 out to LED latch

#include <def21262.h>
#include <asm_sprt.h> 


.section/pm seg_pmco;
.extern _LED_value;
.global _latchLEDs;
.extern _PP_avail;


_latchLEDs:

    r0=dm(PPCTL);   
    r1=PPBS; //wait for external bus to complete the transfer.
    r0=r0 AND r1;
    if ne jump(pc,-3); //if not zero, bus transaction is incomplete, wait.
    
    
//ready PP to TX one word to _LED latch via DMA
    ustat3=PPTRAN|PPBHC|PPDUR20; //disable PP to change parameters
    dm(PPCTL)=ustat3; 
    nop;
    
    dm(_LED_value)=r4;
    
    ustat3=_LED_value;      dm(IIPP)=ustat3;     nop;
    ustat3=0;               dm(IMPP)=ustat3; nop;
    ustat3=1;               dm(ICPP)=ustat3; nop;
    ustat3=0;               dm(EMPP)=ustat3; nop;
    //address that maps to _LED latch = 0x1400000
    ustat3=0x01400000;      dm(EIPP)=ustat3; nop;
    ustat3=1;               dm(ECPP)=ustat3; nop;

//initiate DMA
    ustat3=PPTRAN|PPBHC|PPDUR20|PPEN|PPDEN;; //disable PP to change parameters
    dm(PPCTL)=ustat3; 
    nop;
         
    r0=dm(PPCTL);   
    r1=PPBS; //wait for external bus to complete the transfer.
    r0=r0 AND r1;
    if ne jump(pc,-3); //if not zero, bus transaction is incomplete, wait.
    
    lcntr=20, do (pc,_loop_end) until lce;
        _loop_end: nop;
    
    dm(PPCTL)=r0;       //when zero, disable parallel port
    nop;
    nop;
    leaf_exit;
    
_latchLEDs.end:

⌨️ 快捷键说明

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