📄 main.asm
字号:
.title "main-dsk"
***********************************************************************
* This programme aims for testing the dspvc5402 analogy loopback *
***********************************************************************
.include "regs.h"
.def main
.def BRINT1_ISR
.ref init_5402
.ref init_McBSP
.ref init_AD50
***********************************************************************
* Declare the stack. Size is determined by the linker option -stack. *
* The default value is 1K words. *
***********************************************************************
stack: .usect ".stack",100h
*=====================================================================*
* allocate data memory for data table *
*=====================================================================*
length .set 0FFh ; data table of length FFh
.sect ".table"
***********************************************************************
* VARIABLE AND GLOBAL FUNCTION DECLARATIONS *
***********************************************************************
.data
temp .word 00000h ; temp storage
freq_scale .word 00001h
ampl_scale .word 07FFFh ; amplitude scaling factor
; (default =1)
host_cmd .word 00000h ; host cmd reg, init val: wait
.bss table,200h
***********************************************************************
* BEGINING OF EXECUTABLE CODE *
***********************************************************************
.text
main:
*=====================================================================*
* Init stack pointer. Stack grows from high to low address *
*=====================================================================*
STM #stack+100h,SP
nop
nop
nop
nop
*======================================================================*
* Main code starts from here *
*======================================================================*
ssbx intm ; globally disable all interrupts
call init_5402
call init_McBSP
call init_AD50
nop
nop
ssbx OVM ; OVM = 1 (saturate at overflow)
ssbx FRCT ; ASM = 1 (shift left 1-bit)
ssbx SXM
stm #McBSP1_DRR1,AR4 ; ar4 holds McBSP receive reg addr
stm #McBSP1_DXR1,AR5 ; ar5 holds McBSP xmit reg addr
STM #table,AR7
STM #200h,BK ;200h循环缓冲区
*======================================================================*
* Wait for host command *
*======================================================================*
*======================================================================*
* Enable McBSP1 Tx and Rx and the interrupts *
*======================================================================*
EN_OUTPUT:
stm SPCR2,McBSP1_SPSA
orm #0001h,McBSP1_SPSD ; enable xmtr
nop
nop
stm SPCR1,McBSP1_SPSA
orm #0001h,McBSP1_SPSD ; enable rcvr
nop
nop
stm #7fffh,IFR ; clear pending interrupts, if any
stm #0400h,IMR ; unmask McBSP1 Rx interrupt
NOP
NOP
rsbx intm ; globally enable all interrupts
WAIT:
NOP
NOP
bd WAIT ; branch to idle loop
nop
nop
**************************************
* RECIEVER INTERRUPT SERVICE ROUTINE *
**************************************
BRINT1_ISR:
LD *AR4 ,A
STL A,*AR7+%
AND #0FFFEH,A
STLM A,*AR5
RETE
nop
nop
here: b here
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -