Example #1
0
void main()
{
	//initialize intermediary values to zero
	for(n = 0; n < 11; n++)
	{
		w[n] = 0;
	}

	DSK6713_init();		// Initialize the board support library, must be called first
    hCodec = DSK6713_AIC23_openCodec(0, &config);	// open codec and get handle

	// Configure buffered serial ports for 32 bit operation
	// This allows transfer of both right and left channels in one read/write
	MCBSP_FSETS(SPCR1, RINTM, FRM);
	MCBSP_FSETS(SPCR1, XINTM, FRM);
	MCBSP_FSETS(RCR1, RWDLEN1, 32BIT);
	MCBSP_FSETS(XCR1, XWDLEN1, 32BIT);

	// set codec sampling frequency
	DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_16KHZ);

	// interrupt setup
	IRQ_globalDisable();			// Globally disables interrupts
	IRQ_nmiEnable();				// Enables the NMI interrupt
	IRQ_map(IRQ_EVT_RINT1,15);		// Maps an event to a physical interrupt
	IRQ_enable(IRQ_EVT_RINT1);		// Enables the event
	IRQ_globalEnable();				// Globally enables interrupts

	while(1)						// main loop - do nothing but wait for interrupts
	{
	}
}
/********************************** init_HWI() **************************************/  
void init_HWI(void)
{
	IRQ_globalDisable();			// Globally disables interrupts
	IRQ_nmiEnable();				// Enables the NMI interrupt (used by the debugger)
	IRQ_map(IRQ_EVT_XINT1,4);		// Maps an event to a physical interrupt
	IRQ_enable(IRQ_EVT_XINT1);		// Enables the event
	IRQ_globalEnable();				// Globally enables interrupts
} 
Example #3
0
void initboard()
{
	CSL_init();
	PLL_Init();
	EMIF_Init();
	TIMER_Init();

	IRQ_globalDisable();
}
Example #4
0
void main()
{
	DSK6713_init();		// Initialize the board support library, must be called first
    hCodec = DSK6713_AIC23_openCodec(0, &config);	// open codec and get handle

    //convert coefficients to Q15 format
    short i,j;
    for(i = 0; i < 33; i++)
    {
    	w[i] = 0;
    }

    for(i = 0; i < 11; i++)
    {
    	for(j = 0; j < 3; j++)
    	{
    		NUM_s[i][j] = NUM[i][j] << 5;
    		DEN_s[i][j] = DEN[i][j] << 5;
    	}
    }

	// Configure buffered serial ports for 32 bit operation
	// This allows transfer of both right and left channels in one read/write
	MCBSP_FSETS(SPCR1, RINTM, FRM);
	MCBSP_FSETS(SPCR1, XINTM, FRM);
	MCBSP_FSETS(RCR1, RWDLEN1, 32BIT);
	MCBSP_FSETS(XCR1, XWDLEN1, 32BIT);

	// set codec sampling frequency
	DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_16KHZ);

	// interrupt setup
	IRQ_globalDisable();			// Globally disables interrupts
	IRQ_nmiEnable();				// Enables the NMI interrupt
	IRQ_map(IRQ_EVT_RINT1,15);		// Maps an event to a physical interrupt
	IRQ_enable(IRQ_EVT_RINT1);		// Enables the event
	IRQ_globalEnable();				// Globally enables interrupts

	while(1)						// main loop - do nothing but wait for interrupts
	{
	}
}
Example #5
0
// for communication/init using interrupt
void comm_intr() {

	// 0 since not polling
	poll=0;

   	// disable interrupts
	IRQ_globalDisable();

	// init DSP and codec
	c6713_dsk_init();

	// McBSP1 Xmit
	CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle);

	// do not need to point to vector table
	#ifndef using_bios
	//point to the IRQ vector table
	IRQ_setVecs(vectors);
	//since interrupt vector handles this
	#endif

	// map McBSP1 Xmit to INT11
  	IRQ_map(CODECEventId, 11);

 	// reset codec INT 11
  	IRQ_reset(CODECEventId);

  	// globally enable interrupts
  	IRQ_globalEnable();

	// enable NMI interrupt
  	IRQ_nmiEnable();

  	// enable CODEC eventXmit INT11
  	IRQ_enable(CODECEventId);

	// start McBSP interrupt outputting a sample
	output_sample(0);
}
Example #6
0
File: bsp.c Project: voileravi/zen
/*..........................................................................*/
void BSP_init(void) {
    PLL_Config pllCfg_100MHz = {
        0x8BE8U, 0x8000U, 0x0806U, 0x0000U
    };
    PLL_Obj pllObj;
    uint16_t i;

    PLL_init(&pllObj, CSL_PLL_INST_0);
    PLL_reset(&pllObj);
    PLL_config(&pllObj, &pllCfg_100MHz);

    QF_zero();                        /* clear the QF variables, see NOTE01 */

    CSL_SYSCTRL_REGS->PCGCR1 = 0U;      /* enable clocks to all peripherals */
    CSL_SYSCTRL_REGS->PCGCR2 = 0U;
    CSL_SYSCTRL_REGS->EBSR   = 0x1800U;             /* configure I/O muxing */
    CSL_SYSCTRL_REGS->PSRCR  = 0x0020U;            /* reset all peripherals */
    CSL_SYSCTRL_REGS->PRCR   = 0x00BFU;

    ULED_init();                              /* configure the User LEDs... */

    IRQ_globalDisable();
    IRQ_disableAll();                         /* disable all the interrupts */
    IRQ_clearAll();                         /* clear any pending interrupts */
    IRQ_setVecs((uint32_t)&VECSTART);               /* set the vector table */
    for (i = 1U; i < 32U; ++i) {               /* pre-fill the Vector table */
        IRQ_plug(i, &illegal_isr);                      /* with illegal ISR */
    }

    /* plug in all ISRs into the vector table...*/
//    IRQ_plug(TINT_EVENT, &TINT_isr);
//    IRQ_plug(RTC_EVENT,  &RTC_isr);
    /* ... */

    if (QS_INIT((void *)0) == 0) {    /* initialize the QS software tracing */
        Q_ERROR();
    }
    QS_OBJ_DICTIONARY(&l_TINT_isr);
}
Example #7
0
/*
 *  main() - The main user task.  Performs application initialization and
 *           starts the data transfer.
 */
void main()
{
    /* Initialize Board Support Library */
    DSK6713_init();

    /* Initialize LEDs and DIP switches */
    DSK6713_LED_init();
    DSK6713_DIP_init();

    /* Clear buffers */
    memset((void *)gBufferXmtPing, 0, BUFFSIZE * 4 * 2);

    AIC23_setParams(&config);  // Configure the codec

    initMcbsp();               // Initialize McBSP1 for audio transfers

    IRQ_globalDisable();       // Disable global interrupts during setup

    initEdma();                // Initialize the EDMA controller

    initIrq();                 // Initialize interrupts

    IRQ_globalEnable();        // Re-enable global interrupts
}
Example #8
0
void main()
{


	// initialize the save buffers
	for(j = 0; j < 2; j++){
		for (i=0;i<SAVES;i++) {
			cde_save[i] = 0;
			pcf_save[i] = 0;
			clockoffset_save[i] = 0.0;
			fde_save[i] = 0.0;
			imax_save[i] = 0;
			recbuf_start_clock_save[i] = 0;
			ppm_estimate_save[i] = 0.0;
			ytilde_save[i] = 0.0;
			state_prediction[j][i] = 0.0;
			state_estimate[j][i] = 0.0;
		}
	}

	// set up the fractionally shifted buffers
	for(k = 0; k < FER; k++){
		fractionalShift = ((double) k )/((double) FER); // number of samples to shift
		for (i=-N;i<=N;i++){
			x = ((double) i - fractionalShift)*BW;
			if (x==0.0) {
				y = 32767.0;
			}
			else
			{
				t = ((double) i - fractionalShift)*CBW;
				y = 32767.0*cos(2*PI*t)*sin(PI*x)/(PI*x); // double
			}
			j = i;
			if (j<0) {
				j += L; // wrap
			}
			allMyDelayedWaveforms[k][j] = (short) y;
		}
	}

	// set up the cosine and sin matched filters for searching
	// also initialize searching buffer
	for (i=0;i<M;i++){
		t = i*CBW;				// time
		y = cos(2*PI*t);		// cosine matched filter (double)
		mfc[i] = (float) y;		// cast and store
		y = sin(2*PI*t);		// sine matched filter (double)
		mfs[i] = (float) y;     // cast and store
		buf[i] = 0;             // clear searching buffer
	}

	// initialize clock buffers
	for (i=0;i<L;i++) {
		clockbuf[i] = 0;
		clockbuf_shifted[0][i] = 0;
		clockbuf_shifted[1][i] = 0;
	}

	// initialize sinc pulse buffer
	for (i=0;i<LL;i++)
		sincpulsebuf[i] = 0;

	// set up clock buffer and sinc pulse buffer
	// to play modulated sinc centered at zero
	for (i=-N;i<=N;i++){
		x = i*BW;
		if (i!=0) {
			t = i*CBW;
			y = 32767.0*cos(2*PI*t)*sin(PI*x)/(PI*x); // double
		}
		else {
			y = 32767.0;
		}
		j = i;
		if (j<0) {
			j += L; // wrap
		}
		clockbuf[j] = (short) y;
		j = i;
		if (j<0) {
			j += LL; // wrap
		}
		sincpulsebuf[j] = (short) y;
	}

	// set up inphase and quadrature sinc pulses for coarse and fine delay estimators
	j = 0;
	for (i=-N;i<=N;i++){
		x = i*BW;
		if (i!=0) {
			t = i*CBW;
			si[j] = (float) (cos(2*PI*t)*sin(PI*x)/(PI*x));
			sq[j] = (float) (sin(2*PI*t)*sin(PI*x)/(PI*x));
		}
		else {
			si[j] = 1.0;
			sq[j] = 0.0;
		}
		j++;
	}

	DSK6713_init();		// Initialize the board support library, must be called first
	DSK6713_LED_init(); // initialize LEDs
    hCodec = DSK6713_AIC23_openCodec(0, &config);	// open codec and get handle

	// Configure buffered serial ports for 32 bit operation
	// This allows transfer of both right and left channels in one read/write
	MCBSP_FSETS(SPCR1, RINTM, FRM);
	MCBSP_FSETS(SPCR1, XINTM, FRM);
	MCBSP_FSETS(RCR1, RWDLEN1, 32BIT);
	MCBSP_FSETS(XCR1, XWDLEN1, 32BIT);

	// set codec sampling frequency
	DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ);

	// interrupt setup
	IRQ_globalDisable();			// Globally disables interrupts
	IRQ_nmiEnable();				// Enables the NMI interrupt
	IRQ_map(IRQ_EVT_RINT1,15);		// Maps an event to a physical interrupt
	IRQ_enable(IRQ_EVT_RINT1);		// Enables the event
	IRQ_globalEnable();				// Globally enables interrupts

	DSK6713_LED_toggle(3);

	while(1)						// main loop
	{
		if ((state==2)&&(delay_est_done==0)){  // TIME TO COMPUTE DELAY ESTIMATES

			DSK6713_LED_toggle(1);	// toggle LED here for diagnostics

			/*****************
			 * 				 *
			 * ESTIMATION    *
			 * 				 *
			 ****************/

			// compute coarse delay estimate
			zmax = 0.0;				// maximum
			imax = 0;				// index of maximum
			for (i=0;i<(2*M-1);i++){  // lag index
				z = 0;
				for (j=0;j<(2*N+1);j++) {
					z+= si[j]*recbuf[i+j];  // correlation at lag i
				}
				if (abs(z)>zmax) {
					zmax = abs(z);  // store maximum
					imax = i;       // store index of maximum
				}
			}
			cde = recbuf_start_clock + imax + N;  // coarse delay estimate (DRB: +N here because si is already shifted by N)
			// cde  is the number of samples elapsed since we launched the S->M sinc pulse

		    // compute fine delay estimate
			zi = 0.0;  // in phase
			zq = 0.0;  // quadrature
			for (j=0;j<(2*N+1);j++) {
				zi+= si[j]*recbuf[imax+j];  // correlation at lag imax
				zq+= sq[j]*recbuf[imax+j];  // correlation at lag imax
			}
			pcf = atan2(zq,zi)*(2*INVPI); // assumes wc = pi/2
			fde = (float) cde + pcf;

			// compute actual clock offset
			// the value computed here is always non-negative and
			// represents the number of samples the master clock is ahead of the slave clock
			// (or the number of samples the slave clock is behind the master clock)
			// S->M sinc pulse was launched at time 0
			// M->S sinc pulse was received at time fde (should be positive)
			// to synchronize, we want slave clock ticks to appear at fde/2 + k*L for k=0,1,....
			clockoffset = fde*0.5;

			// testing/debugging
			imax_save[save_index] = imax;
			recbuf_start_clock_save[save_index] = recbuf_start_clock;
			cde_save[save_index] = cde;
			pcf_save[save_index] = pcf;
			fde_save[save_index] = fde;
			clockoffset_save[save_index] = clockoffset;


			//If first time running
			if(!hasSaved && save_index == 0){
			   state_estimate[0][0] = clockoffset* TS;
			   state_estimate[1][0] = 0;
			   state_prediction[0][1] = clockoffset * TS;
			   state_prediction[1][1] = 0;
			}

			else
			{   // save_index > 0
			    ytilde = clockoffset * TS - state_prediction[0][save_index];  // innovation (difference between current observation and prediction)


			    state_estimate[0][save_index] = state_prediction[0][save_index] + ((double) K1)*ytilde;  // filtered clock offset estimate
			    state_estimate[1][save_index] = state_prediction[1][save_index] + ((double)K2)*ytilde;  // filtered frequency offset estimate

			    //Determine if a glitch has happened


			    if (save_index+1<SAVES) {
			        // generate predictions for next observation (make sure multiplication by LL doesn't cause datatype problems)
			        state_prediction[0][save_index+1] = state_estimate[0][save_index] +  state_estimate[1][save_index] * (double)T0;//* LL;
			        state_prediction[1][save_index+1] = state_estimate[1][save_index];
			    }
			    else if(save_index + 1 == SAVES){
			    	state_prediction[0][0] = state_estimate[0][save_index] + state_estimate[1][save_index]* (double)T0;//* LL;
			    	state_prediction[1][0] = state_prediction[1][save_index];
			    }
			}

			//Calculate the rate offset
			if(!hasSaved && save_index < 1){
				if(save_index == 0)
					rateoffset_estimate = 0;
				else
					rateoffset_estimate = TS * (clockoffset_save[save_index] - clockoffset_save[save_index - 1]);
			}

			//Otherwise, use kalman filter
			else{
				rateoffset_estimate = state_prediction[0][save_index] - state_estimate[0][save_index];

			}

			//

			if(clockoffset_save[save_index] > L && clockoffset_save[save_index - 1] < L)
				adjustedclockoffset = clockoffset_save[save_index] + 5 * L * rateoffset_estimate;
			else if(clockoffset_save[save_index] > L && clockoffset_save[save_index - 1] < L)
				adjustedclockoffset = clockoffset_save[save_index] + 3 * L *rateoffset_estimate;
			else
				adjustedclockoffset = clockoffset_save[save_index] + 4 * L * rateoffset_estimate;
			////////


			j = (short) adjustedclockoffset; // casting from float to short just truncates, e.g., 3.99 becomes 3
			fractionalShift = adjustedclockoffset - (double) j; // fractionalShift >= 0 and < 1 tells us how much of a sample is left
			k = (short) (fractionalShift * (double) FER + 0.5);  // this now rounds and givse results on 0,...,FER
			if (k==FER) {  // we rounded up to the next whole sample
				k = 0;
				j++;
			}
			for (i=0;i<L;i++) {
				ell = j+i;

				while (ell>=L) {
					ell = ell-L;
				}

				if (current_clockbuf==0) {
					clockbuf_shifted[1][ell] = allMyDelayedWaveforms[k][i];  // write other buffer
				}
				else {
					clockbuf_shifted[0][ell] = allMyDelayedWaveforms[k][i];  // write other buffer
				}

			}

			// when can we swap buffers?
			buffer_swap_index = j+L/2;  // midpoint of the silent part (I think)
			while (buffer_swap_index>=L)
				buffer_swap_index = buffer_swap_index-L;

			// tell the ISR the calculations are done
			delay_est_done = 1;

			// update save index
			save_index++;
			if (save_index>=SAVES)  // wrap
				{
				save_index = 0;
				hasSaved = 1;
				}

			DSK6713_LED_toggle(1);	// toggle LED here for diagnostics

		}
		else if (buffer_just_swapped==1) {
			// this code computes the next buffer and attempts to corect for the frequency offset
			buffer_just_swapped = 0;
			// copy appropriate fractionally shifted clock buffer to shifted clock buffer
			adjustedclockoffset = adjustedclockoffset + ((double) L)*one_over_beta;  // adjust latency of next pulse
			while (adjustedclockoffset>((double) L))
				adjustedclockoffset = adjustedclockoffset - (double) L;
			j = (short) adjustedclockoffset; // casting from float to short just truncates, e.g., 3.99 becomes 3
			fractionalShift = adjustedclockoffset - (double) j; // fractionalShift >= 0 and < 1 tells us how much of a sample is left
			k = (short) (fractionalShift * (double) FER);  // this also truncates and should give result on 0,...,FER-1
			for (i=0;i<L;i++) {
				ell = j+i;
				if (ell>=L) {
					ell = ell-L;
				}
				if (current_clockbuf==0) {
					clockbuf_shifted[1][ell] = allMyDelayedWaveforms[k][i];  // write other buffer
				}
				else {
					clockbuf_shifted[0][ell] = allMyDelayedWaveforms[k][i];  // write other buffer
				}

			}
		} // if ((state==2)&&(delay_est_done==0))
	}  // while(1)
}  // void main
Example #9
0
void main()
{
	DSK6713_init();		// Initialize the board support library, must be called first
    hCodec = DSK6713_AIC23_openCodec(0, &config);	// open codec and get handle

	// Configure buffered serial ports for 32 bit operation
	// This allows transfer of both right and left channels in one read/write
	MCBSP_FSETS(SPCR1, RINTM, FRM);
	MCBSP_FSETS(SPCR1, XINTM, FRM);
	MCBSP_FSETS(RCR1, RWDLEN1, 32BIT);
	MCBSP_FSETS(XCR1, XWDLEN1, 32BIT);

	// set codec sampling frequency
	DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ);

	//initialize buffers to zero
	init();

	// interrupt setup
	IRQ_globalDisable();			// Globally disables interrupts
	IRQ_nmiEnable();				// Enables the NMI interrupt
	IRQ_map(IRQ_EVT_RINT1,15);		// Maps an event to a physical interrupt
	IRQ_enable(IRQ_EVT_RINT1);		// Enables the event
	IRQ_globalEnable();				// Globally enables interrupts

	//temporary variable for real-imag swapping for ifft, placed here for convenience
	float temp = 0;

	while(1)						// main loop - do nothing but wait for interrupts
	{
		if(pingFlag == 1){
			for(n = 0; n < FFT_LENGTH; n++){
				if(n < (ORDER - 1)){
					pingU[n] = Z[n];
				}
				else{
					pingU[n] = PING[n - (ORDER - 1)];
				}
			}
//			cfftr2_dit(pingU,w,FFT_LENGTH); //TI floating-pt complex FFT
//			bitrev(pingU,ix,FFT_LENGTH); //freq scrambled->bit-reverse X

			for(n = 0; n < FFT_LENGTH; n++){
//				V[n] = cmplxMult(h[n],pingU[n]);

				V[n] = pingU[n];

				//swap real and imaginary for ifft, remember to uncomment temp as well
//				temp = V[n].re;
//				V[n].re = V[n].im;
//				V[n].im = temp;
			}

//			cfftr2_dit(V,w,FFT_LENGTH) ; //TI floating-pt complex ifft
//			bitrev(V,ix,FFT_LENGTH); //freq scrambled->bit-reverse X

			for(n = ORDER - 1; n < FFT_LENGTH; n++)
			{
				outputPING[n] = V[n].re * 32768;
			}

			for(n = (FFT_LENGTH - (ORDER - 1)) - (ORDER -1); n < FFT_LENGTH - (ORDER - 1); n++)
			{
				Z[n] = PING[n];
			}
			lflag = 1;
		}
		if(pongFlag == 1){
			for(n = 0; n < FFT_LENGTH; n++){
				if(n < (ORDER - 1)){
					pongU[n] = Z[n];
				}
				else{
					pongU[n] = PONG[n - (ORDER - 1)];
				}
			}

//			cfftr2_dit(pongU,w,FFT_LENGTH) ; //TI floating-pt complex FFT
//			bitrev(pongU,ix,FFT_LENGTH); //freq scrambled->bit-reverse X

			for(n = 0; n < FFT_LENGTH; n++){
//				V[n] = cmplxMult(h[n],pongU[n]);

				V[n] = pongU[n];

//				swap real and imaginary for ifft, remember to uncomment temp as well
//				temp = V[n].re;
//				V[n].re = V[n].im;
//				V[n].im = temp;
			}
//			cfftr2_dit(V,w,FFT_LENGTH) ; //TI floating-pt complex ifft
//			bitrev(V,ix,FFT_LENGTH); //freq scrambled->bit-reverse X

			for(n = ORDER - 1; n < FFT_LENGTH; n++)
			{
				outputPONG[n] = V[n].re * 32768;
			}

			for(n = (FFT_LENGTH - (ORDER - 1)) - (ORDER -1); n < FFT_LENGTH - (ORDER - 1); n++)
			{
				Z[n] = PONG[n];
			}
			lflag = 1;
		}
	}
}
void main()
{

	// set up the cosine and sin matched filters for searching
	// also initialize searching buffer
	for (i=0;i<M;i++){
		t = i*0.25;				// time
		y = cos(2*PI*t);		// cosine matched filter (double)
		mfc[i] = (float) y;		// cast and store
		y = sin(2*PI*t);		// sine matched filter (double)
		mfs[i] = (float) y;     // cast and store
		buf[i] = 0.0;             // clear searching buffer
		fbuf[i] = 0.0;
	}

	// initialize input buffer
	for (i=0;i<BL;i++)
		inbuf[i] = 0.0;

	// initialize clock buffer
	for (i=0;i<L;i++)
		clockbuf[i] = 0;

	// set up clock buffer to play modulated sinc centered at zero
	for (i=-N;i<=N;i++){
		x = i*BW;
		if (i!=0) {
			t = i*0.25;
			y = ((double) CLOCKAMPLITUDE)*cos(CARRIERKHZ*PI*t)*sin(PI*x)/(PI*x); // double
		}
		else {
			y = ((double) CLOCKAMPLITUDE);
		}
		j = i;
		if (j<0) {
			j += L; // wrap
		}
		clockbuf[j] = (short) y;
	}



	DSK6713_init();		// Initialize the board support library, must be called first
	DSK6713_LED_init(); // initialize LEDs
    hCodec = DSK6713_AIC23_openCodec(0, &config);	// open codec and get handle

	// Configure buffered serial ports for 32 bit operation
	// This allows transfer of both right and left channels in one read/write
	MCBSP_FSETS(SPCR1, RINTM, FRM);
	MCBSP_FSETS(SPCR1, XINTM, FRM);
	MCBSP_FSETS(RCR1, RWDLEN1, 32BIT);
	MCBSP_FSETS(XCR1, XWDLEN1, 32BIT);

	// set codec sampling frequency
	DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_16KHZ);

	// interrupt setup
	IRQ_globalDisable();			// Globally disables interrupts
	IRQ_nmiEnable();				// Enables the NMI interrupt
	IRQ_map(IRQ_EVT_RINT1,15);		// Maps an event to a physical interrupt
	IRQ_enable(IRQ_EVT_RINT1);		// Enables the event
	IRQ_globalEnable();				// Globally enables interrupts

	while(1)						// main loop
	{
	}
}
/**
 *  \brief  UART interrupt Test function
 *
 *   This function verifies the UART operation in interrupt mode.
 *   This function runs in an infinite loop to read the characters
 *   from HyperTerminal and echo the characters back to HyperTerminal.
 *
 *  \param  none
 *
 *  \return Test result(Only Failure Case)
 */
