#ifndef XP_PLANE_ADR_H
#define XP_PLANE_ADR_H 	
#include <project_setup.h>
/*------------------------------------------------------------------------------
 Plane counter
------------------------------------------------------------------------------*/
/////////////////////////////////////////////////////////////////////
// Настройка номеров плат, для каждого проекта разной может быть
/////////////////////////////////////////////////////////////////////

#if (C_PROJECT_TYPE==PROJECT_10510)

// Подсчет количества плат

//
// для выставления авторазмер массивов в project.
// но т.к. границу массива сложно проверить, возвращаем в максим. возможный размер
// память кушает, но лучше так возможно
//
#define MAX_C_CDS_TK_NUMBER     6 // max 8
#define MAX_C_CDS_IN_NUMBER     3 // max 3
#define MAX_C_CDS_OUT_NUMBER    3 // max 3
#define MAX_C_ADC_NUMBER        3 // max 3
#define MAX_C_HWP_NUMBER        3 // max 3
#define MAX_C_CDS_RS_NUMBER     1 // max 1

/*------------------------------------------------------------------------------
 Plane address
------------------------------------------------------------------------------*/
////////////////////////////////////////////////////////////////////////////////////////////////////
#define C_controller_address        1
////////////////////////////////////////////////////////////////////////////////////////////////////
#define C_cds_in0_address           2
#define C_cds_in1_address           3
#define C_cds_in2_address           4
////////////////////////////////////////////////////////////////////////////////////////////////////
#define C_cds_tk0_address           6
#define C_cds_tk1_address           7
#define C_cds_tk2_address           8
#define C_cds_tk3_address           9
#define C_cds_tk4_address           10
#define C_cds_tk5_address           11
//#define C_cds_tk6_address           19
//#define C_cds_tk7_address           20
////////////////////////////////////////////////////////////////////////////////////////////////////
#define C_cds_out0_address          5
#define C_cds_out1_address          21
#define C_cds_out2_address          22
////////////////////////////////////////////////////////////////////////////////////////////////////
#define C_adc0_address              13
#define C_adc1_address              15
#define C_adc2_address              12
////////////////////////////////////////////////////////////////////////////////////////////////////
#define C_cds_rs0_address           14
////////////////////////////////////////////////////////////////////////////////////////////////////
#define C_hwp0_address              16
#define C_hwp1_address              17
#define C_hwp2_address              18
#else
/////////////////////////////////////////
// это для остальных проектов
////////////////////////////////////////

// Подсчет количества плат

//
// для выставления авторазмер массивов в project.
// но т.к. границу массива сложно проверить, возвращаем в максим. возможный размер
// память кушает, но лучше так возможно
//
#define MAX_C_CDS_TK_NUMBER     4 // max 8
#define MAX_C_CDS_IN_NUMBER     3 // max 3
#define MAX_C_CDS_OUT_NUMBER    3 // max 3
#define MAX_C_ADC_NUMBER        2 // max 3
#define MAX_C_HWP_NUMBER        2 // max 3
#define MAX_C_CDS_RS_NUMBER     1 // max 1

/*------------------------------------------------------------------------------
 Plane number address
------------------------------------------------------------------------------*/
#define C_controller_address        1

#define C_cds_in0_address           2
#define C_cds_in1_address           3
#define C_cds_in2_address           4

#define C_cds_tk0_address           5
#define C_cds_tk1_address           6
#define C_cds_tk2_address           9
#define C_cds_tk3_address           10

//#define C_cds_tk4_address           255
//#define C_cds_tk5_address           255
//#define C_cds_tk6_address           255
//#define C_cds_tk7_address           255

#define C_cds_out0_address          11
#define C_cds_out1_address          12
#define C_cds_out2_address          13

#define C_adc0_address              7
#define C_adc1_address              8
//#define C_adc2_address              255

#define C_cds_rs0_address           14

#define C_hwp0_address              16
#define C_hwp1_address              17
//#define C_hwp2_address              255

#endif



///////////////////////////////////////////////////////
//  тут авто расчет
//  количество плат может вдруг превысить MAX_C_CDS_TK_NUMBER (см.выше)
//  тогда производим авто пересчет
///////////////////////////////////////////////////////





#if (MAX_COUNT_PLATES_CDS_TK>MAX_C_CDS_TK_NUMBER)
#define C_cds_tk_number		MAX_COUNT_PLATES_CDS_TK // max 8
#else
#define C_cds_tk_number     MAX_COUNT_PLATES_CDS_TK // max 8
#endif


#if (MAX_COUNT_PLATES_ADC>MAX_C_ADC_NUMBER)
#define C_adc_number		MAX_C_ADC_NUMBER // max 3
#else
#define C_adc_number        MAX_COUNT_PLATES_ADC // max 3
#endif

#if (MAX_COUNT_PLATES_HWP>=MAX_C_HWP_NUMBER)
#define C_hwp_number		MAX_C_HWP_NUMBER // max 3
#else
#define C_hwp_number        MAX_COUNT_PLATES_HWP // max 3
#endif


#if (MAX_COUNT_PLATES_OUT>MAX_C_CDS_OUT_NUMBER)
#define C_cds_out_number        MAX_C_CDS_OUT_NUMBER // max 3
#else
#define C_cds_out_number        MAX_COUNT_PLATES_OUT // max 3
#endif


#if (MAX_COUNT_PLATES_IN>MAX_C_CDS_IN_NUMBER)
#define C_cds_in_number        MAX_C_CDS_IN_NUMBER // max 3
#else
#define C_cds_in_number        MAX_COUNT_PLATES_IN // max 3
#endif


#if (MAX_COUNT_PLATES_CDS_RS>MAX_C_CDS_RS_NUMBER)
#define C_cds_rs_number        MAX_COUNT_PLATES_CDS_RS // max 1
#else
#define C_cds_rs_number        MAX_COUNT_PLATES_CDS_RS // max 1
#endif



//#define C_cds_in_number         MAX_C_CDS_IN_NUMBER // max 3
//#define C_cds_out_number        MAX_C_CDS_OUT_NUMBER // max 3
//#define C_cds_rs_number         MAX_C_CDS_RS_NUMBER // max 1


#endif  // end XP_PLANE_ADR_H



