📄 loopcontrol.asm
字号:
; THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
; REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
; INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
; FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
; COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
; TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
; POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
; INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
; YOUR USE OF THE PROGRAM.
;
; IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
; CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
; THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
; OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
; OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
; EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
; REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
; OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
; USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
; AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
; YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
; (U.S.$500).
;
; Unless otherwise stated, the Program written and copyrighted
; by Texas Instruments is distributed as "freeware". You may,
; only under TI's copyright in the Program, use and modify the
; Program without any charge or restriction. You may
; distribute to third parties, provided that you transfer a
; copy of this license to the third party and the third party
; agrees to these terms by its first use of the Program. You
; must reproduce the copyright notice and any other legend of
; ownership on each copy or partial copy, of the Program.
;
; You acknowledge and agree that the Program contains
; copyrighted material, trade secrets and other TI proprietary
; information and is protected by copyright laws,
; international copyright treaties, and trade secret laws, as
; well as other intellectual property laws. To protect TI's
; rights in the Program, you agree not to decompile, reverse
; engineer, disassemble or otherwise translate any object code
; versions of the Program to a human-readable form. You agree
; that in no event will you alter, remove or destroy any
; copyright notice included in the Program. TI reserves all
; rights not specifically granted under this license. Except
; as specifically provided herein, nothing in this agreement
; shall be construed as conferring by implication, estoppel,
; or otherwise, upon you, any license or other right under any
; TI patents, copyrights or trade secrets.
;
; You may not use the Program in non-TI devices.
************************************************************************
** File Name: LoopControl.asm
** Part Number: TLV320AIC10/11EVM-SW-0010
************************************************************************
** Copyright (c) Texas Instruments, Inc. 2000
************************************************************************
**
** Release History:
** Version Date Engr Description
** 1.00 10-11-2000 Wendy X Fang Original Release
**
************************************************************************
**
** Function:
** This program has the following two functions:
** (1) control main loop repeat rate, here is equals to 10KHz
** (using time0 to control and where
** =CPUCLKFreq/(TDDR+1)/(PRD+1)=50M/3125=16KHz)
** (2) flash XF pin at 1hz rate to indicate the main loop is running
** (which can also be called DSP safety checking and indicating).
**
************************************************************************
** References:
** (1) TMS320C54x DSP, CPU and Peripheral (SPRU131)
************************************************************************
.global _LoopControl
************************************************************************
** Include Statements
************************************************************************
.include MMRegs.h
************************************************************************
** Varaible & Initialization
************************************************************************
.global LoopCount
Sparee .usect ".variable", 5
LoopCount .usect ".variable", 1 ; main loop counter (system var)
.ref _DCSICount
.ref _DCSIConfig
.ref _MasterCRValues
************************************************************************
** Function Routine
************************************************************************
_LoopControl:
NOP
******* DCSI is used for the configuration
******* of AIC10 device control registers
NOP
LD *(_DCSIConfig), A ; check if DCSI config flag is on
BC LoopWait0, AEQ ; no, skip
NOP ; otherwise
STM SPCR1, McBSP1_SPSA ; register subaddr of SPCR1
STM #4020h, McBSP1_SPSD ; McBSP1 recv = left-justify
; RINT generated by frame sync
STM SPCR2, McBSP1_SPSA ; register subaddr for SPCR2
; XINT generated by frame sync
STM #0020h, McBSP1_SPSD ; McBSP1 Tx = FREE(clock stops
; to run after SW breakpoint
LD *(_DCSICount), A ; check if DCSI in process
BC LoopWait, AGT ; yes, skip
; otherwise
ST #0, *(_DCSICount) ; clear DCSICount
STM #0xFFFF, IFR ; clear interrupt flags
STM SPCR2, McBSP1_SPSA ; enable McBSP1 TX for DCSI
LDM McBSP1_SPSD,A
OR #0x0001, A
STLM A, McBSP1_SPSD
RPT #7
NOP
LD *(_MasterCRValues), A ; load master CR1 value
STLM A, McBSP1_DXR1
STM #0xFFFF, IFR
STM #0x0800, IMR ; enable McBSP1 TX interrupt
NOP
B LoopWait
NOP
LoopWait0:
NOP
STM SPCR1, McBSP1_SPSA ; register subaddr of SPCR1
STM #4000h, McBSP1_SPSD ; McBSP1 recv = left-justify
; RINT generated by frame sync
STM SPCR2, McBSP1_SPSA ; register subaddr for SPCR2
; XINT generated by frame sync
STM #0000h, McBSP1_SPSD ; McBSP1 Tx = FREE(clock stops
; to run after SW breakpoint
STM SPCR2, McBSP1_SPSA ; disable McBSP1 TX for DCSI
LDM McBSP1_SPSD,A
AND #0xFFFE, A
STLM A, McBSP1_SPSD
RPT #7
NOP
STM #0xFFFF, IFR ; clear interrupt flags
* STM #0x0010, IMR
NOP
******* Wait for Starting Next Loop *******
LoopWait: ; wait for timer0 return to zero
NOP
LDM IFR, A ; load interupt flag
AND #0x0008, A ; mask out timer0 intr flag
BC LoopWait, AEQ ; check if tim0 intr occured
NOP ; no: waiting
OR #0x0008, A ; yes: clear timer0 interrupt flag
STLM A, IFR ;
LD #LoopCount, DP ; set DP to the page having LoopCount
NOP
NOP
****** Toggle/Flash XF at Frequency 1Hz *******
ADDM #1, LoopCount ; increase LoopCounter by 1
LD LoopCount, A
SUB #8000, A ; t=8000*2*(3125/50M)=1sec
BC LoopEnd, ALT ; if not 1/2t, wait for mext loop
NOP ; else: toggle XF
NOP
ST #0, LoopCount ; reset LoopCount
LDM ST1, A ; check XF status: load ST1
AND #0x2000, A ; & mask out XF
BC SetXF, AEQ ; if XF=0, to set XF=1
NOP
NOP
RSBX XF ; else (XF=1), to set XF=0
B LoopEnd
NOP
SetXF:
NOP
SSBX XF
NOP
LoopEnd:
NOP
RETD ; return
NOP
NOP
.end
************************************************************************
** End of File -- LoopControl.asm
************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -