/* 
 *  Copyright 2004 by Soos, Antal 
 *  All rights reserved. Property of Soos, Antal. 
 *  Restricted rights to use, duplicate or disclose this code are 
 *  granted through contract.   
 */ 
/***************************************************************************/ 
/*                                                                         */ 
/*     hlobal_var . hpp													   */ 
/*                                                                         */ 
/*                                                                         */ 
/***************************************************************************/ 
//#ifndef _GLOBAL_VAR_HPP_ 
//#define _GLOBAL_VAR_HPP_    
//------------------------------
//  DSP 2 <=> TMS320C6713



#include "mmaccfg.h"

#include "dsk_lib.h"
/* Global definitions: */
#include "global_def.h"
//*****************************************************************************
#include "sysIdent.hpp"
#include "MatrixCal.hpp" 
#include "sysContr.hpp"
 
//*****************************************************************************
// Paramether estimation:
#include "FIX.hpp"
#include "RLS.hpp"
#include "LMS.hpp"
#include "WCE.hpp"
#include "KF.hpp"
#include "FQR_RLS.hpp"
#include "IQR_RLS.hpp"
#include "QR_LMS.hpp"
  
  // Control algorithm
  #include "H8_MPC.hpp"

//***********************************************************************/
/************************************************************************/ 
#ifdef _in_MAIN_CPP_ 
/************************************************************************/ 
#undef _in_MAIN_CPP_ 
 

// The MPC algorithm paramethers:
int selectionflag;	//The identification parameters and statistic is redy =1
int controlStatRedy; // The statistic on the control is redy = 1, else 0



 FIX_alg     *pFIX;
 RLS_alg     *pRLS;
 LMS_alg     *pLMS;
 WCE_alg     *pWCE;
 KF_alg      *pKF;
 FQR_RLS_alg *pFQR_RLS;
 IQR_RLS_alg *pIQR_RLS;  
 QR_LMS_alg  *pQR_LMS;

 H8MPC_alg  *pH8MPC;
 
#pragma DATA_ALIGN(REC_BUF_SZ);
Uint32 com_rec[REC_BUF_SZ];

#pragma DATA_ALIGN(TRA_BUF_SZ);
Uint32 com_tra[TRA_BUF_SZ];

 D2D_com *rec;
 D2D_com *tra;
 
 Uint32 uiRotationalPeriod;
 float delta_omega;
 
 float t_n;   // The time measurement
 Uint32 log_ux[3];  // For LOG_event data
 F2Xcon  *pfxyz;
 
 float gftemp1,  gftemp2, gftemp3, gftemp4,  gftemp5;
/************************************************************************/        
#else  /* Defnitions external to MAIN_CPP  folow                       */
/************************************************************************/  

extern int selectionflag;
extern int controlStatRedy;

extern far FIX_alg     *pFIX;
extern far  RLS_alg     *pRLS;
extern far  LMS_alg     *pLMS;
extern far  WCE_alg     *pWCE;
extern far  KF_alg      *pKF;
extern far  FQR_RLS_alg *pFQR_RLS;
extern far  IQR_RLS_alg *pIQR_RLS;  
extern far  QR_LMS_alg  *pQR_LMS;

extern far  H8MPC_alg  *pH8MPC;

extern Uint32 com_rec[REC_BUF_SZ];
extern Uint32 com_tra[TRA_BUF_SZ];

extern  D2D_com *rec;
extern  D2D_com *tra;

extern Uint32 log_ux[3];  // For LOG_event data
extern  F2Xcon  *pfxyz;

extern float t_n;   // The time measurement 

extern Uint32 uiRotationalPeriod;
extern  float delta_omega;

extern   float gftemp1,  gftemp2, gftemp3, gftemp4,  gftemp5;
/************************************************************************/  
#endif  /* Commom definitions follows : */
/************************************************************************/ 

//#endif  /* _GLOBAL_VAR_HPP_ */
