📄 memory2.h
字号:
/******************** local memory map for audio decoder ***************/
//--------------local memory map A ----------------------------
///////////////////////////////////////////////////////////////////
// 0xf80 - 0x1000: local registers, used on the system level
///////////////////////////////////////////////////////////////////
;********** local registers dedicated to interrupt stuf *******
// #define r0_tmp 0xf80 tchou
#define r1_tmp 0xf82
// #define r2_tmp 0xf84 tchou
#define r3_tmp 0xf86
#define r4_tmp 0xf88
#define r8_tmp 0xf90
; variable to store the current dsp_mask....
#define int_mask 0xf92
#define r11_tmp 0xf94
; variable temporaire
#define temp 0xf96
;***********************************************************************
;;; general command related to key-sift, trebble,bass,3D sound, echo delay
;;; decide what to do, and with which key, filter....
;***********************************************************************
#define keyshift_com 0xf8a
#define bass_com 0xf8c
#define trebble_com 0xf8e
#define echo_com 0xfbc
#define micro_com 0xfbe
#define dc_offset 0xfbe //ZhangWei
;***********************************************************************
;;; flags to determine the type of interrupt
;***********************************************************************
#define aud_on 0xf98
#define pcm_on 0xf9a
#define pcm_in 0xf9c
#define cd_on 0xf9e
;;;;;; debug stuff, arghh
#define PcmRd 0xfa0
#define AudWr 0xfa2
#define PcmBl 0xfa4
#define Debug_Int_Adr 0xfa6
#define PcmInt 0xfa8
#define AudInt 0xfaa
; local register for the previous interrupt
#define Prev_Int 0xfac
; local register for the MPEG_CD flag. MPEG=0, CD=1
#define MPEG_CD_PCM_FLAG 0xfae
;local area to store the value of the key
#define key_value 0xfb0
#define Nkey_value 0xfba
;local area to store the left/right flag
#define left_right 0xfb2
; local area to store a counter, for the initialisation of search_buf
#define count 0xfb4
; when to change the value of key......
#define count2 0xfb6
; if the key has changed, change this flag
#define key_change 0xfb8
;***********************************************************************
;;;; Definition related to the correlation
;***********************************************************************
; local area to store the intermediate position in matched seq
#define inter_pos 0xfc0
; local area to store the start position of goal sequence in search buffer
#define Cgoal_start 0xfc2
#define Lgoal_start 0xfc4
#define Rgoal_start 0xfc6
; local area to store the value of Dmin
#define Dmin 0xfc8
; local area to store the value of current deltai
#define Cdeltai 0xfca
; local area to store the value of deltap
#define Cdeltap 0xfcc
#define Ldeltap 0xfce
#define Rdeltap 0xfd0
;******************************************************************
;;; definitions related to buffers (search, input...)
;******************************************************************
; local area for pointer in the input buffer
#define InputBuf_Ptr 0xfd4
; local area for current start/end adress of search buffer in DRAM
#define CSEARCH_END 0xfd6
#define CSBUF_START 0xfd8
;local area to store the end adress of search buffers in DRAM
#define LSEARCH_END 0xfda
#define RSEARCH_END 0xfdc
; local area for pointer on search buffer in local memory
#define localsearch_ptr 0xfde
; local area for pointer on search buffer in DRAM
#define Csearch_ptr 0xfe0
#define Lsearch_ptr 0xfe2
#define Rsearch_ptr 0xfe4
; local area for input adress
#define Cinput_adr 0xfe6
; local area for pointer on fake input buffer in DRAM
#define mic_data_ptr 0xfe8
;*******************************************************************
;;; definitions of parameters related to the value of the key
;*******************************************************************
#ifdef EFFECT //align to word boundary for 32-bit DMA
; local area to store the value of pos1
#define pos1 0xfec
; local area to store the new value of pos1
#define Npos1 0xfee
; local area to store Dec
#define Dec 0xff0
; local area to store Length
#define Length 0xff2
; local area to store Nb
#define Nb 0xff4
; local area to store (Nb-1)*Length
#define Nb_1 0xff6
; local area to store new Dec
#define NDec 0xff8
; local area to store new Length
#define NLength 0xffa
; local area to store new Nb
#define NNb 0xffc
; local area to store new (Nb-1)*Length
#define NNb_1 0xffe
#else //EFFECT
; local area to store the value of pos1
#define pos1 0xfea
; local area to store the new value of pos1
#define Npos1 0xfec
; local area to store Dec
#define Dec 0xfee
; local area to store Length
#define Length 0xff0
; local area to store Nb
#define Nb 0xff2
; local area to store (Nb-1)*Length
#define Nb_1 0xff4
; local area to store new Dec
#define NDec 0xff6
; local area to store new Length
#define NLength 0xff8
; local area to store new Nb
#define NNb 0xffa
; local area to store new (Nb-1)*Length
#define NNb_1 0xffc
#endif //EFFECT
//////////////////////////////////////////////////////////////////////
// 0x800 - 0xf80: interpolation filter coefficients
//////////////////////////////////////////////////////////////////////
; local area for coeff start at 1K (part A)
#ifdef EFFECT
#define localA_coeff 0x800
#define coeffA 0x800 //for dma
#else //EFFECT
#define localA_coeff 1024*2
#endif //EFFECT
//////////////////////////////////////////////////////////////////////
// 0x600 - 0x800: triangular window coefficients
//////////////////////////////////////////////////////////////////////
; local area for triangular window coefficients (part A)
#ifdef EFFECT
#define localA_window 0x600
#define window1 0x600
#define window0 0x7fe
#else //EFFECT
#define localA_window 768*2
#define window1 768*2
#define window0 1023*2
#endif //EFFECT
//////////////////////////////////////////////////////////////////////
// 0x500 - 0x600: treble/bass filter and echo coefficients
//////////////////////////////////////////////////////////////////////
;********* definition of gains of the AP filters ****************
; local area to store the coefficients of the LP feedback filter (15 coeff)
#define LPFB 0x500
; local area to put: LPFB gain
#define FBgain 0x520
; local area to put: NAP1, g1=0.4=13107
#define g1 0x522
; local area to put: NAP2, g2=0.6=19661
#define g2 0x524
; local area to put: OAP1, g3=0.3=9830
#define g3 0x526
; local area to put: NAP3, g4=0.4=13107
#define g4 0x528
; local area to put: OAP2, g5=0.1=3277
#define g5 0x52a
;********* definition of pointers in AP histories in DRAM *******
; local area to store pointer in DRAM on DL1
#define DL1_ptr 0x52c
; local area to store pointer in DRAM on NAP1
#define NAP1_ptr 0x52e
; local area to store pointer in DRAM on NAP2
#define NAP2_ptr 0x530
; local area to store pointer in DRAM on NAP3
#define NAP3_ptr 0x532
; local area to store pointer in DRAM on OAP2
#define OAP2_ptr 0x534
//---------- from ster_filt_dec.S ------------------
#define local_hist_point 0x530
;********* Echo delay vars *******
#define Echo_delay_ptr 0x536
#define ufon_on_counter 0x538
#define ufon_off_counter 0x540
#define energy_indicator 0x542
#define dc_offset_44 0x544
#define channelsel 0x546
//-------------------- trebble_bass_new.S ------------------------------
;****** local area to store the coefficients of the filter ***************
#define local_k2s2 0x580
#define local_k1s1 0x590
#define local_c0c1c2 0x5a0
;****** local area to store the value of the current adress in DRAM for history
#define Cu0u1 0x5d0
#define LWMacroTemp %0x5e0 //used in DMA Macro def in regdef2.h
//////////////////////////////////////////////////////////////////////
// 0x400 - 0x500: 4:1 decim 1:4 interp filter coefficients
//////////////////////////////////////////////////////////////////////
; local area for the rate conversion filter
#define local_rate_filter 0x400
//////////////////////////////////////////////////////////////////////
// 0x000 - 0x400: input and output data sequences
//////////////////////////////////////////////////////////////////////
#define localA_data 0*2 //moved to 0x1300
//----------------- local memory map B -------------------------------
// echo2.S
;********* definition related to the reverberator ***************
#define top 0x2000
//////////////////////////////////////////////////////////////////////
// 0x1f80 - 0x2000: delay line 1, for echo generation
//////////////////////////////////////////////////////////////////////
; local area for initial delay-line (input + LP filter feedback)
#define local_DL1 top-0x80
//////////////////////////////////////////////////////////////////////
// 0x1f00 - 0x1f80: nested all pass filetr 1
//////////////////////////////////////////////////////////////////////
; local area for history of first nested AP filter (g1=0.4, 22 ms)
#define local_NAP1 top-0x100
//////////////////////////////////////////////////////////////////////
// 0x1e80 - 0x1f00: nested all pass filetr 2
//////////////////////////////////////////////////////////////////////
; local area for history of second nested AP filter (g2=0.6, 8.3 ms)
#define local_NAP2 top-0x180
//////////////////////////////////////////////////////////////////////
// 0x1e00 - 0x1e80: overall all pass filetr 1
//////////////////////////////////////////////////////////////////////
; local area for history of first overall AP filter (g3=0.3, 35 ms)
#define local_OAP1 top-0x200
//////////////////////////////////////////////////////////////////////
// 0x1dec - 0x1e00: delay line 2
//////////////////////////////////////////////////////////////////////
; local area for small history between both OAP filters (10 samples)
#define local_DL2 top-0x214
//////////////////////////////////////////////////////////////////////
// 0x1d6c - 0x1dec: nested all pass filetr 3
//////////////////////////////////////////////////////////////////////
; local area for history of third nested AP filter (g4=0.4, 30 ms)
#define local_NAP3 top-0x294
//////////////////////////////////////////////////////////////////////
// 0x1cec - 0x1d6c: overall all pass filetr 2
//////////////////////////////////////////////////////////////////////
; local area for history of second overall AP filter (g=0.1, 66 ms)
#define local_OAP2 top-0x314
//////////////////////////////////////////////////////////////////////
// 0x1cce - 0x1cec: low pass filetr
//////////////////////////////////////////////////////////////////////
; local area for history of low pass filter (feedback, 14 samples for history)
#define local_LP top-0x314-0x1c
//////////////////////////////////////////////////////////////////////
// 0x1c00 - 0x1c80: history low pass filetr
//////////////////////////////////////////////////////////////////////
; local area to store the 64 samples decimated sequence 11Khz
; it is local area to store input buffer required for FB after LP
; filtering
#define local_DL1FB 0x1c00
//////////////////////////////////////////////////////////////////////
// 0x1300 - 0x1700: copy of data sequences for echo generation
//////////////////////////////////////////////////////////////////////
; local area for the microphone input sequence (512, 44.1Khz)
#define local_micro_44 0x1300
//////////////////////////////////////////////////////////////////////
// 0x1100 - 0x1300: data sequence before and after echo (44.1)
//////////////////////////////////////////////////////////////////////
; local area for the microphone input after rate conversion ( 256, 44.1Khz)
#define local_micro_out 0x1100
#ifdef EFFECT
//////////////////////////////////////////////////////////////////////
// 0x1040 - 0x10c0: data sequence before and after echo (11)
//////////////////////////////////////////////////////////////////////
; local area for the microphone input sequence (64 samples, 11Khz)
#define local_micro_in 0x1040 //word aligned for DMA
#else //EFFECT
//////////////////////////////////////////////////////////////////////
// 0x103e - 0x10be: data sequence before and after echo (11)
//////////////////////////////////////////////////////////////////////
; local area for the microphone input sequence (64 samples, 11Khz)
#define local_micro_in 0x103e
#endif //EFFECT
; local area for the last history
#define local_last_history 0x1080
//-------------- trebble_bass_new.S ----------------------------------
;****** local area to store the intermediate results *********************
#define scale 0x1050
#define max 0x1060
#define one 0x1040
#define block2 0x1000
#define x1_1 block2+12
#define x1_0 block2+14
#define s2 block2+4
#define k2 block2+6
#define u2_1 block2+16
#define u2_0 block2+18
#define u0_1 block2+8
#define u0_0 block2+10
#define u1_1 block2
#define u1_0 block2+2
//////////////////////////////////////////////////////////////////////
// 0x1000 - 0x103e: filter history for interp, treble/bass, etc.
//////////////////////////////////////////////////////////////////////
#define localB_data 0x1000
; local area for history start at 2K (part B)
#define localB_history 2048*2
; local area for result start at 2K (part B)
; (localA_coeff +23*2)
#define coeff_inc 2094
; local area for the history of the decimating filter
#define local_dec_hist 0x1000 //0x1002
; local area for the last history of the decimating filter (update in DRAM)
#define local_last_dec_hist local_dec_hist+0x200
#define local_next_delayed_echo local_last_dec_hist
//////////////////////////////////////////////////////////////////////
// 0x1000 - 0x2000: search buffers, to compute correlation
//////////////////////////////////////////////////////////////////////
/*********************** constants ***********************************/
;***********************************************************************
;;; definitions related to keyshift algorithm
;***********************************************************************
;Value of key on 16 bits
#define Key_default 16
; Value of the ratio
#define Ratio 40*24*2
;iteration a laquelle on change la cle 6 cas 0-3.9, 10 cas 3.9 0
#define change 6
/********************** macros **************************************/
.macro WaitDma
0: bdb 0b
.endm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -