www.pudn.com > Echo_Cancel.rar > 2191_EZKIT_ECHO.asm
/************************************************************************************************ * TITLE: 2191_EZKIT_echo * PURPOSE: Show a Echo Cancellation demo for the ADSP-2191 EZ-KIT * * * Modified: 07/12/2001 - GJO * ************************************************************************************************/ #include#include "2191_EZ_KIT.h" /***************************************************************************************************** CONSTANT & MACRO DEFINITIONS *****************************************************************************************************/ /* TDM Timeslot Definitions */ #define TAG_PHASE 0 #define COMMAND_ADDRESS_SLOT 1 #define COMMAND_DATA_SLOT 2 #define STATUS_ADDRESS_SLOT 1 #define STATUS_DATA_SLOT 2 #define LEFT 3 #define RIGHT 4 /************************************************************************************************/ /* GLOBAL & EXTERNAL DECLARATIONS */ /************************************************************************************************/ .GLOBAL Start; .GLOBAL codec_tx, codec_rx; .GLOBAL move_disp; .EXTERN Codec_Reset; .EXTERN Program_SPORT0_Registers; .EXTERN Program_DMA_Controller; .EXTERN AD1885_Codec_Initialization; .EXTERN tx_buf; .EXTERN rx_buf; .EXTERN codec_init_commands; /* DM buffer which holds CODEC initializarion control words */ .EXTERN temp; .EXTERN RX_Status; .EXTERN codec_rx; .EXTERN codec_tx; .EXTERN move_disp; /************************************************************************************************/ /* DM data */ /************************************************************************************************/ .section/dm data1; .var sync_value = 0x7FFF; .global sync_value; .var echo[l]; .var input[n]; .var disp[m]; .var beta; .global beta; .global delay_val; .var delay_val = 0; /************************************************************************************************/ /* PM data */ /************************************************************************************************/ .section/pm data2; .var/init24 f_coeff[m] = "echoeff.dat"; .var a_coeff[n]; /************************************************************************************************/ .SECTION /pm program; Start: call Codec_Reset; call Program_SPORT0_Registers; /* Initialize SPORT0for codec communications */ call Program_DMA_Controller; /* Start Serial Port 0 tx and rx DMA Transfers */ call AD1885_Codec_Initialization; /* Initialize & program AD1885 */ ax0 = 0; dm(tx_buf + COMMAND_ADDRESS_SLOT) = ax0; dm(tx_buf + COMMAND_DATA_SLOT) = ax0; i0 = echo; /* Assign i0 to point to the echo buffer */ l0 = l; i1 = disp; /* Assign i1 to point to the buffer used to output coefficients to the oscilloscope */ l1 = m; i2 = input; /* Buffer used for input samples */ l2 = n; i3 = echo; l3 = l; i4 = f_coeff; l4 = m; i7 = a_coeff; l7 = n; i6=i7; l6=l7; /* This is for the display/scope pointer */ ay0=i6; ax0 = i0; reg(B0) = ax0; ax0 = i1; reg(B1) = ax0; ax0 = i2; reg(B2) = ax0; ax0 = i3; reg(B3) = ax0; i3 = echo+delay; ax0 = i4; reg(B4) = ax0; ax0 = i6; reg(B6) = ax0; ax0 = i7; reg(B7) = ax0; m0 = 0; m2 = 2; m3 = -1; m4 = 2; m7 = -1; m5 = 1; m1 = 1; ax0=0; dm(beta)=ax0; cntr = n; si = 0; do zeroloop1 until ce; zeroloop1: pm(i7,m5) = si; /* Clear the adaptive filter coefficients */ my1=0; /* Beta = 0 disables canceller initially */ ena ar_sat, dis av_latch, dis bit_rev; /* Clear RX_Status flag indicating incoming RX data is audio data and can be processed according */ ax0=0x0000; dm(RX_Status) = ax0; wait_forever: idle; jump wait_forever; Start.end: