/* This file includes the initialization codes for FIR, IIR and FFT Accelerators */

#include "def21469.h"

.global _Init_IIR;



/* Declaring the external buffers needed for IIR Accelerator*/
.extern  IIR_IP_buff1;
.extern  IIR_OP_buff1;
.extern  IIR_CF_buff1;


/*Adding the TCB for IIR channels*/

.section/dm seg_dmda;


	.var IIR_TCB_CH1[13]={
				IIR_TCB_CH1+12,
				42,
				1,
				IIR_CF_buff1,
				IIR_OP_buff1,
				1024,
				1,
				IIR_OP_buff1+0,
				IIR_IP_buff1,
				1024,
				1,
				IIR_IP_buff1+0,
				5|(1023<<14)
			};




/* Adding the IIR Initialization Code Now */

.section/pm seg_pmco;

_Init_IIR:

		//Mapping the IIR DMA interrupt
		ustat3=dm(PICR0);
		bit clr ustat3 P0I0|P0I1|P0I2|P0I3|P0I4;
		bit set ustat3 P0I0|P0I1|P0I3|P0I4;
		dm(PICR0)=ustat3;

		//Unmasking the IIR DMA Interrupt
		bit set IMASK P0I;

		//Selecting the IIR Accelerator
		ustat1=dm(PMCTL1);
		bit clr ustat1 BIT_17|BIT_18;
		bit set ustat1 IIRACCSEL;
		dm(PMCTL1)=ustat1;

		//PMCTL1 effect latency
		nop;nop;nop;nop;

		//Initializing the Chain Pointer Register
		ustat1=IIR_TCB_CH1+12-0x80000;
		dm(CPIIR)=ustat1;

		//Now Enabling the IIR Accelerator
		ustat1=IIR_EN|IIR_DMAEN|IIR_CH1|IIR_RND0;
		dm(IIRCTL1)=ustat1;

		rts;


_Init_IIR.END: