led.asm

来自「ADI 公司的DSP ADSP21262 EZ-KIT LITE开发板的全部源代」· 汇编 代码 · 共 57 行

ASM
57
字号

//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 + =
减小字号Ctrl + -
显示快捷键?