📄 in_bpf.asm
字号:
;;*****************************************************************************
;;*****************************************************************************
;; FILENAME: In_BPF.asm
;; Version: 5.1, Updated on 2003/11/20 at 18:00:49
;; Generated by PSoC Designer ver 4.1 BETA b923 : 11 December, 2003
;;
;; DESCRIPTION: Asm source for 2 Pole Switched Capacitor Band Pass Filter
;;
;; NOTE: User Module APIs conform to the fastcall convention for marshalling
;; arguments and observe the associated "Registers are volatile" policy.
;; This means it is the caller's responsibility to preserve any values
;; in the X and A registers that are still needed after the API
;; function returns. Even though these registers may be preserved now,
;; there is no guarantee they will be preserved in future releases.
;;-----------------------------------------------------------------------------
;; Copyright (c) Cypress MicroSystems 2001-2003. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************
include "m8c.inc"
include "In_BPF.inc"
;-----------------------------------------------
; Global Symbols
;-----------------------------------------------
export In_BPF_Start
export _In_BPF_Start
export In_BPF_SetPower
export _In_BPF_SetPower
export In_BPF_SetC1
export _In_BPF_SetC1
export In_BPF_SetC2
export _In_BPF_SetC2
export In_BPF_SetC3
export _In_BPF_SetC3
export In_BPF_SetC4
export _In_BPF_SetC4
export In_BPF_SetCA
export _In_BPF_SetCA
export In_BPF_SetCB
export _In_BPF_SetCB
export In_BPF_SetPolarity
export _In_BPF_SetPolarity
export In_BPF_Stop
export _In_BPF_Stop
;-----------------------------------------------
; Variable Allocation
;-----------------------------------------------
AREA bss (RAM,REL)
;-----------------------------------------------
; EQUATES
;-----------------------------------------------
bPOWERMASK: equ 03h ; Power field mask for CR3
BPF_CNUMMASK: equ 1fh ; Mask for A, B & C Caps
BPF_CFBMASK: equ 80h ; Mask for Feedback Caps
BPF_POLARITYMASK: equ 20h ; Mask of Asign field for CR0
AREA UserModules (ROM,REL)
;-----------------------------------------------------------------------------
; FUNCTION NAME: In_BPF_Start
;
; DESCRIPTION: Applies power setting to the module's PSoC blocks
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: A register contains the power setting (constant)
; RETURNS: Nothing
; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
In_BPF_Start:
_In_BPF_Start:
In_BPF_SetPower:
_In_BPF_SetPower:
and A, bPOWERMASK ; mask A to protect unchanged bits
mov X, SP ; define temp store location
push A ; put power value in temp store
mov A, reg[In_BPF_FLIN_CR3] ; read power value
and A, ~bPOWERMASK ; clear power bits in A
or A, [X] ; combine power value with balance of reg.
mov reg[In_BPF_FLIN_CR3], A ; move complete value back to register
mov A, reg[In_BPF_FLFB_CR3] ; read power value
and A, ~bPOWERMASK ; clear power bits in A
or A, [X] ; combine power value with balance of reg.
mov reg[In_BPF_FLFB_CR3], A ; move complete value back to register
pop A
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: In_BPF_SetCn, n=1..4
;
; DESCRIPTION: Alters the filter transfer function by modifying the value
; of the capacitors (defined in In_BPF.inc)
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: The A register contains a non-negative integer less than 32
; RETURNS:
; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
In_BPF_SetC1:
_In_BPF_SetC1:
and A, BPF_CNUMMASK ; mask A to protect unchanged bits
mov X, SP ; define temp store location
push A ; put C1 value in temp store
mov A, reg[In_BPF_FILT_C1_REG] ; read current C1
and A, ~BPF_CNUMMASK ; clear C1 bits in A
or A, [X] ; combine C1 value with balance of reg.
mov reg[In_BPF_FILT_C1_REG], A ; move complete value back to register
pop A
ret
In_BPF_SetC2:
_In_BPF_SetC2:
and A, BPF_CNUMMASK ; mask A to protect unchanged bits
mov X, SP ; define temp store location
push A ; put C2 value in temp store
mov A, reg[In_BPF_FILT_C2_REG] ; read current C2
and A, ~BPF_CNUMMASK ; clear C2 bits in A
or A, [X] ; combine C2 value with balance of reg.
mov reg[In_BPF_FILT_C2_REG], A ; move complete value back to register
pop A
ret
In_BPF_SetC3:
_In_BPF_SetC3:
and A, BPF_CNUMMASK ; mask A to protect unchanged bits
mov X, SP ; define temp store location
push A ; put C3 value in temp store
mov A, reg[In_BPF_FILT_C3_REG] ; read current C3
and A, ~BPF_CNUMMASK ; clear C3 bits in A
or A, [X] ; combine C3 value with balance of reg.
mov reg[In_BPF_FILT_C3_REG], A ; move complete value back to register
pop A
ret
In_BPF_SetC4:
_In_BPF_SetC4:
and A, BPF_CNUMMASK ; mask A to protect unchanged bits
mov X, SP ; define temp store location
push A ; put C4 value in temp store
mov A, reg[In_BPF_FILT_C4_REG] ; read current C4
and A, ~BPF_CNUMMASK ; clear C4 bits in A
or A, [X] ; combine C4 value with balance of reg.
mov reg[In_BPF_FILT_C4_REG], A ; move complete value back to register
pop A
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: In_BPF_SetCA
; and In_BPF_SetCB
;
; DESCRIPTION: Alters the filter transfer function by modifying the value
; of the op-amp feedback capacitors (see In_BPF.inc)
;-----------------------------------------------------------------------------
;
; ARGUMENTS: The A register contains one of the In_BPF_FEEDBACK
; constants defined in In_BPF.inc
; RETURNS: Nothing.
; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
In_BPF_SetCA:
_In_BPF_SetCA:
cmp A, In_BPF_FEEDBACK_32 ; Change Feedback to 32 units?
jz .SetCAto32 ; Yes, go make it so
; No, clear it to 16 units...
and reg[In_BPF_FILT_CA_REG], ~BPF_CFBMASK
ret
.SetCAto32:
or reg[In_BPF_FILT_CA_REG], BPF_CFBMASK
ret
In_BPF_SetCB:
_In_BPF_SetCB:
cmp A, In_BPF_FEEDBACK_32 ; Change Feedback to 32 units?
jz .SetCAto32 ; Yes, go make it so
; No, clear it to 16 units...
and reg[In_BPF_FILT_CB_REG], ~BPF_CFBMASK
ret
.SetCAto32:
or reg[In_BPF_FILT_CB_REG], BPF_CFBMASK
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: In_BPF_SetPolarity
;
; DESCRIPTION: Alters the output polarity of the data by altering the
; input polarity at FLIN
;-----------------------------------------------------------------------------
;
; ARGUMENTS: The A register contains one of the In_BPF_POLARITY
; constants defined in In_BPF.inc
; RETURNS: Nothing.
; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
In_BPF_SetPolarity:
_In_BPF_SetPolarity:
cmp A, In_BPF_POLARITY_NON_INVERTING ; Should the output be non-inverting?
jz .SetPoltoNonInv ; Yes, go make it so
; No, then set it to Inverting...
or reg[In_BPF_FLIN_CR0], BPF_POLARITYMASK
ret
.SetPoltoNonInv:
and reg[In_BPF_FLIN_CR0], ~BPF_POLARITYMASK
ret
;-----------------------------------------------------------------------------
; FUNCTION NAME: In_BPF_Stop
;
; DESCRIPTION: Cuts power to the user module.
;
;-----------------------------------------------------------------------------
;
; ARGUMENTS: None
; RETURNS: Nothing
; SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
In_BPF_Stop:
_In_BPF_Stop:
and reg[In_BPF_FLIN_CR3], ~bPOWERMASK
and reg[In_BPF_FLFB_CR3], ~bPOWERMASK
ret
; End of File In_BPF.asm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -