page 132,60 ;**************************************************************************** ; ECHO.ASM Ver.2.0 ; Example program to move audio through CS4215 ; This program uses 2k samples of delay ; to add a noticeable echo to the audio. ; ; Copyright (c) MOTOROLA 1995, 1996 ; Semiconductor Products Sector ; Digital Signal Processing Division ; ;****************************************************************************** ;--------------------------------------------- IF (STANDALONE==1) nolist include 'ioequ.asm' include 'intequ.asm' include 'ada_equ.asm' include 'vectors.asm' list ;****************************************************************************** ; the following EQUates will define the operatonal parameters ; of the codec. Please refer to the ADA_EQU.ASM source file ; for a description of the parameters selections available. The ; variables defined by the EQUates are sent to the codec via ; the transmit buffer, TX_BUFF. ; ; Since the parameters are defined in ADA_EQU.ASM, these lines must ; follow the include statement. ;****************************************************************************** CTRL_WD_12 equ NO_PREAMP+HI_PASS_FILT+SAMP_RATE_48+STEREO+DATA_16 ;CLB=0 CTRL_WD_34 equ IMMED_3STATE+XTAL1_SELECT+BITS_64+CODEC_MASTER CTRL_WD_56 equ $000000 CTRL_WD_78 equ $000000 TONE_OUTPUT EQU HEADPHONE_EN+LINEOUT_EN+(0*LEFT_ATTN)+(0*RIGHT_ATTN) TONE_INPUT EQU MIC_IN_SELECT+(15*MONITOR_ATTN) ;---Buffer for talking to the CS4215 org x:0 RX_BUFF_BASE equ * RX_data_1_2 ds 1 ;data time slot 1/2 for RX ISR RX_data_3_4 ds 1 ;data time slot 3/4 for RX ISR RX_data_5_6 ds 1 ;data time slot 5/6 for RX ISR RX_data_7_8 ds 1 ;data time slot 7/8 for RX ISR TX_BUFF_BASE equ * TX_data_1_2 ds 1 ;data time slot 1/2 for TX ISR TX_data_3_4 ds 1 ;data time slot 3/4 for TX ISR TX_data_5_6 ds 1 ;data time slot 5/6 for TX ISR TX_data_7_8 ds 1 ;data time slot 7/8 for TX ISR RX_PTR ds 1 ; Pointer for rx buffer TX_PTR ds 1 ; Pointer for tx buffer org P:$100 START main movep #$040004,x:M_PCTL ;PLL = 5 x 16.9344Mhz = 84.672MHz movep #012421,x:M_BCR ENDIF ;------------------------------ org p: echo movec #0,SP ; clear stack pointer move #0,SC ; clear stack counter ori #3,mr ; disable interrupts movep #$040004,x:M_PCTL ; PLL = 16.9344 x 5 = 84.672MHz movep #$11,x:M_TCSR0 ; turn LED off move #$40,r6 ; initialize stack pointer move #-1,m6 ; linear addressing move #RX_BUFF_BASE,x0 move x0,x:RX_PTR ; Initialize the rx pointer move #TX_BUFF_BASE,x0 move x0,x:TX_PTR ; Initialize the tx pointer ; --- INIT THE CODEC --- jsr ada_init ; Jump to initialize the codec move #$0400,r4 ; echo buffer starts at $400 move #$03FF,m4 ;...and is 1024 deep ;========================================================================== ; this is where the work gets done... ; loop_1 jset #2,x:M_SSISR0,* ; Wait for frame sync to pass. jclr #2,x:M_SSISR0,* ; Wait for frame sync. move x:RX_BUFF_BASE,a ;get new samples move x:RX_BUFF_BASE+1,b asr a x:(r4),x0 ;divide them by 2 and get oldest asr b y:(r4),y0 ; samples from buffer add x0,a ;add the new samples and the old add y0,b asr a ;reduce magnitude of new data asr b move a,x:(r4) ;save the altered samples move b,y:(r4)+ ; and bump the pointer move a,x:TX_BUFF_BASE ; Put value in left channel tx. move b,x:TX_BUFF_BASE+1 ; Put value in right channel tx. move #TONE_OUTPUT,y0 ; headphones, line out, mute spkr, no attn. move y0,x:TX_BUFF_BASE+2 move #TONE_INPUT,y0 ; no input gain, monitor mute move y0,x:TX_BUFF_BASE+3 jmp loop_1 ; Loop back. IF (STANDALONE==1) include 'ada_init.asm' ; load the code init routines ENDIF