CSL_Status uart_IntcSample(void)
{
	CSL_UartIsrAddr    isrAddr;
	CSL_Status         status;
	Uint32            sysClk;

	sysClk = getSysClk();

	mySetup.clkInput = sysClk;

    /* Loop counter and error flag */
    status = UART_init(&uartObj,CSL_UART_INST_0,UART_INTERRUPT);
    if(CSL_SOK != status)
    {
        printf("UART_init failed error code %d\n",status);
        return(status);
    }
	else
	{
		printf("UART_init Successful\n");
	}

    /* Handle created */
    hUart = (CSL_UartHandle)(&uartObj);

    /* Configure UART registers using setup structure */
    status = UART_setup(hUart,&mySetup);
    if(CSL_SOK != status)
    {
        printf("UART_setup failed error code %d\n",status);
        return(status);
    }
	else
	{
		printf("UART_setup Successful\n");
	}

	/* Send the details of the test to HyperTerminal */
   	status = UART_fputs(hUart,"\r\n\nUART INTERRUPT TEST!",0);
    if(CSL_SOK != status)
    {
        printf("UART_fputs failed error code %d\n",status);
        return(status);
    }

   	status = UART_fputs(hUart,"\r\nTEST READS A CHARACTER FROM HYPERTERMINAL CONTINUOUSLY",0);
    if(CSL_SOK != status)
    {
        printf("UART_fputs failed error code %d\n",status);
        return(status);
    }

   	status = UART_fputs(hUart,"\r\nENTER '$' TO END THE TEST\r\n",0);
    if(CSL_SOK != status)
    {
        printf("UART_fputs failed error code %d\n",status);
        return(status);
    }

	/* Configure and Register the UART interrupts */
	isrAddr.rbiAddr  = uart_rxIsr;
	isrAddr.tbeiAddr = uart_txIsr;
	isrAddr.ctoi     = uart_ctoIsr;
	isrAddr.lsiAddr  = uart_lsiIsr;

    /* Disable interrupt */
    IRQ_globalDisable();

    /* Clear any pending interrupts */
	IRQ_clearAll();

	/* Disable all the interrupts */
	IRQ_disableAll();

	IRQ_setVecs((Uint32)(&VECSTART));

	/* Configuring Interrupt */
	IRQ_plug (UART_EVENT, &UART_intrDispatch);

	/* Enabling Interrupt */
	IRQ_enable(UART_EVENT);
	IRQ_globalEnable();

	/* Set the UART callback function */
 	status = UART_setCallback(hUart,&isrAddr);
	if(status != CSL_SOK)
	{
		printf("UART_setCallback Failed\n");
		return(status);
	}

 	/* Enable the UART Events */
	status = UART_eventEnable(hUart, CSL_UART_XMITOR_REG_EMPTY_INTERRUPT);
	if(status != CSL_SOK)
	{
		printf("UART_eventEnable Failed\n");
		return(status);
	}

	status = UART_eventEnable(hUart, CSL_UART_RECVOR_REG_DATA_INTERRUPT);
	if(status != CSL_SOK)
	{
		printf("UART_eventEnable Failed\n");
		return(status);
	}

	status = UART_eventEnable(hUart, CSL_UART_RECVOR_LINE_STATUS_INTERRUPT);
	if(status != CSL_SOK)
	{
		printf("UART_eventEnable Failed\n");
		return(status);
	}

	/* Tests runs until users enters Symbol '$' on the HyperTerminal */
	while(endOfTest == FALSE)
	{

	}

	printf("\nUSER ENTERED '$' on HyperTerminal\n");
	printf("END OF TEST!\n");

	/* Disable UART interrupts */
	IRQ_disable(UART_EVENT);

	/* Disable GLobal Interrupts */
	IRQ_globalDisable();

	/* Send the END OF TEST MESSAGE to HyperTerminal */
   	status = UART_fputs(hUart,"\r\n\nYOU HAVE ENTERED '$'.",0);
    if(CSL_SOK != status)
    {
        printf("UART_fputs failed error code %d\n",status);
        return(status);
    }

   	status = UART_fputs(hUart,"\r\nEND OF THE TEST!!\r\n",0);
    if(CSL_SOK != status)
    {
        printf("UART_fputs failed error code %d\n",status);
        return(status);
    }

    /* Disable interrupt */
    IRQ_globalDisable();

    /* Clear any pending interrupts */
	IRQ_clearAll();

	/* Disable all the interrupts */
	IRQ_disableAll();

	return(CSL_SOK);
}