#ifndef PROJECT_SETUP_H
#define PROJECT_SETUP_H

/*

   ГлобальнаЯ настройка длЯ сбора либы в myXilinx 
   В зависимости от C_PROJECT_TYPE происходит сбор

   project_setup.h должен лежать в папке /main/
   т.е. вне /myXilinx/
   т.к. он длЯ каждого проекта он должен быть уникален!
*/

/*------------------------------------------------------------------------------
	Project type
------------------------------------------------------------------------------*/
// все возможные проекты
/////////////////////////////////////////////////////////////////////////////
#define PROJECT_22220		10
#define PROJECT_21300		11
#define PROJECT_21180		12
#define PROJECT_BALZAM		13
#define PROJECT_23470		14
#define PROJECT_23550		15
#define PROJECT_10510       16


#define PROJECT_STEND_D		PROJECT_BALZAM

///////////////////////////////////////////////
// выбираем нужный проект
///////////////////////////////////////////////

//#define C_PROJECT_TYPE		PROJECT_21180
//#define C_PROJECT_TYPE		PROJECT_21300
//#define C_PROJECT_TYPE		PROJECT_22220
//#define C_PROJECT_TYPE		PROJECT_BALZAM
//#define C_PROJECT_TYPE		PROJECT_23470
//#define C_PROJECT_TYPE		PROJECT_STEND_D

#define C_PROJECT_TYPE		    PROJECT_23550
//#define C_PROJECT_TYPE          PROJECT_10510

// Настройка скоростей RS232
#define RS232_SPEED_A                       57600//115200//57600
#define RS232_SPEED_B                       57600//115200//57600//

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//  Настройка типа ШИМа
///////////////////////////////////////////////////////////////////////////////////

#if (C_PROJECT_TYPE==PROJECT_23550 || C_PROJECT_TYPE==PROJECT_BALZAM)
#define XPWMGEN     1   // ШИМ от xilinx 24
#define TMSPWMGEN   0 // ШИМ от tms
#else
#define XPWMGEN     0   // ШИМ от xilinx 24
#define TMSPWMGEN   1 // ШИМ от tms
#endif


///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

#if (TMSPWMGEN==1) && (XPWMGEN==1)
    #error "Ошибка настройки проекта. Выбрано оба типа ШИМа!!!"

#endif


#if (TMSPWMGEN==1)

#else //TMSPWMGEN

#if (XPWMGEN==1)
#else

    #error "Ошибка настройки проекта. Не выбран тип ШИМа!!!"

#endif //XPWMGEN
#endif //TMSPWMGEN

////////////////////////////////////////////////
////////////////////////////////////////////////
/////////////////////////////////////////////////
// Настройка количества плат длЯ проекта
////////////////////////////////////////////////
/////////////////////////////////////////////////
#if (_FLOOR6==0)
#define USE_ADC_0   1
#define USE_ADC_1   1
////#define USE_ADC_2   1
//
#define USE_IN_0    1

#define USE_IN_1    1
//////#define USE_IN_2    1
////
#define USE_OUT_0   1
//////#define USE_OUT_1 1
//////#define USE_OUT_2 1
////
////
#define USE_TK_0    1
#define USE_TK_1    1
////
#define USE_TK_2    1
#define USE_TK_3    1
////
//////#define USE_TK_4    1
//////#define USE_TK_5    1
//////#define USE_TK_6    1
//////#define USE_TK_7    1
////
#define USE_HWP_0   1
////#define USE_HWP_1   1
//////#define USE_HWP_2   1
////
//////#define USE_ROT_1 1

#else

#if (_FLOOR6_ADD==1)

#define USE_ADC_0   1
#define USE_ADC_1   1
//////
#define USE_IN_0    1
////
//#define USE_IN_1    1
////////
//#define USE_OUT_0   1
////////
////////
#define USE_TK_0    1
#define USE_TK_1    1
//////
#define USE_TK_2    1
#define USE_TK_3    1

//#define USE_HWP_0   1


#else

#define USE_ADC_0	1
#define USE_ADC_1	1
////
#define USE_IN_0	1
//
#define USE_IN_1	1
//////
#define USE_OUT_0	1
//////
//////
#define USE_TK_0	1
#define USE_TK_1	1
////
#define USE_TK_2 	1
#define USE_TK_3	1

#define USE_HWP_0	1
#define USE_HWP_1   1

#endif

#endif


////////////////////////////////////////////////
// Настройка типа плат SP2 или SP6
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////

#define TYPE_CDS_XILINX_IN_0	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_IN_1	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_IN_2	TYPE_CDS_XILINX_SP2

#define TYPE_CDS_XILINX_OUT_0	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_OUT_1	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_OUT_2	TYPE_CDS_XILINX_SP2

#define TYPE_CDS_XILINX_TK_0	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_TK_1	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_TK_2	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_TK_3	TYPE_CDS_XILINX_SP6
#define TYPE_CDS_XILINX_TK_4    TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_TK_5    TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_TK_6    TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_TK_7    TYPE_CDS_XILINX_SP2

#define TYPE_CDS_XILINX_ADC_0	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_ADC_1	TYPE_CDS_XILINX_SP2
#define TYPE_CDS_XILINX_ADC_2   TYPE_CDS_XILINX_SP2

#define TYPE_CDS_XILINX_RS_0	TYPE_CDS_XILINX_SP2

////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////

//#define TYPE_CDS_XILINX_HWP_0_1	MODE_HWP_SPEED_SLOW

#ifndef USE_ADC_0
#define USE_ADC_0   0
#endif

#ifndef USE_ADC_1
#define USE_ADC_1   0
#endif

#ifndef USE_ADC_2
#define USE_ADC_2   0
#endif


#ifndef USE_IN_0
#define USE_IN_0    0
#endif

#ifndef USE_IN_1
#define USE_IN_1    0
#endif

#ifndef USE_IN_2
#define USE_IN_2   0
#endif


#ifndef USE_OUT_0
#define USE_OUT_0   0
#endif

#ifndef USE_OUT_1
#define USE_OUT_1 0
#endif

#ifndef USE_OUT_2
#define USE_OUT_2 0
#endif



#ifndef USE_TK_0
#define USE_TK_0    0
#endif

#ifndef USE_TK_1
#define USE_TK_1    0
#endif


//
#ifndef USE_TK_2
#define USE_TK_2    0
#endif

#ifndef USE_TK_3
#define USE_TK_3    0
#endif


#ifndef USE_TK_4
#define USE_TK_4    0
#endif

#ifndef USE_TK_5
#define USE_TK_5    0
#endif

#ifndef USE_TK_6
#define USE_TK_6    0
#endif

#ifndef USE_TK_7
#define USE_TK_7    0
#endif


#ifndef USE_HWP_0
#define USE_HWP_0   0
#endif

#ifndef USE_HWP_1
#define USE_HWP_1   0
#endif

#ifndef USE_HWP_2
#define USE_HWP_2  0
#endif


#ifndef USE_ROT_1
#define USE_ROT_1 0
#endif



////////////////////////////////////////////////
// автоматически идет подсчет плат в проекте
////////////////////////////////////////////////
#if (USE_HWP_2==1)
#define MAX_COUNT_PLATES_HWP    3
#else
#if (USE_HWP_1==1)
#define MAX_COUNT_PLATES_HWP    2
#else
#define MAX_COUNT_PLATES_HWP    1
#endif
#endif
////////////////////////////////////////////////

#if (USE_TK_7==1)
#define MAX_COUNT_PLATES_CDS_TK     8
#else
#if (USE_TK_6==1)
#define MAX_COUNT_PLATES_CDS_TK     7
#else
#if (USE_TK_5==1)
#define MAX_COUNT_PLATES_CDS_TK     6
#else
#if (USE_TK_4==1)
#define MAX_COUNT_PLATES_CDS_TK     5
#else
#if (USE_TK_3==1)
#define MAX_COUNT_PLATES_CDS_TK     4
#else
#if (USE_TK_2==1)
#define MAX_COUNT_PLATES_CDS_TK     3
#else
#if (USE_TK_1==1)
#define MAX_COUNT_PLATES_CDS_TK     2
#else
#if (USE_TK_0==1)
#define MAX_COUNT_PLATES_CDS_TK     1
#else
#define MAX_COUNT_PLATES_CDS_TK     1

#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
////////////////////////////////////////////////

#if (USE_ADC_2==1)
#define MAX_COUNT_PLATES_ADC     3
#else
#if (USE_ADC_1==1)
#define MAX_COUNT_PLATES_ADC     2
#else
#if (USE_ADC_0==1)
#define MAX_COUNT_PLATES_ADC     1
#else
#define MAX_COUNT_PLATES_ADC     1
#endif
#endif
#endif


////////////////////////////////////////////////
#if (USE_OUT_2==1)
#define MAX_COUNT_PLATES_OUT     3
#else
#if (USE_OUT_1==1)
#define MAX_COUNT_PLATES_OUT     2
#else
#if (USE_OUT_0==1)
#define MAX_COUNT_PLATES_OUT     1
#else
#define MAX_COUNT_PLATES_OUT     1
#endif
#endif
#endif


////////////////////////////////////////////////
////////////////////////////////////////////////
#if (USE_IN_2==1)
#define MAX_COUNT_PLATES_IN     3
#else
#if (USE_IN_1==1)
#define MAX_COUNT_PLATES_IN     2
#else
#if (USE_IN_0==1)
#define MAX_COUNT_PLATES_IN     1
#else
#define MAX_COUNT_PLATES_IN     1
#endif
#endif
#endif


////////////////////////////////////////////////


#if (USE_ROT_1==1)
#define MAX_COUNT_PLATES_CDS_RS    1
#else
#define MAX_COUNT_PLATES_CDS_RS    0
#endif

////////////////////////////////////////////////


#include <params_bsu.h>

#endif // end PROJECT_SETUP_H

