/************************************************************************
*
* 文件名       ：  dquCIInterFace.c
* 版权说明 ：  北京交控科技有限公司 
* 版本号   ：  1.0
* 创建时间 ：  2011.12.27
* 作者     ：  研发中心软件部
* 功能描述 ：  CI数据接口处理过程 
* 使用注意 ： 
* 修改记录 ： 20150723修改ReadRouteConfigData()函数，只读取属于本联锁的进路数据 
*
************************************************************************/
#include "dquCIInterFace.h"
#include "commonQueryStruDef.h"
#include "dquCbtcType.h"
#include "dquIdmapQuery.h"
#include "dsuEmapDefine.h"
#include "LinkConfigDataManage.h"
#include "dsuRssp2Func.h"
#include "CommonMemory.h"
#include "Convert.h"
#include "dfsDataRead.h"
#include "dquDataTypeDefine.h"
#include "dquIdmapInit.h"
#include "dfsDataRead.h"
#include "SystemParameterManage.h"
#include "../Initial/InitialProcess.h"
#include "dquIdmapQuery.h"

/*********************************************
*函数功能：为CI使用的公共数据赋值
*参数说明：dsuEmapStru 电子地图总结构体          
*返回值：无
*********************************************/
static void CIInitEmap(DSU_EMAP_STRU dsuEmapStruPar);
/*********************************************
*函数功能：初始化所有数据
*参数说明：FSName文件指针          
*返回值：0，失败；1，成功
*********************************************/
/****************************************************************************************

 	函数功能：找出link所属的物理区段编号
	入口参数：UINT16 wLinkId				linkID信息
	出口参数：无
	返回值：  查询失败:0xffff;查询成功：返回物理区段ID信息  
	算法：    1。遍历计轴区段表，查找关联计轴区段，找到link所属的物理区段
*******************************************************************************************/
static UINT16 FindLinkBelongAxleSgmt(UINT16 wLinkId);

UINT8 InitAll(CHAR* FSName)
{
	UINT8 RtnVal = 0u;
	UINT8 cFunRetVal = 0u;
	
	UINT8 szFSFILEVersionFS[DFS_VERSION_LENGTH] = { 0U };

	UINT8 szFSPUBVersionFS[DFS_VERSION_LENGTH] = { 0U };

	UINT8 szFSPRIVVersionFS[DFS_VERSION_LENGTH_PRIV] = { 0U };

	UINT8 szFSOCVersionFS[DFS_VERSION_LENGTH_PRIV] = { 0U };

	/* 数据版本号初始化 */

	/*电子地图版本号*/
	cFunRetVal = dquGetFSVersion(FSName, szFSFILEVersionFS);
	if (1u == cFunRetVal)
	{
		SetTiocFsVersion(szFSFILEVersionFS);
	}
	/*公共数据结构版本号*/
	cFunRetVal = dquGetPublicFSVersion(FSName, szFSPUBVersionFS);
	cFunRetVal &= dquGetPrivateFSVersion(FSName, szFSPRIVVersionFS);
	cFunRetVal &= dquGetOcDataFSVersion(FSName, szFSOCVersionFS);

	if (1u == cFunRetVal)
	{
		RtnVal = CheckTiocPublicFsVersion(szFSPUBVersionFS);
		if (CI_SUCCESS == RtnVal)
		{
			/*私有数据结构版本号*/
			RtnVal = CheckTiocPrivateFsVersion(szFSPRIVVersionFS);

			if (CI_SUCCESS == RtnVal)
			{
				/*数据结构版本号检查通过*/

				/*OC数据结构检查*/
				RtnVal = CheckTiocOcFsVersion(szFSOCVersionFS);

				if (CI_SUCCESS == RtnVal)
				{
					/*数据结构版本号检查通过*/
				}
				else
				{
					/*不兼容此版本OC数据结构*/
					debug_infor_printf((const)"Error: OC FS Version %d.%d.%d.%d Is Not Compatible\n", szFSOCVersionFS[0], szFSOCVersionFS[1], 0u, 0u);
				}
			}
			else
			{
				/*不兼容此版本私有数据结构*/
				debug_infor_printf((const)"Error: Private FS Version %d.%d.%d.%d Is Not Compatible\n", szFSPRIVVersionFS[0], szFSPRIVVersionFS[1], 0u, 0u);
			}
		}
		else
		{
			/*不兼容此版本公共数据结构*/
			debug_infor_printf((const)"Error: Public FS Version %d.%d.%d.%d Is Not Compatible\n", szFSPUBVersionFS[0], szFSPUBVersionFS[1], szFSPUBVersionFS[2], szFSPUBVersionFS[3]);

		}
	}
	else
	{
		/*读取数据结构表头中的版本号失败*/
		debug_infor_printf((const)"Error: Public or Private FS Version Read Faild\n");
		RtnVal = CI_ERROR;
	}
	if (CI_ERROR != RtnVal)
	{
		RtnVal = dquSetInitEmapRef(&dsuEmapStru);/*设置电子地图静态结构体,集成指针版查询函数*/

		RtnVal &= dquSetInitStaticLimitLinkRef(&gg_ppDsuLimitStcLinkIdx);/*设置静态数据LINK查询初始化表的指针*/

		RtnVal &= dquSetInitEmapExtendRef(&dsuEmapExtendStru);

		RtnVal &= dfsEmapInit(FSName);/*电子地图初始化*/
	}

	if (0u != RtnVal)
	{
		CIInitEmap(dsuEmapStru);/*为CI使用的公共数据赋值*/

		RtnVal = CiPatternInit(FSName); /*初始化当前联锁类型配置数据*/
		if (0u != RtnVal) /*初始化当前联锁类型配置数据*/
		{
			/*初始化系统配置数据结构体*/
			/*初始化本机联锁包含虚拟联锁数据*/
			InitLocalCIHaveVirCI_UseVirCI();
			/*读联锁功能配置数据*/
			CiFunctionSwitchStructInit(FSName);
			if (1u != ReadCiFuncSwitchConfigData(CiFuncSwitConfStruNew))
			{
				RtnVal = 0u;
			}
			RtnVal *= RelayInit(FSName);
			if (0u != RtnVal)
			{
				RtnVal *= MaskInit(FSName);
				if (0u == RtnVal)
				{
#ifdef PLATFORM_2OO2

					(void)printf("Mask Init Error\n");
					debug_infor_printf((const)"Mask Init Error\n");
#endif
				}
				CheckOverlapMaskBit();/*检查保护区段码位*/
			}
			else
			{
#ifdef PLATFORM_2OO2

				(void)printf("Relay Init Error\n");
				debug_infor_printf((const)"Relay Init Error\n");
#endif
			}
		}
		else
		{
#ifdef PLATFORM_2OO2
			(void)printf("CiPattern Init Error\n");
			debug_infor_printf((const)"CiPattern Init Error\n");
#endif
		}
	}
	else
	{
#ifdef PLATFORM_2OO2

		(void)printf("Emap Init Error\n");
		debug_infor_printf((const)"Emap Init Error\n");
#endif
	}
	return RtnVal;
}

/*********************************************
*函数功能：检查保护区段码位
			规则：同一进路的所有保护区段码位必须一样
*参数说明：无
*返回值：无
*********************************************/
void CheckOverlapMaskBit(void)
{
	UINT16 i = 0u;
	UINT16 j = 0u;
	UINT16 k = 0u;
	UINT16 overlapId = 0u;
	UINT16 overlapIdNext = 0u;
	UINT16 overlapIdMax = 0u;/*最大保护区段id*/

	UINT16 cizc_Overlap_maskId = 0u;
	UINT16 cizc_Overlap_maskId_next = 0u;
	UINT8 ciId = 0u;
	UINT8 flag1=0u;
	UINT8 flag2 =0u;
	UINT8 flagMax = 0u;
	UINT16 maskId = 0u;
	UINT16 maskIdNext = 0u;
	for(i=0u;i<LSDataLen.LSRouteStrLen;i++)
	{
		RouteConfigDataStruct * pRouteCfgDtStr = (RouteConfigDataStruct *)&(dquCICfgDtStr.RouteCfgDtStr[i]);
		ciId = pRouteCfgDtStr->BelongCiId;
		if (2u <= pRouteCfgDtStr->OverlapSum )/*如果保护区段数量大于等于2条*/
		{
			overlapIdMax = pRouteCfgDtStr->OverlapIdBuf[0];
			for (j=1u;j<pRouteCfgDtStr->OverlapSum;j++)
			{
				if (pRouteCfgDtStr->OverlapIdBuf[j] > overlapIdMax)
				{
					overlapIdMax = pRouteCfgDtStr->OverlapIdBuf[j];
				}
				else
				{
				}
			}

			/*获取每条保护区段的编号，对应的CI-ZC码位*/
			for (j=0u;j<pRouteCfgDtStr->OverlapSum-1u;j++)
			{
				if (pRouteCfgDtStr->OverlapIdBuf[j] < pRouteCfgDtStr->OverlapIdBuf[j+1u])
				{
					overlapId = pRouteCfgDtStr->OverlapIdBuf[j];
					overlapIdNext = pRouteCfgDtStr->OverlapIdBuf[j+1u];
				}
				else
				{
					overlapId = pRouteCfgDtStr->OverlapIdBuf[j+1u];
					overlapIdNext = pRouteCfgDtStr->OverlapIdBuf[j];
					
				}
				
				flag1 = 0u;
				flag2 = 0u;
				flagMax = 0u;
				for (k=0u;k<=ConfigCiToZcMaskIdMax[ciId];k++)
				{
					if ((ConfigCiToZcMaskConfigDataStru[ciId][k].DeviceId == overlapId)
						&& (ConfigCiToZcMaskConfigDataStru[ciId][k].DeviceType == CI_DEVICE_TYPE_OVERLAP)
						&& (ConfigCiToZcMaskConfigDataStru[ciId][k].MaskType == MASK_TYPE_OVERLAP_LOCKSTATE))
					{
						flag1 = 1u;
						maskId = ConfigCiToZcMaskConfigDataStru[ciId][k].MaskId;
					}
					else
					{
					}

					if ((ConfigCiToZcMaskConfigDataStru[ciId][k].DeviceId == overlapIdNext)
						&& (ConfigCiToZcMaskConfigDataStru[ciId][k].DeviceType == CI_DEVICE_TYPE_OVERLAP)
						&& (ConfigCiToZcMaskConfigDataStru[ciId][k].MaskType == MASK_TYPE_OVERLAP_LOCKSTATE))
					{
						flag2 = 1u;
						maskIdNext = ConfigCiToZcMaskConfigDataStru[ciId][k].MaskId;
					}
					else
					{
					}

					if ((ConfigCiToZcMaskConfigDataStru[ciId][k].DeviceId == overlapIdMax)
						&& (ConfigCiToZcMaskConfigDataStru[ciId][k].DeviceType == CI_DEVICE_TYPE_OVERLAP)
						&& (ConfigCiToZcMaskConfigDataStru[ciId][k].MaskType == MASK_TYPE_OVERLAP_LOCKSTATE))
					{
						flagMax = 1u;
					}
					else
					{
					}

					if ((1u==flag1) && (1u==flag2))
					{
						if (maskId != maskIdNext)
						{
							/*同一条进路的CI-ZC保护区段码位不相等，则发错误帧*/
							debug_infor_printf((const)"Route %d overLaps: %d and %d mask not same.",pRouteCfgDtStr->RouteId,overlapId,overlapIdNext);
							DebugPrintAppError(ERROR_ONEROUTE_OVERLAP_CIZCMASK_NOT_SAME,pRouteCfgDtStr->RouteId,((UINT32)overlapId<<16u)+overlapIdNext,PRINT_ONCE);
						}
						else
						{
						}
						break;
					}
					else
					{
					}
				}
#if 0
				if (0u == flag1)
				{
					debug_infor_printf((const)"Route %d overLap %d CI-ZC mask not config",pRouteCfgDtStr->RouteId,overlapId);
					DebugPrintAppError(ERROR_ROUTE_OVERLAP_CIZCMASK_NOT_CONFIG,CI_DEVICE_TYPE_OVERLAP,((pRouteCfgDtStr->RouteId) <<16u)+overlapId,PRINT_ONCE);
				}
				else
				{
				}
#endif
				if (0u==flagMax)
				{
					debug_infor_printf((const)"Route %d overLap %d CI-ZC mask not config",pRouteCfgDtStr->RouteId,overlapIdMax);
					DebugPrintAppError(ERROR_ROUTE_OVERLAP_CIZCMASK_NOT_CONFIG,CI_DEVICE_TYPE_OVERLAP,(((UINT32)pRouteCfgDtStr->RouteId) <<16u)+overlapIdNext,PRINT_ONCE);
				}
				else
				{
				}
			}
		}
		else
		{
		}
		
	}
}

/*********************************************
*函数功能：读继电器配置数据
*参数说明：ciId联锁ID，  pRelayConfigDataStru继电器配置数据结构体指针
*返回值：继电器个数
*********************************************/
INT16 ReadRelayConfigData(const UINT8 ciId,RelayConfigDataStruct* pRelayConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = 0;

	if ((0u == ciId) || (NULL == pRelayConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}
	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.RelayCfgDtStrLen;i++)
		{
			if(ciId == dquCICfgDtStr.RelayCfgDtStr[i].BelongCiId)
			{
				/*访问数组不能越界，越界直接返回失败*/
				if(dquCICfgDtStr.RelayCfgDtStr[i].RelayId < RELAY_SUM_MAX)
				{
					pRelayConfigDataStru[dquCICfgDtStr.RelayCfgDtStr[i].RelayId] = dquCICfgDtStr.RelayCfgDtStr[i];
					DataNum++;

				}
				else
				{
					/*返回失败*/
					DataNum = -1;
					break;
				}
			}
		}
	}
	
	return DataNum;
}


/*********************************************
*函数功能：读信号机配置数据
*参数说明：ciId联锁ID，  pSignalConfigDataStru信号机配置数据结构体指针
*返回值：信号机数
*********************************************/
INT16 ReadSignalConfigData(const UINT8 ciId,SignalConfigDataStruct* pSignalConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	SignalConfigDataStruct* tempSigCfgDataPtr = NULL;
	DSU_ROUTE_STRU tempRouteRecord = { 0 };
	UINT16 j = 0u, k = 0u;
	UINT16 tempProSec = 0u;/*保护区段ID临时变量*/
	UINT8 collMode = 0u;
	SignalConfigDataStruct* pSgnl = NULL;
	UINT16 lxRelayId = 0u;
	UINT8 lxBelongCi = 0u;/*列车信号继电器所属联锁ID*/
	if ((0u == ciId) || (NULL == pSignalConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.SgnlCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.SgnlCfgDtStr[i].SignalId < SIGNAL_SUM_MAX)
			{
				pSignalConfigDataStru[dquCICfgDtStr.SgnlCfgDtStr[i].SignalId] = dquCICfgDtStr.SgnlCfgDtStr[i];
				lxRelayId = pSignalConfigDataStru[dquCICfgDtStr.SgnlCfgDtStr[i].SignalId].LxRelayId;/*获取列车信号继电器ID*/
				lxBelongCi = GetRelayBelongCiId(lxRelayId);
				if ((ciId == dquCICfgDtStr.SgnlCfgDtStr[i].BelongCiId) || (lxBelongCi == ciId))
				{/*信号机所属联锁为本联锁或者信号机的列车信号继电器所属联锁为本联锁*/
					DataNum++;

					pSgnl = &(pSignalConfigDataStru[dquCICfgDtStr.SgnlCfgDtStr[i].SignalId]);
					if ((pSgnl->signalVirtualAttr) == SIGNAL_VIRTUAL_NO)
					{/*不为虚拟信号机*/
						switch (pSgnl->SignalType)
						{
						case SIGNAL_TYPE_THREE_ALL_YINDAO:/*必需继电器：LX YD 1DS 2DS*/
						case SIGNAL_TYPE_THREE_NOGREEN_YINDAO:
						case SIGNAL_TYPE_THREE_NOYELLOW_YINDAO:
						case SIGNAL_TYPE_THREE_ALL_YINDAO_NOY:
						case SIGNAL_TYPE_3_NOGREEN_YINDAO_NOL:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->YxRelayId)
								{
									debug_infor_printf((const)"Signal %d YDJ %d not config",pSgnl->SignalId,pSgnl->YxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_YDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								break;
							}
						case SIGNAL_TYPE_THREE_ALL_NOYINDAO:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->ZxRelayId)
								{
									debug_infor_printf((const)"Signal %d ZXJ %d not config",pSgnl->SignalId,pSgnl->ZxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_ZXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}

						case SIGNAL_TYPE_THREE_NOGREEN_NOYINDAO:
						case SIGNAL_TYPE_THREE_NOYELLOW_NOYINDAO:
						case SIGNAL_TYPE_TWO_ALL_NOYINDAO:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}




						case SIGNAL_TYPE_TWO_NOGREEN_NOYINDAO:
							{
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_DIAOCHE:
							{
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_JINKUCHUKU:
							{
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}


						case SIGNAL_TYPE_TWO_JINKU_RGY:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->YxRelayId)
								{
									debug_infor_printf((const)"Signal %d YDJ %d not config",pSgnl->SignalId,pSgnl->YxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_YDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_THREE_JINKU_YINDAO:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->YxRelayId)
								{
									debug_infor_printf((const)"Signal %d YDJ %d not config",pSgnl->SignalId,pSgnl->YxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_YDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_THREE_DIAOCHE_YINDAO:
							{
								if (0u == pSgnl->YxRelayId)
								{
									debug_infor_printf((const)"Signal %d YDJ %d not config",pSgnl->SignalId,pSgnl->YxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_YDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_4_ALL_NOYINDAO_ZX:
							{
								if (0u == pSgnl->DdRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->DdRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->ZxRelayId)
								{
									debug_infor_printf((const)"Signal %d ZXJ %d not config",pSgnl->SignalId,pSgnl->ZxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_ZXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->GreenRelayId_wh)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->GreenRelayId_wh);
									DebugPrintAppError(ERROR_SIGNAL_GREENJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->YellowRelayId_wh)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->YellowRelayId_wh);
									DebugPrintAppError(ERROR_SIGNAL_YELLOWJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->BlueDsRelayId_wh)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->BlueDsRelayId_wh);
									DebugPrintAppError(ERROR_SIGNAL_BLUEJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								break;
							}
						case SIGNAL_TYPE_4_NOGREEN_NOYINDAO_ZX:
							{
								if (0u == pSgnl->DdRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->DdRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->BlueDsRelayId_wh)
								{
									debug_infor_printf((const)"Signal %d BlueDJ %d not config",pSgnl->SignalId,pSgnl->BlueDsRelayId_wh);
									DebugPrintAppError(ERROR_SIGNAL_BLUEJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_5_NOGREEN_YINDAO_CD:
							{

								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->YxRelayId)
								{
									debug_infor_printf((const)"Signal %d YDJ %d not config",pSgnl->SignalId,pSgnl->YxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_YDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}


								break;
							}
						case SIGNAL_TYPE_5_NOY_NOYINDAO_CD:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->ZxRelayId)
								{
									debug_infor_printf((const)"Signal %d ZXJ %d not config",pSgnl->SignalId,pSgnl->ZxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_ZXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}	
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_4_ALL_NOYINDAO_CD:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->GreenRelayId_wh)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->GreenRelayId_wh);
									DebugPrintAppError(ERROR_SIGNAL_GREENJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_5_NOY_NOYINDAO_WB:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_3_RGG_CD:
						case SIGNAL_TYPE_3_RGG_NOGREEN_CD:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}

						case SIGNAL_TYPE_3_NOGREENWHITE_CD:
							{
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_4_ALL_NOYINDAO_NOYELLOWONLY_ZX:
							{
								if (0u == pSgnl->DdRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->DdRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DDJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->GreenRelayId_wh)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->GreenRelayId_wh);
									DebugPrintAppError(ERROR_SIGNAL_GREENJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->BlueDsRelayId_wh)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->BlueDsRelayId_wh);
									DebugPrintAppError(ERROR_SIGNAL_BLUEJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->SecDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 2DJ %d not config",pSgnl->SignalId,pSgnl->SecDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_2DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_4_NOGREENBLUE_NOYINDAO_ZX:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}

								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_3_ALL_NOYINDAO_CD:
							{
								if (0u == pSgnl->LxRelayId)
								{
									debug_infor_printf((const)"Signal %d LXJ %d not config",pSgnl->SignalId,pSgnl->LxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_LXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->DxRelayId)
								{
									debug_infor_printf((const)"Signal %d DXJ %d not config",pSgnl->SignalId,pSgnl->DxRelayId);
									DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						case SIGNAL_TYPE_1_ALL_END:
							{
								if (0u == pSgnl->FirDsRelayId)
								{
									debug_infor_printf((const)"Signal %d 1DJ %d not config",pSgnl->SignalId,pSgnl->FirDsRelayId);
									DebugPrintAppError(ERROR_SIGNAL_1DJ_NOT_CONFIG,CI_DEVICE_TYPE_SIGNAL,(UINT32)pSgnl->SignalId,PRINT_ONCE);
								}
								else
								{
								}
								break;
							}
						default:
							/*不可达分支*/
							break;
						}

						if (pSgnl->YxRelayId>0u)
						{
							collMode = GetRelayCollectMode(pSgnl->YxRelayId);
							if (collMode != RELAY_COLL_MODE_DOUBLE)
							{
								debug_infor_printf((const)"Signal %d YXJ %d not double-coll mode.",pSgnl->SignalId,pSgnl->YxRelayId);
								DebugPrintAppError(ERROR_SIGNAL_YXJ_NOT_DOUBLE_COLL,CI_DEVICE_TYPE_RELAY,(((UINT32)pSgnl->SignalId<<16u)+pSgnl->YxRelayId),PRINT_ONCE);
							}
							else
							{
							}
						}
						else
						{
						}

						if (pSgnl->DxRelayId>0u)
						{
							collMode = GetRelayCollectMode(pSgnl->DxRelayId);
							if (collMode != RELAY_COLL_MODE_DOUBLE)
							{
								debug_infor_printf((const)"Signal %d DXJ %d not double-coll mode.",pSgnl->SignalId,pSgnl->DxRelayId);
								DebugPrintAppError(ERROR_SIGNAL_DXJ_NOT_DOUBLE_COLL,CI_DEVICE_TYPE_RELAY,(((UINT32)pSgnl->SignalId<<16u)+pSgnl->DxRelayId),PRINT_ONCE);
							}
							else
							{
							}
						}
						else
						{
						}

						if (pSgnl->GreenRelayId_wh>0u)
						{
							collMode = GetRelayCollectMode(pSgnl->GreenRelayId_wh);
							if (collMode != RELAY_COLL_MODE_DOUBLE)
							{
								debug_infor_printf((const)"Signal %d GREENJ %d not double-coll mode.",pSgnl->SignalId,pSgnl->GreenRelayId_wh);
								DebugPrintAppError(ERROR_SIGNAL_GREENJ_NOT_DOUBLE_COLL,CI_DEVICE_TYPE_RELAY,(((UINT32)pSgnl->SignalId<<16u)+pSgnl->GreenRelayId_wh),PRINT_ONCE);
							}
							else
							{
							}
						}
						else
						{
						}

						if (pSgnl->YellowRelayId_wh>0u)
						{
							collMode = GetRelayCollectMode(pSgnl->YellowRelayId_wh);
							if (collMode != RELAY_COLL_MODE_DOUBLE)
							{
								debug_infor_printf((const)"Signal %d YELLOWJ %d not double-coll mode.",pSgnl->SignalId,pSgnl->YellowRelayId_wh);
								DebugPrintAppError(ERROR_SIGNAL_YELLOWJ_NOT_DOUBLE_COLL,CI_DEVICE_TYPE_RELAY,(((UINT32)pSgnl->SignalId<<16)+pSgnl->YellowRelayId_wh),PRINT_ONCE);
							}
							else
							{
							}
						}
						else
						{
						}
					}
				}

				pSignalConfigDataStru[dquCICfgDtStr.SgnlCfgDtStr[i].SignalId].signalProSecSum = 0u;/*完成初始化*/
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	
	if (DataNum >= 0)
	{
		/*根据电子地图进路数据，查找进路终端信号机关联的保护区段*/
		for (i = 0u;i < dsuDataLenStru.wRouteLen;i++)
		{
			tempRouteRecord = dsuStaticHeadStru.pRouteStru[i];
			tempSigCfgDataPtr = &(pSignalConfigDataStru[tempRouteRecord.wEndSignalId]);

			for (j = 0u;j < tempRouteRecord.wProtectLinkNum;j++)
			{
				tempProSec = tempRouteRecord.wProtectLinkId[j];
				if ((tempProSec != 0u) && (tempProSec != UINT16_MAX))
				{
					for (k = 0u;k < tempSigCfgDataPtr->signalProSecSum;k++)
					{
						if (tempProSec == tempSigCfgDataPtr->signalProSecBuf[k])
						{
							/*说明该保护区段已经被添加过*/
							break;
						}
						else
						{
						}
					}

					if (k == tempSigCfgDataPtr->signalProSecSum)
					{
						/*说明该保护区段没有被添加过*/
						tempSigCfgDataPtr->signalProSecBuf[tempSigCfgDataPtr->signalProSecSum] = tempProSec;
						tempSigCfgDataPtr->signalProSecSum = tempSigCfgDataPtr->signalProSecSum + 1u;
					}
					else
					{
					}
				}
				else
				{
				}
			}
		}
	}
	else
	{
	}
	

	return DataNum;
}

/*********************************************
*函数功能：读洗车机配置数据
*参数说明：ciId联锁ID，  
pWashMachineConfigDataStru洗车机配置数据结构体指针
*返回值：  洗车机个数
*********************************************/
UINT16 ReadWashMachineConfigData(const UINT8 ciId,WashMachineConfigDataStruct* pWashMachineConfigDataStru)
{
	UINT16 i=0u;
	UINT16 DataNum = 0u;

	if ((0u == ciId) || (NULL == pWashMachineConfigDataStru))
	{
		DataNum = 0u;
	}
	else
	{
		for(i = 0u;i < dquCICfgDtStr.WashMachineCfgDtStrLen;i++)
		{
			if (ciId == dquCICfgDtStr.WashMachineCfgStr[i].BelongCiId)
			{
				/*访问数组不能越界，越界直接返回失败*/
				if(dquCICfgDtStr.WashMachineCfgStr[i].WashMachineId < WASHMACHINE_SUM_MAX)
				{
					pWashMachineConfigDataStru[dquCICfgDtStr.WashMachineCfgStr[i].WashMachineId] = dquCICfgDtStr.WashMachineCfgStr[i];
					DataNum++;

				}
				else
				{
					/*返回失败*/
					break;
				}
			}		
		}
		if(i < dquCICfgDtStr.WashMachineCfgDtStrLen)
		{
			DataNum = 0u;
		}

	}
	return DataNum;
}

/*********************************************
*函数功能：读道岔配置数据
*参数说明：ciId联锁ID，  pSwitchConfigDataStru道岔配置数据结构体指针
*返回值：道岔数
*********************************************/
INT16 ReadSwitchConfigData(const UINT8 ciId,SwitchConfigDataStruct* pSwitchConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	UINT16 logIndex = 0U;
	UINT8 swIndex = 0U;
	UINT16 switchId = 0U;

	if ((0u == ciId) || (NULL == pSwitchConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.SwchCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.SwchCfgDtStr[i].SwitchId < SWITCH_SUM_MAX)
			{
				pSwitchConfigDataStru[dquCICfgDtStr.SwchCfgDtStr[i].SwitchId] = dquCICfgDtStr.SwchCfgDtStr[i];
				if (ciId == dquCICfgDtStr.SwchCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}
#if 0

				switchId = dquCICfgDtStr.SwchCfgDtStr[i].SwitchId;
				/**根据逻辑区段初始化数据，建立道岔到逻辑区段的映射*/
				SwitchConfigDataStru[switchId].SwitchLogSecSum = 0U;
				for (logIndex = 0u; logIndex < dquCICfgDtStr.lgcSctCfgDtStrLen; logIndex++)
				{
					if (LOGSEC_INCLUDE_SWITCH_SUM_MAX < dquCICfgDtStr.lgcSctCfgDtStr[logIndex].chLogsecSwitchSum)
					{
						/*返回失败*/
						DataNum = -1;
					}
					else
					{
						for (swIndex = 0u; swIndex < dquCICfgDtStr.lgcSctCfgDtStr[logIndex].chLogsecSwitchSum; swIndex++)
						{
							if ((SwitchConfigDataStru[switchId].SwitchId == dquCICfgDtStr.lgcSctCfgDtStr[logIndex].LogsecSwitchIdStru[swIndex].SwitchId)
								&&(0u != dquCICfgDtStr.lgcSctCfgDtStr[logIndex].LogsecSwitchIdStru[swIndex].SwitchId)
								&& (0xFFFF != dquCICfgDtStr.lgcSctCfgDtStr[logIndex].LogsecSwitchIdStru[swIndex].SwitchId))
							{
								/** 道岔关联逻辑区段已添加该逻辑区段*/
								break;
							}
							else if((0u == dquCICfgDtStr.lgcSctCfgDtStr[logIndex].LogsecSwitchIdStru[swIndex].SwitchId)
								|| (0xFFFF == dquCICfgDtStr.lgcSctCfgDtStr[logIndex].LogsecSwitchIdStru[swIndex].SwitchId))
							{
								/** 还未添加*/
								/** 在数组末尾添加该逻辑区段，并更新数量*/
								SwitchConfigDataStru[switchId].SwitchLogSecIdBuf[SwitchConfigDataStru[switchId].SwitchLogSecSum++] = dquCICfgDtStr.lgcSctCfgDtStr[logIndex].LogicSectionId;
								break;
							}
							else
							{
								/** 未添加且未找到插入位置，继续遍历。*/
							}

							if (SWITCH_LOG_TRACK_MAX_NUM <= SwitchConfigDataStru[switchId].SwitchLogSecSum)
							{
								/**数据错误*/
								DataNum = -1;
								break;
							}
							else
							{

							}
						}

					}

					if (-1 == DataNum)
					{
						break;
					}
					else
					{

					}
				}
#endif

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
			}

			if (-1 == DataNum)
			{
				break;
			}
			else
			{

			}

		}
	}
	
	return DataNum;
}

/*********************************************
*函数功能：初始化轨道区段配置数据结构体----对外结构体
*参数说明：pPhysicalSectionConfigDataStru物理区段配置数据结构体指针        
*返回值：无
*********************************************/

INT16 ReadTrackSectionConfigData(PhysicalSectionConfigDataStruct* pPhysicalSectionConfigDataStru)
{
	UINT32 i=0u,j=0u;
	UINT16 Link = 0u;
	UINT16 phySec=0u;
	INT16 retRes = -1;
	UINT8 chSysType = 0U;
	if (NULL != pPhysicalSectionConfigDataStru)
	{
		chSysType = GetCbtcSysType();
		if((DQU_CBTC_HLT == chSysType)||(DQU_CBTC_CC == chSysType))
		{/*CBTC系统类型为互联互通*/
			for(i=0u;i<dsuIdmapStru.dsuIdmapLenStru->wTrackSecNumLen;i++)
			{
				for (j=0u;j<dsuIdmapStru.dsuStaticIdmapStru->pTrackSecNumStru[i].wTrackNum;j++)
				{
					if (dsuIdmapStru.dsuStaticIdmapStru->pTrackSecNumStru[i].dwTrackSecId[j]!=0u)
					{
						Link=dsuIdmapStru.dsuStaticIdmapStru->pTrackSecNumStru[i].wLinkId;
						phySec=FindLinkBelongAxleSgmt(Link);/*查找Link对应的物理区段*/
						if ((phySec!=0U)&&(phySec!=UINT16_MAX))
						{
							if ( phySec< PHYSICAL_SECTION_SUM_MAX)
							{
								retRes = 0;

								if (pPhysicalSectionConfigDataStru[phySec].trackSecNum < PHY_SEC_TRACK_SEC_MAX_SUM)
								{
									retRes = 0;
								}
								else
								{
									retRes = -1;
								}
							}
							else
							{
								retRes = -1;
							}
							if (0 == retRes)
							{
								pPhysicalSectionConfigDataStru[phySec].trackSecBuf[pPhysicalSectionConfigDataStru[phySec].trackSecNum++]=dsuIdmapStru.dsuStaticIdmapStru->pTrackSecNumStru[i].dwTrackSecId[j];
							}
							
						}
					}
				}
			}
		}
	}
	else
	{
		retRes = -1;
	}

	return retRes;
}
/*********************************************
*函数功能：读物理区段配置数据
*参数说明：ciId联锁ID，  pPhysicalSectionConfigDataStru物理区段配置数据结构体指针
*返回值：物理区段数
*********************************************/
INT16 ReadPhySicalSectionConfigData(const UINT8 ciId,PhysicalSectionConfigDataStruct* pPhysicalSectionConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	DSU_ROUTE_STRU tempRouteRecord = { 0u };
	UINT16 j = 0u, k = 0u, m = 0u;
	UINT16 tempProSec = 0u;/*保护区段ID临时变量*/
	UINT16 tempPhySec = 0u;/*物理区段ID临时变量*/
	UINT16 tempAxleSec = 0u;/*计轴区段ID临时变量*/
	UINT16 gdIndex = 0u;
	DSU_PROTECT_LINK_STRU tempDsuProStru = { 0u };
	PhysicalSectionConfigDataStruct *tempPhySecCfgDataPtr = NULL;
	UINT16 logIndex = 0u;
	UINT8 logsecSum = 0U;

	if ((0u == ciId) || (NULL == pPhysicalSectionConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.PsclSgmtCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId < PHYSICAL_SECTION_SUM_MAX)
			{
				pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId] = dquCICfgDtStr.PsclSgmtCfgDtStr[i];
				if (ciId == dquCICfgDtStr.PsclSgmtCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}
				pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId].proLockRouteSum = 0u;/*完成初始化*/

				for (gdIndex = 0u; gdIndex < dsuDataLenStru.wDepotGateLen; gdIndex++)
				{
					if ((dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId == dsuStaticHeadStru.pDepotGateStru[gdIndex].wAPhysicalSgmtId)
						|| (dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId == dsuStaticHeadStru.pDepotGateStru[gdIndex].wBPhysicalSgmtId))
					{
						pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId].wReleatedGd = dsuStaticHeadStru.pDepotGateStru[gdIndex].wId;
						break;
					}
					else
					{
						;
					}
				}

				/**根据逻辑区段初始化数据，建立物理区段到逻辑区段的映射*/
				pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId].LogSectionSum = 0U;
				for (logIndex = 0u; logIndex < dquCICfgDtStr.lgcSctCfgDtStrLen; logIndex++)
				{
					if (pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId].PhysicalSectionId == dquCICfgDtStr.lgcSctCfgDtStr[logIndex].wRelativePhySecId)
					{
						logsecSum = pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId].LogSectionSum;
						pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId].LogSectionIdBuf[logsecSum] = dquCICfgDtStr.lgcSctCfgDtStr[logIndex].LogicSectionId;
						pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[i].PhysicalSectionId].LogSectionSum++;
					}
					else
					{

					}
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}

	if (DataNum >= 0)
	{
		/*根据电子地图进路数据，初始化保护区段对应的进路ID数组*/
		for (i = 0u;i < dsuDataLenStru.wRouteLen;i++)
		{
			tempRouteRecord = dsuStaticHeadStru.pRouteStru[i];

			for (j = 0u;j < tempRouteRecord.wProtectLinkNum;j++)
			{
				tempProSec = tempRouteRecord.wProtectLinkId[j];

				if ((tempProSec != 0u) && (tempProSec != UINT16_MAX))
				{
					tempDsuProStru = dsuStaticHeadStru.pProtectLinkStru[dsuProtectLinkIndex[tempProSec]];
					for (k = 0u;k < tempDsuProStru.wIncludeAxleSgmtNum;k++)
					{
						tempAxleSec = tempDsuProStru.wIncludeAxleSgmtId[k];
						if ((tempAxleSec != 0u) && (tempAxleSec != UINT16_MAX))
						{
							tempPhySec = dsuStaticHeadStru.pAxleSgmtStru[dsuAxleSgmtIndex[tempAxleSec]].wRelatePhysicalSgmtId;/*找到计轴对应的物理区段*/
							tempPhySecCfgDataPtr = &(pPhysicalSectionConfigDataStru[tempPhySec]);
							for (m=0u;m<tempPhySecCfgDataPtr->proLockRouteSum;m++)
							{
								if (tempRouteRecord.wId == tempPhySecCfgDataPtr->proLockRouteIdBuf[m])
								{
									/*说明进路已经被添加*/
									break;
								}
							}

							if (m == tempPhySecCfgDataPtr->proLockRouteSum)
							{
								if (tempPhySecCfgDataPtr->proLockRouteSum < PHY_SEC_PRO_LOCK_ROUTE_MAX_NUM)
								{/*下标防护，如果物理区段保护锁闭对应的进路ID数量小于最大数量*/
									/*说明进路没有被添加*/
									tempPhySecCfgDataPtr->proLockRouteIdBuf[tempPhySecCfgDataPtr->proLockRouteSum] = tempRouteRecord.wId;
									tempPhySecCfgDataPtr->proLockRouteSum = tempPhySecCfgDataPtr->proLockRouteSum + 1u;
								}
								else
								{
									debug_infor_printf((const)"Physec %d proLockRouteSum exceed MACRO %d\r\n",
										tempPhySecCfgDataPtr->PhysicalSectionId,
										PHY_SEC_PRO_LOCK_ROUTE_MAX_NUM);
								}
							}
						}
					}
				}
			}
		}
	}
	

	return DataNum;
}

/*********************************************
*函数功能：读计轴区段配置数据
*参数说明：ciId联锁ID，  pAxisSectionConfigDataStru计轴区段配置数据结构体指针
*返回值：计轴区段数
*********************************************/
INT16 ReadAxisSectionConfigData(const UINT8 ciId,AxisSectionConfigDataStruct* AxisSectionConfigDataSt, UINT16 * pAcNum, AxisSectionConfigDataStruct * pAcConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	UINT16 j = 0u;
	UINT8 cLinkLineAttr = RC_LINK_LINE_NO;
	UINT8 cFuncRet = CI_ERROR;

	if ((0u == ciId) || (NULL == AxisSectionConfigDataSt))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dsuDataLenStru.wAxleSgmtLen;i++)
		{
			pAcConfigDataStru[i] = dquCICfgDtStr.AxisSctCfgDtStr[i];
			*pAcNum = (*pAcNum) + 1u;
			if(ciId == dsuStaticHeadStru.pAxleSgmtStru[i].wManagePhysicalCI)
			{
				/*访问数组不能越界，越界直接返回失败*/
				if(dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId < AXIS_SECTION_SUM_MAX)
				{
					AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId] = dquCICfgDtStr.AxisSctCfgDtStr[i];
					AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chLinkLine = AXIS_SEC_LINK_LINE_NO;
					AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chEntrance = AXIS_SEC_ENTRANCE_NO;
					AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chStorageLineProperty = AXIS_SEC_STORAGE_LINE_NO;
					
					DataNum++;
					for (j = 0u; j < dquCICfgDtStr.wLinkLineCfgDtLen; j++)
					{
						if (dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId == dquCICfgDtStr.LinkLineCfgDtStr[j].wAxisSecId)
						{
							if (0x55u == dquCICfgDtStr.LinkLineCfgDtStr[j].cLinkLineType)
							{
								/* 联络线 */
								AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chLinkLine = AXIS_SEC_LINK_LINE_YES;
								cLinkLineAttr = RC_LINK_LINE_YES;
							}

							if (0x55u == dquCICfgDtStr.LinkLineCfgDtStr[j].cInType)
							{
								/* 入口 */
								AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chEntrance = AXIS_SEC_ENTRANCE_YES;
								debug_infor_printf((const)"ReadAxisSectionConfigData: AC[%d] Init Entrance", dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId);
							}

							if (0x55u == dquCICfgDtStr.LinkLineCfgDtStr[j].cStorageLineType)
							{
								/* 存车线属性 */
								AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chStorageLineProperty = AXIS_SEC_STORAGE_LINE_YES;
							}
							else
							{
								/*不处理*/
							}
							break;
						}
						else
						{
							;
						}
					}

					if ((AXIS_SEC_ENTRANCE_NO == AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chEntrance) &&
						(AXIS_SEC_STORAGE_LINE_NO == AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chStorageLineProperty))
					{
						cFuncRet = EnsureNearAxleStorageLineAtrr(dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId);  /*确定相邻计轴区段是否为存车线*/
						if (CI_SUCCESS == cFuncRet)
						{
							/*相邻计轴区段为存车线且本计轴区段非存车线，则初始化本计轴区段为入口计轴区段*/
							AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].chEntrance = AXIS_SEC_ENTRANCE_YES;
							debug_infor_printf((const)"ReadAxisSectionConfigData: AC[%d] Init Entrance", dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId);
						}
					}

					cFuncRet = EnsureAxleBorderAtrr(dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId);

					if (CI_SUCCESS == cFuncRet)
					{
						AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].cBorderAttr = AXIS_BORDER_AXLE_YES;
						debug_infor_printf((const)"ReadAxisSectionConfigData: AC[%d] Init Cfp Border", dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId);
					}
					else
					{
						AxisSectionConfigDataSt[dquCICfgDtStr.AxisSctCfgDtStr[i].AxisSectionId].cBorderAttr = AXIS_BORDER_AXLE_NO;
					}
				}
				else
				{
					/*返回失败*/
					DataNum = -1;
					break;
				}
			}
		}

		cFuncRet = SetLocalRcLinkLineAttr(cLinkLineAttr);  /*设置RC联络线属性*/
		if (CI_ERROR == cFuncRet)
		{
			DataNum = -1;
		}
		else
		{
			;
		}
	}
	return DataNum;
}
/*********************************************
*函数功能：读逻辑区段配置数据
*参数说明：ciId联锁ID，pLogicSectionConfigDataStru  逻辑区段配置数据结构体指针
*返回值：逻辑区段数
*********************************************/
INT16 ReadLogicSectionConfigData(const UINT8 ciId,LogicSectionConfigDataStruct* pLogicSectionConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pLogicSectionConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.lgcSctCfgDtStrLen;i++)
		{

			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.lgcSctCfgDtStr[i].LogicSectionId < LOGIC_SECTION_SUM_MAX)
			{
				pLogicSectionConfigDataStru[dquCICfgDtStr.lgcSctCfgDtStr[i].LogicSectionId] = dquCICfgDtStr.lgcSctCfgDtStr[i];
				if (ciId == dsuStaticHeadStru.pAxleSgmtStru[dsuAxleSgmtIndex[dsuStaticHeadStru.pLogicSgmtStru[i].wAxleSgmtId[0]]].wManagePhysicalCI)
				{
					DataNum++;
				}
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}       

		}
	}
	
	return DataNum;
}

/*********************************************
*函数功能：读紧急停车按钮配置数据
*参数说明：ciId联锁ID，  pEsbConfigDataStru紧急停车配置数据结构体指针
*返回值：紧急停车按钮数
*********************************************/
INT16 ReadEsbConfigData(const UINT8 ciId,EsbConfigDataStruct* pEsbConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	UINT16 repEsbRelayId = 0u;/*复视esb继电器ID*/
	UINT8 belongCi = 0u;

	if ((0u == ciId) || (NULL == pEsbConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.EsbCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.EsbCfgDtStr[i].EsbId < ESB_SUM_MAX)
			{
				pEsbConfigDataStru[dquCICfgDtStr.EsbCfgDtStr[i].EsbId] = dquCICfgDtStr.EsbCfgDtStr[i];
				repEsbRelayId = pEsbConfigDataStru[dquCICfgDtStr.EsbCfgDtStr[i].EsbId].EsbRepRelayId;
				belongCi = GetRelayBelongCiId(repEsbRelayId);
				if ((ciId == dquCICfgDtStr.EsbCfgDtStr[i].BelongCiId) || (belongCi == ciId))
				{/*esb属于本联锁，或者ESB的复视继电器属于本联锁*/
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	
	return DataNum;
}

/*********************************************
*函数功能：读屏蔽门配置数据
*参数说明：ciId联锁ID，  pPsdConfigDataStru屏蔽门配置数据结构体指针
*返回值：屏蔽门数
*********************************************/
INT16 ReadPsdConfigData(const UINT8 ciId,PsdConfigDataStruct* pPsdConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pPsdConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.PsdCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.PsdCfgDtStr[i].PsdId < PSD_SUM_MAX)
			{
				pPsdConfigDataStru[dquCICfgDtStr.PsdCfgDtStr[i].PsdId] = dquCICfgDtStr.PsdCfgDtStr[i];
				if (ciId == dquCICfgDtStr.PsdCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	
	return DataNum;
}
/*********************************************
*函数功能：读进路配置数据
*参数说明：ciId联锁ID，pRouteConfigDataStru  进路配置数据结构体指针
*返回值：进路数
*********************************************/
INT16 ReadRouteConfigData(const UINT8 ciId,RouteConfigDataStruct* pRouteConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	UINT16 startSignalId = 0u;
	UINT16 signalFirstInPhySecId = 0u;
	UINT16 routeId = 0u;
	UINT16 phyCISecId = 0u;
	if ((0u == ciId) || (NULL == pRouteConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.RouteCfgDtStrLen;i++)
		{
			startSignalId = 0u;
			signalFirstInPhySecId = 0u;
			routeId = 0u;
			phyCISecId = 0u;
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.RouteCfgDtStr[i].RouteId < ROUTE_SUM_MAX)
			{
				routeId = dquCICfgDtStr.RouteCfgDtStr[i].RouteId;
				startSignalId = dquCICfgDtStr.RouteCfgDtStr[i].StartSignalId;
				signalFirstInPhySecId = GetSignalInFirstPhySecId(startSignalId,routeId);

				phyCISecId = dquCICfgDtStr.RouteCfgDtStr[i].RoutePhySectionStru[0].PhysicalSectionId;

				if (signalFirstInPhySecId == phyCISecId)
				{
					pRouteConfigDataStru[routeId] = dquCICfgDtStr.RouteCfgDtStr[i];
				}
				else
				{/*电子地图进路表信号机内方第一区段与CI联锁表内方第一区段不一致时，以CI联锁表为准*/
					SetSignalInFirstPhySecId(startSignalId, phyCISecId);
					pRouteConfigDataStru[routeId] = dquCICfgDtStr.RouteCfgDtStr[i];
				}
				if (ciId == dquCICfgDtStr.RouteCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	
	return DataNum;
}

/*********************************************
*函数功能：读非进路调车配置数据
*参数说明：pNonRouteConfigDataStru 非进路配置数据结构体指针
*返回值：非进路调车数
*********************************************/
UINT16 ReadNonRouteConfigData(NonRouteConfigDataStruct* pNonRouteConfigDataStru)
{
	UINT16 i=0u;

	if (NULL == pNonRouteConfigDataStru)
	{
		return 0u;
	}

	for(i=0u;i<dquCICfgDtStr.NonRouteCfgDtStrLen;i++)
	{
		pNonRouteConfigDataStru[i] = dquCICfgDtStr.NonRouteCfgDtStr[i];
	}
	return dquCICfgDtStr.NonRouteCfgDtStrLen;
}
/*********************************************
*函数功能：读自动通过进路配置数据
*参数说明：ciId联锁ID，  pAutoRouteConfigDataStru自动进路配置数据结构体指针
*返回值：自动通过进路数
*********************************************/
INT16 ReadAutoRouteConfigData(const UINT8 ciId,AutoRouteConfigDataStruct* pAutoRouteConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pAutoRouteConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.AutoRouteCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.AutoRouteCfgDtStr[i].AutoRouteId < AUTO_ROUTE_SUM_MAX)
			{
				pAutoRouteConfigDataStru[dquCICfgDtStr.AutoRouteCfgDtStr[i].AutoRouteId] = dquCICfgDtStr.AutoRouteCfgDtStr[i];
				if (ciId == dquCICfgDtStr.AutoRouteCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	
	return DataNum;
}

/*********************************************
*函数功能：读自动折返进路配置数据
*参数说明：ciId联锁ID，  pAutoReturnConfigDataStru自动折返配置数据结构体指针
*返回值：自动折返进路数
*********************************************/
INT16 ReadAutoReturnConfigData(const UINT8 ciId,AutoReturnConfigDataStruct* pAutoReturnConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pAutoReturnConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0;i<dquCICfgDtStr.AutoRtnRouteCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.AutoRtnRouteCfgDtStr[i].AutoReturnId < AUTO_RETURN_SUM_MAX)
			{
				pAutoReturnConfigDataStru[dquCICfgDtStr.AutoRtnRouteCfgDtStr[i].AutoReturnId] = dquCICfgDtStr.AutoRtnRouteCfgDtStr[i];
				if (ciId == dquCICfgDtStr.AutoRtnRouteCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}
	
	return DataNum;
}

/*********************************************
*函数功能：读反向进路配置数据
*参数说明：ciId联锁ID，  pReverseRouteConfigDataStru反向进路配置数据结构体指针
*返回值：反向进路数
*********************************************/
INT16 ReadReverseRouteConfigData(const UINT8 ciId,ReverseRouteConfigDataStruct* pReverseRouteConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pReverseRouteConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}
	
	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.ReverseRouteCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.ReverseRouteCfgDtStr[i].ReverseRouteId < ROUTE_SUM_MAX)
			{
				pReverseRouteConfigDataStru[dquCICfgDtStr.ReverseRouteCfgDtStr[i].ReverseRouteId] = dquCICfgDtStr.ReverseRouteCfgDtStr[i];
				if (ciId == dquCICfgDtStr.ReverseRouteCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}
	return DataNum;
}


/*********************************************
*函数功能：读长调进路配置数据
*参数说明： pLongRouteConfigDataStru 长进路配置数据结构体指针
*返回值：长调进路数
*********************************************/
INT16 ReadLongRouteConfigData(LongRouteConfigDataStruct* pLongRouteConfigDataStru)
{
	INT16 dataNum = -1;
	UINT16 i =0u;

	if (NULL == pLongRouteConfigDataStru)
	{
		dataNum = -1;
	}
	else
	{
		dataNum = 0;
	}
	if (0 == dataNum)
	{
		for (i = 0u; i < dquCICfgDtStr.LongRouteCfgDtStrLen; i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if (dquCICfgDtStr.LongRouteCfgDtStr[i].LongRouteId < ROUTE_LONG_SUM_MAX)
			{
				pLongRouteConfigDataStru[dquCICfgDtStr.LongRouteCfgDtStr[i].LongRouteId] = dquCICfgDtStr.LongRouteCfgDtStr[i];
				dataNum++;
			}
			else
			{
				/*返回失败*/
				dataNum = -1;
				break;
			}
		}
	}
	return dataNum;
}
/*********************************************
*函数功能：读指示灯报警灯配置数据
*参数说明：ciId联锁ID，IndicatorConfigDataStru  指示灯配置数据结构体指针
*返回值：报警灯数
*********************************************/
INT16 ReadIndicatorConfigData(const UINT8 ciId,IndicatorConfigDataStruct* IndicatorConfigDataSt)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	UINT8 bjdYouXiao = 0u;

	if ((0u == ciId) || (NULL == IndicatorConfigDataSt))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}
	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.IndctCfgDtStrLen;i++)
		{
			if(INDICATOR_MAX_SIZE > i)
			{
				bjdYouXiao = RelayData.pRelayBjdStr[i].wBjdYouXiao;
				if((ciId == RelayData.pRelayBjdStr[i].wBelongCiId)&&((0xAAu == bjdYouXiao)||(0xBBu == bjdYouXiao)||(0xDDu == bjdYouXiao)))
				{
					/*访问数组不能越界，越界直接返回失败*/
					if(dquCICfgDtStr.IndctCfgDtStr[i].IndicatorId < INDICATOR_SUM_MAX)
					{
						IndicatorConfigDataSt[dquCICfgDtStr.IndctCfgDtStr[i].IndicatorId] = dquCICfgDtStr.IndctCfgDtStr[i];
						DataNum++;
					}
					else
					{
						/*返回失败*/
						DataNum = -1;
						break;
					}
				}
			}
		}
	}
	
	return DataNum;
}
/*********************************************
*函数功能：读指示灯报警灯配置数据
*参数说明：ciId联锁ID，IndicatorConfigDataStru  指示灯配置数据结构体指针
*返回值：报警灯数
*********************************************/
INT16 ReadIndicatorConfigData_Vir(const UINT8 ciId, const UINT8 virCIid,IndicatorConfigDataStruct* pIndicatorConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;
	UINT8 bjdYouXiao = 0u;
	

	if ((0u == ciId) || (NULL == pIndicatorConfigDataStru)||(0u == virCIid))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}
	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.IndctCfgDtStrLen;i++)
		{
			bjdYouXiao = RelayData.pRelayBjdStr[i].wBjdYouXiao;
			if((virCIid == RelayData.pRelayBjdStr[i].wBelongVirCIid)&&(ciId == RelayData.pRelayBjdStr[i].wBelongCiId)&&
				((INDICATOR_DATA_RELAY == bjdYouXiao)||(INDICATOR_DATA_PHYSEC == bjdYouXiao)||(INDICATOR_DATA_STATION == bjdYouXiao))&&
				(i<INDICATOR_MAX_SIZE))
			{
				/*访问数组不能越界，越界直接返回失败*/
				if(VIRTUAL_CI_INDICATOR_SUM_MAX > dquCICfgDtStr.IndctCfgDtStr[i].IndicatorId)
				{
					pIndicatorConfigDataStru[dquCICfgDtStr.IndctCfgDtStr[i].IndicatorId] = dquCICfgDtStr.IndctCfgDtStr[i];
					DataNum++;
				}
				else
				{
					/*返回失败*/
					DataNum = -1;
					break;
				}
			}

		}
	}
	
	return DataNum;
}
/*********************************************
*函数功能：读保护区段配置数据
*参数说明：ciId联锁ID，pOverlapConfigDataStru  保护区段配置数据结构体指针,
*返回值：保护区段数
*********************************************/
INT16 ReadOverlapConfigData(const UINT8 ciId,OverlapConfigDataStruct* pOverlapConfigDataStru)
{
	UINT16 i = 0u;
	UINT16 j = 0u;
	UINT16 k = 0u;
	INT16 DataNum = -1;
	UINT16 RouteOverlapSum = 0u;
	UINT16 CurOverlapId = 0u;

	if ((0u == ciId) || (NULL == pOverlapConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.OvlapCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.OvlapCfgDtStr[i].OverlapId < OVERLAP_SUM_MAX)
			{
				pOverlapConfigDataStru[dquCICfgDtStr.OvlapCfgDtStr[i].OverlapId] = dquCICfgDtStr.OvlapCfgDtStr[i];
				if (ciId == dquCICfgDtStr.OvlapCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	
	if (DataNum >= 0)
	{
		/*本联锁包含进路中含有的保护区段初始化配置数据*/
		for(i=0u;i<dquCICfgDtStr.RouteCfgDtStrLen;i++)
		{
			/*属于该联锁的进路*/
			if(ciId == dquCICfgDtStr.RouteCfgDtStr[i].BelongCiId)
			{
				/*访问数组不能越界，越界直接返回失败*/
				if(dquCICfgDtStr.RouteCfgDtStr[i].RouteId < ROUTE_SUM_MAX)
				{
					RouteOverlapSum = dquCICfgDtStr.RouteCfgDtStr[i].OverlapSum;
					if(RouteOverlapSum > 0u)
					{
						for(j = 0u; j < RouteOverlapSum; j++)
						{
							CurOverlapId = dquCICfgDtStr.RouteCfgDtStr[i].OverlapIdBuf[j];
							if((pOverlapConfigDataStru[CurOverlapId].BelongCiId!= ciId)
								&&(pOverlapConfigDataStru[CurOverlapId].OverlapId!= CurOverlapId))
							{/*未初始化的保护区段*/    
								for(k=0u;k<dquCICfgDtStr.OvlapCfgDtStrLen;k++)
								{
									if(CurOverlapId == dquCICfgDtStr.OvlapCfgDtStr[k].OverlapId)
									{
										pOverlapConfigDataStru[CurOverlapId] = dquCICfgDtStr.OvlapCfgDtStr[k];
									}
								}
							}
						}
					}
				}
				else
				{
				}
			}

		}
	}
	
	return DataNum;
}
/*********************************************
*函数功能：读通信关系配置数据
*参数说明：ciId联锁ID，  TransmitRelationDataStru通信关系配置数据结构体指针
*返回值：通信关系数
*********************************************/
UINT16 ReadTransmitRelationConfigData(const UINT8 ciId,TransmitRelationDataStruct* TransmitRelationDataStru)
{
	UINT16 i=0u;
	UINT16 DataNum = 0u;

	if ((0u == ciId) || (NULL == TransmitRelationDataStru))
	{
		return DataNum;
	}

	for(i=0u;i<dquCICfgDtStr.TrsmtRlsDtStrLen;i++)
	{
		if (ciId == dquCICfgDtStr.TrsmtRlsDtStr[i].CiId)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(DataNum < TRANSMIT_OBJECT_SUM_MAX)
			{
				TransmitRelationDataStru[DataNum] = dquCICfgDtStr.TrsmtRlsDtStr[i];
				DataNum++;
			}
			else
			{
				/*返回失败*/
				DataNum = 0u;
				return DataNum;
			}
		}
	}
	return DataNum;
}

/*********************************************
*函数功能：读系统参数配置数据
*参数说明：ciId联锁ID，SystemParaStruct  系统参数配置数据结构体指针
*返回值：配置长度
*备注：	dquSetInitCbtcConfigInfoRef把cbtcConfigDataStru赋值给g_pCbtcConfigDataStru
		然后dquCbtcConfigDataInit中把数据都解析到g_pCbtcConfigDataStru
		之后SystemParameterStructInit函数中把cbtcConfigDataStru赋值给pCbtcConfigDataStru
		最后pCbtcConfigDataStru又赋值给了dquCICfgDtStr，再ReadSystemParamConfDataNew函数中赋值给SystemParameterStru使用
*********************************************/
UINT8 ReadSystemParamConfDataNew(const UINT8 ciId,SystemParameterStructNew* SystemParameterStru)
{
	UINT16 i=0u;
	UINT8 rtnVal = 0u;/*返回值*/
	UINT16 paraId = 0u;

	if ((0u == ciId) || (NULL == SystemParameterStru))
	{
		rtnVal = 0u;
	}
	else
	{
		rtnVal = 1u;

		for(i=0u ;i<dquCICfgDtStr.SystemParamStrLen;i++)
		{		
			if (i >= CI_SYSTEM_PARA_SUM_MAX)
			{
				rtnVal = 0u;
				break;
			}
			paraId = dquCICfgDtStr.SystemParaStrNew.ParaStru[i].SysParaId;		
			if (paraId < CI_SYSTEM_PARA_SUM_MAX)
			{
				SystemParameterStru->ParaStru[paraId] = dquCICfgDtStr.SystemParaStrNew.ParaStru[i];
			}
			else
			{
				rtnVal = 0u;
				break;
			}
			
		}
		if (1u == rtnVal)
		{	/*给从公共查询函数中*/
			/*紧急制动最高触发速度（单位已在dfsInitSubSystemCommonConfigData_CC函数中转换）*/
			SystemParameterStru->MaxLineLimitSpeed = dquCICfgDtStr.SystemParaStrNew.MaxLineLimitSpeed;

			/*临时限速最高限速(km/h)（未进行单位转换）*/
			SystemParameterStru->MaxTsrSpeed = dquCICfgDtStr.SystemParaStrNew.MaxTsrSpeed;

			/*NTP校时时区差（小时）*/
			SystemParameterStru->TimeZoneDifference = dquCICfgDtStr.SystemParaStrNew.TimeZoneDifference;

			/*区间同向行驶双车间隔最小安全距离(cm))*/
			SystemParameterStru->MABackDistance = dquCICfgDtStr.SystemParaStrNew.MABackDistance;

			/*一次设置的临时限速最大个数*/
			SystemParameterStru->MaxTsrNum = dquCICfgDtStr.SystemParaStrNew.MaxTsrNum;

			/*一个临时限速报文中包含的最大限速区段数量*/
			SystemParameterStru->MaxSectionOfTsr = dquCICfgDtStr.SystemParaStrNew.MaxSectionOfTsr;

			/*IVOC-IVOC信故障判断时间（ms）*/
			SystemParameterStru->IvocIvocCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.IvocIvocCommunicationErrorTime;

			/*IVOC-OC通信故障判断时间(ms)*/
			SystemParameterStru->IvocOcCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.IvocOcCommunicationErrorTime;

			/*VOBC-ITS通信故障判断时间(ms)*/
			SystemParameterStru->VobcAtsCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.VobcAtsCommunicationErrorTime;

			/*TMC-ITS通信故障判断时间（ms）*/
			SystemParameterStru->TmcItsCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.TmcItsCommunicationErrorTime;

			/*ITS-OC通信故障判断时间（ms）*/
			SystemParameterStru->ItsOcCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.ItsOcCommunicationErrorTime;

			/*OC-PSD通信故障判断时间（ms）*/
			SystemParameterStru->OcPsdCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.OcPsdCommunicationErrorTime;

			/*IVOC-TSL通信故障判断时间（ms）*/
			SystemParameterStru->IvocTslCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.IvocTslCommunicationErrorTime;

			/*OC-TSL通信故障判断时间（ms）*/
			SystemParameterStru->OcTslCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.OcTslCommunicationErrorTime;

			/*满足精确停车条件的MA延伸长度（cm）*/
			SystemParameterStru->MALengthForATOParking = dquCICfgDtStr.SystemParaStrNew.MALengthForATOParking;

			/*本线系统定义逻辑方向与上下行方向的关系*/
			SystemParameterStru->LinkLogicDirUpAndDown = dquCICfgDtStr.SystemParaStrNew.LinkLogicDirUpAndDown;

			/*对向行驶双车间隔最小安全距离(cm)*/
			SystemParameterStru->OppositeTrackDistance = dquCICfgDtStr.SystemParaStrNew.OppositeTrackDistance;

			/*线路最差情况下紧急制动距离（单位m）*/
			SystemParameterStru->MaxMALength = dquCICfgDtStr.SystemParaStrNew.MaxMALength;

			/*TIOC间通信中断时间 （单位ms）*/
			SystemParameterStru->CiAndCiTransmitBadEnsureTime = dquCICfgDtStr.SystemParaStrNew.CiAndCiTransmitBadEnsureTime;

			/*OC-TMC通信故障判断时间（ms）*/
			SystemParameterStru->TmcOcCommunicationErrorTime = dquCICfgDtStr.SystemParaStrNew.TmcOcCommunicationErrorTime;
			if (CI_TYPE_TCC == dsuStaticHeadStru.pCIStruStru[dsuCIIndex[ciId]].wType)
			{
				SystemParameterStru->CiType = CI_TYPE_CLD;
			}
			else
			{
				SystemParameterStru->CiType = (UINT8)dsuStaticHeadStru.pCIStruStru[dsuCIIndex[ciId]].wType;
			}

			SystemParameterStru->dwLineMinTrainLength = dquCICfgDtStr.SystemParaStrNew.dwLineMinTrainLength;

			SystemParameterStru->chZXDynamicTestSwitch = (UINT8)(~dquCICfgDtStr.SystemParaStrNew.chZXDynamicTestSwitch);

			SystemParameterStru->chDynamicTestSwitch = (UINT8)(~dquCICfgDtStr.SystemParaStrNew.chDynamicTestSwitch);

			SystemParameterStru->chWLSFunSwitch = dquCICfgDtStr.SystemParaStrNew.chWLSFunSwitch;

			SystemParameterStru->dwEaFrontDis = dquCICfgDtStr.SystemParaStrNew.dwEaFrontDis;
			
			SystemParameterStru->dwEaBehindDis = dquCICfgDtStr.SystemParaStrNew.dwEaBehindDis;

			SystemParameterStru->CiAndVobcTransmitBadEnsureTime = dquCICfgDtStr.SystemParaStrNew.CiAndVobcTransmitBadEnsureTime;
			SystemParameterStru->CiAndZcTransmitBadEnsureTime = dquCICfgDtStr.SystemParaStrNew.CiAndZcTransmitBadEnsureTime;
			SystemParameterStru->CiAndCiTransmitBadEnsureTime = dquCICfgDtStr.SystemParaStrNew.CiAndCiTransmitBadEnsureTime;

			SystemParameterStru->CiAndPsdTransmitBadEnsureTime = dquCICfgDtStr.SystemParaStrNew.CiAndPsdTransmitBadEnsureTime;
			SystemParameterStru->dwVersionOfZCToCI = dquCICfgDtStr.SystemParaStrNew.dwVersionOfZCToCI;
			SystemParameterStru->dwVersionOfVOBCToCI = dquCICfgDtStr.SystemParaStrNew.dwVersionOfVOBCToCI;
			SystemParameterStru->CiAndPscTransmitBadEnsureTime = dquCICfgDtStr.SystemParaStrNew.CiAndPscTransmitBadEnsureTime;

			SystemParameterStru->cAwakeCheckSpksSwitch = dquCICfgDtStr.SystemParaStrNew.cAwakeCheckSpksSwitch;
			SystemParameterStru->dwVobcCiBackUpCommErrorTime = dquCICfgDtStr.SystemParaStrNew.dwVobcCiBackUpCommErrorTime;
			SystemParameterStru->VerSionBtwAxisAndCi = dquCICfgDtStr.SystemParaStrNew.VerSionBtwAxisAndCi;
			SystemParameterStru->dwHitSoftWallSwitch = dquCICfgDtStr.SystemParaStrNew.dwHitSoftWallSwitch;
			SystemParameterStru->dwOverlapLockType = dquCICfgDtStr.SystemParaStrNew.dwOverlapLockType;
			SystemParameterStru->dwCDOccuCheckFlag = dquCICfgDtStr.SystemParaStrNew.dwCDOccuCheckFlag;
			SystemParameterStru->chNoCGFollowUtSwitch = dquCICfgDtStr.SystemParaStrNew.chNoCGFollowUtSwitch;
		}
	}

	return rtnVal;
}




/*********************************************
*函数功能：读CI-ATS配置数据
*参数说明：ciId联锁ID，  MaskConfigDataStru码位配置数据结构体指针
*返回值：码位值
*********************************************/
UINT16 ReadCiToAtsMaskConfigData(const UINT8 ciId, MaskConfigDataStruct* MaskConfigDataStru)
{
	UINT16 i=0u;

	if ((0u == ciId) || (NULL == MaskConfigDataStru) || (ConfigCiToAtsMaskIdMax[ciId] >= CI_TO_ATS_MASK_SUM_MAX))
	{
		return 0u;
	}

	for(i=0u;i<=ConfigCiToAtsMaskIdMax[ciId];i++)
	{
		MaskConfigDataStru[i] = ConfigCiToAtsMaskConfigDataStru[ciId][i];
	}

	/*返回码位的最大值*/
	return ConfigCiToAtsMaskIdMax[ciId];
}

/*********************************************
*函数功能：读CI-ZC配置数据
*参数说明：ciId联锁ID，  MaskConfigDataStru码位配置数据结构体指针
*返回值：0，失败；1，成功
*********************************************/ 
UINT16 ReadCiToZcMaskConfigData(const UINT8 ciId, MaskConfigDataStruct* MaskConfigDataStru)
{
	UINT16 i=0u;

	if ((0u == ciId) || (NULL == MaskConfigDataStru) || (ConfigCiToZcMaskIdMax[ciId] >= CI_TO_ZC_MASK_SUM_MAX))
	{
		return 0u;
	}

	for(i=0u;i<=ConfigCiToZcMaskIdMax[ciId];i++)
	{
		MaskConfigDataStru[i] = ConfigCiToZcMaskConfigDataStru[ciId][i];
	}
	/*返回码位的最大值*/
	return ConfigCiToZcMaskIdMax[ciId];
}
/*********************************************
*函数功能：读ZC-CI配置数据
*参数说明：ciId联锁ID， MaskConfigDataStru 码位配置数据结构体指针
*返回值：0，失败；1，成功
*********************************************/
UINT16 ReadZcToCiMaskConfigData(const UINT8 ciId, MaskConfigDataStruct* MaskConfigDataStru)
{
	UINT16 i=0u;

	if ((0u == ciId) || (NULL == MaskConfigDataStru) || (ConfigZcToCiMaskIdMax[ciId] >= ZC_TO_CI_MASK_SUM_MAX))
	{
		return 0u;
	}

	for(i=0u;i<=ConfigZcToCiMaskIdMax[ciId];i++)
	{
		MaskConfigDataStru[i] = ConfigZcToCiMaskConfigDataStru[ciId][i];
	}

	/*返回码位的最大值*/
	return ConfigZcToCiMaskIdMax[ciId];
}
/*********************************************
*函数功能：读CI-LEU配置数据
*参数说明：ciId联锁ID，  MaskConfigDataStru码位配置数据结构体指针
*返回值：0，失败；1，成功
*********************************************/
UINT16 ReadCiToLeuMaskConfigData(const UINT8 ciId, MaskConfigDataStruct* MaskConfigDataStru)
{
	UINT16 i=0u;

	if ((0u == ciId) || (NULL == MaskConfigDataStru) || (ConfigCiToLeuMaskIdMax[ciId] >= CI_TO_LEU_MASK_SUM_MAX))
	{
		return 0u;
	}

	for(i=0u;i<=ConfigCiToLeuMaskIdMax[ciId];i++)
	{
		MaskConfigDataStru[i] = ConfigCiToLeuMaskConfigDataStru[ciId][i];
	}

	/*返回码位的最大值*/
	return ConfigCiToLeuMaskIdMax[ciId]; 
}
/*********************************************
*函数功能：读应急盘继电器数据
*参数说明：ciId联锁ID 
*返回值：继电器ID
*********************************************/
UINT16 ReadJkjRelayId(const UINT8 ciId)
{
	UINT16 i=0u;

	if (0u == ciId)
	{
		return 0u;
	}

	for(i=0u;i<dquCICfgDtStr.RelayCfgDtStrLen;i++)
	{
		if((ciId == dquCICfgDtStr.RelayCfgDtStr[i].BelongCiId)&&(0==memcmp(dquCICfgDtStr.RelayName[i],"JKJ",3)))
		{
			return dquCICfgDtStr.RelayCfgDtStr[i].RelayId;
		}	
	}
	return 0u;
}

/*********************************************
*函数功能：释放内存
*参数说明：无
*返回值：无
*********************************************/
void FreeMem(void)
{
	/*RelayData.pRelayCfgDtStr是静态分配*/
	MyFree(&RelayData.pRelayBjdStr);
	MyFree(&RelayData.pRelayEmgcyStpStr);
	MyFree(&RelayData.pRelayNoRouteDcStr);
	MyFree(&RelayData.pRelayPhysicalSgmtStr);
	MyFree(&RelayData.pRelayPointStr);
	MyFree(&RelayData.pRelayScreenStr);
	MyFree(&RelayData.pRelaySignalStr);
	MyFree(&RelayData.pRelayZhaoChaStr);
	MyFree(&RelayData.pRelayNoRtnStru);             /*add in 2013.05.23*/
	MyFree(&RelayData.pRelaySpksStr);				/* ywlou20141204 add*/
	MyFree(&RelayData.pRelayWashMachineStr);        /*释放洗车机继电器临时结构*/

#if 0 
	MyFree(&dsuStaticHeadStru.pARInStru);
	MyFree(&dsuStaticHeadStru.pAROutStru);
	MyFree(&dsuStaticHeadStru.pARStru );
	MyFree(&dsuStaticHeadStru.pATSStruStru  );
	MyFree(&dsuStaticHeadStru.pAxleSgmtStru );
	MyFree(&dsuStaticHeadStru.pAxleStru );	
	MyFree(&dsuStaticHeadStru.pSignalStru);           /*add in 2013.05.23*/
	MyFree(&dsuStaticHeadStru.pBaliseStru );
	MyFree(&dsuStaticHeadStru.pBLOCAccessLinkStru);
	MyFree(&dsuStaticHeadStru.pBlocTrgAreaStru);
	MyFree(&dsuStaticHeadStru.pCBTCAccessLinkStru );
	MyFree(&dsuStaticHeadStru.pCbtcTrgAreaStru);
	MyFree(&dsuStaticHeadStru.pCIStruStru);
	MyFree(&dsuStaticHeadStru.pConGradeStru );
	MyFree(&dsuStaticHeadStru.pConResSpeedStru);

	MyFree(&dsuStaticHeadStru.pDefaultRoutStru );
	MyFree(&dsuStaticHeadStru.pEmergStopStru );
	MyFree(&dsuStaticHeadStru.pExitRouteStru);
	MyFree(&dsuStaticHeadStru.pGradeStru);
	MyFree(&dsuStaticHeadStru.pLinkStru);
	MyFree(&dsuStaticHeadStru.pLogicSgmtStru);
	MyFree(&dsuStaticHeadStru.pPhysicalSgmtStru );
	MyFree(&dsuStaticHeadStru.pPointStru );
	MyFree(&dsuStaticHeadStru.pProtectLinkStru);
	MyFree(&dsuStaticHeadStru.pRouteStru);
	MyFree(&dsuStaticHeadStru.pDepotGateStru);     /*add in 2014.12.18*/
	MyFree(&dsuStaticHeadStru.pPSCStru );

	MyFree(&dsuStaticHeadStru.pRunLevelStru);
	MyFree(&dsuStaticHeadStru.pScreenStru);
	MyFree(&dsuStaticHeadStru.pStaticResSpeedStru);
	MyFree(&dsuStaticHeadStru.pStationStru);
	MyFree(&dsuStaticHeadStru.pStopPointStru);
	MyFree(&dsuStaticHeadStru.pTrainLineStru);
	MyFree(&dsuStaticHeadStru.pZCComZoneStru);
	MyFree(&dsuStaticHeadStru.pZCDividPointStru);
	MyFree(&dsuStaticHeadStru.pPlatFormStru);           /*add in 2013.05.23*/
	MyFree(&dsuStaticHeadStru.pComeGoRouteStru);        /*add in 2013.11.12*/
#endif
	MyFree(&LSData.pLSAutoRouteStr);
	MyFree(&LSData.pLSAutoRtnRouteStr);
	MyFree(&LSData.pLSReverseRouteStr);
	MyFree(&LSData.pLSDDXHStr);
	MyFree(&LSData.pLSDDXHZStru);
	MyFree(&LSData.pLSFHDaoChaStr);
    MyFree(&LSData.pLSAssocSwitchGroupStru);
	MyFree(&LSData.pLSIntruPhySecStr);
	MyFree(&LSData.pLSLongRouteStr);
	MyFree(&LSData.pLSNoRouteDcStr);
	MyFree(&LSData.pLSOterCiStr);
	MyFree(&LSData.pLSPhyAndChkStaStr);
	MyFree(&LSData.pLSRouteStr);
	MyFree(&LSData.pLSSignalStr);
	MyFree(&LSData.pLSAllAutoRtnRouteStr);               /*add in 2014.11.3*/
    MyFree(&LSData.pLSOverlapLockCondStru);
	/* zt 删除单轨相关代码 2022-02-15 */

	MyFree(&pDquCiTranmitInfoStr);

	MyFree(&pDquOutStationSigStr);
    MyFree(&pDquCiFuncSwitchStru);
}

/*********************************************
*函数功能：分配内存空间
*参数说明：pMem空间长度
*返回值：无
*********************************************/
void MyFree(void ** pMem)
{
	if(*pMem!= NULL)
	{
		free(*pMem);
	}
	*pMem = NULL;
}
/*********************************************
*函数功能：读全自动折返进路配置数据
*参数说明：ciId联锁ID，  pAllAutoReturnConfigDataStru全自动折返配置数据结构体指针
*返回值：全自动折返进路数
*********************************************/
INT16 ReadAllAutoReturnConfigData(const UINT8 ciId,AllAutoReturnConfigDataStruct* pAllAutoReturnConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pAllAutoReturnConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.AllAutoRtnRouteCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.AllAutoRtnRouteCfgDtStr[i].AllAutoReturnId < ALL_AUTO_RETURN_SUM_MAX)
			{
				pAllAutoReturnConfigDataStru[dquCICfgDtStr.AllAutoRtnRouteCfgDtStr[i].AllAutoReturnId] = dquCICfgDtStr.AllAutoRtnRouteCfgDtStr[i];
				if (ciId == dquCICfgDtStr.AllAutoRtnRouteCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}
	return DataNum;
}


/*********************************************
*函数功能：读车库门配置数据
*参数说明：ciId联锁ID，  pGaragedoorConfigDataStru车库门配置数据结构体指针
*返回值：车库门数
*********************************************/
INT16 ReadGaragedoorConfigData(const UINT8 ciId,GaragedoorConfigDataStruct* pGaragedoorConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pGaragedoorConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.GaragedoorCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.GaragedoorCfgDtStr[i].GaragedoorId < GARAGE_DOOR_SUM_MAX)
			{
				pGaragedoorConfigDataStru[dquCICfgDtStr.GaragedoorCfgDtStr[i].GaragedoorId] = dquCICfgDtStr.GaragedoorCfgDtStr[i];
				if (ciId == dquCICfgDtStr.GaragedoorCfgDtStr[i].BelongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}

	return DataNum;
}

/*********************************************
*函数功能：读SPKS配置数据
*参数说明：ciId联锁ID，  spksConfig  SPKS配置数据结构体指针
*返回值：SPKS数
*********************************************/
INT16 ReadSpksConfigData(const UINT8 ciId,SpksDataConfigStruct* spksConfig)
{
	UINT16 i=0u;
	INT16 DataNum = 0;

	if ((0u != ciId) && (NULL != spksConfig))
	{
		for(i=0u;i<dquCICfgDtStr.spksDataConfigStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if(dquCICfgDtStr.spksDataConfigStr[i].spksId< SPKS_SUM_MAX)
			{
				spksConfig[dquCICfgDtStr.spksDataConfigStr[i].spksId] = dquCICfgDtStr.spksDataConfigStr[i];
				if (ciId == dquCICfgDtStr.spksDataConfigStr[i].belongCiId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}

	return DataNum;
}

/*********************************************
*函数功能：读门禁配置数据
*参数说明：ciId联锁ID，  mjConfig  门禁配置数据结构体指针
*返回值：SPKS数
*********************************************/
INT16 ReadMJConfigData(const UINT8 ciId, MJDataConfigStruct* mjConfig)
{
	UINT16 i = 0u;
	INT16 DataNum = 0;
	UINT8 belongCiID = 0u;
	if ((0u != ciId) && (NULL != mjConfig))
	{
		for (i = 0u; i < dquCICfgDtStr.mjDataConfigStrLen; i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if (dquCICfgDtStr.mjDataConfigStr[i].mjId < MJ_SUM_MAX)
			{
				mjConfig[dquCICfgDtStr.mjDataConfigStr[i].mjId] = dquCICfgDtStr.mjDataConfigStr[i];
				if ((ciId == dquCICfgDtStr.mjDataConfigStr[i].belongCiId))
				{
					DataNum++;
				}
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}

	return DataNum;
}

/*********************************************
*函数功能：读相连联锁CI之间的配置数据
*参数说明：ciId联锁ID，  pCiTransmitStru  相连联锁配置数据结构体指针
*返回值：与本联锁通信的联锁数目
*********************************************/
UINT16 ReadCiTransConfigData(const UINT8 ciId,CiTransmitStruct* pCiTransmitStru)
{
	UINT16 i=0u;
	UINT16 DataNum = 0u;
	UINT8 tempCiId = 0u;

	/* 获取指定联锁CI的数据 */
	if ((0u != ciId) && (NULL != pCiTransmitStru)&&(ciId < CI_SUM_MAX ))
	{
		for (tempCiId = 1u;tempCiId < CI_SUM_MAX;tempCiId++)
		{
			if (ciId == tempCiId)
			{
				for (i = 0u;i < dquCICfgDtStr.CiTransmitStrLen[ciId];i++)
				{
					pCiTransmitStru[DataNum] = dquCICfgDtStr.CiTransmitStru[ciId][i];
					DataNum++;
				}
			}
			else
			{
				for (i = 0u;i < dquCICfgDtStr.CiTransmitStrLen[tempCiId];i++)
				{
					if (ciId==dquCICfgDtStr.CiTransmitStru[tempCiId][i].destCiId)
					{
						pCiTransmitStru[DataNum] = dquCICfgDtStr.CiTransmitStru[tempCiId][i];
						DataNum++;
					}
				}
			}
		}
	}

	return DataNum;
}



/*
功能描述: 	读取其他线路设备配置数据
输入参数:		const UINT8 ciId 联锁ID
输出参数:		pDiffLineDevStruct* pDiffLineDevData 其他线路设备数据指针
返回值:	[0-65535]其他线路设备数量总数
*/
UINT16 ReadDiffLineDevConfigData(const UINT8 ciId, DiffLineDevStruct* pDiffLineDevData)
{
	UINT16 DataNum = 0u;

	/* 获取指定联锁CI的数据 */
	if ((0u != ciId) &&(CI_SUM_MAX > ciId) && (NULL != pDiffLineDevData))
	{
		*pDiffLineDevData = *dquCICfgDtStr.dquCIfg_DiffLineDevData;
		DataNum = dquCICfgDtStr.dquCIfg_DiffLineDevData->diffLineDevSum;
	}

	return DataNum;
}

/*********************************************
*函数功能：读联锁功能开关配置数据
*参数说明：
*返回值：0  无功能开关配置数据或数据错误
*        1  有功能开关配置数据
*********************************************/
UINT16 ReadCiFuncSwitchConfigData(DquCiFuncSwitchStructNew* pCiFuncSwitConfStru)
{
	UINT16 retVal = 0u;
	UINT16 ii = 0u;

	DquCiFuncSwitchStructNew * pTmpFuncSwitch = NULL;

	if (NULL == pCiFuncSwitConfStru)
	{
		retVal = 0u;
	}
	else
	{
		retVal = 1u;
		if (dquCiFuncSwitchStruLen < CI_FUNCTION_SWITCH_SUM_MAX)
		{
			for (ii=0u;ii<dquCiFuncSwitchStruLen;ii++)
			{
				pTmpFuncSwitch = pDquCiFuncSwitchStru + ii;

				if (pTmpFuncSwitch->wCiFuncSwitchId < CI_FUNCTION_SWITCH_SUM_MAX)
				{
					pCiFuncSwitConfStru[pTmpFuncSwitch->wCiFuncSwitchId] = *pTmpFuncSwitch;
				}
				else
				{
					retVal = 0u;
					break;
				}
			}
		}
		else
		{
			retVal = 0u;
		}
				
	}

	return retVal;
}

/*
功能描述: 	读侵限区段配置数据
输入参数:	const UINT8 ciId 联锁ID
	        pInvSecConfigDataStruct InvSecConfigDataStru[] 侵限区段数据结构数组
输出参数:	无
返回值:		0 无数据
				>1 侵限区段数据数量
*/
INT16 ReadInvaSectionConfigData(const UINT8 ciId, InvSecConfigDataStruct pInvSecConfigDataStru[])
{
	UINT16 i = 0u;
	INT16 DataNum = 0;

	if ((0u != ciId) && (NULL != pInvSecConfigDataStru))
	{

		for(i = 0u; i < dquCICfgDtStr.InvSecCfgDtStrLen; i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if((dquCICfgDtStr.dquCIfg_InvSecConfigDataStru[i].InvSecAndConSwiId < INVA_SECT_N_COND_SWIT_SUM_MAX) &&
				(dquCICfgDtStr.dquCIfg_InvSecConfigDataStru[i].InvSecAndConSwiId > 0u))
			{
				pInvSecConfigDataStru[dquCICfgDtStr.dquCIfg_InvSecConfigDataStru[i].InvSecAndConSwiId] = dquCICfgDtStr.dquCIfg_InvSecConfigDataStru[i];
				DataNum ++;
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}

	return DataNum;
}

/*
功能描述: 	读防掩门配置数据
输入参数:	const UINT8 ciId 联锁ID
	        FloodGateConfigDataStruct floodGateConfigDataStru[] 防掩门数据结构数组
输出参数:	无
返回值:		0 无数据
				>1 防掩门数据数量
*/
INT16 ReadFloodGateConfigData(const UINT8 ciId, FloodGateConfigDataStruct floodGateConfigDataStru[])
{
	UINT16 i = 0u;
	INT16 DataNum = 0;
	UINT8 localID = 0U;

	localID = GetSystemParaLocalCiId();
	if ((0u != ciId) && (NULL != floodGateConfigDataStru))
	{
		for(i = 0u; i < dquCICfgDtStr.FloodGateCfgDtStrLen; i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if((dquCICfgDtStr.FloodGateCfgDtStr[i].FloodGateId < FLOOD_GATE_SUM_MAX) &&
				(dquCICfgDtStr.FloodGateCfgDtStr[i].FloodGateId > 0u))
			{
				floodGateConfigDataStru[dquCICfgDtStr.FloodGateCfgDtStr[i].FloodGateId] = dquCICfgDtStr.FloodGateCfgDtStr[i];
				if (dquCICfgDtStr.FloodGateCfgDtStr[i].BelongCiId == localID)
				{
					DataNum++;
				}
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}
		}
	}

	return DataNum;
}


/*********************************************
*函数功能：读站台门控制器配置数据
*参数说明：ciId联锁ID，  pPscConfigDataStru站台门控制器配置数据结构体指针
*返回值：PSC数
*********************************************/
INT16 ReadPscConfigData(const UINT8 ciId,PscConfigDataStruct* pPscConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pPscConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for(i=0u;i<dquCICfgDtStr.PscCfgDtStrLen;i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if((dquCICfgDtStr.PscCfgDtStr[i].PscId < PSC_SUM_MAX) && ((UINT16)DataNum < PSC_SUM_MAX))
			{
				pPscConfigDataStru[DataNum] = dquCICfgDtStr.PscCfgDtStr[i];
				DataNum++;
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}

	return DataNum;
}


/*********************************************
*函数功能：读无人折返配置数据
*参数说明：ciId联锁ID，  pNonReturnConfigDataStru无人折返配置数据结构体指针
*返回值：无人折返数量
*********************************************/
INT16 ReadNonReturnConfigData(const UINT8 ciId, NonAutoReturnConfigDataStruct* pNonReturnConfigDataStru)
{
	UINT16 i = 0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pNonReturnConfigDataStru))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for (i = 0u; i<dquCICfgDtStr.NonReturnCfgSum; i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if ((dquCICfgDtStr.NonAutoReturnCfgDataSt[i].NonAutoReturnId < NON_AUTO_RETURN_SUM_MAX) && ((UINT16)DataNum < NON_AUTO_RETURN_SUM_MAX))
			{
				pNonReturnConfigDataStru[dquCICfgDtStr.NonAutoReturnCfgDataSt[i].NonAutoReturnId] = dquCICfgDtStr.NonAutoReturnCfgDataSt[i];
				if (ciId == dquCICfgDtStr.NonAutoReturnCfgDataSt[i].BelongCiId)
				{
					DataNum++;
				}
				else
				{
					/* 其他联锁不增加*/
				}
			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	else
	{
		/* DO NOTHING*/
	}

	return DataNum;
}
/*********************************************
*函数功能：整理相邻联锁发送给本联锁设备配置数据
*参数说明：LocalciId本地联锁ID
*返回值：0,整理成功
*		 >0,整理失败
*********************************************/
UINT8 NeibourToLocalDevConfDataManage(const UINT8 LocalciId)
{
	UINT8 j=0u;			/*游标*/
	UINT8 k=0u;			/*游标*/
	UINT8 retVal = 0u;	/*返回值*/
	UINT8 funcVal = 1u;/*标志*/
	if (0u == LocalciId)
	{/*若联锁ID无效，直接返回失败*/
		retVal = 1u;
	}
	else
	{
		for (j = 0u;j < CI_SUM_MAX;j++)
		{/*dquCICfgDtStr.CiTransmitStru[][]第1维索引*/

			if (j != LocalciId)
			{/*第1维发送方是本地联锁*/

				for (k = 0u;k< CI_SUM_MAX;k++)
				{/*dquCICfgDtStr.CiTransmitStru[][]第2维索引*/

					if (LocalciId == dquCICfgDtStr.CiTransmitStru[j][k].destCiId)
					{
						/*整理相邻联锁发送给本联锁的信号机配置数据*/
						funcVal = AddExtendSignalIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].signalNum,dquCICfgDtStr.CiTransmitStru[j][k].signalIdBuf);

						/*整理相邻联锁发送给本联锁的道岔配置数据*/
						funcVal *= AddExtendSwitchIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].switchNum,dquCICfgDtStr.CiTransmitStru[j][k].switchIdBuf);

						/*整理相邻联锁发送给本联锁的物理区段配置数据*/
						funcVal *= AddExtendPhySecIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].phySecNum,dquCICfgDtStr.CiTransmitStru[j][k].phySecIdBuf);

						/*整理相邻联锁发送给本联锁的逻辑区段配置数据*/
						funcVal *= AddExtendLogSecIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].logicSecNum,dquCICfgDtStr.CiTransmitStru[j][k].logicSecIdBuf);

						/*整理相邻联锁发送给本联锁的进路配置数据*/
						funcVal *= AddExtendRouteIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].routeNum,dquCICfgDtStr.CiTransmitStru[j][k].routeIdBuf);

						/*整理相邻联锁发送给本联锁的Esb配置数据*/
						funcVal *= AddExtendEsbIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].esbNum,dquCICfgDtStr.CiTransmitStru[j][k].esbIdBuf);

						/*整理相邻联锁发送给本联锁的Psd配置数据*/
						funcVal *= AddExtendPsdIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].psdNum,dquCICfgDtStr.CiTransmitStru[j][k].psdIdBuf);

						/*整理相邻联锁发送给本联锁的Spks配置数据*/
						funcVal *= AddExtendSpksIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].spksNum,dquCICfgDtStr.CiTransmitStru[j][k].spksIdBuff);

						/*整理相邻联锁发送给本联锁的Relay配置数据*/
						funcVal *= AddExtendRelayIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].zcjNum,dquCICfgDtStr.CiTransmitStru[j][k].zcjIdBuf);
						/*整理相邻联锁发送给本联锁的计轴区段配置数据：将物理区段转换为计轴区段*/
						funcVal *= AddExtendAxisSecIdDataManage(AxisSectionConfigDataStru,dquCICfgDtStr.CiTransmitStru[j][k].phySecNum,dquCICfgDtStr.CiTransmitStru[j][k].phySecIdBuf);
						/*整理相邻联锁发送给本联锁的防淹门配置数据*/
						funcVal *= AddExtendFloodGateIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].floodGateNum,dquCICfgDtStr.CiTransmitStru[j][k].floodGateIdBuf);

						/*整理相邻联锁发送给本联锁的保护区段配置数据*/
						funcVal *= AddExtendOverlapIdDataManage(dquCICfgDtStr.CiTransmitStru[j][k].overlapNum,dquCICfgDtStr.CiTransmitStru[j][k].overlapIdBuf);

						if (0u == funcVal)
						{/*整理相邻联锁发送给本联锁的设备数据，若失败返回1*/
							retVal = 1u;
							break;
						}
					}
				}
				if(1u == retVal)
				{
					break;
				}
			}
		}
	}
	
	return retVal;
}

/*********************************************
*函数功能：为CI使用的公共数据赋值
*参数说明：dsuEmapStru 电子地图总结构体          
*返回值：无
*mod by qw.liu 2022-02-22 增加逻辑区段电子地图索引
*********************************************/

static void CIInitEmap(DSU_EMAP_STRU dsuEmapStruPar)
{
	dsuDataLenStru = *(dsuEmapStruPar.dsuDataLenStru);/*拷贝数据*/
	dsuStaticHeadStru = *(dsuEmapStruPar.dsuStaticHeadStru);/*拷贝数据*/

	LINKINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->LINKINDEXNUM;					/*区段索引数组空间大小*/
	dsuLinkIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuLinkIndex;				/*link信息索引数组*/
	dsuPointIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuPointIndex;		/*道岔信息索引数组*/
	dsuBaliseIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuBaliseIndex;				/*应答器信息索引数组*/
	dsuSignalIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuSignalIndex;		/*信号机信息索引数组*/
	SIGNALINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->SIGNALINDEXNUM;		/*信号机信息索引大小*/
	dsuAxleIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuAxleIndex;				/*计轴器信息索引数组*/
	dsuScreenIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuScreenIndex;			/*安全屏蔽门信息索引数组*/
	STATIONINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->STATIONINDEXNUM;				/*车站索引数组空间大小*/
	dsuStationIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuStationIndex;				/*站台信息索引数组*/
	dsuEmergStopIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuEmergStopIndex;			/*紧急停车按钮信息索引数组*/
	AXLESGMTINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->AXLESGMTINDEXNUM;	/*计轴区段索引数组空间大小*/
	dsuAxleSgmtIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuAxleSgmtIndex;			/*计轴区段信息索引数组*/

	LOGICSGMTINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->LOGICSGMTINDEXNUM; ;		/*计轴区段索引数组空间大小*/
	dsuLogicSgmtIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuLogicSgmtIndex; ;			/*计轴区段信息索引数组*/

	dsuStopPointIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuStopPointIndex;			/*停车点信息索引数组*/	
	dsuTrainLineIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuTrainLineIndex;			/*车辆段信息索引数组*/
	dsuExitRouteIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuExitRouteIndex;			/*退出CBTC区段信息索引数组*/
	dsuRunLevelIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuRunLevelIndex;			/*站间运营级别信息索引数组*/
	dsuStaticResSpeedIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuStaticResSpeedIndex;	    /*静态限速信息信息索引数组*/	
	GRADEINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->GRADEINDEXNUM;			/*坡度索引数组空间大小*/
	dsuGradeIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuGradeIndex;				/*坡度信息索引数组*/
	dsuRouteIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuRouteIndex;				/*进路信息索引数组*/
	PROTECT_INDEX_NUM = dsuEmapStruPar.dsuEmapIndexStru->PROTECTLINKINDEXNUM;	/*保护区段索引空间大小*/
	dsuProtectLinkIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuProtectLinkIndex;		    /*进路保护区段信息索引数组*/
	dsuCBTCAccessLinkIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuCBTCAccessLinkIndex;      /*CBTC进路接近区段信息索引数组*/
	dsuBLOCAccessLinkIndex= dsuEmapStruPar.dsuEmapIndexStru->dsuBLOCAccessLinkIndex;      /*BLOC进路接近区段信息索引数组*/
	dsuDefaultRoutIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuDefaultRoutIndex;	        /*默认行车序列信息索引数组*/
	dsuARInIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuARInIndex;				/*无人折返进入区域信息索引数组*/
	dsuAROutIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuAROutIndex;				/*无人折返退出区域信息索引数组*/
	dsuATSIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuATSIndex;					/*ATS信息索引数组*/
	dsuCIIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuCIIndex;					/*CI信息索引数组*/
	dsuARIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuARIndex;                  /*新增加的结构体自动折返表，对应索引数组*/
	dsuZCComZoneIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuZCComZoneIndex;           /*新增加的ZC共管区域，对应索引数组 2012.1.5*/
	dsuConResSpeedIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuConResSpeedIndex;		/*统一限速索引数组*/ 
	dsuConGradeIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuConGradeIndex;		/*统一坡度索引数组*/ 
	dsuZCDividPointIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuZCDividPointIndex;		/*ZC分界点索引数组*/
	dsuPhysicalSgmtIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuPhysicalSgmtIndex;        /*物理区段索引数组*/
	BLOCTRGAREAINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->BLOCTRGAREAINDEXNUM;/*大小*/
	dsuBlocTrgAreaIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuBlocTrgAreaIndex;        /*点式触发区段索引数组*/
	CBTCTRGAREAINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->CBTCTRGAREAINDEXNUM;/*大小*/
	dsuCbtcTrgAreaIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuCbtcTrgAreaIndex;        /*CBTC触发区段索引数组*/
	dsuPlatFormIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuPlatFormIndex;        /*站台索引数组*/
	COMEGOINDEXNUM = dsuEmapStruPar.dsuEmapIndexStru->COMEGOINDEXNUM;          /*往复进路索引数组大小*/
	dsuComeGoIndex= dsuEmapStruPar.dsuEmapIndexStru->dsuComeGoIndex;             /*往复进路索引数组*/
	dsuFloodGateIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuFloodGateIndex;		/*防淹门索引数组*/
	dsuSpksButtonIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuSpksButtonIndex;		   /*SPKS按钮索引数组*/
	dsuDepotGateIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuDepotGateIndex;		   /*车库门索引数组*/
	dsuTunnelIndex = dsuEmapStruPar.dsuEmapIndexStru->dsuTunnelIndex;			/*隧道索引数组*/
}
/****************************************************************************************

 	函数功能：找出link所属的物理区段编号
	入口参数：UINT16 wLinkId				linkID信息
	出口参数：无
	返回值：  查询失败:0xffff;查询成功：返回物理区段ID信息  
	算法：    1。遍历计轴区段表，查找关联计轴区段，找到link所属的物理区段
*******************************************************************************************/
static UINT16 FindLinkBelongAxleSgmt(UINT16 wLinkId)
{
	struct DSU_AxleSgmtStruct *pstAxleSgmtStruct;/*指向计轴区段信息的结构体指针*/
	UINT16 i=0u;/*循环用变量*/
	UINT16 phySecID= 0u;    /*物理区段 ID*/

	/*判断数据输入的有效性*/

	if((wLinkId>LINKINDEXNUM)||(dsuLinkIndex[wLinkId] == 0xFFFFu))
	{
		/*数据无效，返回错误*/
		phySecID = 0u;
	}
	else
	{
		/*遍历计轴区段信息*/
		pstAxleSgmtStruct = dsuStaticHeadStru.pAxleSgmtStru;

		for (i=0u; i<dsuDataLenStru.wAxleSgmtLen; i++)
		{

			/*在计轴区段包含的link上找到给定的link编号*/
			if ((pstAxleSgmtStruct->wOrgnLkId == wLinkId) || (pstAxleSgmtStruct->wTmnlLkId == wLinkId) 
			|| (pstAxleSgmtStruct->wMiddleLinkId[0] == wLinkId) || (pstAxleSgmtStruct->wMiddleLinkId[1] == wLinkId))
			{
				/*该物理区段编号*/	
				phySecID = pstAxleSgmtStruct->wRelatePhysicalSgmtId;/*查到物理区段ID即返回*/

				break;
			}
			else
			{
				pstAxleSgmtStruct++;
			}

		}
	}
	
	return phySecID;	
 }

/*********************************************
*函数功能：根据根据读入的虚拟设备表设置相关设备的虚拟属性
*参数说明：PsdConfigDataStruct* psdCfgData屏蔽门配置数据
*          EsbConfigDataStruct* esbCfgData ESB配置数据
*		   SpksDataConfigStruct *spksCfgData SPKS配置数据
*返回值：CI_SUCCESS 成功
*        CI_ERROR   失败
*********************************************/
UINT8 ReadVirtualDevicesInit(PsdConfigDataStruct* psdCfgData, EsbConfigDataStruct* esbCfgData, SpksDataConfigStruct *spksCfgData, RelayConfigDataStruct *relayCfgData,IndicatorConfigDataStruct *pIndicatorConfigDataStruct)
{
	UINT16 i = 0u;
	UINT16 j = 0u;
	UINT8 ret = CI_SUCCESS;
	UINT8 belongCiId = 0u;
	UINT8 localCiId = 0u;
	UINT8 relayVirtAttr = 0u;

	/*入口参数防护*/
	if(	(NULL == psdCfgData)	|| 
		(NULL == esbCfgData)	|| 
		(NULL == spksCfgData)	|| 
		(NULL == relayCfgData)	||
		(NULL == pDquVirtualDeviceStr)||
		(NULL == pIndicatorConfigDataStruct))
	{
		/*返回失败*/
		ret = CI_ERROR;
	}

	if (CI_SUCCESS == ret)
	{
		InitVirtualZDZFData(); /*初始化虚拟无人折返按钮设备状态*/

		/*PSD虚拟设备属性计算*/
		for (i = 0u;i < dquVirtualDeviceStrLen;i++)
		{
			for (j = 0u;j < PSD_SUM_MAX;j++)
			{
				if (0u != psdCfgData[j].PsdId)
				{
					if ((pDquVirtualDeviceStr[i].vDeviceType == CI_DEVICE_TYPE_PSD) && (pDquVirtualDeviceStr[i].vDeviceId == psdCfgData[j].PsdId))
					{/*虚拟设备表中存在该PSD ID，则设置为具有虚拟属性*/
						psdCfgData[j].VirtualAttribute = PSD_VIRTUAL_ATTR_YES;
					}
				}
			}
		}

		/*ESB虚拟设备属性计算*/
		for (i = 0u;i < dquVirtualDeviceStrLen;i++)
		{
			for (j = 0u;j < ESB_SUM_MAX;j++)
			{
				if (0u != esbCfgData[j].EsbId)
				{
					if ((pDquVirtualDeviceStr[i].vDeviceType == CI_DEVICE_TYPE_ESB) && (pDquVirtualDeviceStr[i].vDeviceId == esbCfgData[j].EsbId))
					{/*虚拟设备表中存在该ESB ID，则设置为具有虚拟属性*/
						esbCfgData[j].VirtualAttribute = ESB_VIRTUAL_ATTR_YES;
					}
				}
			}
		}

		/*SPKS虚拟设备属性计算*/
		for (i = 0u;i < dquVirtualDeviceStrLen;i++)
		{
			for (j = 0u;j < SPKS_SUM_MAX;j++)
			{
				if (0u != spksCfgData[j].spksId)
				{
					if ((pDquVirtualDeviceStr[i].vDeviceType == CI_DEVICE_TYPE_SPKS) && (pDquVirtualDeviceStr[i].vDeviceId == spksCfgData[j].spksId))
					{/*虚拟设备表中存在该SPKS ID，则设置为具有虚拟属性*/
						spksCfgData[j].VirtualAttribute = SPKS_VIRTUAL_ATTR_YES;
					}
				}
			}
		}
		/*继电器虚拟设备属性计算*/
		for (i = 0u; i < dquVirtualDeviceStrLen; i++)
		{
			for (j = 0u; j < RELAY_SUM_MAX; j++)
			{
				if (0u != relayCfgData[j].RelayId)
				{
					if ((pDquVirtualDeviceStr[i].vDeviceType == CI_DEVICE_TYPE_RELAY) && (pDquVirtualDeviceStr[i].vDeviceId == relayCfgData[j].RelayId))
					{/*虚拟设备表中存在该继电器 ID，则设置为具有虚拟属性*/
						relayCfgData[j].VirtualAttribute = RELAY_VIRTUAL_ATTR_YES;
					}
				}
			}
		}
		/*虚拟无人折返按钮初始化*/
		for (i = 0u; i < INDICATOR_SUM_MAX; i++)
		{
			if (INDICATOR_TYPE_EXPRESS_RETURN == pIndicatorConfigDataStruct[i].IndicatorType)
			{
				for (j = 0u; j < 3u; j++)
				{
					relayVirtAttr = GetRelayVirtAttr(pIndicatorConfigDataStruct[i].IdBuf[j]);
					if (RELAY_VIRTUAL_ATTR_YES != relayVirtAttr)
					{
						break;
					}
				}
				if (RELAY_VIRTUAL_ATTR_YES == relayVirtAttr)
				{
					belongCiId = GetRelayBelongCiId(pIndicatorConfigDataStruct[i].IdBuf[0]);
					localCiId = GetSystemParaLocalCiId();
					if (localCiId == belongCiId)
					{
						VirtualZDZFAJData.belongCiId = belongCiId;
						VirtualZDZFAJData.virtualDevType = CI_DEVICE_TYPE_AUTORETURN;
					}
				}
				break;
			}
		}

	}
	return ret;
}

/*
* 功能描述： 读取各联锁电子地图校验版本配置
* 参数说明： 
	EmapCheckVerConfigStru emapVerArr[]:存储读到联锁电子地图校验配置的结构体数组
* 返回值:
	无
*/
void ReadEmapCiConfig(EmapCiConfigStru emapVerArr[])
{
	UINT16 ciStruSum = 0u;
	UINT16 i;
	UINT8 ciId;
	UINT8 jj = 0U;

	if (NULL != emapVerArr)
	{
		ciStruSum = dsuDataLenStru.wCILen;

		for (i = 0u;i < ciStruSum;i++)
		{
			ciId = (UINT8)(dsuStaticHeadStru.pCIStruStru[i].wID);
			emapVerArr[ciId].devId = ciId;
			emapVerArr[ciId].ciType = (UINT8)(dsuStaticHeadStru.pCIStruStru[i].wType);
			if (CI_TYPE_TCC == dsuStaticHeadStru.pCIStruStru[i].wType)
			{
				emapVerArr[ciId].ciType = CI_TYPE_CLD;
			}
			emapVerArr[ciId].dataVerCheckCIAndVOBC = dsuStaticHeadStru.pCIStruStru[i].dwVersionOfCIToVOBC;
			emapVerArr[ciId].dataVerCheckCIAndZC = dsuStaticHeadStru.pCIStruStru[i].dwVersionOfCIToZC;
			emapVerArr[ciId].dataVerCheckCIAndATS = dsuStaticHeadStru.pCIStruStru[i].dwVersionOfCIToATS;
			emapVerArr[ciId].dataVerCheckCIAndTMC = dsuStaticHeadStru.pCIStruStru[i].dwVersionOfCIToTMC;

			/*与相邻联锁数据校验信息*/
			emapVerArr[ciId].chAdjoinCICount = dsuStaticHeadStru.pCIStruStru[i].dwAdjoinCICount;
			for (jj = 0U; jj < CI_TRAINSMIT_CI_MAX_NUM; jj++)
			{
				emapVerArr[ciId].wAdjoinCIId[jj] = dsuStaticHeadStru.pCIStruStru[i].dwAdjoinCIId[jj];
				emapVerArr[ciId].dwAdjoinCIShareCheckData[jj] = dsuStaticHeadStru.pCIStruStru[i].dwAdjoinCIShareCheckData[jj];
			}

			for (jj = 0U; jj < CI_TRAINSMIT_AXIS_MAX_NUM; jj++)
			{
				emapVerArr[ciId].ciTransmitAxisId[jj] = dsuStaticHeadStru.pCIStruStru[i].dwCIToAxleID[jj];
				emapVerArr[ciId].ciTransmitAxisCheckData[jj] = dsuStaticHeadStru.pCIStruStru[i].dwCIToAxleShareCheckData[jj];
			}

			/*与OC系统数据校验信息*/
			emapVerArr[ciId].chAdjoinOcCount = dsuStaticHeadStru.pCIStruStru[i].chAdjoinOcCount;
			for (jj = 0U; jj < CI_TRAINSMIT_OC_MAX_NUM; jj++)
			{
				emapVerArr[ciId].wAdjoinOcId[jj] = dsuStaticHeadStru.pCIStruStru[i].wAdjoinOcId[jj];
				emapVerArr[ciId].dwAdjoinOcShareCheckData[jj] = dsuStaticHeadStru.pCIStruStru[i].dwAdjoinOcShareCheckData[jj];
			}
		}
	}
}

/*
* 功能描述： 互联互通编号对照表初始化
* 参数说明： void
* 返回值  ： 0: 初始化失败
*            1: 初始化成功
*/
UINT8 HLHTCiIdMapInitial(void)
{
	UINT8 retVal = CI_ERROR;/*返回值*/
	UINT8 retOfDataRead = 0u;
	UINT8 retOfDfsIdmapInit = 0u;
	UINT8 chSysType = 0U;
	retOfDataRead = dataRead((const)DataPath);/*读取FS文件*/

	if(1u == retOfDataRead)
	{/*读取成功*/
		chSysType = GetCbtcSysType();
		if ((DQU_CBTC_HLT == chSysType)|| (DQU_CBTC_CC == chSysType))
		{/*只有系统类型为互联互通时，才初始化编号对照表*/
			retVal = dquSetInitIdmapRef(&dsuIdmapStru);

			retOfDfsIdmapInit = dfsIdmapInit((const)DataPath);

			if (1u == retOfDfsIdmapInit)
			{/*读取成功*/
				retVal &= CI_SUCCESS;
			}
			else
			{/*读取失败*/
				retVal = CI_ERROR;				
			}
		}
		else
		{
			retVal = CI_SUCCESS;			
		}
	}
	else
	{/*读取失败*/
		retVal = CI_ERROR;	
	}

	return retVal;/*返回值*/
}

/*
*功能描述:
*	根据设备名称查询互联互通编号
*参数说明:
*	输入:
*		const UINT16 LocalDevName 本地设备ID
*		const UINT16 logId 设备端ID
*	输出:
*		UINT32 *pHlhtId 互联互通ID指针
*返回值:
*	0 查询失败
*	1 查询成功
*/
UINT8 dquDevName2HlhtId(const UINT16 LocalDevName, const UINT16 logId, UINT32 *pHlhtId)
{
	UINT8 retVal = CI_ERROR;        		/*函数返回值*/
	UINT8 retOfQueryDevId = 0u;	/*查询函数返回值*/
	UINT32 hlhtId = 0u;    		/*互联互通ID*/
	UINT32 szHlhtIdBuf[2] = {0u, 0u}; /*VOBC或ITE的互联互通ID数组*/
	UINT32 dwIdIndex = 0u;		/*索引*/
	UINT8 devType = 0u;    	    /*设备类型*/
	UINT8 devId = 0u;      	    /*设备ID*/

	if((NULL != pHlhtId) && (0xFFFFu != LocalDevName) && (0u != LocalDevName))
	{/*参数有效*/
		devType = (UINT8)((LocalDevName >> 8u) & 0x00FFu);
		devId = (UINT8)((LocalDevName >> 0u) & 0x00FFu);

		switch(devType)
		{
		case DEVTYPE_ZC:
			retOfQueryDevId = dquQueryOutDevId(QFUN_IDMAP_ZC_ID, devId, &hlhtId);
			break;
		case DEVTYPE_ATS:
			retOfQueryDevId = dquQueryOutDevId(QFUN_IDMAP_ATS_ID, devId, &hlhtId);
			break;
		case DEVTYPE_CI:
			retOfQueryDevId = dquQueryOutDevId(QFUN_IDMAP_CI_ID, devId, &hlhtId);
			break;
		case DEVTYPE_VOBC:
			retOfQueryDevId = dquQueryOutVobcDevId(devId, szHlhtIdBuf);

			switch(logId)
			{
			case 1u:
				dwIdIndex = 0u;
				break;
			case 2u:
				dwIdIndex = 1u;
				break;
			default:
				dwIdIndex = 0u;
				break;
			}

			hlhtId = szHlhtIdBuf[dwIdIndex];
			break;
		case DEVTYPE_DSU:
			retOfQueryDevId = dquQueryOutDevId(IDMAP_DSU_ID, devId, &hlhtId);
			break;
		case DEVTYPE_AXLE:
			retOfQueryDevId = dquQueryOutDevId(IDMAP_AXLE_ID, devId, &hlhtId);
			break;
		case DEVTYPE_ITE:
			retOfQueryDevId = dquQueryOutIteDevId((UINT16)devId, szHlhtIdBuf);

			switch (logId)
			{
			case 1U:
				dwIdIndex = 0U;
				break;
			case 2U:
				dwIdIndex = 1U;
				break;
			default:
				dwIdIndex = 0U;
				retOfQueryDevId = 0U; /*ITE逻辑ID其他值非法，返回失败*/
				break;
			}

			hlhtId = szHlhtIdBuf[dwIdIndex];
			break;
		default:
			retOfQueryDevId = 0u;
			break;
		}

		if(1U == retOfQueryDevId)
		{
			*pHlhtId = hlhtId;			
			retVal = CI_SUCCESS;
		}
		else
		{
			retVal = CI_ERROR;
		}
	}
	else
	{/*参数无效*/
		retVal = CI_ERROR;
	}

	return retVal;
}


/************************************************************************
功能：HlhtID转vobc内部编号
输入：
IN UINT32 EtcsId    ETCSID
输出：
OUT UINT16 *pDevName     2字节内部编号（高位设备类型 低位设备索引号)
OUT UINT16 *pEndId		vobc使用端编号 1-TC1 2-TC2 0-2IP车（首尾冗余车）
返回值：UINT8 1成功 0失败
************************************************************************/
UINT8 dquHlhtId2VobcName(IN UINT32 EtcsId, OUT UINT16 *pDevName, OUT UINT16 *pEndId)
{
	UINT8 ret = 0U;
	UINT8 endId = 0U;
	UINT16 index = 0U;
	RSSP2_DEVICE_TYPE type = DEVICE_TYPE_UNKNOWN;

	if ((NULL != pDevName) && (NULL != pEndId))
	{
		*pDevName = 0;
		*pEndId = 0;
		ret = 1;
	}
	else
	{
		ret = 0;
	}

	if (1U == ret)
	{
		endId = GET_VOBC_END_ID(EtcsId);
		switch (endId)
		{
		case 1:
			*pEndId = VOBC_ENDID_TC1;
			break;
		case 2:
			*pEndId = VOBC_ENDID_TC2;
			break;
		case 3:
			*pEndId = VOBC_ENDID_REDUN;
			break;
		case 0:
			*pEndId = VOBC_ENDID_REDUN;
			break;
		default:
			ret = 0;
			break;
		}
	}

	(void)GetEtcsTypeFromEtcsId(EtcsId, &type);
	if ((DEVICE_TYPE_ATP != type) && (DEVICE_TYPE_AOM != type))
	{
		ret = 0;
	}

	if (1U == ret)
	{
		if (DEVICE_TYPE_ATP == type)
		{
			ret = dquQueryVobcDevLgId2Index(EtcsId, ETCSID_MASK, &index, pEndId);
		}
		else
		{
			ret = dquQueryAOMDevBits2Index(EtcsId, ETCSID_MASK, &index);
		}
	}

	if (1U == ret)
	{
		if (DEVICE_TYPE_ATP == type)
		{
			*pDevName = DEVTYPE_VOBC * 256U + index;
		}
		else
		{
			*pDevName = DEVTYPE_AOM * 256U + index;
		}
	}
	return ret;
}

/*********************************************
*函数功能：读组合自动通过进路配置数据
*参数说明： GroupAutoRouteConfigDataStruct* pGroupAutoRouteConfigDataStru 组合自动进路配置数据结构体指针
*返回值：自动通过进路数
*********************************************/
INT16 ReadGroupAutoRouteConfigData(GroupAutoRouteConfigDataStruct* pGroupAutoRouteConfigDataStru)
{
	UINT16 i=0u;
	INT16 DataNum = -1;

	if(NULL == pGroupAutoRouteConfigDataStru)
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		if(GROUP_AUTO_ROUTE_SUM_MAX > dquCICfgDtStr.GroupAutoRouteStrLen)
		{
			for(i=0u;i<dquCICfgDtStr.GroupAutoRouteStrLen;i++)
			{
				/*访问数组不能越界，越界直接返回失败*/
				if(GROUP_AUTO_ROUTE_SUM_MAX > dquCICfgDtStr.GroupAutoRouteCfgStr[i].GroupAutoRouteId)
				{
					pGroupAutoRouteConfigDataStru[dquCICfgDtStr.GroupAutoRouteCfgStr[i].GroupAutoRouteId] = dquCICfgDtStr.GroupAutoRouteCfgStr[i];
					DataNum++;
				}
				else
				{
					/*返回失败*/
					DataNum = -1;
					break;
				}

			}
		}
		else
		{
			/*返回失败*/
			DataNum = -1;
		}
	}

	return DataNum;
}

/*********************************************
*函数功能：读Link配置数据
*参数说明：LinkDataConfigStru Link配置数据结构体指针
*返回值：Link数
1、create 2022.02.28
*********************************************/
INT16 ReadLinkConfigData(LinkDataConfigStru* pLinkConfigAddr)
{
	UINT16 i = 0u;
	INT16 DataNum = -1;
	UINT16 indexAc = 0u;
	UINT8 indexLink = 0u;
	UINT16 indexStation = 0u;

	if ((NULL == pLinkConfigAddr) || (LINK_SUM_MAX < dsuDataLenStru.wLinkLen))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for (i = 0u; i < dsuDataLenStru.wLinkLen; i++)
		{
			if (LINK_SUM_MAX > dquCICfgDtStr.LinkCfgDtStr[i].wId)
			{
				pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId] = dquCICfgDtStr.LinkCfgDtStr[i];

				DataNum++;
				for (indexAc = 0u; indexAc < dsuDataLenStru.wAxleSgmtLen; indexAc++)
				{
					if ((0u != dquCICfgDtStr.AxisSctCfgDtStr[indexAc].AxisSectionId)
						&& (UINT16_MAX != dquCICfgDtStr.AxisSctCfgDtStr[indexAc].AxisSectionId)
						&& (0u != dquCICfgDtStr.AxisSctCfgDtStr[indexAc].chLinkNum)
						&& (UINT8_MAX != dquCICfgDtStr.AxisSctCfgDtStr[indexAc].chLinkNum))
					{
						for (indexLink = 0u; indexLink < dquCICfgDtStr.AxisSctCfgDtStr[indexAc].chLinkNum; indexLink++)
						{
							if (dquCICfgDtStr.AxisSctCfgDtStr[indexAc].szLinkIdBuff[indexLink] == pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].wId)
							{
								pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].wRelatedPhySec = dquCICfgDtStr.AxisSctCfgDtStr[indexAc].RelativePhySecId;
								break;
							}
						}
					}
				}

				pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].wStopAreaId = 0u;
				pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].chSwTrack = LINK_SW_TRACK_NO;
				pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].chRevertArea = LINK_REVERT_AREA_NO;
				pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].chPlatform = LINK_PLATFORM_NO;
				pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].wPlatformId = 0u;

				for (indexStation = 0u; indexStation < dsuDataLenStru.wStationLen; indexStation++)
				{
					if (dquCICfgDtStr.LinkCfgDtStr[i].wId == dsuStaticHeadStru.pStationStru[indexStation].wLinkId)
					{
						pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].wStopAreaId = dsuStaticHeadStru.pStationStru[indexStation].wId;

						if (((dsuStaticHeadStru.pStationStru[indexStation].dwAttribute & (UINT32)EMAP_STATION_AREA) != 0u)
							&& ((dsuStaticHeadStru.pStationStru[indexStation].dwAttribute & EMAP_VC_STATION_AREA) == 0u))
						{
							pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].chPlatform = LINK_PLATFORM_YES;
							pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].wPlatformId = dsuStaticHeadStru.pStationStru[indexStation].wATSStationId;
						}
						else
						{
							;
						}

						if ((dsuStaticHeadStru.pStationStru[indexStation].dwAttribute & (UINT32)EMAP_SLEEP_AREA) != 0u)
						{
							pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].chSwTrack = LINK_SW_TRACK_YES;
						}
						else
						{
							;
						}

						if (0u != (dsuStaticHeadStru.pStationStru[indexStation].dwAttribute & (UINT32)EMAP_REVERT_AREA))
						{
							pLinkConfigAddr[dquCICfgDtStr.LinkCfgDtStr[i].wId].chRevertArea = LINK_REVERT_AREA_YES;
						} 
						else
						{
							;
						}
					}
					else
					{
						;
					}
				}
			}
			else
			{
				DataNum = -1;
				break;
			}
		}
	}
	return DataNum;
}

/*********************************************
*函数功能：读计轴器配置数据
*参数说明：pAxisConfigAddr 计轴器配置数据结构体指针
*返回值：计轴器数
1、create 2022.03.11
*********************************************/
INT16 ReadAxisConfigData(AxisConfigStru* pAxisConfigAddr)
{
	UINT16 i = 0u;
	INT16 DataNum = -1;

	if ((NULL == pAxisConfigAddr) || (AXIS_NUM_MAX < dsuDataLenStru.wAxlecounterLen))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for (i = 0u; i < dsuDataLenStru.wAxlecounterLen; i++)
		{
			if (AXIS_NUM_MAX > dquCICfgDtStr.AxisCfgDtStr[i].wId)
			{
				pAxisConfigAddr[dquCICfgDtStr.AxisCfgDtStr[i].wId] = dquCICfgDtStr.AxisCfgDtStr[i];
				DataNum++;
			}
			else
			{
				DataNum = -1;
				break;
			}
		}
	}
	return DataNum;
}

/*********************************************
*函数功能：读分界点配置数据
*参数说明：ciId联锁ID，  pstCutoffConfigData屏蔽门配置数据结构体指针
*返回值：本地关联分界点ID
*********************************************/
INT16 ReadCutoffPointConfigData(const UINT8 ciId, CfpConfigStru* pstCutoffConfigData)
{
	UINT16 i = 0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pstCutoffConfigData))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for (i = 0u; i<dquCICfgDtStr.wCfgCfgDtLen; i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if (dquCICfgDtStr.stCutoffPointCfgDt[i].wPointId < CUTOFF_POINT_SUM_MAX)
			{
				pstCutoffConfigData[dquCICfgDtStr.stCutoffPointCfgDt[i].wPointId] = dquCICfgDtStr.stCutoffPointCfgDt[i];
				if (ciId == dquCICfgDtStr.stCutoffPointCfgDt[i].wLocalTiocId)
				{
					DataNum++;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}

	return DataNum;
}

/*********************************************
*函数功能：读倒切设备点配置数据
*参数说明：ciId联锁ID，  pstReverseConfigData 倒切设备配置数据结构体指针
*返回值：本地关联分界点ID
*********************************************/
INT16 ReadReverseCutConfigData(const UINT8 ciId, ReverseCutCfgDataStru* pstReverseConfigData)
{
	UINT16 i = 0u;
	INT16 DataNum = -1;

	if ((0u == ciId) || (NULL == pstReverseConfigData))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for (i = 0u; i<dquCICfgDtStr.wReverseCutCfgLen; i++)
		{
			/*访问数组不能越界，越界直接返回失败*/
			if (dquCICfgDtStr.stReverseCutCfgDtStr[i].wId < REVERSE_CUT_SUM_MAX)
			{
				pstReverseConfigData[dquCICfgDtStr.stReverseCutCfgDtStr[i].wId] = dquCICfgDtStr.stReverseCutCfgDtStr[i];
				if (ciId == dquCICfgDtStr.stReverseCutCfgDtStr[i].chBelongCiId)
				{
					DataNum++;
				}
				else
				{
					;
				}

			}
			else
			{
				/*返回失败*/
				DataNum = -1;
				break;
			}

		}
	}
	else
	{
		;
	}

	return DataNum;
}


/**************************************************
*函数功能：取VOBC设备编号相应位数，查询vobc索引
***************************************************/
UINT8 dquQueryVobcDevLgId2Index(UINT32 devId, UINT32 bitMask, UINT16 *pInDevIndex,UINT16 *wLogicId)
{
	UINT8 bRetVal = 0U;
	UINT16 index = 0U;
	UINT16 DataCount = 0U;
	UINT32 *pwVobcDevId = NULL;
	UINT16 tempCount = 0U;/*查找到符合条件的设备索引值个数，找到的个数应为1，否则查找失败*/

	
	if ((NULL != pInDevIndex) && (NULL != wLogicId))
	{
		DataCount = (UINT16)dquGetVobcNumLen();
		for (index = 0U; index < DataCount; index++)
		{
			pwVobcDevId = dquGetVobcDevIdArray(index);
			if (((devId&bitMask) == (pwVobcDevId[0] & bitMask)) 
				)
			{
				*pInDevIndex = dquGetVobcIndex(index);
				*wLogicId = 1U;
				tempCount++;
			}
			else if ((devId&bitMask) == (pwVobcDevId[1] & bitMask))
			{
				*pInDevIndex = dquGetVobcIndex(index);
				*wLogicId = 2U;
				tempCount++;
			}
			else
			{
				/*无操作*/
			}
		}
		if (1U == tempCount)
		{
			bRetVal = 1U;
		}
		else
		{
			;
		}
	}
	else
	{
		;
	}

	return bRetVal;
}

/*
*  功能描述： CRC32函数，计算过程如下，注意：计算CRC是从输入数据第一个字节的最高BIT开始的
*             采用的多项式0x4c10db7L，初始值为0x00000000,未镜像，结果异或系数为0x00000000
*             如果DataLen=0，返回值也为0.
*  参数说明： pData,    数据指针
*             DataLen,  数据长度（字节）
*  返回值：   返回值为CRC值
*/
UINT32 Tioc_CommonCrc32(const UINT8 *pData, UINT32 DataLen)
{
	UINT32 Crc;
	UINT32 i;
	const static UINT32 s_TiocCrcTable[256] = {
		0x00000000U,0x04c10db7U,0x09821b6eU,0x0d4316d9U,0x130436dcU,0x17c53b6bU,0x1a862db2U,0x1e472005U,
		0x26086db8U,0x22c9600fU,0x2f8a76d6U,0x2b4b7b61U,0x350c5b64U,0x31cd56d3U,0x3c8e400aU,0x384f4dbdU,
		0x4c10db70U,0x48d1d6c7U,0x4592c01eU,0x4153cda9U,0x5f14edacU,0x5bd5e01bU,0x5696f6c2U,0x5257fb75U,
		0x6a18b6c8U,0x6ed9bb7fU,0x639aada6U,0x675ba011U,0x791c8014U,0x7ddd8da3U,0x709e9b7aU,0x745f96cdU,
		0x9821b6e0U,0x9ce0bb57U,0x91a3ad8eU,0x9562a039U,0x8b25803cU,0x8fe48d8bU,0x82a79b52U,0x866696e5U,
		0xbe29db58U,0xbae8d6efU,0xb7abc036U,0xb36acd81U,0xad2ded84U,0xa9ece033U,0xa4aff6eaU,0xa06efb5dU,
		0xd4316d90U,0xd0f06027U,0xddb376feU,0xd9727b49U,0xc7355b4cU,0xc3f456fbU,0xceb74022U,0xca764d95U,
		0xf2390028U,0xf6f80d9fU,0xfbbb1b46U,0xff7a16f1U,0xe13d36f4U,0xe5fc3b43U,0xe8bf2d9aU,0xec7e202dU,
		0x34826077U,0x30436dc0U,0x3d007b19U,0x39c176aeU,0x278656abU,0x23475b1cU,0x2e044dc5U,0x2ac54072U,
		0x128a0dcfU,0x164b0078U,0x1b0816a1U,0x1fc91b16U,0x018e3b13U,0x054f36a4U,0x080c207dU,0x0ccd2dcaU,
		0x7892bb07U,0x7c53b6b0U,0x7110a069U,0x75d1addeU,0x6b968ddbU,0x6f57806cU,0x621496b5U,0x66d59b02U,
		0x5e9ad6bfU,0x5a5bdb08U,0x5718cdd1U,0x53d9c066U,0x4d9ee063U,0x495fedd4U,0x441cfb0dU,0x40ddf6baU,
		0xaca3d697U,0xa862db20U,0xa521cdf9U,0xa1e0c04eU,0xbfa7e04bU,0xbb66edfcU,0xb625fb25U,0xb2e4f692U,
		0x8aabbb2fU,0x8e6ab698U,0x8329a041U,0x87e8adf6U,0x99af8df3U,0x9d6e8044U,0x902d969dU,0x94ec9b2aU,
		0xe0b30de7U,0xe4720050U,0xe9311689U,0xedf01b3eU,0xf3b73b3bU,0xf776368cU,0xfa352055U,0xfef42de2U,
		0xc6bb605fU,0xc27a6de8U,0xcf397b31U,0xcbf87686U,0xd5bf5683U,0xd17e5b34U,0xdc3d4dedU,0xd8fc405aU,
		0x6904c0eeU,0x6dc5cd59U,0x6086db80U,0x6447d637U,0x7a00f632U,0x7ec1fb85U,0x7382ed5cU,0x7743e0ebU,
		0x4f0cad56U,0x4bcda0e1U,0x468eb638U,0x424fbb8fU,0x5c089b8aU,0x58c9963dU,0x558a80e4U,0x514b8d53U,
		0x25141b9eU,0x21d51629U,0x2c9600f0U,0x28570d47U,0x36102d42U,0x32d120f5U,0x3f92362cU,0x3b533b9bU,
		0x031c7626U,0x07dd7b91U,0x0a9e6d48U,0x0e5f60ffU,0x101840faU,0x14d94d4dU,0x199a5b94U,0x1d5b5623U,
		0xf125760eU,0xf5e47bb9U,0xf8a76d60U,0xfc6660d7U,0xe22140d2U,0xe6e04d65U,0xeba35bbcU,0xef62560bU,
		0xd72d1bb6U,0xd3ec1601U,0xdeaf00d8U,0xda6e0d6fU,0xc4292d6aU,0xc0e820ddU,0xcdab3604U,0xc96a3bb3U,
		0xbd35ad7eU,0xb9f4a0c9U,0xb4b7b610U,0xb076bba7U,0xae319ba2U,0xaaf09615U,0xa7b380ccU,0xa3728d7bU,
		0x9b3dc0c6U,0x9ffccd71U,0x92bfdba8U,0x967ed61fU,0x8839f61aU,0x8cf8fbadU,0x81bbed74U,0x857ae0c3U,
		0x5d86a099U,0x5947ad2eU,0x5404bbf7U,0x50c5b640U,0x4e829645U,0x4a439bf2U,0x47008d2bU,0x43c1809cU,
		0x7b8ecd21U,0x7f4fc096U,0x720cd64fU,0x76cddbf8U,0x688afbfdU,0x6c4bf64aU,0x6108e093U,0x65c9ed24U,
		0x11967be9U,0x1557765eU,0x18146087U,0x1cd56d30U,0x02924d35U,0x06534082U,0x0b10565bU,0x0fd15becU,
		0x379e1651U,0x335f1be6U,0x3e1c0d3fU,0x3add0088U,0x249a208dU,0x205b2d3aU,0x2d183be3U,0x29d93654U,
		0xc5a71679U,0xc1661bceU,0xcc250d17U,0xc8e400a0U,0xd6a320a5U,0xd2622d12U,0xdf213bcbU,0xdbe0367cU,
		0xe3af7bc1U,0xe76e7676U,0xea2d60afU,0xeeec6d18U,0xf0ab4d1dU,0xf46a40aaU,0xf9295673U,0xfde85bc4U,
		0x89b7cd09U,0x8d76c0beU,0x8035d667U,0x84f4dbd0U,0x9ab3fbd5U,0x9e72f662U,0x9331e0bbU,0x97f0ed0cU,
		0xafbfa0b1U,0xab7ead06U,0xa63dbbdfU,0xa2fcb668U,0xbcbb966dU,0xb87a9bdaU,0xb5398d03U,0xb1f880b4U };

	if (NULL != pData)
	{/*生成多项式：0x4c10db7L;  */


		i = 0;
		Crc = 0;

		while (i < DataLen)
		{
			Crc = (Crc << 8) ^ s_TiocCrcTable[(Crc >> 24) ^ pData[i]];
			i++;
		}
	}
	else
	{
		Crc = 0;
	}
	return Crc;
}


/**
* @brief CRC32函数 解析平台心跳帧使用
* @param pData 数据指针
* @param dataLen 数据长度
* @return 为CRC值
* @details
* 计算过程如下，注意：计算CRC是从输入数据第一个字节的最高BIT开始的
* 采用的多项式0x4c11db7L，初始值为0x00000000,未镜像，结果异或系数为0x00000000
* 如果dataLen=0，返回值也为0
*/
UINT32 Tioc_PlatCommonCrc32(const UINT8* pData, UINT32 dataLen)
{
	/*- 变量初始化 */
	UINT32 crc = 0U;
	UINT32 i = 0U;


	static const UINT32 s_CrcTable[256] = {
		0x00000000u,0x04c11db7u,0x09823b6eu,0x0d4326d9u,0x130476dcu,0x17c56b6bu,
		0x1a864db2u,0x1e475005u,0x2608edb8u,0x22c9f00fu,0x2f8ad6d6u,0x2b4bcb61u,
		0x350c9b64u,0x31cd86d3u,0x3c8ea00au,0x384fbdbdu,0x4c11db70u,0x48d0c6c7u,
		0x4593e01eu,0x4152fda9u,0x5f15adacu,0x5bd4b01bu,0x569796c2u,0x52568b75u,
		0x6a1936c8u,0x6ed82b7fu,0x639b0da6u,0x675a1011u,0x791d4014u,0x7ddc5da3u,
		0x709f7b7au,0x745e66cdu,0x9823b6e0u,0x9ce2ab57u,0x91a18d8eu,0x95609039u,
		0x8b27c03cu,0x8fe6dd8bu,0x82a5fb52u,0x8664e6e5u,0xbe2b5b58u,0xbaea46efu,
		0xb7a96036u,0xb3687d81u,0xad2f2d84u,0xa9ee3033u,0xa4ad16eau,0xa06c0b5du,
		0xd4326d90u,0xd0f37027u,0xddb056feu,0xd9714b49u,0xc7361b4cu,0xc3f706fbu,
		0xceb42022u,0xca753d95u,0xf23a8028u,0xf6fb9d9fu,0xfbb8bb46u,0xff79a6f1u,
		0xe13ef6f4u,0xe5ffeb43u,0xe8bccd9au,0xec7dd02du,0x34867077u,0x30476dc0u,
		0x3d044b19u,0x39c556aeu,0x278206abu,0x23431b1cu,0x2e003dc5u,0x2ac12072u,
		0x128e9dcfu,0x164f8078u,0x1b0ca6a1u,0x1fcdbb16u,0x018aeb13u,0x054bf6a4u,
		0x0808d07du,0x0cc9cdcau,0x7897ab07u,0x7c56b6b0u,0x71159069u,0x75d48ddeu,
		0x6b93dddbu,0x6f52c06cu,0x6211e6b5u,0x66d0fb02u,0x5e9f46bfu,0x5a5e5b08u,
		0x571d7dd1u,0x53dc6066u,0x4d9b3063u,0x495a2dd4u,0x44190b0du,0x40d816bau,
		0xaca5c697u,0xa864db20u,0xa527fdf9u,0xa1e6e04eu,0xbfa1b04bu,0xbb60adfcu,
		0xb6238b25u,0xb2e29692u,0x8aad2b2fu,0x8e6c3698u,0x832f1041u,0x87ee0df6u,
		0x99a95df3u,0x9d684044u,0x902b669du,0x94ea7b2au,0xe0b41de7u,0xe4750050u,
		0xe9362689u,0xedf73b3eu,0xf3b06b3bu,0xf771768cu,0xfa325055u,0xfef34de2u,
		0xc6bcf05fu,0xc27dede8u,0xcf3ecb31u,0xcbffd686u,0xd5b88683u,0xd1799b34u,
		0xdc3abdedu,0xd8fba05au,0x690ce0eeu,0x6dcdfd59u,0x608edb80u,0x644fc637u,
		0x7a089632u,0x7ec98b85u,0x738aad5cu,0x774bb0ebu,0x4f040d56u,0x4bc510e1u,
		0x46863638u,0x42472b8fu,0x5c007b8au,0x58c1663du,0x558240e4u,0x51435d53u,
		0x251d3b9eu,0x21dc2629u,0x2c9f00f0u,0x285e1d47u,0x36194d42u,0x32d850f5u,
		0x3f9b762cu,0x3b5a6b9bu,0x0315d626u,0x07d4cb91u,0x0a97ed48u,0x0e56f0ffu,
		0x1011a0fau,0x14d0bd4du,0x19939b94u,0x1d528623u,0xf12f560eu,0xf5ee4bb9u,
		0xf8ad6d60u,0xfc6c70d7u,0xe22b20d2u,0xe6ea3d65u,0xeba91bbcu,0xef68060bu,
		0xd727bbb6u,0xd3e6a601u,0xdea580d8u,0xda649d6fu,0xc423cd6au,0xc0e2d0ddu,
		0xcda1f604u,0xc960ebb3u,0xbd3e8d7eu,0xb9ff90c9u,0xb4bcb610u,0xb07daba7u,
		0xae3afba2u,0xaafbe615u,0xa7b8c0ccu,0xa379dd7bu,0x9b3660c6u,0x9ff77d71u,
		0x92b45ba8u,0x9675461fu,0x8832161au,0x8cf30badu,0x81b02d74u,0x857130c3u,
		0x5d8a9099u,0x594b8d2eu,0x5408abf7u,0x50c9b640u,0x4e8ee645u,0x4a4ffbf2u,
		0x470cdd2bu,0x43cdc09cu,0x7b827d21u,0x7f436096u,0x7200464fu,0x76c15bf8u,
		0x68860bfdu,0x6c47164au,0x61043093u,0x65c52d24u,0x119b4be9u,0x155a565eu,
		0x18197087u,0x1cd86d30u,0x029f3d35u,0x065e2082u,0x0b1d065bu,0x0fdc1becu,
		0x3793a651u,0x3352bbe6u,0x3e119d3fu,0x3ad08088u,0x2497d08du,0x2056cd3au,
		0x2d15ebe3u,0x29d4f654u,0xc5a92679u,0xc1683bceu,0xcc2b1d17u,0xc8ea00a0u,
		0xd6ad50a5u,0xd26c4d12u,0xdf2f6bcbu,0xdbee767cu,0xe3a1cbc1u,0xe760d676u,
		0xea23f0afu,0xeee2ed18u,0xf0a5bd1du,0xf464a0aau,0xf9278673u,0xfde69bc4u,
		0x89b8fd09u,0x8d79e0beu,0x803ac667u,0x84fbdbd0u,0x9abc8bd5u,0x9e7d9662u,
		0x933eb0bbu,0x97ffad0cu,0xafb010b1u,0xab710d06u,0xa6322bdfu,0xa2f33668u,
		0xbcb4666du,0xb8757bdau,0xb5365d03u,0xb1f740b4u
	};

	/*- 遍历输入数据 */
	while (i < dataLen)
	{
		/*- 迭代计算CRC */
		crc = (crc << 8) ^ s_CrcTable[(crc >> 24) ^ (*(pData + i))]; /* parasoft-suppress MISRA2004-17_1 "为了提高代码效率，使用指针运算" */
		i++;
	}
	/*- 返回CRC结果 */
	return crc;
}




/*********************************************
*函数功能：读防护区域配置数据
*参数说明：EaConfigStru 防护区域配置数据结构体指针
*返回值：防护区域数
*********************************************/
INT16 ReadEaConfigData(EaConfigStru* pEaConfigAddr)
{
	UINT16 i = 0u;
	INT16 DataNum = -1;

	if ((NULL == pEaConfigAddr) || (EA_CFG_SUM_MAX < dsuDataLenStru.wEaLen))
	{
		DataNum = -1;
	}
	else
	{
		DataNum = 0;
	}

	if (0 == DataNum)
	{
		for (i = 0u; i < dsuDataLenStru.wEaLen; i++)
		{
			if (EA_CFG_SUM_MAX > dquCICfgDtStr.szEaCfgDtStr[i].wId)
			{
				pEaConfigAddr[i] = dquCICfgDtStr.szEaCfgDtStr[i];

				DataNum++;
			}
			else
			{
				DataNum = -1;
				break;
			}
		}
	}
	return DataNum;
}

/*********************************************
*函数功能：获取TIOC全线免筛有效标志
*参数说明：ciId联锁ID
*返回值：TIOC全线免筛有效标志 TIOC_WLSCTEEN_VALID TIOC_WLSCTEEN_UNVALID
*********************************************/
UINT8 GetWLScreenTypeById(const UINT8 ciId)
{
	UINT8 cRetVal = TIOC_WLSCTEEN_VALID;

	cRetVal = dsuStaticHeadStru.pCIStruStru[dsuCIIndex[ciId]].cWLScreenType;

	return cRetVal;
}

/*********************************************
*函数功能：读声光报警器配置数据
*参数说明：const UINT8 cLocalCiId 本地联锁ID
*          SGBJConfigDataStruct* pSGBJConfigDataStru 声光报警器配置数据结构体指针
*返回值：-1 读取失败
         其它 声光报警器数量
*********************************************/
INT16 ReadSGBJConfigData(const UINT8 cLocalCiId, SGBJConfigDataStruct* pSGBJConfigDataStru)
{
	INT16 dataNum = -1;
	UINT16 i = 0U;
	UINT8 cSGBJbelongCiId = 0U;
	UINT16 wSGBJId = 0U;

	if ((NULL != pSGBJConfigDataStru) && (0U != cLocalCiId))
	{
		dataNum = 0;
	}
	else
	{
		dataNum = -1;
	}

	if (0 == dataNum)
	{
		for (i = 0U; i < dquCICfgDtStr.wSGBJCfgLen; i++)
		{
			
			wSGBJId = dquCICfgDtStr.SGBJCfgDataStru[i].wSGBJId;
			if (wSGBJId < SGBJ_SUM_MAX)
			{
				pSGBJConfigDataStru[wSGBJId] = dquCICfgDtStr.SGBJCfgDataStru[i];
				cSGBJbelongCiId = dquCICfgDtStr.SGBJCfgDataStru[i].cBelongCiId;
				if (cLocalCiId == cSGBJbelongCiId)
				{
					dataNum++;
				}
				else
				{
					/*继续遍历*/
				}
			}
			else
			{
				dataNum = -1;  /*返回失败*/
				break;
			}
		}
	}
	else
	{
		dataNum = -1;  /*返回-1*/
	}

	return dataNum;
}

/*********************************************
*函数功能：确定计轴区段的边界计轴区段属性
*参数说明：const UINT16 wAxleId 计轴区段ID
*返 回 值：1 边界计轴区段
*	       0 非边界计轴区段
*********************************************/
UINT8 EnsureAxleBorderAtrr(const UINT16 wAxleId)
{
	UINT8 cRetVal = CI_ERROR;
	DSU_AXLE_SGMT_STRU* pTempAxleSgmtStru = NULL;
	UINT16 wOrgnJointMainLkId = 0U;  /*起点正线相邻link*/
	UINT16 wOrgnJointSideLkId = 0U;  /*起点侧线相邻link*/
	UINT16 wTmnlJointMainLkId = 0U;  /*终点正线相邻link*/
	UINT16 wTmnlJointSideLkId = 0U;  /*终点侧线相邻link*/
	UINT8 cCurCiId = 0U;
	
	if ((0U < wAxleId) && (AXIS_SECTION_SUM_MAX > wAxleId))
	{
		pTempAxleSgmtStru = &dsuStaticHeadStru.pAxleSgmtStru[g_dsuEmapStru->dsuEmapIndexStru->dsuAxleSgmtIndex[wAxleId]];
		cCurCiId = pTempAxleSgmtStru->wManagePhysicalCI;

		/*判断计轴区段起点link相邻的link是否属于其它控区*/
		wOrgnJointMainLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wOrgnLkId]].wOrgnJointMainLkId;
		wOrgnJointSideLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wOrgnLkId]].wOrgnJointSideLkId;
		wTmnlJointMainLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wOrgnLkId]].wTmnlJointMainLkId;
		wTmnlJointSideLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wOrgnLkId]].wTmnlJointSideLkId;

		if ((0U != wOrgnJointMainLkId) && (UINT16_MAX != wOrgnJointMainLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wOrgnJointMainLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}

		if ((0U != wOrgnJointSideLkId) && (UINT16_MAX != wOrgnJointSideLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wOrgnJointSideLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}

		if ((0U != wTmnlJointMainLkId) && (UINT16_MAX != wTmnlJointMainLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wTmnlJointMainLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}

		if ((0U != wTmnlJointSideLkId) && (UINT16_MAX != wTmnlJointSideLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wTmnlJointSideLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}

		/*判断计轴区段终点link相邻的link是否属于其它控区*/
		wOrgnJointMainLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wTmnlLkId]].wOrgnJointMainLkId;
		wOrgnJointSideLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wTmnlLkId]].wOrgnJointSideLkId;
		wTmnlJointMainLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wTmnlLkId]].wTmnlJointMainLkId;
		wTmnlJointSideLkId = dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[pTempAxleSgmtStru->wTmnlLkId]].wTmnlJointSideLkId;

		if ((0U != wOrgnJointMainLkId) && (UINT16_MAX != wOrgnJointMainLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wOrgnJointMainLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}

		if ((0U != wOrgnJointSideLkId) && (UINT16_MAX != wOrgnJointSideLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wOrgnJointSideLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}

		if ((0U != wTmnlJointMainLkId) && (UINT16_MAX != wTmnlJointMainLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wTmnlJointMainLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}

		if ((0U != wTmnlJointSideLkId) && (UINT16_MAX != wTmnlJointSideLkId))
		{
			if (cCurCiId != dsuStaticHeadStru.pLinkStru[g_dsuEmapStru->dsuEmapIndexStru->dsuLinkIndex[wTmnlJointSideLkId]].wManagePhysicalCI)
			{
				cRetVal = CI_SUCCESS;  /*相邻link非本控区，该计轴区段即为边界计轴区段，返回成功*/
			}
		}
	}
	else
	{
		;
	}

	return cRetVal;
}

/*********************************************
*函数功能：确定计轴区段相邻计轴区段是否为存车线
*参数说明：const UINT16 wAxleId 计轴区段ID
*返 回 值：1 是
*	       0 否
* Created By LQ 2025.03.08
*********************************************/
UINT8 EnsureNearAxleStorageLineAtrr(const UINT16 wAxleId)
{
	UINT8 cRetVal = CI_SUCCESS;
	DSU_AXLE_SGMT_STRU* pTempAxleSgmtStru = NULL;
	UINT8 ii = 0U;
	UINT16 wTempAxleId = 0U;
	UINT16 jj = 0U;
	UINT8 cFindFlag = CI_ERROR;

	if ((0U < wAxleId) && (AXIS_SECTION_SUM_MAX > wAxleId))
	{
		pTempAxleSgmtStru = &dsuStaticHeadStru.pAxleSgmtStru[g_dsuEmapStru->dsuEmapIndexStru->dsuAxleSgmtIndex[wAxleId]];

		/*查询起点相邻的计轴区段有无存车线*/
		for (ii = 0U; ii < 16U; ii++)
		{
			wTempAxleId = pTempAxleSgmtStru->wOrgnAxleSgmtId[ii];
			for (jj = 0U; jj < dquCICfgDtStr.wLinkLineCfgDtLen; jj++)
			{
				if (wTempAxleId == dquCICfgDtStr.LinkLineCfgDtStr[jj].wAxisSecId)
				{
					if (0x55U == dquCICfgDtStr.LinkLineCfgDtStr[jj].cStorageLineType)
					{
						cFindFlag = CI_SUCCESS;
						break;
					}
					else
					{
						/*继续遍历*/
					}
				}
				else
				{
					/*继续遍历*/
				}
			}

			if (CI_SUCCESS == cFindFlag)
			{
				break;  /*存在相邻计轴区段为存车线，停止遍历*/
			}
			else
			{
				/*继续遍历*/
			}
		}

		if (CI_ERROR == cFindFlag)
		{
			/*查询终点相邻的计轴区段有无存车线*/
			for (ii = 0U; ii < 16U; ii++)
			{
				wTempAxleId = pTempAxleSgmtStru->wTmnlAxleSgmtId[ii];
				for (jj = 0U; jj < dquCICfgDtStr.wLinkLineCfgDtLen; jj++)
				{
					if (wTempAxleId == dquCICfgDtStr.LinkLineCfgDtStr[jj].wAxisSecId)
					{
						if (0x55U == dquCICfgDtStr.LinkLineCfgDtStr[jj].cStorageLineType)
						{
							cFindFlag = CI_SUCCESS;
							break;
						}
						else
						{
							/*继续遍历*/
						}
					}
					else
					{
						/*继续遍历*/
					}
				}

				if (CI_SUCCESS == cFindFlag)
				{
					break;  /*存在相邻计轴区段为存车线，停止遍历*/
				}
				else
				{
					/*继续遍历*/
				}
			}
		}
		else
		{
			;
		}

		if (CI_ERROR == cFindFlag)
		{
			cRetVal = CI_ERROR;  /*相邻计轴区段无存车线，返回失败*/
		}
		else
		{
			cRetVal = CI_SUCCESS;  /*相邻计轴区段为存车线，返回成功*/
		}
	}
	else
	{
		;
	}

	return cRetVal;
}

/*
* 功能描述：读取物理区段在计轴中的索引
* 参数说明：const UINT8 chLocalCiId 本地联锁ID
*			PhysicalSectionConfigDataStruct* pPhysicalSectionConfigDataStru 物理区段结构体
* 返回值  ：CI_SUCCESS,成功
*			CI_ERROR,失败
* BY CGH 20250418
*/
UINT8 ReadPhySecIndexInAxle(const UINT8 chLocalCiId, PhysicalSectionConfigDataStruct* pPhysicalSectionConfigDataStru)
{
	UINT8 chReval = CI_ERROR;
	UINT8 chDevSum = 0U; /*设备数目*/
	UINT8* szDevIdBuf = NULL; /*设备ID数组*/
	UINT8 ii = 0U;
	UINT16 jj = 0U;
	UINT16 wIndexInAxle = 0U; /*物理区段在计轴系统中的索引*/

	if ((0U != chLocalCiId) && (NULL != pPhysicalSectionConfigDataStru))
	{
		chReval = CI_SUCCESS;
		chDevSum = GetCiTransmitSpecifySysDevSum(CI_SYSTEM_TYPE_AXIS);
		szDevIdBuf = GetCiTransmitSpecifySysDevBuf(CI_SYSTEM_TYPE_AXIS);
		
		for (ii = 0U; ii < chDevSum; ii++)
		{
			wIndexInAxle = 1U;
			for (jj = 0U; jj < dquCICfgDtStr.PsclSgmtCfgDtStrLen; jj++)
			{
				if (dquCICfgDtStr.PsclSgmtCfgDtStr[jj].PhysicalSectionId < PHYSICAL_SECTION_SUM_MAX)
				{
					if (chLocalCiId == dquCICfgDtStr.PsclSgmtCfgDtStr[jj].BelongCiId)
					{
						if (szDevIdBuf[ii] == (UINT8)dquCICfgDtStr.PsclSgmtCfgDtStr[jj].BelongAxleSysID)
						{
							pPhysicalSectionConfigDataStru[dquCICfgDtStr.PsclSgmtCfgDtStr[jj].PhysicalSectionId].wIndexInAxle = wIndexInAxle;
							wIndexInAxle++;
						}
						else
						{
							;
						}					
					}
					else
					{
						; 
					}
				}
				else
				{
					chReval = CI_ERROR;
					break;
				}			
			}

			if (CI_ERROR == chReval)
			{
				break;
			}
			else
			{
				;
			}
		}
	}
	else
	{
		;
	}

	return chReval;
}

