; File name: myTDF2IIR.asm ; ; 19Oct2003 .. created as a learning experience code study .. KM ; ; on call we have ; ar0 ptr_x ; ar1 ptr_h ; ar2 ptr_y ; ar3 ptr_d ; T0 nbiq ; T1 nx .c54cm_off ;don't want compatible with c54 .ARMS_on ;enable assembler for ARMS=1 .CPL_on ;enable assembler for CPL=1 .asg ar0,ptr_x .asg ar1,ptr_h .asg xar1,xptr_h .asg xar7,txptr_h .asg ar2,ptr_y .asg ar3,ptr_w .asg xar3,xptr_w .asg xar6,txptr_w .asg T0,nbiq .asg T1,nx .asg 0001100000000000b,my_ST0_55 .asg 0110100100000000b,my_ST1_55 .asg 1001000000000000b,my_ST2_55 .asg 0001000000000010b,my_ST3_55 .sect ".text" ;place into the code section .align 4 ;force 32-bit boundary .global _myTDF2IIR ;make entry visible to linker _myTDF2IIR: psh mmap(st0_55) ; save machine state psh mmap(st1_55) ; by saving all four psh mmap(st2_55) ; status registers psh mmap(st3_55) ; on the system stack psh T3 ; probably don't need this pshboth txptr_h ; save the xars use to hold reset pshboth txptr_w ; address of coeffs and delays mov #my_ST0_55,mmap(st0_55) ; now configure the machine mov #my_ST1_55,mmap(st1_55) ; a generic set of values that mov #my_ST2_55,mmap(st2_55) ; still need a bit of tweeking mov #my_ST3_55,mmap(st3_55) ; close to reset state bset sxmd ; enable sign extend bset frct ; shift left 1 on multiply bset m40 ; use 40 bit accumulator bset rdm ; round to nearest bclr c54cm ; not C54x compatible bclr satd ; disable saturation in D-unit bclr sata ; disable saturation in A-unit sub #1,nx ; hardware needs nx-1 for loop count sub #1,nbiq ; hardware needs nbiq-1 for loop count mov nx,mmap(brc0) ; set up outer loop count..T1 is free now mov nbiq,mmap(brc1) ; set up inner loop count..T0 is free now mov xptr_w,txptr_w ; save ptr_w initial value mov xptr_h,txptr_h ; save ptr_h initial value rptblocal L_outer-1 mov *ptr_x+,?? ; get sample value into ?? rptblocal L_inner-1 ; loop through sections ; here be dragons L_inner: mov ??,*ptr_y+ ; filter cascade output value mov txptr_w,xptr_w ; reset xptr_w mov txptr_h,xptr_h ; reset xptr_h L_outer: popboth txptr_w ; restore xar used to hold reset address popboth txptr_h ; restore xar used to hold reset address pop T3 ; restore contents of T3 pop mmap(st3_55) ; restore the four status registers pop mmap(st2_55) pop mmap(st1_55) pop mmap(st0_55) ret