
/************************************************************************/ 
#define _in_MAIN_CPP_ 
/************************************************************************/ 
//  DSP 1 <=> TMS320C6711
#include "mmaccfg.h"
#include <std.h>
#include <csl_cache.h>



#include "global_var.h"
#include "A2D2A.h"

#include "dsk_lib.h"
#include "AVR_Exciter.h"


/*
 *  ======== main ========
 */
int main()
{
 
 //--------------------------------------------------------------------   
// int i;
 
   // if (IRQ_biosPresent()) printlog(" 1-IRQ_biosPresent! \n");

     	//EDMA_intDisable(TCCINTNUM);		/*Disable EDMA interrupt 	*/
      
 // System identification:    
 

    LED_off(1);
    LED_on(2);  
    LED_on(3); 
    
  

 //--------------------------------------------------------------------   
   		    			
    //LOG_printf(&trace, " Pre GO DSK! \n"); 	
    
    
    
    // Set the D/A to zero output
    da_buffer[0] =  ZERO_V_D2A; //0;//da_buffer[0]+ 555 ;
    da_buffer[1] =  ZERO_V_D2A; // 0x3fff;//da_buffer[1] + (555*2);   
    da_buffer[2] =  ZERO_V_D2A; // 0xbffd;//da_buffer[2]+ (555*3);
    da_buffer[3] =  ZERO_V_D2A; // 0xffff;//da_buffer[3] + (555*4);    
  
   // if (IRQ_biosPresent()) printlog(" 2-IRQ_biosPresent! \n");				
	init_A2D2A();
	
	// DSP to DSP communication buffer definition:
 	rec = (D2D_com *) com_rec;
 	tra = (D2D_com *) com_tra;
	for (int i=0; i<SCR_BLOCK_SZ; i++) com_tra[i] = 0x0;
	// Initialization to zero float:
	for (int i=0; i<(SCR_BLOCK_SZ-2); i++) rec->x[i] = 0.0;
	for (int i=0; i<(SCR_BLOCK_SZ-2); i++) tra->x[i] = 0.0;
	
	init_AVR_Exciter();  // Initializatin the AVR paramethers
	
    LED_off(1);
    LED_off(2);  
    LED_off(3);  
	
	LED_off(LED_DSK_Y);
	LED_off(LED_DSK_R);
	LED_off(LED_DSK_G);
	
	LED_off(LED_A2D2A_Y);
	LED_off(LED_A2D2A_R);
	
   // LOG_printf(&trace, "in main: the mmac upp and runing!");
    // printlog(" in main: the mmac upp and runing! \n"); 
     /* fall into DSP/BIOS idle loop */
    return 0;
}


extern "C" {
Void userInitFun(Void) ;}



Void userInitFun(Void)// Not used !!!
{
   
	//LOG_printf(&trace, " Start of userInitFun ! \n");

	LED_on(1);
   	LED_on(2);  
   	LED_on(3);    	
   	
	//LOG_printf(&trace, " End of userInitFun ! \n");

}




