📄 sts.h62
字号:
;
; Copyright 2003 by Texas Instruments Incorporated.
; All rights reserved. Property of Texas Instruments Incorporated.
; Restricted rights to use, duplicate or disclose this code are
; granted through contract.
;
;
; "@(#) DSP/BIOS 4.90.270 12-18-03 (barracuda-o04)"
;
; ======== sts.h62 ========
; Statistics accumulator
;
; This module provides an object that maintains 3 statistics about a
; time series of 32-bit signed values: the number of values, the sum of the
; values, and the maximum value.
;
;
.if ($isdefed("STS_") = 0) ; prevent multiple includes of this file
STS_ .set 1
.include chk.h62
.include std.h62
.global STS_F_add, STS_F_delta, STS_F_reset
; ======== STS_Obj ========
;
STS_Obj .struct
num .long ; number of values, 32 bits
acc .long ; accumulated value, 32 bits
max .long ; maximum value, 32 bits
STS_A_OBJSIZE .endstruct
STS_BASE .set STS_Obj.num
STS_O_NUM .set STS_Obj.num - STS_BASE
STS_O_ACC .set STS_Obj.acc - STS_BASE
STS_O_MAX .set STS_Obj.max - STS_BASE
;
;# ======== STS_Obj ========
; Allocate (and initialize) an STS object and two extra words
; before object to hold previous 32-bit time series sample.
;
;#
;# Preconditions:
;# none
;#
;# Postconditions:
;# none
;#
.asg "", STS_Obj$regs
STS_Obj .macro cflag, name, id, prevh, prevl
CHK_nargs "STS_Obj", prevl
.if ($symcmp(":CHK_status:", "error") = 0)
.emsg "STS_Obj parameter error."
.endif
.if (:cflag: = 0) ; if this object is not
; really to be allocated
.mexit ; exit quietly now
.endif
.global :name:, :name:$stsobj
.sect ".sts" ; allocate STS_Obj
; (in section ".sts")
:name: .tag STS_Obj ; declare name as having
; type STS_Obj
:name:$stsobj:
; NOTE: on 32-bit targets
; only prevh is used
.long 0 ; allocate space for previous
; 32-bit value
:name:
.long 0 ; num
.long 0 ; acc
.long 80000000h ; max
.sect ".cinit"
.align 8
.field STD_TARGWORDMAUS * 4
.field :name:$stsobj
.field :prevh: ; allocate space for history
.field 0 ; num
.field 0 ; acc
.field 80000000h ; max
.sect ".sts"
.endm
;
;# ======== STS_add ========
; Add signed 32-bit sample to time series
; Execution time: instruction cycles
;
;#
;# Preconditions:
;# a4 = STS object handle
;# b4 = 32-bit sample
;#
;# Postconditions:
;# none
;#
.asg "b3,:STS_F_add$regs:", STS_add$regs
STS_add .macro
mvkl STS_F_add,b3 ; change to be FAR call.
mvkh STS_F_add,b3
b b3
mvkl stsad?,b3
mvkh stsad?,b3
nop 3
stsad?:
.endm
;
;# ======== STS_config ========
; Static configuration of the STS module
;
;#
;# Preconditions:
;# none
;#
;# Postconditions:
;# none
;#
.asg "", STS_config$regs
STS_config .macro
; only expand if the STS module is configured by the user
.if (STS$ = 1)
.if (STS$NUMOF > 0)
.endif
.endif
.endm
;
;# ======== STS_delta ========
; Add 32-bit delta to time series, where delta(new, old) = new - old.
;
;#
;# Preconditions:
;# a4 = STS object handle
;# b4 = 32-bit sample
;#
;# Postconditions:
;# none
;#
;# Constraints and Calling Environment:
;# STS_delta can only be used after a call to STS_set or the user
;# used the DSP/BIOS Configuration Tool to set the "prev" property
;# for this STS object.
;#
;
.asg "b3,:STS_F_delta$regs:", STS_delta$regs
STS_delta .macro
mvkl STS_F_delta,b3 ; change to be FAR call
mvkh STS_F_delta,b3
b b3
mvkl stsd?,b3
mvkh stsd?,b3
nop 3
stsd?:
.endm
;
;# ======== STS_end ========
; Invoked at the end of all other configuration
; declarations.
;
;#
;# Preconditions:
;# none
;#
;# Postconditions:
;# none
;#
.asg "", STS_end$regs
STS_end .macro
.endm
;
;# ======== STS_init ========
; Runtime initialization of the STS module
;
;#
;# Preconditions:
;# none
;#
;# Postconditions:
;# none
;#
.asg "", STS_init$regs
STS_init .macro
; only expand if the STS module is configured
.if (STS$ = 1)
.endif
.endm
;
;# ======== STS_reset ========
; Reset the statistics to their initial value
;
;#
;# Preconditions:
;# a4 = STS object handle
;#
;# Postconditions:
;# none
;#
.asg "a1", STS_reset$regs
STS_reset .macro
zero a1 ; clear temp register
stw a1,*+a4(0) ; clear num
stw a1,*+a4(4) ; clear acc
mvklh 8000h, a1 ; form largest negative number
stw a1,*+a4(8) ; set max
.endm
;
;# ======== STS_set ========
; Set history word of STS object
;
;#
;# Preconditions:
;# a4 = STS object handle
;# b4 = new 32-bit value to store as 'previous'
;#
;# Postconditions:
;# none
;#
.asg "", STS_set$regs
STS_set .macro dummy
CHK_void STS_set, dummy
stw b4,*-a4(4) ; store value
.endm
;
;# ======== STS_startup ========
;
;#
;# Preconditions:
;# none
;#
;# Postconditions:
;# none
;#
.asg "", STS_startup$regs
STS_startup .macro
.endm
.endif ; STS_ not defined
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -