/************************************************************************
*
* 文件名   ：  dquMaskInit.c
* 版权说明 ：  北京交控科技有限公司 
* 版本号   ：  1.0
* 创建时间 ：  2011.12.27
* 作者     ：  研发中心软件部
* 功能描述 ：   码位初始化处理过程
* 使用注意 ： 
* 修改记录 ：  
*
************************************************************************/
#include "dquMaskInit.h"
#include "commonQueryStruDef.h"
#include "SignalDefine.h"
#include "../Signal/SignalConfigDataManage.h"


UINT16 ConfigCiToLeuMaskCurSum[CI_SUM_MAX] = {0u};  /*定义各CI站到Leu码位当前总数*/
UINT16 ConfigZcToCiMaskCurSum[CI_SUM_MAX] = {0u};  /*定义各CI站接收ZC码位当前总数*/
UINT16 ConfigCiToZcMaskCurSum[CI_SUM_MAX] = {0u};  /*定义各CI站到ZC码位当前总数*/
UINT16 ConfigCiToAtsMaskCurSum[CI_SUM_MAX] = {0u};  /*定义各CI站到ATS码位当前总数*/

UINT16 ConfigCiToLeuMaskIdMax[CI_SUM_MAX] = {0u};  /*定义各CI站到Leu码位最大值*/
UINT16 ConfigZcToCiMaskIdMax[CI_SUM_MAX] = {0u};  /*定义各CI站接收ZC码位最大值*/
UINT16 ConfigCiToZcMaskIdMax[CI_SUM_MAX] = {0u};  /*定义各CI站到ZC码位最大值*/
UINT16 ConfigCiToAtsMaskIdMax[CI_SUM_MAX] = {0u};  /*定义各CI站到ATS码位最大值*/


MaskConfigDataStruct ConfigCiToAtsMaskConfigDataStru[CI_SUM_MAX][CI_TO_ATS_MASK_SUM_MAX];  /*定义各CI站到ATS码位配置数据*/ 
MaskConfigDataStruct ConfigCiToZcMaskConfigDataStru[CI_SUM_MAX][CI_TO_ZC_MASK_SUM_MAX];  /*定义各CI站到ZC码位配置数据*/
MaskConfigDataStruct ConfigZcToCiMaskConfigDataStru[CI_SUM_MAX][ZC_TO_CI_MASK_SUM_MAX];  /*定义各ZC站到CI码位配置数据*/
MaskConfigDataStruct ConfigCiToLeuMaskConfigDataStru[CI_SUM_MAX][CI_TO_LEU_MASK_SUM_MAX];  /*定义各CI到LEU码位配置数据*/


UINT8  MaskCfgDtStruFrmCI2ZCLogSgmt(UINT8 * FSDataName);
UINT8  MaskCfgDtStruFrmZC2CiRouteMask(UINT8 * FSDataName);
/*********************************************
*函数功能：CI到ATS码位表解析
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSSwitchMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = CI_ERROR;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow = 0u;  /*码位矩阵行数*/
	UINT16 DeviceID = 0u; /*设备ID*/
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 rowCount = 0u;
	UINT8 rowLenth = 0u;/*行字节数*/

	/*对应表格的每一列*/
	UINT8 MaskType[]={0u,MASK_TYPE_SWITCH_DINGWEI,MASK_TYPE_SWITCH_FANWEI,MASK_TYPE_SWITCH_SIKAI,MASK_TYPE_SWITCH_DYNAMIC_JICHA,
		MASK_TYPE_SWITCH_MOVING,MASK_TYPE_SWITCH_DANSUO,MASK_TYPE_SWITCH_FENGSUO,MASK_TYPE_SWITCH_YINDAOSUO,MASK_TYPE_SWITCH_PROTECTLOCK,MASK_TYPE_SWITCH_BYPASS,
		MASK_TYPE_SWITCH_OPEN_CAP,MASK_TYPE_SWITCH_SUDDEN_JICHA,0u};
	UINT16 BuChang = 0u;/*步长*/

	funcRtn = dquGetConfigDataNew(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_SWITCH_MASK_ID,&pDataAddr,&DataSize,&rowCount);
	if(funcRtn==0u)
	{
		/*不做处理*/
	}
	else
	{
		funcRtn = CI_SUCCESS;
		/*数据读取正常*/
		if((0u < DataSize) && (0u < rowCount))
		{
			if(0u == DataSize % rowCount)
			{
				/*一行字节数*/
				rowLenth = (UINT8)(DataSize / rowCount);
				for(;DataSize>0u;DataSize-=2u)
				{
					residue = (UINT16)(BuChang%(rowLenth/2u));
					/*第一列是用来计算行的，一般是一个id号*/
					if(0u == residue)
					{
						DeviceID = ShortFromChar(pDataAddr);

						pDataLin = pDataAddr + rowLenth -2u;
						MaskRow = ShortFromChar(pDataLin);

						/*访问数组不能越界，越界直接返回失败*/
						if(MaskRow < CI_SUM_MAX)
						{
							pDataAddr+=2u;
							BuChang++;
						}
						else
						{
							funcRtn = CI_ERROR;
							break;
						}
					}
					/*第二列往后才是码位值*/
					else if((0u < residue) && (residue < ((rowLenth / 2u)-1u)))
					{
						/*获取码位ID*/
						tempMaskId = ShortFromChar(pDataAddr);

						/*0和0xFFFF是无效的码位*/
						if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
						{
							if((CI_SUM_MAX > MaskRow)&&(CI_TO_ATS_MASK_SUM_MAX > tempMaskId)&&(0u <tempMaskId))/*检查是否为有效码位值*/
							{
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SWITCH;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(rowLenth / 2u)]);

								/*统计最大的有效码位*/
								if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
								{
									ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
								}
								else
								{
									/*do nothing*/
								}

								ConfigCiToAtsMaskCurSum[MaskRow]++;
							}
							else
							{
								funcRtn = CI_ERROR;
								break;
							}
						}

						pDataAddr+=2u;
						BuChang++;
					}
					else
					{
						pDataAddr+=2u;
						BuChang++;
					}
				}
			}
			else
			{
				funcRtn = CI_ERROR;
			}
		}
		else
		{
			funcRtn = CI_SUCCESS;
		}
	}
	return funcRtn;
}
/* zt 删除单轨相关代码 2022-02-15 */
/*********************************************
*函数功能：CI-ATS信号机码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*1、zt 2022.02.28 新增信号机异常关闭码位
*2、qw.liu 2022.08.10 新增信号机故障报警码位
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSSignalMask(UINT8 * FSDataName)
{
    UINT8 funcRtn = 0u;
    UINT8* pDataAddr, *pDataLin;
    UINT32 DataSize = 0u;
	UINT16 rowCount = 0u;
    UINT16 MaskRow=0u;
    UINT16 DeviceID=0u;
    UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT8 reVal = CI_ERROR;
	UINT8 rowLenth = 0u;/*行长度*/ 
	UINT8 MaskType[] = { 0u,MASK_TYPE_SIGNAL_RED,MASK_TYPE_SIGNAL_YELLOW,MASK_TYPE_SIGNAL_GREEN,MASK_TYPE_SIGNAL_WHITE,
						MASK_TYPE_SIGNAL_REDYELLOW,MASK_TYPE_SIGNAL_LIGHTSTATE,MASK_TYPE_SIGNAL_BREAK,MASK_TYPE_SIGNAL_FENGSUO,MASK_TYPE_SIGNAL_CENTER_DETAIN,
						MASK_TYPE_SIGNAL_LOCAL_DETAIN,MASK_TYPE_SIGNAL_LINSHIXIANSU_SET,MASK_TYPE_SIGNAL_DOUBLE_GREEN,MASK_TYPE_SIGNAL_DOUBLE_YELLOW,
						MASK_TYPE_SIGNAL_GREEN_YELLOW,MASK_TYPE_SIGNAL_MAINTAINSTATE,MASK_TYPE_SIGNAL_CLOSE_ABNORMAL,MASK_TYPE_SIGNAL_OC_BOARD_FAULT,
						MASK_TYPE_SIGNAL_CANCEL_DET_ERR,MASK_TYPE_SIGNAL_DET_ERR,MASK_TYPE_SIGNAL_RELAY_DETAIN,MASK_TYPE_SIGNAL_AUTO_DERAIN,0U,
						MASK_TYPE_SIGNAL_GREENBREAK,MASK_TYPE_SIGNAL_YELLOWBREAK,MASK_TYPE_SIGNAL_WHITEBREAK,MASK_TYPE_SIGNAL_BLUEBREAK,
						MASK_TYPE_SIGNAL_DET_CUT_VALID,MASK_TYPE_SIGNAL_DET_CUT_ERR,0U };
	UINT16 BuChang = 0u;
#if 0
    funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_SIGNAL_MASK_ID,&pDataAddr,&DataSize);
#endif
	funcRtn = dquGetConfigDataNew(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_SIGNAL_MASK_ID,&pDataAddr,&DataSize,&rowCount);
    if(0u == funcRtn)
    {
    	reVal = CI_ERROR;
    }
	else
	{
		reVal = CI_SUCCESS;
	}
    
	if(CI_SUCCESS == reVal)
	{
		reVal = CI_ERROR;/*先置失败*/
		if(0u < DataSize)
		{
			if(0u < rowCount)
			{
				if(0u == (DataSize % rowCount))
				{
					rowLenth =(UINT8)(DataSize/rowCount);
					reVal = CI_SUCCESS;	
				}	
			}
		}
		else
		{
			reVal = CI_SUCCESS;
		}
	}

	if(CI_SUCCESS == reVal)
	{
		for(;DataSize>0u;DataSize-=2u)
		{
			residue = (UINT16)(BuChang%(rowLenth/2u));
			if(0u == residue)
			{
				DeviceID = ShortFromChar(pDataAddr);

				pDataLin = pDataAddr + rowLenth - 2u;/*使得指针指向CI编号*/
				MaskRow = ShortFromChar(pDataLin);/*获取CI编号*/

				pDataAddr+=2u;
				BuChang++;
			}
			else if((residue > 0u ) && (residue < (rowLenth/2u -1u)))
			{
				/*获取码位ID*/
				tempMaskId = ShortFromChar(pDataAddr);

				if((0xFFFFu == tempMaskId)||(0u == tempMaskId))/*本码位是无效值*/
				{
					pDataAddr+=2u;
					BuChang++;
				}
				else if((CI_SUM_MAX > MaskRow)&&(CI_TO_ATS_MASK_SUM_MAX > tempMaskId)&&(0u <tempMaskId))/*检查是否为有效码位值*/
				{
					ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
					ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SIGNAL;
					ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
					ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(rowLenth/2u)]);

					/*统计最大的有效码位*/
					if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
					{
						ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
					}
					else
					{
						/*do nothing*/
					}

					ConfigCiToAtsMaskCurSum[MaskRow]++;

					pDataAddr+=2u;
					BuChang++;
				}
				else
				{
					reVal = CI_ERROR;/*错误*/
					break;
				}

			}
			else
			{
				pDataAddr+=2u;
				BuChang++;
			}
		}
	}

   
    return reVal;
}

/*********************************************
*函数功能：CI-ATS屏蔽门码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSPsdMask(UINT8* FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, * pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow = 0u;
	UINT16 DeviceID = 0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 realRow = 0u;
	UINT16 rowLen = 0u;

#if 1
	UINT8 MaskType[] = { 0u,MASK_TYPE_PSD_STATE_ATS,MASK_TYPE_MUTUALLOCK_STATE,MASK_TYPE_REMORA_STATE,
						MASK_TYPE_PSD_PCB,MASK_TYPE_PSD_POB,MASK_TYPE_PSD_PSB,MASK_TYPE_PSD_PCB_INVALID,
						MASK_TYPE_PSD_POB_INVALID,MASK_TYPE_PSD_PSB_INVALID,MASK_TYPE_PSD_JXTC_PANGLU,
						MASK_TYPE_PSD_PCBPSBDPB_PANGLU_STATE,MASK_TYPE_PSD_PDB_FLASH_STATE,
						MASK_TYPE_PSD_VIDEO_QK_LU,MASK_TYPE_PSD_VIDEO_QK_HONG,MASK_TYPE_PSD_EXCEPT_OPEN,0U };
#else
	UINT8 MaskType[] = { 0u,MASK_TYPE_PSD_STATE_ATS,MASK_TYPE_MUTUALLOCK_STATE,MASK_TYPE_REMORA_STATE, MASK_TYPE_PSD_PCB,MASK_TYPE_PSD_POB,MASK_TYPE_PSD_PSB,MASK_TYPE_PSD_PCB_INVALID,MASK_TYPE_PSD_POB_INVALID,MASK_TYPE_PSD_PSB_INVALID,0 };
#endif

	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigDataNew(FSDataName, CI_ATS_MASK_TYPE, CI_ATS_PSD_MASK_ID, &pDataAddr, &DataSize, &realRow);	
	if (funcRtn == 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if (0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	if(0u != DataSize % realRow)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
		rowLen = (UINT16)(DataSize / realRow);
	}
	for (; DataSize > 0u; DataSize -= 2u)
	{
		residue = BuChang % (rowLen / 2u);
		if (0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);

			pDataLin = pDataAddr + rowLen - 2u;
			MaskRow = ShortFromChar(pDataLin);

			/*访问数组不能越界，越界直接返回失败*/
			if (MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

			pDataAddr += 2u;
			BuChang++;
		}
		else if ((residue > 0u) && (residue < rowLen / 2u - 1u))
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
			{
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PSD;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = MaskType[BuChang % ((UINT16)rowLen / 2U)];

				/*统计最大的有效码位*/
				if (ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
				{
					ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToAtsMaskCurSum[MaskRow]++;
			}

			pDataAddr += 2u;
			BuChang++;
		}
		else
		{
			pDataAddr += 2u;
			BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}

/*********************************************
*函数功能：CI-ATS紧急停车按钮码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSEsbMask(UINT8* FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr = NULL;
	UINT8* pDataLin = NULL;
	UINT32 DataSize = 0u;
	UINT16 MaskRow = 0u;
	UINT16 DeviceID = 0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 realRow = 0u;
	UINT16 rowLen = 0u;
	UINT16 i = 0U;
	UINT8 chBreakFlag = 0U;

	UINT8 MaskType[] = { 0u, MASK_TYPE_ESP_STATE, MASK_TYPE_ESS_STEADY_STATE, MASK_TYPE_ESP_FLASH_STATE, MASK_TYPE_CANCEL_ESP_FAULT, MASK_TYPE_ESP_FAULT, MASK_TYPE_CUT_ESP_FAULT, MASK_TYPE_ESP_PRESS_STATE, 0u };
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigDataNew(FSDataName, CI_ATS_MASK_TYPE, CI_ATS_ESB_MASK_ID, &pDataAddr, &DataSize, &realRow);
	if (funcRtn == 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if (0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	if (0u != DataSize % realRow)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
		rowLen = (UINT16)(DataSize / realRow);
	}
	for (; DataSize > 0U; DataSize -= 2u)
	{
		residue = BuChang % (rowLen / 2u);
		if (0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);

			pDataLin = pDataAddr + rowLen - 2u;
			MaskRow = ShortFromChar(pDataLin);

			/*访问数组不能越界，越界直接返回失败*/
			if (MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

			pDataAddr += 2u;
			BuChang++;
		}
		else if ((residue > 0u) && (residue < rowLen / 2u - 1u))
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
			{
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ESB;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = MaskType[BuChang % ((UINT16)rowLen / 2u)];

				/*对闪灯/稳灯码位是否配置标志进行设置*/
				for (i = 0U; i < dquCICfgDtStr.EsbCfgDtStrLen; i++)
				{
					chBreakFlag = 0U;
					if ((ESB_SUM_MAX > dquCICfgDtStr.EsbCfgDtStr[i].EsbId) && (dquCICfgDtStr.EsbCfgDtStr[i].EsbId == DeviceID))
					{
						if (MASK_TYPE_ESS_STEADY_STATE == ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
						{
							dquCICfgDtStr.EsbCfgDtStr[i].ConfigAtsCiEssSteadyMask = ESS_MASK_YES;
							chBreakFlag = 1U;

						}
						else if (MASK_TYPE_ESP_FLASH_STATE == ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
						{
							dquCICfgDtStr.EsbCfgDtStr[i].ConfigAtsCiEssFlashMask = ESS_MASK_YES;
							chBreakFlag = 1U;
						}
						else
						{
							/*不处理*/
							;
						}
					}
					if (1U == chBreakFlag)
					{
						break;
					}
				}

				/*统计最大的有效码位*/
				if (ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
				{
					ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			pDataAddr += 2u;
			BuChang++;
		}
		else
		{
			pDataAddr += 2u;
			BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}

/*********************************************
*函数功能：CI-ATS逻辑区段码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSLogSgmt(UINT8 * FSDataName)
{
	UINT8 funcRtn = CI_ERROR;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 rowCount = 0u;
	UINT8 rowLenth = 0u;/*行字节数*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_LOGICSECTION_CTOCCUPY,
		MASK_TYPE_LOGICSECTION_UTOCCUPY,
		MASK_TYPE_LOGICSECTION_LINSHIXIANSU_SET,
		MASK_TYPE_LOGICSECTION_ROUTELOCK,
		MASK_TYPE_LOGICSECTION_PROTECTLOCK,
		MASK_TYPE_LOGICSECTION_FAULTLOCK,
		MASK_TYPE_LOGICSECTION_JUMPLOCK,
		MASK_TYPE_UPWARD_DIRECTION,
		MASK_TYPE_DOWNWARD_DIRECTION,
		MASK_TYPE_LOGICSECTION_ARB,
		MASK_TYPE_LOGICSECTION_SPKS_FLOCK,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigDataNew(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_LOGIC_SGMT_MASK_ID,&pDataAddr,&DataSize,&rowCount);
	if(0u == funcRtn)
	{
		funcRtn = CI_ERROR;
	}
	else
	{
		funcRtn = CI_SUCCESS;
		if((0u < DataSize) && (0u < rowCount))
		{
			if(0u == DataSize % rowCount)
			{
				/*一行字节数*/
				rowLenth = (UINT8)(DataSize / rowCount);
				for(;DataSize>0u;DataSize-=2u)
				{
					residue = (UINT16)(BuChang%((UINT16)rowLenth/2U));
					if(0u == residue)
					{
						DeviceID = ShortFromChar(pDataAddr);

						pDataLin = pDataAddr + rowLenth -2u;
						MaskRow = ShortFromChar(pDataLin);

						/*访问数组不能越界，越界直接返回失败*/
						if(CI_SUM_MAX > MaskRow)
						{
							pDataAddr+=2u;
							BuChang++;
						}
						else
						{
							funcRtn = CI_ERROR;
							break;
						}
						
					}
					else if(residue < (UINT16)((rowLenth/2u)-1u))
					{
						/*获取码位ID*/
						tempMaskId = ShortFromChar(pDataAddr);

						if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
						{
							/*0和0xFFFF是无效的码位*/
							if ((CI_SUM_MAX > MaskRow) && (CI_TO_ATS_MASK_SUM_MAX > tempMaskId) && (0u < tempMaskId))/*检查是否为有效码位值*/
							{
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_LOGICSEC;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang % ((UINT16)rowLenth / 2u)]);


								/*统计最大的有效码位*/
								if (ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
								{
									ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
								}
								else
								{
									/*do nothing*/
								}

								ConfigCiToAtsMaskCurSum[MaskRow]++;
							}
							else
							{
								funcRtn = CI_ERROR;
								break;
							}
						}

						pDataAddr+=2u;
						BuChang++;
					}
					else
					{
						pDataAddr+=2u;
						BuChang++;
					}
				}
			}
			else
			{
				funcRtn = CI_ERROR;
			}
		}
		else
		{
			funcRtn = CI_SUCCESS;
		}
	}
	return funcRtn;
/**********************************************************************/
#if 0
	if(DataSize%CI_ATS_LOGIC_SGMT_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
    for(;DataSize>0u;DataSize-=2u)
	{
	    residue = BuChang%(CI_ATS_LOGIC_SGMT_MASK_LEN/2);
		if(0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
			
            pDataLin = pDataAddr + CI_ATS_LOGIC_SGMT_MASK_LEN -2u;
            MaskRow = ShortFromChar(pDataLin);

            /*访问数组不能越界，越界直接返回失败*/
            if(MaskRow >= CI_SUM_MAX)
            {
                funcRtn = 0u;
                return funcRtn;
            }
            
			pDataAddr+=2u;
			BuChang++;
		}
		else if((residue>0u)&&(residue < CI_ATS_LOGIC_SGMT_MASK_LEN/2-1))
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

            /*0和0xFFFF是无效的码位*/
            if((0xFFFF != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_LOGICSEC;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = MaskType[BuChang%(CI_ATS_LOGIC_SGMT_MASK_LEN/2u)];

                
                /*统计最大的有效码位*/
                if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
                {
                    ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToAtsMaskCurSum[MaskRow]++;
			}

            pDataAddr+=2u;
            BuChang++;
		}
		else
        {
            pDataAddr+=2u;
            BuChang++;
        }
	}
		funcRtn = 1u;
		return funcRtn;
#endif
}
/*********************************************
*函数功能：CI-ATS进路码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSRouteMask(UINT8* FSDataName)
{
	UINT8 funcRtn = CI_ERROR;
	UINT8* pDataAddr = NULL;
	UINT8* pDataLin = NULL;
	UINT32 DataSize = 0U;
	UINT16 MaskRow = 0U;
	UINT16 DeviceID = 0U;
	UINT16 residue = 0U;
	UINT16 tempMaskId = 0U; /*码位ID临时变量*/
	UINT16 realRowCount = 0U; /*实际表数据的行数*/
	UINT16 rowDataLen = 0U; /*一行数据的字节长度*/
	UINT8 MaskType[] = { 1U,MASK_TYPE_ROUTE_ALLLOCK,	MASK_TYPE_ROUTE_XUANPAI,	MASK_TYPE_ROUTE_DELAYUNLOCK,
		MASK_TYPE_ROUTE_EXISTENCE,	MASK_TYPE_ROUTE_NEARLOCK,	MASK_TYPE_ROUTE_YINDAOLOCK,
		MASK_TYPE_ROUTE_DC_QINGQIU,	MASK_TYPE_ROUTE_DC_AGREE, MASK_TYPE_ROUTE_AUTO_TRIGGER,MASK_TYPE_ROUTE_DC_AGREE_ERR,1U };
	UINT16 BuChang = 0U;

	funcRtn = dquGetConfigDataNew(FSDataName, CI_ATS_MASK_TYPE, CI_ATS_ROUTE_MASK_ID, &pDataAddr, &DataSize, &realRowCount);
	if (0U == funcRtn)
	{
		funcRtn = CI_ERROR;
	}
	else
	{
		funcRtn = CI_SUCCESS;
		if ((0U < DataSize) && (0U < realRowCount))
		{
			if (0U == DataSize % realRowCount)
			{
				rowDataLen = (UINT16)(DataSize / realRowCount);   /*计算一行数据的长度*/

				for (; DataSize > 0U; DataSize -= 2U)
				{
					residue = BuChang % (rowDataLen / 2U);
					if (0U == residue)
					{
						DeviceID = ShortFromChar(pDataAddr);
						pDataLin = pDataAddr + rowDataLen - 2U;
						MaskRow = ShortFromChar(pDataLin);

						/*访问数组不能越界，越界直接返回失败*/
						if (MaskRow < CI_SUM_MAX)
						{
							pDataAddr += 2U;
							BuChang++;
						}
						else
						{
							funcRtn = CI_ERROR;
							break;
						}
					}
					else if ((residue > 0U) && (residue < ((rowDataLen / 2U) - 1U)))
					{
						/*获取码位ID*/
						tempMaskId = ShortFromChar(pDataAddr);

						if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
						{
							/*0和0xFFFF是无效的码位*/
							if ((CI_SUM_MAX > MaskRow) && (CI_TO_ATS_MASK_SUM_MAX > tempMaskId) && (0U < tempMaskId))/*检查是否为有效码位值*/
							{
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ROUTE;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang % (rowDataLen / 2U)]);


								/*统计最大的有效码位*/
								if (ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
								{
									ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
								}
								else
								{
									/*do nothing*/
								}

								ConfigCiToAtsMaskCurSum[MaskRow]++;
							}
							else
							{
								funcRtn = CI_ERROR;
								break;
							}
						}
						else
						{


						}
						
						pDataAddr += 2U;
						BuChang++;
					}
					else
					{
						pDataAddr += 2U;
						BuChang++;
					}
				}
			}
			else
			{
				funcRtn = CI_ERROR;
			}
		}
		else
		{
			; 
		}
	}
	
	return funcRtn;
}
/*********************************************
*函数功能：CI-ATS自动折返进路码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSARRtMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_AUTORETURN_STATE, 1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_AR_ROUTE_MASK_ID,&pDataAddr,&DataSize);
	if(0u ==funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u !=DataSize%CI_ATS_AR_ROUTE_MASK_LEN )
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u ==DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}

    for(;DataSize>0u;DataSize-=2u)
	{
        residue = BuChang%(CI_ATS_AR_ROUTE_MASK_LEN/2u);
		if(0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
            pDataLin = pDataAddr + CI_ATS_AR_ROUTE_MASK_LEN - 2u;
            MaskRow = ShortFromChar(pDataLin);
            
            /*访问数组不能越界，越界直接返回失败*/
            if(CI_SUM_MAX <= MaskRow)
            {
                funcRtn = 0u;
                return funcRtn;
            }
			else
			{
			}
            
			pDataAddr+=2u;
			BuChang++;
		}
		else if(2u > residue)
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_AUTORETURN;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_AR_ROUTE_MASK_LEN/2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
                {
                    ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			else
			{
			}

            pDataAddr+=2u;
            BuChang++;
		}
        else
        {
            pDataAddr+=2u;
            BuChang++;
        }
	}
		funcRtn = 1u;
		return funcRtn;
}
/*********************************************
*函数功能：CI-ATS自动通过进路码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSARtMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_AUTOROUTE_STATE, 1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_AUTO_ROUTE_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ATS_AUTO_ROUTE_MASK_LEN)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}

   for(;DataSize>0u;DataSize-=2u)
	{   
        residue = BuChang%(CI_ATS_AUTO_ROUTE_MASK_LEN/2u);
		if(0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
            pDataLin = pDataAddr + CI_ATS_AUTO_ROUTE_MASK_LEN - 2u;
            MaskRow = ShortFromChar(pDataLin);

            /*访问数组不能越界，越界直接返回失败*/
            if(CI_SUM_MAX <= MaskRow)
            {
                funcRtn = 0u;
                return funcRtn;
            }
			else
			{
			}
            
			pDataAddr+=2u;
			BuChang++;
		}
		else if (2u > residue)
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_AUTOROUTE;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_AUTO_ROUTE_MASK_LEN/2U)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
                {
                    ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			else
			{
			}
            pDataAddr+=2u;
            BuChang++;
		}
        else
        {
            pDataAddr+=2u;
            BuChang++;
        }
	}
		funcRtn = 1u;
		return funcRtn;
}
/*********************************************
*函数功能：CI-ATS物理区段码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSPhySecMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[] = {
		1u,
		MASK_TYPE_PHYSECTION_STARTLOCK,
#if 0
		MASK_TYPE_PHYSECTION_ROUTELOCK_SHOW,
		MASK_TYPE_PHYSECTION_PROTECTLOCK,
		MASK_TYPE_PHYSECTION_FAULTLOCK,
		MASK_TYPE_AXISSECTION_ARB,
#endif

		MASK_TYPE_PHYSECTION_FLOCK,
#if 0
		MASK_TYPE_PHYSECTION_JUMPLOCK,
#endif
		MASK_TYPE_PHYSECTION_PRERESET,
		MASK_TYPE_PHYSECTION_UT_OCC,
		MASK_TYPE_PHYSEC_FLOCK_SPKS
	};

	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_PHYSEC_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u !=DataSize%CI_ATS_PHYSEC_MASK_LEN)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u ==DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}
    for(;DataSize>0u;DataSize-=CI_ATS_DATA_ELEMENT_LEN)
	{
        residue = BuChang%(CI_ATS_PHYSEC_MASK_LEN/CI_ATS_DATA_ELEMENT_LEN);
		if(0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
            pDataLin = pDataAddr + CI_ATS_PHYSEC_MASK_LEN - CI_ATS_DATA_ELEMENT_LEN;
            MaskRow = ShortFromChar(pDataLin);

            /*访问数组不能越界，越界直接返回失败*/
            if(CI_SUM_MAX <= MaskRow )
            {
                funcRtn = 0u;
                return funcRtn;
            }
			else
			{
			}

			pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;
			BuChang++;
		}
		else if(residue < ((CI_ATS_PHYSEC_MASK_LEN/CI_ATS_DATA_ELEMENT_LEN) - 1u))
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
	        
	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PHYSEC;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_PHYSEC_MASK_LEN/CI_ATS_DATA_ELEMENT_LEN)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
                {
                    ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			else
			{
			}

            pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;
            BuChang++;
		}
        else
        {
            pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;
            BuChang++;
        }
	}
		funcRtn = 1u;
		return funcRtn;
}
/*********************************************
*函数功能：CI-ATS SPKS开关状态码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSSPKSMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[]={0u,MASK_TYPE_SPKS_OPENSTATE,MASK_TYPE_SPKS_ISOLATE_BUTTON_STATE,0u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_SPKS_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ATS_SPKS_MASK_LEN )
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}

	for(;DataSize>0u;DataSize-=2u)
	{   
		residue = BuChang%(CI_ATS_SPKS_MASK_LEN/2u);
		if(0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ATS_SPKS_MASK_LEN - 2u;
			MaskRow = ShortFromChar(pDataLin);

			/*访问数组不能越界，越界直接返回失败*/
			if(CI_SUM_MAX <= MaskRow )
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{
			}

			pDataAddr+=2u;
			BuChang++;
		}
		else if (3u > residue)
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
			{
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SPKS;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_SPKS_MASK_LEN/2u)]);


				/*统计最大的有效码位*/
				if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
				{
					ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			else
			{
			}
			pDataAddr+=2u;
			BuChang++;
		}
		else
		{
			pDataAddr+=2u;
			BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}
/*********************************************
*函数功能：CI-ATS 洗车机就绪状态码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSWashM(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[]={0u,MASK_TYPE_WASHMACHINE_READYSTATE,MASK_TYPE_WASHMACHINE_WORKMODE,0u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_WASHMACHINE_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ATS_WASHMACHINE_MASK_LEN )
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}

	for(;DataSize>0u;DataSize-=2u)
	{   
		residue = BuChang%(CI_ATS_WASHMACHINE_MASK_LEN/2u);
		if(0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ATS_WASHMACHINE_MASK_LEN - 2u;
			MaskRow = ShortFromChar(pDataLin);

			/*访问数组不能越界，越界直接返回失败*/
			if(CI_SUM_MAX <= MaskRow)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{
			}

			pDataAddr+=2u;
			BuChang++;
		}
		else if(3u >residue)
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
			{
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_WASHMACHINE;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_WASHMACHINE_MASK_LEN/2U)]);


				/*统计最大的有效码位*/
				if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
				{
					ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			else
			{
			}
			pDataAddr+=2u;
			BuChang++;
		}
		else
		{
			pDataAddr+=2u;
			BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}

/*********************************************
*函数功能：CI-ATS 防淹门状态码位
*参数说明：FSDataName文件件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSFloodGate(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr = NULL;
	UINT8* pDataLin = NULL;
	UINT16 index =0u;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[] = {
		0u,
		MASK_TYPE_FD_OPENLOCK_TO_ATS,  /*开启锁定状态*/
		MASK_TYPE_FLOODGATE_CLOSEAPLAY_STATE, /*关门请求状态*/
		MASK_TYPE_FLOODGATE_AGREECLOSE_TOATS, /*同意关闭状态*/
		0u
	};
	UINT16 BuChang = 0u;

	if (NULL == FSDataName)
	{
		funcRtn = 0u;
	}
	
	else
	{
		funcRtn = 1u;
	}
	if (1u == funcRtn)
	{
		funcRtn = dquGetConfigData((CHAR*)FSDataName,CI_ATS_MASK_TYPE,CI_ATS_FLOODGATE_MASK_ID,&pDataAddr,&DataSize);
		if(0u == funcRtn)
		{
			funcRtn = 0u;
		}
		else
		{
			funcRtn = 1u;
		}
	}
	else
	{
	}

	if (1u == funcRtn)
	{
		if((DataSize%CI_ATS_FLOODGATE_MASK_LEN) != 0u)
		{
			funcRtn = 0u;
		}
		else
		{
		}
	}
	else
	{
	}
	
	if (1u == funcRtn)
	{
		for(;DataSize>0u;DataSize-=CI_ATS_DATA_ELEMENT_LEN)
		{   
			residue = BuChang%(CI_ATS_FLOODGATE_MASK_LEN/CI_ATS_DATA_ELEMENT_LEN);
			if(0u == residue)
			{
				DeviceID = ShortFromChar((UINT8*)(&pDataAddr[index]));
				/*pDataLin = pDataAddr + (CI_ATS_FLOODGATE_MASK_LEN - CI_ATS_DATA_ELEMENT_LEN);*/
				pDataLin = (UINT8*)(&pDataAddr[index + (CI_ATS_FLOODGATE_MASK_LEN - CI_ATS_DATA_ELEMENT_LEN)]);
				MaskRow = ShortFromChar(pDataLin);

				/*访问数组不能越界，越界直接返回失败*/
				if(CI_SUM_MAX <= MaskRow )
				{
					funcRtn = 0u;
					break;
				}
				else
				{
				}

				/*pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;*/
				index+=(UINT16)CI_ATS_DATA_ELEMENT_LEN;
				BuChang++;
			}
			else if (residue < (UINT16)((UINT16)(CI_ATS_FLOODGATE_MASK_LEN/2u) - 1u))
			{
				/*获取码位ID*/
				tempMaskId = ShortFromChar((UINT8*)(&pDataAddr[index]));

				/*0和0xFFFF是无效的码位*/
				if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
				{
					if ((MaskRow < CI_SUM_MAX) &&(tempMaskId <CI_TO_ATS_MASK_SUM_MAX ) )
					{
					
						ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
						ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_FLOODGATE;
						ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
						ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_FLOODGATE_MASK_LEN/CI_ATS_DATA_ELEMENT_LEN)]);


						/*统计最大的有效码位*/
						if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
						{
							ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
						}
						else
						{
							/*do nothing*/
						}

						ConfigCiToAtsMaskCurSum[MaskRow]++;
					}
					else
					{
					}
				}
				else
				{
				}
				/*pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;*/
				index+=(UINT16)CI_ATS_DATA_ELEMENT_LEN;
				BuChang++;
			}
			else
			{
				/*pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;*/
				index+=(UINT16)CI_ATS_DATA_ELEMENT_LEN;
				BuChang++;
			}
		}
	}

	return funcRtn;
}

/*********************************************
*函数功能：CI-ATS 车库门状态码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSGarageDoor(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[] = {
		0u,
		MASK_TYPE_GARAGEDOOR_OPEN_STATE,
		MASK_TYPE_GARAGEDOOR_CLOSE_STATE,
		MASK_TYPE_GARAGEDOOR_MODE_STATE,
		MASK_TYPE_GARAGEDOOR_FAULT_STATE,
		MASK_TYPE_GARAGEDOOR_PANGLU_STATE,
		0u};

	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_GARAGEDOOR_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ATS_GARAGEDOOR_MASK_LEN)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}

	for(;DataSize>0u;DataSize-=CI_ATS_DATA_ELEMENT_LEN)
	{   
		residue = BuChang%(CI_ATS_GARAGEDOOR_MASK_LEN/CI_ATS_DATA_ELEMENT_LEN);
		if(0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ATS_GARAGEDOOR_MASK_LEN - CI_ATS_DATA_ELEMENT_LEN;
			MaskRow = ShortFromChar(pDataLin);

			/*访问数组不能越界，越界直接返回失败*/
			if(CI_SUM_MAX <= MaskRow)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{
			}

			pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;
			BuChang++;
		}
		else if (residue < ((CI_ATS_GARAGEDOOR_MASK_LEN/2u) - 1u))
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
			{
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_GARAGEDOOR;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_GARAGEDOOR_MASK_LEN/CI_ATS_DATA_ELEMENT_LEN)]);


				/*统计最大的有效码位*/
				if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
				{
					ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			else
			{
			}
			pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;
			BuChang++;
		}
		else
		{
			pDataAddr+=CI_ATS_DATA_ELEMENT_LEN;
			BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}
/*****
******CI到ATS码位表解析完毕
********/

/*****
******CI到ZC码位表解析
********/
/*********************************************
*函数功能：CI-ZC道岔码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIZCSwitchMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_SWITCH_DINGWEI_LOGIC,MASK_TYPE_SWITCH_FANWEI_LOGIC,MASK_TYPE_SWITCH_LOCKSTATE,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_SWITCH_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ZC_SWITCH_MASK_LEN )
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize )
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}
	for(;DataSize>0u;DataSize-=2u)
	{
		BuChang = BuChang%(CI_ZC_SWITCH_MASK_LEN/2u);
		if(0u == BuChang)
		{
			DeviceID = ShortFromChar(pDataAddr);	
			pDataLin = pDataAddr + CI_ZC_SWITCH_MASK_LEN -2u;
			MaskRow = ShortFromChar(pDataLin);
			/*访问数组不能越界，越界直接返回失败*/
			if(CI_SUM_MAX <= MaskRow)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{
			}
		}
		
		/* 过滤所属联锁ID */
		else if (BuChang < ((CI_ZC_SWITCH_MASK_LEN/2u)-1u))
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
            
            /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SWITCH;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_SWITCH_MASK_LEN/2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
            }
			else
			{
			}        
		}
		else
		{
			/* 读取所属联锁ID:此段代码为方便调试时使用 */
			UINT16 tmpCiId = ShortFromChar(pDataAddr);
			if (MaskRow != tmpCiId)
			{
				/* 所属联锁ID配置错误时，返回错误 */
			}
		} 
		pDataAddr+=2u;
		BuChang++;
	}
	funcRtn = 1u;
	return funcRtn;
}
/* zt 删除单轨相关代码 2022-02-15 */
/*********************************************
*函数功能：CI-ZC信号机码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIZCSignalMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[] = { 1u,MASK_TYPE_SIGNAL_OPENSTATE,MASK_ZC_CI_TYPE_SIGNAL_OCCUPYED,MASK_TYPE_SIGNAL_LIGHTSTATE,MASK_ZC_CI_SIG_ENGINEERV_NEAR,MASK_CI_ZC_SIG_ENGINCROSS_STE,MASK_CI_ZC_SIGNAL_OCCUPYED_REC,1u };
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_SIGNAL_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_SIGNAL_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
    for(;DataSize>0u;DataSize-=2u)
    {
        if(BuChang%(CI_ZC_SIGNAL_MASK_LEN/2u) == 0u)
        {
            DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_SIGNAL_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

		}
		/*第3、4列是 zc-ci 码位 ,第五列是联锁ID,缺少验证 */
		else if ((1u != (BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2u)))
			&& (5u != (BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2u))) 
			&& (6u != (BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2u))))
		{
			pDataAddr += 2u;
			BuChang++;
		}
		else
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SIGNAL;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_SIGNAL_MASK_LEN/2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
			}

            pDataAddr+=2u;
            BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}
/*********************************************
*函数功能：ZC-CI信号机码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmZCCISignalMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 ii =0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	SignalConfigDataStruct *pSignalCconfigData = NULL;
    
	UINT8 MaskType[] = { 1u,MASK_TYPE_SIGNAL_OPENSTATE,MASK_ZC_CI_TYPE_SIGNAL_OCCUPYED,MASK_TYPE_SIGNAL_LIGHTSTATE,MASK_ZC_CI_SIG_ENGINEERV_NEAR,MASK_CI_ZC_SIG_ENGINCROSS_STE,MASK_CI_ZC_SIGNAL_OCCUPYED_REC,1u };
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_SIGNAL_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_SIGNAL_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
    for(;DataSize>0u;DataSize-=2u)
	{
		if(BuChang%(CI_ZC_SIGNAL_MASK_LEN/2u) == 0u)
		{
            DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_SIGNAL_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}
		}
		/*第二列是 ci-zc 码位 ,第五列是联锁ID，过滤 */
		else if ((1u == (BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2U))) || (5u == BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2U)) || (6u == BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2U)) || (7u == BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2U)))
		{
			pDataAddr += 2u;
			BuChang++;
		}
		/*第三、四列才是zc-ci码位*/
		else
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			pSignalCconfigData = NULL;


			/*0和0xFFFF是无效的码位*/
			if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
			{
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SIGNAL;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang % (CI_ZC_SIGNAL_MASK_LEN / 2u)]);

				for (ii = 0u; ii<dquCICfgDtStr.SgnlCfgDtStrLen; ii++)
				{
					/*访问数组不能越界，越界直接返回失败*/
					if (dquCICfgDtStr.SgnlCfgDtStr[ii].SignalId < SIGNAL_SUM_MAX)
					{
						if ((dquCICfgDtStr.SgnlCfgDtStr[ii].SignalId == DeviceID)
							&& (MASK_ZC_CI_TYPE_SIGNAL_OCCUPYED == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType))
						{
							pSignalCconfigData = &(dquCICfgDtStr.SgnlCfgDtStr[ii]);
							pSignalCconfigData->ConfigZcCiSignalCrossMask = SIGNAL_CONFIG_CROSS_MASK_YES;
							break;
						}

					}
				}

				/*统计最大的有效码位*/
				if (ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
				{
					ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigZcToCiMaskCurSum[MaskRow]++;
			}

			pDataAddr += 2u;
			BuChang++;
		}
	}

	funcRtn = 1u;
	return funcRtn;
}

/* zt 删除单轨相关代码 2022-02-15 */
/*********************************************
*函数功能：CI-ZC信号机码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIZCSignalMask2(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT8 MaskType[] = { 1u,MASK_TYPE_SIGNAL_OPENSTATE,MASK_ZC_CI_TYPE_SIGNAL_OCCUPYED,MASK_TYPE_SIGNAL_LIGHTSTATE,MASK_ZC_CI_SIG_ENGINEERV_NEAR,MASK_CI_ZC_SIG_ENGINCROSS_STE,MASK_CI_ZC_SIGNAL_OCCUPYED_REC,1u };
	UINT16 BuChang = 0u;
	UINT16 residue = 0u;
	UINT16 realRow = 0U;
	UINT16 rowLenth = 0U;
	funcRtn = dquGetConfigDataNew(FSDataName, CI_ZC_MASK_TYPE, CI_ZC_SIGNAL_MASK_ID, &pDataAddr, &DataSize, &realRow);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	if (DataSize%realRow != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
		rowLenth = (UINT16)(DataSize / realRow);
	}
    for(;DataSize>0u;DataSize-=2u)
    {
		residue = (BuChang % (rowLenth / 2u));
		if (0u == residue)
        {
            DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + rowLenth -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

		}
		/*第3、4、5列是 zc-ci 码位 ,第五列是联锁ID,缺少验证 */
		else if (((1u != residue)
			&& (5u != residue)
			&& (6u != residue))
				||(residue == (rowLenth / 2u-1u ))
			)
		{
			pDataAddr += 2u;
			BuChang++;
		}
		else
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SIGNAL;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(rowLenth /2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
			}

            pDataAddr+=2u;
            BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}

/*********************************************
*函数功能：ZC-CI信号机码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmZCCISignalMask2(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 ii =0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	SignalConfigDataStruct *pSignalCconfigData = NULL;
    
	UINT8 MaskType[] = { 1u,MASK_TYPE_SIGNAL_OPENSTATE,MASK_ZC_CI_TYPE_SIGNAL_OCCUPYED,MASK_TYPE_SIGNAL_LIGHTSTATE,MASK_ZC_CI_SIG_ENGINEERV_NEAR,MASK_CI_ZC_SIG_ENGINCROSS_STE,MASK_CI_ZC_SIGNAL_OCCUPYED_REC,1u };
	UINT16 BuChang = 0u;
	UINT16 realRow = 0U;
	UINT16 rowLenth = 0U;
	UINT16 residue = 0U;
	funcRtn = dquGetConfigDataNew(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_SIGNAL_MASK_ID,&pDataAddr,&DataSize, &realRow);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if (DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	if (0U != DataSize%realRow)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
		rowLenth = (UINT16)(DataSize / realRow);
	}
    for(;DataSize>0u;DataSize-=2u)
	{
		residue =BuChang % (rowLenth / 2u);
		if (0u == residue)
		{
            DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + rowLenth -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}
		}
		/*只计算3 4 5列 */
		else if ((2U != residue)&& (3u != residue)&& (4u != residue))
		{
			pDataAddr += 2u;
			BuChang++;
		}
		/*第三、四列、五才是zc-ci码位*/
		else
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
            
			pSignalCconfigData = NULL;
			

            /*0和0xFFFF是无效的码位*/	        
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SIGNAL;
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(rowLenth /2u)]);

				for(ii=0u;ii<dquCICfgDtStr.SgnlCfgDtStrLen;ii++)
				{
					/*访问数组不能越界，越界直接返回失败*/
					if(dquCICfgDtStr.SgnlCfgDtStr[ii].SignalId < SIGNAL_SUM_MAX)
					{
						if ((dquCICfgDtStr.SgnlCfgDtStr[ii].SignalId == DeviceID) 
							&&(MASK_ZC_CI_TYPE_SIGNAL_OCCUPYED == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType))
						{
							pSignalCconfigData = &(dquCICfgDtStr.SgnlCfgDtStr[ii]);
							pSignalCconfigData->ConfigZcCiSignalCrossMask = SIGNAL_CONFIG_CROSS_MASK_YES;
							break;
						}

					}
				}
				                
                /*统计最大的有效码位*/
                if(ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
                {                   
                    ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigZcToCiMaskCurSum[MaskRow]++;
            }

            pDataAddr+=2u;
            BuChang++;
		}
	}
	
    funcRtn = 1u;
    return funcRtn;
}
/*********************************************
*函数功能：CI-ZC屏蔽门码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIZCPsdMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[] = { 1u,MASK_TYPE_PSD_STATE,MASK_TYPE_PSD_EXCEPT_OPEN,1u };
	UINT16 BuChang = 0u;
	UINT16 wTempCount = 0U;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_PSD_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_PSD_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	for(;DataSize>0U;DataSize-=2u)
	{
		wTempCount = BuChang % (CI_ZC_PSD_MASK_LEN / 2U);
		if(0U == wTempCount)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_PSD_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

		}
		else if ((1U == wTempCount) || (2U == wTempCount))
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PSD;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_PSD_MASK_LEN/2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
			}

            pDataAddr+=2u;
            BuChang++;
		}
		else
		{
			/* 过滤所属联锁ID */
			pDataAddr+=2u;
			BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}

/*********************************************
*函数功能：CI-ZC紧急停车按钮码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIZCEsbMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_ESP_STATE,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_ESB_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_ESB_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	for(;DataSize>0U;DataSize-=2u)
	{
		if(BuChang%(CI_ZC_ESB_MASK_LEN/2u) == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_ESB_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}
		}
		else if(BuChang%(CI_ZC_ESB_MASK_LEN/2u) == 1u)
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ESB;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_ESB_MASK_LEN/2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
			}

            pDataAddr+=2u;
            BuChang++;
		}
		else
		{
			pDataAddr+=2u;
			BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}

/*********************************************
*函数功能：CI-ZC逻辑区段码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCI2ZCLogSgmt(UINT8 * FSDataName)
{
	UINT8 funcRtn = 1u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 dataSize = 0u;
	UINT16 maskRow=0u;
	UINT16 deviceID=0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	const UINT8 MaskType[]={1u,MASK_TYPE_LOGICSECTION_CTOCCUPY,MASK_TYPE_LOGICSECTION_UTOCCUPY,MASK_TYPE_LOGICSECTION_TXOCCUPY,MASK_TYPE_LOGICSECTION_LINSHIXIANSU_SET,
		MASK_TYPE_LOGICSECTION_LOCK,MASK_TYPE_LOGICSECTION_DIR_DOWN,MASK_TYPE_LOGICSECTION_DIR_UP,1u};
	UINT16 buChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_LOGIC_SGMT_MASK_ID,&pDataAddr,&dataSize);
	if (funcRtn == 1u)
	{
		if(dataSize > 0u)
		{
			if(dataSize%CI_ZC_LOGIC_SGMT_MASK_LEN != 0u)
			{
				funcRtn = 0u;	/* 数据总量不是一行数据的倍数，则说明数据不完整或者不一致 */
			}
		}
		else
		{
			funcRtn = 1u; /* 无数据 */
		}
		
	}
	else
	{
		funcRtn = 0u;	/* 处理失败 */
	}
	
	if ((funcRtn ==1u) && (dataSize > 0u))
	{
		for(;dataSize>0u;dataSize-=2u)
		{
			buChang = buChang%(CI_ZC_LOGIC_SGMT_MASK_LEN/2u);
			if(buChang == 0u)
			{
				deviceID = ShortFromChar(pDataAddr);
				pDataLin = pDataAddr + CI_ZC_LOGIC_SGMT_MASK_LEN -2u;
				maskRow = ShortFromChar(pDataLin);

				if (maskRow >= CI_SUM_MAX)
				{	/* 出错，查找失败*/
					funcRtn = 0u;
					break;
				}
			}
			else if( (4u<buChang) && (buChang < 8u))
			{	/* CI到ZC的码位是 5,6，7列*/
				/*获取码位ID*/
				tempMaskId = ShortFromChar(pDataAddr);

				/*0和0xFFFF是无效的码位*/	        
				if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
				{
					ConfigCiToZcMaskConfigDataStru[maskRow][tempMaskId].DeviceId = deviceID;
					ConfigCiToZcMaskConfigDataStru[maskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_LOGICSEC;
					ConfigCiToZcMaskConfigDataStru[maskRow][tempMaskId].MaskId = tempMaskId;
					ConfigCiToZcMaskConfigDataStru[maskRow][tempMaskId].MaskType = (UINT8)(MaskType[buChang%(CI_ZC_LOGIC_SGMT_MASK_LEN/2u)]);


					/*统计最大的有效码位*/
					if(ConfigCiToZcMaskConfigDataStru[maskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[maskRow])
					{                   
						ConfigCiToZcMaskIdMax[maskRow] = ConfigCiToZcMaskConfigDataStru[maskRow][tempMaskId].MaskId;
					}
					ConfigCiToZcMaskCurSum[maskRow]++;
				}			
			}
			else
			{
				/* 过滤所属联锁以及其他信息 */
			}
			pDataAddr+=2u;
			buChang++;
		}	
	}
	
	return funcRtn;
}

/*********************************************
*函数功能：ZC-CI逻辑区段码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmZCCILogSgmtMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_LOGICSECTION_CTOCCUPY,MASK_TYPE_LOGICSECTION_UTOCCUPY,MASK_TYPE_LOGICSECTION_TXOCCUPY,MASK_TYPE_LOGICSECTION_LINSHIXIANSU_SET,
						MASK_TYPE_LOGICSECTION_LOCK,MASK_TYPE_LOGICSECTION_DIR_DOWN,MASK_TYPE_LOGICSECTION_DIR_UP,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_LOGIC_SGMT_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ZC_LOGIC_SGMT_MASK_LEN)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}
    for(;DataSize>0u;DataSize-=2u)
	{
		BuChang = BuChang%(CI_ZC_LOGIC_SGMT_MASK_LEN/2u);
		if(0u == BuChang)
		{
			DeviceID = ShortFromChar(pDataAddr);	
			pDataLin = pDataAddr + CI_ZC_LOGIC_SGMT_MASK_LEN -2u;
			MaskRow = ShortFromChar(pDataLin);
			/*访问数组不能越界，越界直接返回失败*/
			if(CI_SUM_MAX <= MaskRow)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{
			}
		}
		
		else if (5u > BuChang )
		{	/* ZC到CI的码位是 1,2,3列*/
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
            
            /*0和0xFFFF是无效的码位*/	        
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_LOGICSEC;
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_LOGIC_SGMT_MASK_LEN/2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
                {                   
                    ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigZcToCiMaskCurSum[MaskRow]++;
            }
			else
			{
			}			
		}
		else
		{
			/* 过滤所属联锁 */
		}
		pDataAddr+=2u;
		BuChang++;
	}	
    funcRtn = 1u;
	return funcRtn;
}
/*********************************************
*函数功能：ZC-CI 进路码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmZC2CiRouteMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 1u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 dataSize = 0u;
	UINT16 maskRow=0u;
	UINT16 deviceID=0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	const UINT8 MaskType[]={1u,MASK_TYPE_ROUTE_LOCKSTATE,MASK_TYPE_ROUTE_STOPE_APPLY,MASK_TYPE_ROUTE_STOPENABLEE_STATUS,1u};
	UINT16 buChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_ROUTE_MASK_ID,&pDataAddr,&dataSize);
	if(funcRtn== 1u)
	{
		if (dataSize > 0u)
		{
			if(dataSize%CI_ZC_ROUTE_MASK_LEN != 0u)
			{	/* 数据不是一行数据整数倍，则认为数据存在问题 */
				funcRtn = 0u;		
				dataSize = 0u;
			}
		}
		else
		{
			/*无数据*/
			funcRtn = 1u;			
		}
	}
	else
	{
		funcRtn = 0u;
		dataSize = 0u;
	}
	
	for(;dataSize>0u;dataSize-=2u)
	{
		buChang = buChang%(CI_ZC_ROUTE_MASK_LEN/2u);
		if(buChang == 0u)
		{
			deviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_ROUTE_MASK_LEN -2u;
			maskRow = ShortFromChar(pDataLin);
			/*访问数组不能越界，越界直接返回失败*/
			if(maskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				break;
			}

		}
		else if(buChang == 3u)
		{/* 第3列 */			
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if((0xFFFFu != tempMaskId)&&(0U != tempMaskId))
			{
				ConfigZcToCiMaskConfigDataStru[maskRow][tempMaskId].DeviceId = deviceID;
				ConfigZcToCiMaskConfigDataStru[maskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ROUTE;
				ConfigZcToCiMaskConfigDataStru[maskRow][tempMaskId].MaskId = tempMaskId;
				ConfigZcToCiMaskConfigDataStru[maskRow][tempMaskId].MaskType = MaskType[buChang];


				/*统计最大的有效码位*/
				if(ConfigZcToCiMaskConfigDataStru[maskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[maskRow])
				{
					ConfigZcToCiMaskIdMax[maskRow] = ConfigZcToCiMaskConfigDataStru[maskRow][tempMaskId].MaskId;
				}

				ConfigZcToCiMaskCurSum[maskRow]++;
			}
		}
		else
		{
			/* 过滤 其余码位 */
		}
		pDataAddr+=2u;
		buChang++;
	}

	return funcRtn;
}
/*********************************************
*函数功能：CI-ZC进路码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCIZCRouteMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_ROUTE_LOCKSTATE,MASK_TYPE_ROUTE_STOPE_APPLY,MASK_TYPE_ROUTE_STOPENABLEE_STATUS,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_ROUTE_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ZC_ROUTE_MASK_LEN)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}
	for(;DataSize>0u;DataSize-=2u)
	{
		BuChang = BuChang%(CI_ZC_ROUTE_MASK_LEN/2u);
		if(0u == BuChang)
		{
            DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_ROUTE_MASK_LEN -2u;
			MaskRow = ShortFromChar(pDataLin);
			/*访问数组不能越界，越界直接返回失败*/
			if(CI_SUM_MAX <= MaskRow)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{	
			}

        }
        else if (3u > BuChang)
        {/* 第1,2列 */			
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ROUTE;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = MaskType[BuChang];

                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
			}
			else
			{
			}
		}
		else
		{
			/* 过滤 所属联锁ID */
		}
		pDataAddr+=2u;
		BuChang++;
	}
		funcRtn = 1u;
		return funcRtn;
}

/*********************************************
*函数功能：CI-ZC计轴区段码位 （物理区段）
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCIZCAxleSgmtMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 i =0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
	UINT16 axleId = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_OCCUPY,
		               MASK_TYPE_PHYSECTION_ROUTELOCK,MASK_TYPE_PHYSECTION_JUMPLOCK_ZC,MASK_TYPE_AXISSECTION_ARB,MASK_TYPE_LIECHE_STOPSTATE,
					   MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_JUMPLOCK_APPLY,
					   MASK_TYPE_PHYSECTION_JUMPLOCK_CANCEL,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_AXLE_SGMT_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_AXLE_SGMT_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
    for(;DataSize>0u;DataSize-=2u)
	{
		residue = BuChang%(CI_ZC_AXLE_SGMT_MASK_LEN/2u);

		if(BuChang%(CI_ZC_AXLE_SGMT_MASK_LEN/2u) == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			axleId = DeviceID;
			pDataLin = pDataAddr + CI_ZC_AXLE_SGMT_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			for(i=0u;i<dsuDataLenStru.wAxleSgmtLen;i++)
		   {
                if(dsuStaticHeadStru.pAxleSgmtStru[i].wId == DeviceID)
                {
					DeviceID = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;
#if 0
					/* 配置数据中以计轴区段配置，一个物理对应多个计轴区段 
					 * 如果前后两个为相同的物理区段，则直接跳过不进行读取 
					 */
					if(wPhysicId == dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId)
					{
						DataSize -= (CI_ZC_AXLE_SGMT_MASK_LEN-2);
						pDataAddr += (CI_ZC_AXLE_SGMT_MASK_LEN-2);
						BuChang --;
                    }
                    else
					{
                        wPhysicId = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;

					}
#endif
                    /*找到相应的CI_ID，可退出for循环*/
                    break;
				}
		   }
		}
		else if((0u < residue )&&( residue < 6u))
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PHYSEC;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_AXLE_SGMT_MASK_LEN/2u)]);

				if (MASK_TYPE_PHYSECTION_JUMPLOCK_ZC == ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
				{
					ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = axleId;/*跳跃锁闭用计轴区段id*/
				}
                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
			}

            pDataAddr+=2u;
            BuChang++;
			
		}
		else
		{
			pDataAddr+=2u;
			BuChang++;
		}
	}	
   funcRtn = 1u;
	return funcRtn;
}

/*********************************************
*函数功能：CI-ZC计轴区段码位 （物理区段）-面向数据结构28.0.0.14
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCIZCAxleSgmtMask2(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 i = 0u;
	UINT16 MaskRow = 0u;
	UINT16 DeviceID = 0u;
	UINT16 residue = 0u;
	UINT16 axleId = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[] = { 1u,MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_OCCUPY,
		MASK_TYPE_PHYSECTION_ROUTELOCK,MASK_TYPE_PHYSECTION_JUMPLOCK_ZC,MASK_TYPE_AXISSECTION_DETAIN_UP,MASK_TYPE_AXISSECTION_DETAIN_DOWN,
		MASK_TYPE_AXISSECTION_ARB,MASK_TYPE_LIECHE_STOPSTATE,
		MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_JUMPLOCK_APPLY,
		MASK_TYPE_PHYSECTION_JUMPLOCK_CANCEL,1u };
	UINT16 BuChang = 0u;
	UINT16 realRow = 0U;
	UINT16 rowLenth = 0U;
	funcRtn = dquGetConfigDataNew(FSDataName, CI_ZC_MASK_TYPE, CI_ZC_AXLE_SGMT_MASK_ID, &pDataAddr, &DataSize, &realRow);
	if (0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if (0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	if (0u != DataSize%realRow)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
		rowLenth = (UINT16)(DataSize / realRow);
	}
	for (; DataSize>0u; DataSize -= 2u)
	{
		residue = BuChang % (rowLenth / 2u);

		if (BuChang % (rowLenth / 2u) == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			axleId = DeviceID;
			pDataLin = pDataAddr + rowLenth - 2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr += 2u;
			/*访问数组不能越界，越界直接返回失败*/
			if (MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			for (i = 0u; i<dsuDataLenStru.wAxleSgmtLen; i++)
			{
				if (dsuStaticHeadStru.pAxleSgmtStru[i].wId == DeviceID)
				{
					DeviceID = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;
					/*找到相应的CI_ID，可退出for循环*/
					break;
				}
			}
		}
		else if ((0u < residue) && (residue < 8u))
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
			{
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PHYSEC;
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang % (rowLenth / 2u)]);

				if (MASK_TYPE_PHYSECTION_JUMPLOCK_ZC == ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
				{
					ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = axleId;/*跳跃锁闭用计轴区段id*/
				}

				/*统计最大的有效码位*/
				if (ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
				{
					ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToZcMaskCurSum[MaskRow]++;
			}

			pDataAddr += 2u;
			BuChang++;

		}
		else
		{
			pDataAddr += 2u;
			BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}

/*********************************************
*函数功能：ZC-CI计轴区段码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmZCCIAxleSgmtMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 i =0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT16 wPhysicId = 0u;
	UINT8 MaskType[]={1u,MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_OCCUPY,
		MASK_TYPE_PHYSECTION_ROUTELOCK,MASK_TYPE_PHYSECTION_JUMPLOCK_ZC,MASK_TYPE_AXISSECTION_ARB,MASK_TYPE_LIECHE_STOPSTATE,
		MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_JUMPLOCK_APPLY,
		MASK_TYPE_PHYSECTION_JUMPLOCK_CANCEL,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_AXLE_SGMT_MASK_ID,&pDataAddr,&DataSize);
	if(0U == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_AXLE_SGMT_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
    for(;DataSize>0u;DataSize-=2u)
	{
		residue = BuChang%(CI_ZC_AXLE_SGMT_MASK_LEN/2u);

		if(residue == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_AXLE_SGMT_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

			for(i=0u;i<dsuDataLenStru.wAxleSgmtLen;i++)
			{
			   if(dsuStaticHeadStru.pAxleSgmtStru[i].wId == DeviceID)
				{
					DeviceID = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;

					/* 配置数据中以计轴区段配置，一个物理对应多个计轴区段 
					* 如果前后两个为相同的物理区段，则直接跳过不进行读取 
					*/
#if 0
                    if(wPhysicId == dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId)
					{						
						DataSize -= (CI_ZC_AXLE_SGMT_MASK_LEN-2u);
						pDataAddr += (CI_ZC_AXLE_SGMT_MASK_LEN-2u);
						BuChang --;
                    }
                    else
					{
						wPhysicId = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;
						MaskRow = dsuStaticHeadStru.pLinkStru [dsuLinkIndex[dsuStaticHeadStru.pAxleSgmtStru[i].wOrgnLkId]].wManagePhysicalCI;
                    }
#endif
					/*配置数据中以计轴区段配置，一个物理对应多个计轴区段,
					如果前后两个为相同的物理区段,但前面计轴区段码位无效时，后面计轴区段码位要进行初始化，这样处理如果
					前后计轴区段都有效（码位相同），则后面覆盖前面，不会出现逻辑错误*/
					wPhysicId = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;
					
                   /*找到相应的CI_ID，可退出for循环*/
                    break;
				}
		   }

			if(i == dsuDataLenStru.wAxleSgmtLen)
			{
				/* 没有找到，则直接退出 */
				funcRtn = 0u;
				return funcRtn;
			}
		}
		else if((6u <= residue)&&(residue <((CI_ZC_AXLE_SGMT_MASK_LEN/2u)-1u)))
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/	        
			if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
			{
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PHYSEC;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_AXLE_SGMT_MASK_LEN/2u)]);
				/*如果码位类型为跳跃锁闭申请，则设备ID设置为计轴区段ID，因为设置跳跃锁闭需要检查道岔状态*/
				if( (MASK_TYPE_PHYSECTION_JUMPLOCK_APPLY == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
					|| (MASK_TYPE_PHYSECTION_JUMPLOCK_CANCEL == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
					|| (MASK_TYPE_AXISSECTION_ARB == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType))
				{
					ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = dsuStaticHeadStru.pAxleSgmtStru[i].wId;
				}
				/*统计最大的有效码位*/
				if(ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
				{                   
					ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigZcToCiMaskCurSum[MaskRow]++;
			}
			pDataAddr+=2u;
			BuChang++;
		}
		else		  
        {
			/* 过滤其他的 */
            pDataAddr+=2u;
            BuChang++;
        }
	}	

    funcRtn = 1u;
	return funcRtn;

}

/*********************************************
*函数功能：CI-ZC保护区段码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCIZCOverLapMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_OVERLAP_LOCKSTATE,MASK_TYPE_OVERLAP_UNLOCK_APPLY,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_OVER_LAP_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if(0u != DataSize%CI_ZC_OVER_LAP_MASK_LEN)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}
	if(0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	else
	{
	}
	for(;DataSize>0u;DataSize-=2u)
	{
		BuChang = BuChang%(CI_ZC_OVER_LAP_MASK_LEN/2u);
		if(0u == BuChang)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_OVER_LAP_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{
			}
		}
		else if (3u > BuChang)
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_OVERLAP;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_OVER_LAP_MASK_LEN/2u)]);

                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                    ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
			}
			else
			{
			}

            pDataAddr+=2u;
            BuChang++;
		}
		else
		{
			pDataAddr+=2u;
			BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}
/*********************************************
*函数功能：CI-ZC无人折返码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCIZCReturnMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 i =0u;
	UINT16 j=0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[]={1u,MASK_TYPE_PLAT_AUTORETURNSIG_FLASH,MASK_TYPE_PLAT_AUTORETURNSIG_STEADY,MASK_TYPE_PLAT_AUTORETURNSIG_BUTTONSTAT,1u};
	UINT16 BuChang = 0u;
	UINT8 findFlag = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_RETURN_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_RETURN_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}

	for(;DataSize>0u;DataSize-=2u)
	{
		residue = BuChang%(CI_ZC_RETURN_MASK_LEN/2u);

		if(residue == 0u)
		{
			pDataLin = pDataAddr;                         /*保留变量pDataLin*/
			DeviceID = ShortFromChar(pDataLin);
			pDataLin = pDataAddr + CI_ZC_RETURN_MASK_LEN -2u;
			MaskRow = ShortFromChar(pDataLin);
			BuChang++;
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			findFlag = 0u;/*初始化找到标志*/
			for(i=0u;i<RelayDataLen.RelayNoRtnStruLen;i++)
			{
				if(RelayData.pRelayNoRtnStru[i].wId == DeviceID)
				{
					for(j=0u;j<RelayDataLen.RelayBjdStrLen;j++)
					{
						if(RelayData.pRelayBjdStr[j].wId == RelayData.pRelayNoRtnStru[i].wWuRenReturnRelayId)
						{
							
							DeviceID = RelayData.pRelayBjdStr[j].wId;/*换成全线不重复的表示报警灯继电器表行ID*/
							
							findFlag =1u;/*设置找到标志*/
							/*找到相应的CI_ID，可退出for循环*/
							break;
						}
					}

					/*找到相应的CI_ID，可退出for循环*/
					break;
				}
			}

			if(0u == findFlag)
			{
				DeviceID = 0u;/*若在无人折返表中未找到该无人折返ID，则置0.*/
			}
		}
		else if(BuChang%(CI_ZC_RETURN_MASK_LEN/2u) != 3u)
		{
			pDataAddr+=2u;
			BuChang++;
		}
		else
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
			{
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PLATFORM;
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_RETURN_MASK_LEN/2u)]);

				/*统计最大的有效码位*/
				if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
				{
					ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToZcMaskCurSum[MaskRow]++;
			}

			pDataAddr+=2u;
			BuChang++;

		}
	}	
	funcRtn = 1u;
	return funcRtn;
}

/********************************* ************
*函数功能：ZC-CI无人折返码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmZCCIRtnMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 i =0u;
	UINT16 j = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT8 findFlag = 0u;
    
	UINT8 MaskType[]={1u,MASK_TYPE_PLAT_AUTORETURNSIG_FLASH,MASK_TYPE_PLAT_AUTORETURNSIG_STEADY,MASK_TYPE_PLAT_AUTORETURNSIG_BUTTONSTAT,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_RETURN_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_ZC_RETURN_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}

     for(;DataSize>0u;DataSize-=2u)
	 {
		 residue = BuChang%(CI_ZC_RETURN_MASK_LEN/2u);

		 if(residue == 0u)
		 {
			 pDataLin = pDataAddr;                          /*保留变量pDataLin*/
			 DeviceID = ShortFromChar(pDataLin);
			 pDataLin = pDataAddr + CI_ZC_RETURN_MASK_LEN -2u;
			 BuChang++;
			 MaskRow = ShortFromChar(pDataLin);
			 pDataAddr+=2u;
			 /*访问数组不能越界，越界直接返回失败*/
			 if(MaskRow >= CI_SUM_MAX)
			 {
				 funcRtn = 0u;
				 return funcRtn;
			 }
			 findFlag = 0u;
			 for(i=0u;i<RelayDataLen.RelayNoRtnStruLen;i++)
			 {
				 if(RelayData.pRelayNoRtnStru[i].wId == DeviceID)
				 {
					 for(j=0u;j<RelayDataLen.RelayBjdStrLen;j++)
					 {
						 if (RelayData.pRelayBjdStr[j].wId == RelayData.pRelayNoRtnStru[i].wWuRenReturnRelayId)
						 {

							 DeviceID = RelayData.pRelayBjdStr[j].wId;/*换成全线不重复的表示报警灯继电器表行ID*/

							 findFlag = 1u;/*设置找到标志*/
							  /*找到相应的CI_ID，可退出for循环*/
							 break;
						 }
					 }

					 /*找到相应的CI_ID，可退出for循环*/
					 break;
				 }

			 }
			 if(0u == findFlag)
			 {
				 DeviceID = 0u;/*若在无人折返表中未找到该无人折返ID，则置0.*/
			 }
		 }
		 else if((residue >= 3u) && (residue <(CI_ZC_RETURN_MASK_LEN/2u)))
		 {
			 pDataAddr+=2u;
			 BuChang++;
		 }
		 else
		 {
			 /*获取码位ID*/
			 tempMaskId = ShortFromChar(pDataAddr);

			 /*0和0xFFFF是无效的码位*/	        
			 if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
			 {
				 ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				 ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PLATFORM;
				 ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				 ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_RETURN_MASK_LEN/2u)]);

				 /*统计最大的有效码位*/
				 if(ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
				 {                   
					 ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				 }
				 else
				 {
					 /*do nothing*/
				 }

				 ConfigZcToCiMaskCurSum[MaskRow]++;
			 }

			 pDataAddr+=2u;
			 BuChang++;

		 }
	 }
	 funcRtn = 1u;
	 return funcRtn;
}

/*********************************************
*函数功能：ZC-CI往复进路码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8 MaskCfgStruFrmCIZCComeGoMask(UINT8 * FSDataName)
{
    UINT8 funcRtn = 0u;
    UINT8* pDataAddr,*pDataLin;
    UINT32 DataSize = 0;
    
    UINT16 MaskRow = 0xff;
    UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    UINT8 MaskType[]={1u, MASK_TYPE_ROUTE_LOCKSTATE,1u};
    UINT16 BuChang = 0u;

    funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_COMEGO_MASK_ID,&pDataAddr,&DataSize);
    
    if(0u == funcRtn)
    {
        return funcRtn;
    }
        
    if(0u != DataSize%CI_ZC_COMEGO_ROUTE_MASK_LEN)
    {
        funcRtn = 0u;
        return funcRtn;
    }
    
    if(0u == DataSize)
    {
        /*无数据*/
        funcRtn = 1u;
        return funcRtn;
    }
    
    for(;DataSize>0u;DataSize-=2u)
    {
        if(0u == BuChang%(CI_ZC_COMEGO_ROUTE_MASK_LEN/2u))
        {
            DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_ZC_COMEGO_ROUTE_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;

            /*访问数组不能越界，越界直接返回失败*/
            if((MaskRow >= CI_SUM_MAX) ||(DeviceID > COMEGOINDEXNUM))
            {
                funcRtn = 0u;
                return funcRtn;
            }

        }
        else if ((BuChang%(CI_ZC_COMEGO_ROUTE_MASK_LEN/2u)) == 1u )
        {
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
            
            /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ROUTE;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_COMEGO_ROUTE_MASK_LEN/2u)]);
                
                /*统计最大的有效码位*/
                if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
                {
                     ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToZcMaskCurSum[MaskRow]++;
            }
            pDataAddr += 2u;
            BuChang++;
        }
		else
		{
			pDataAddr += 2u;
			BuChang++;
		}
    }
    
    funcRtn = 1u;
    return funcRtn;
}

/*****
******完毕
********/
/*********************************************
*函数功能：CI到LEU码位表解析
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCILEUSwitchMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,1u,MASK_TYPE_SWITCH_DINGWEI_LOGIC,MASK_TYPE_SWITCH_FANWEI_LOGIC};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_LEU_MASK_TYPE,CI_LEU_SWITCH_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_LEU_SWITCH_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	for(;DataSize>0u;DataSize-=2u)
	{
		if(BuChang%(CI_LEU_SWITCH_MASK_LEN/2u) == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataAddr+=2u;
			BuChang++;

            #if 1
            MaskRow = ShortFromChar(pDataAddr);
            /*访问数组不能越界，越界直接返回失败*/
            if(MaskRow >= CI_SUM_MAX)
            {
                funcRtn = 0u;
                return funcRtn;
            }

            #else
            for(i=0;i<dsuDataLenStru.wPointLen;i++)
            {
				if(dquCICfgDtStr.SwchCfgDtStr[i].SwitchId == DeviceID)
				{
					MaskRow = dquCICfgDtStr.SwchCfgDtStr[i].BelongCiId;

                    /*访问数组不能越界，越界直接返回失败*/
                    if(MaskRow >= CI_SUM_MAX)
                    {
                        funcRtn = 0u;
                        return funcRtn;
                    }

                    /*找到相应的CI_ID，可退出for循环*/
                    break;
				}
            }
            #endif
        }
        else if(1u == BuChang%(CI_LEU_SWITCH_MASK_LEN/2u))
        {
            pDataAddr+=2u;
            BuChang++;
        }
		else
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
	        
	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SWITCH;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_LEU_SWITCH_MASK_LEN/2u)]);
                
                /*统计最大的有效码位*/
                if(ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToLeuMaskIdMax[MaskRow])
                {
                    ConfigCiToLeuMaskIdMax[MaskRow] = ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToLeuMaskCurSum[MaskRow]++;
            }

            pDataAddr+=2u;
            BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}

/* zt 删除单轨相关代码 2022-02-15 */

/*********************************************
*函数功能：CI-LEU屏蔽门码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCILEUPsdMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,1u,MASK_TYPE_PSD_STATE};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_LEU_MASK_TYPE,CI_LEU_PSD_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if(DataSize%CI_LEU_PSD_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
    for(;DataSize>0u;DataSize-=2u)
	{
		if(BuChang%(CI_LEU_PSD_MASK_LEN/2u) == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataAddr+=2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataAddr);
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

		}
		else if(BuChang%(CI_LEU_PSD_MASK_LEN/2u) == 2u)
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
            
            /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PSD;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_LEU_PSD_MASK_LEN/2u)]);
                
                /*统计最大的有效码位*/
                if(ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToLeuMaskIdMax[MaskRow])
                {
                    ConfigCiToLeuMaskIdMax[MaskRow] = ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToLeuMaskCurSum[MaskRow]++;
            }

            pDataAddr+=2u;
            BuChang++;
		}
		else
		{
			pDataAddr+=2u;
			BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}
/*********************************************
*函数功能：CI-LEU进路码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCILEURouteMask(UINT8 * FSDataName)

{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,MASK_TYPE_ROUTE_SIGNAL_STATE,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_LEU_MASK_TYPE,CI_LEU_ROUTE_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}

	if((DataSize%CI_LEU_ROUTE_MASK_LEN) != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	for(;DataSize>0u;DataSize-=2u)
	{
		if(BuChang%(CI_LEU_ROUTE_MASK_LEN/2u) == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + CI_LEU_ROUTE_MASK_LEN -2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr+=2u;
			/*访问数组不能越界，越界直接返回失败*/
			if(MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

		}
		else if((BuChang%(CI_LEU_ROUTE_MASK_LEN/2u)) == 1u)
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);

	        /*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ROUTE;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_LEU_ROUTE_MASK_LEN/2u)]);
                
                /*统计最大的有效码位*/
                if(ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToLeuMaskIdMax[MaskRow])
                {
                    ConfigCiToLeuMaskIdMax[MaskRow] = ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToLeuMaskCurSum[MaskRow]++;
            }

            pDataAddr+=2u;
            BuChang++;
		}
		else
		{
			pDataAddr+=2u;
			BuChang++;
		}
	}
		funcRtn = 1u;
		return funcRtn;
}
/*********************************************
*函数功能：CI-LEU保护区段码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCILEUOverLapMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,1u,MASK_TYPE_OVERLAP_LOCKSTATE};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_LEU_MASK_TYPE,CI_LEU_OVER_LAP_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		return funcRtn;
	}
	
	if(DataSize%CI_LEU_OVER_LAP_MASK_LEN != 0u)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if(DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	for(;DataSize>0u;DataSize-=2u)
	{
		if(BuChang%(CI_LEU_OVER_LAP_MASK_LEN/2u) == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataAddr+=2u;
			BuChang++;
			
#if 1
            MaskRow = ShortFromChar(pDataAddr);
            /*访问数组不能越界，越界直接返回失败*/
            if(MaskRow >= CI_SUM_MAX)
            {
                funcRtn = 0u;
                return funcRtn;
            }
			
#else
			for(i=0u;i<dsuDataLenStru.wProtectLinkLen;i++)
            {
				if(dquCICfgDtStr.OvlapCfgDtStr[i].OverlapId == DeviceID)
				{
					MaskRow = dquCICfgDtStr.OvlapCfgDtStr[i].BelongCiId;
					
                    /*访问数组不能越界，越界直接返回失败*/
                    if(MaskRow >= CI_SUM_MAX)
                    {
                        funcRtn = 0u;
                        return funcRtn;
                    }
					
                    /*找到相应的CI_ID，可退出for循环*/
                    break;
				}
            }
#endif
		}
		else if(1u == BuChang%(CI_LEU_OVER_LAP_MASK_LEN/2u))
        {
            pDataAddr+=2u;
            BuChang++;
        }
		else
		{
            /*获取码位ID*/
            tempMaskId = ShortFromChar(pDataAddr);
			
			/*0和0xFFFF是无效的码位*/
            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
            {
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_OVERLAP;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_LEU_OVER_LAP_MASK_LEN/2u)]);
                
                /*统计最大的有效码位*/
                if(ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToLeuMaskIdMax[MaskRow])
                {
                    ConfigCiToLeuMaskIdMax[MaskRow] = ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
                }
                else
                {
                    /*do nothing*/
                }
                
                ConfigCiToLeuMaskCurSum[MaskRow]++;
            }
			
            pDataAddr+=2u;
            BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}


/*********************************************
*函数功能：CI-LEU信号机码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8 MaskCfgStruFrmCILEUSignalMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={1u,1u,MASK_TYPE_SIGNAL_LINSHIXIANSU_SET};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_LEU_MASK_TYPE,CI_LEU_SIGNAL_MASK_ID,&pDataAddr,&DataSize);
	if(0u != funcRtn)
	{
		if(0u == (DataSize % CI_LEU_SIGNAL_MASK_LEN))
		{
			if(0u != DataSize)
			{
				for(;DataSize > 0u;DataSize -= 2u)
				{
					if(0u == BuChang%(CI_LEU_SIGNAL_MASK_LEN/2u))
					{
						DeviceID = ShortFromChar(pDataAddr);
						pDataAddr+=2u;
						BuChang++;


					}
					else if(1u == BuChang%(CI_LEU_SIGNAL_MASK_LEN/2u))
					{
						#if 1
			            MaskRow = ShortFromChar(pDataAddr);
						pDataAddr+=2u;
						BuChang++;
			            /*访问数组不能越界，越界直接返回失败*/
			            if(MaskRow >= CI_SUM_MAX)
			            {
							break;
			            }

			            #else
						for(i=0u;i<dsuDataLenStru.wProtectLinkLen;i++)
			            {
						   if(dquCICfgDtStr.OvlapCfgDtStr[i].OverlapId == DeviceID)
							{
								MaskRow = dquCICfgDtStr.OvlapCfgDtStr[i].BelongCiId;

			                    /*访问数组不能越界，越界直接返回失败*/
			                    if(MaskRow >= CI_SUM_MAX)
			                    {
			                        funcRtn = 0u;
			                        return funcRtn;
			                    }

			                    /*找到相应的CI_ID，可退出for循环*/
			                    break;
							}
			            }
						DataSize += 2u;
			            #endif
					}
					else
					{
			            /*获取码位ID*/
			            tempMaskId = ShortFromChar(pDataAddr);

				        /*0和0xFFFF是无效的码位*/
			            if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
			            {
			                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
			                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SIGNAL;
			                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
			                ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_LEU_SIGNAL_MASK_LEN/2u)]);
			                
			                /*统计最大的有效码位*/
			                if(ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToLeuMaskIdMax[MaskRow])
			                {
			                    ConfigCiToLeuMaskIdMax[MaskRow] = ConfigCiToLeuMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
			                }
			                else
			                {
			                    /*do nothing*/
			                }
			                
			                ConfigCiToLeuMaskCurSum[MaskRow]++;
			            }

			            pDataAddr+=2u;
			            BuChang++;
					}
				}
				if(DataSize <= 0u)
				{
					funcRtn = 1u;
				}
				else
				{
					funcRtn = 0u;
				}
			}
			else
			{
				/*无数据*/
				funcRtn = 1u;				
			}
		}
		else
		{
			/*数据长度不符合*/
			funcRtn = 0u;
		}
	}
	else
	{
		funcRtn = 0u;
	}

	return funcRtn;	
}

/*********************************************
*函数功能：初始化码位
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8 MaskInit(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8 ciPattern = 0U;
	UINT16 i = 0U;
	UINT8 chPulicData = GetLocalPublicDataType();
	/*****
	******CI到ATS码位表解析
	********/
	/*CI-ATS道岔码位*/
	if (DATA_TYPE_NEW == chPulicData)
	{
		/*CI-ATS道岔码位*/
		funcRtn = MaskCfgDtStruFrmCIATSSwitchMask(FSDataName);
		/*CI-ATS物理区段码位*/
		funcRtn *= MaskCfgDtStruFrmCIATSPhySecMask(FSDataName);
	}
	else
	{
		/*CI-ATS道岔码位*/
		funcRtn = MaskCfgDtStruFrmCIATSSwitchMask2(FSDataName);
		/*CI-ATS物理区段码位*/
		funcRtn *= MaskCfgDtStruFrmCIATSPhySecMask2(FSDataName);
	}
	/*CI-ATS信号机码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSSignalMask(FSDataName);
	/*CI-ATS屏蔽门码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSPsdMask( FSDataName);
	/*CI-ATS紧急停车按钮码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSEsbMask( FSDataName);
	/*CI-ATS逻辑区段码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSLogSgmt( FSDataName);
	/*CI-ATS进路码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSRouteMask( FSDataName);
	/*ci-ats自动折返码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSARRtMask(FSDataName);
	/*CI-ATS自动通过进路码位*/
    funcRtn *= MaskCfgDtStruFrmCIATSARtMask(FSDataName);
	/*ci-ats全自动折返码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSAARRtMask(FSDataName);
	
	/*CI-ATS SPKS开关码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSSPKSMask(FSDataName);
	
	/*CI-ATS 洗车机码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSWashM(FSDataName);
	
	/*CI-ATS 车库门码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSGarageDoor(FSDataName);
	
	/*CI-ATS 防淹门码位*/
	funcRtn *= MaskCfgDtStruFrmCIATSFloodGate(FSDataName);

	/* zt 删除单轨相关代码 2022-02-15 */

	/*****
	******CI到ATS码位表解析完毕
	********/


	/*****
	******CI到ZC码位表解析  （删除表）
	********/
	ciPattern = GetLocalRcWorkMode();
	if(RC_WORK_MODE_CI == ciPattern)
	{
		/*CI-ZC道岔码位*/
		funcRtn *= MaskCfgDtStruFrmCIZCSwitchMask( FSDataName);
		if (DATA_TYPE_NEW == chPulicData)
		{
			/*CI-ZC信号机码位*/
			funcRtn *= MaskCfgDtStruFrmCIZCSignalMask(FSDataName);
			/*ZC-CI信号机码位*/
			funcRtn *= MaskCfgDtStruFrmZCCISignalMask(FSDataName);
			/*CI-ZC计轴区段码位*/
			funcRtn *= MaskCfgStruFrmCIZCAxleSgmtMask(FSDataName);
			/*ZC-CI计轴区段码位*/
			funcRtn *= MaskCfgStruFrmZCCIAxleSgmtMask(FSDataName);
		}
		else
		{
			/*CI-ZC信号机码位*/
			funcRtn *= MaskCfgDtStruFrmCIZCSignalMask2(FSDataName);
			/*ZC-CI信号机码位*/
			funcRtn *= MaskCfgDtStruFrmZCCISignalMask2(FSDataName);
			/*CI-ZC计轴区段码位*/
			funcRtn *= MaskCfgStruFrmCIZCAxleSgmtMask2(FSDataName);
			/*ZC-CI计轴区段码位*/
			funcRtn *= MaskCfgStruFrmZCCIAxleSgmtMask2(FSDataName);
		}
		/*CI-ZC屏蔽门码位*/
		funcRtn *= MaskCfgDtStruFrmCIZCPsdMask( FSDataName);
		/*CI-ZC紧急停车按钮码位*/
		funcRtn *= MaskCfgDtStruFrmCIZCEsbMask( FSDataName);
		/*ZC-CI逻辑区段码位*/
		funcRtn *= MaskCfgStruFrmZCCILogSgmtMask( FSDataName);
		/*CI-ZC逻辑区段码位*/
		funcRtn *= MaskCfgDtStruFrmCI2ZCLogSgmt(FSDataName);
		/*CI-ZC进路码位*/
		funcRtn *= MaskCfgStruFrmCIZCRouteMask( FSDataName);
		funcRtn *= MaskCfgDtStruFrmZC2CiRouteMask(FSDataName);
		/*CI-ZC保护区段码位*/
		funcRtn *= MaskCfgStruFrmCIZCOverLapMask( FSDataName);
		/*CI-ZC无人折返码位*/
		funcRtn *= MaskCfgStruFrmCIZCReturnMask( FSDataName);
		/*ZC-CI无人折返码位*/
		funcRtn *= MaskCfgStruFrmZCCIRtnMask(FSDataName);
		/*CI_ZC往复进路码位*/
		funcRtn *= MaskCfgStruFrmCIZCComeGoMask(FSDataName);
		/*CI-ZC车库门码位*/
		funcRtn *= MaskCfgStruFrmCIZCGaragedoor( FSDataName);
		/*ZC-CI车库门码位*/
		funcRtn *= MaskCfgStruFrmZCCIGaragedoor( FSDataName);
		/*CI-ZC SPKS开关码位*/
		funcRtn *= MaskCfgDtStruFrmCIZCSPKSMask(FSDataName);
		/*CI-ZC 防淹门状态码位*/
		funcRtn *= MaskCfgStruFrmCIZCFloodGateMask(FSDataName);
	/*****
	******CI到ZC码位表解析完毕
	********/

	
	}

	/*****
	******CI到LEU码位表解析
	********/
	/*CI-LEU道岔码位*/
	funcRtn *= MaskCfgStruFrmCILEUSwitchMask(FSDataName);
	/* zt 删除单轨相关代码 2022-02-15 */
	/*CI-LEU屏蔽门码位*/
	funcRtn *= MaskCfgDtStruFrmCILEUPsdMask(FSDataName);
	/*CI-LEU进路码位*/
	funcRtn *= MaskCfgDtStruFrmCILEURouteMask(FSDataName);
	/*CI-LEU保护区段码位*/
	funcRtn *= MaskCfgStruFrmCILEUOverLapMask(FSDataName);
	/*CI-LEU信号机码位*/
	funcRtn *= MaskCfgStruFrmCILEUSignalMask(FSDataName);
	/*码位最大值防护*/
	for ( i = 0U; i < CI_SUM_MAX; i++)
	{
		if (CI_TO_LEU_MASK_SUM_MAX <= ConfigCiToLeuMaskIdMax[i])
		{
			funcRtn = CI_ERROR;
			debug_infor_printf((const)"CI TO LEU Mask Is Exceed MAX\n");
		}
		else if (CI_TO_ZC_MASK_SUM_MAX <= ConfigCiToZcMaskIdMax[i])
		{
			funcRtn = CI_ERROR;
			debug_infor_printf((const)"CI TO ZC Mask Is Exceed MAX\n");
		}
		else if (CI_TO_ATS_MASK_SUM_MAX <= ConfigCiToAtsMaskIdMax[i])
		{
			funcRtn = CI_ERROR;
			debug_infor_printf((const)"CI TO ATS Mask Is Exceed MAX\n");
		}
		else if (ZC_TO_CI_MASK_SUM_MAX <= ConfigZcToCiMaskIdMax[i])
		{
			funcRtn = CI_ERROR;
			debug_infor_printf((const)"ZC TO CI Mask Is Exceed MAX\n");
		}
		else
		{
			/*码位最大值检查通过*/
		}
	}


	return funcRtn;
}
/*********************************************
*函数功能：CI-ATS全自动折返进路码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSAARRtMask(UINT8 *FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8 *pDataAddr = NULL, *pDataLin = NULL;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 residue = 0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
    
	UINT8 MaskType[]={0u,MASK_TYPE_ALLAUTORETURN_STATE, 0u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ATS_MASK_TYPE,CI_ATS_AAR_ROUTE_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
	}
	else
	{
		if(DataSize%CI_ATS_AAR_ROUTE_MASK_LEN != 0u)
		{
			funcRtn = 0u;
		}
		else
		{
			if(DataSize == 0u)
			{
				/*无数据*/
				funcRtn = 1u;
			}
			else
			{
				for(;DataSize>0u;DataSize-=2u)
				{
					residue = BuChang%(CI_ATS_AAR_ROUTE_MASK_LEN/2u);
					if(0u == residue)
					{
						DeviceID = ShortFromChar(pDataAddr);
						pDataLin = pDataAddr + CI_ATS_AAR_ROUTE_MASK_LEN - 2u;
						MaskRow = ShortFromChar(pDataLin);
            
						/*访问数组不能越界，越界直接返回失败*/
						if(MaskRow >= CI_SUM_MAX)
						{
							funcRtn = 0u;
							break;
						}
            
						pDataAddr+=2u;
						BuChang++;
					}
					else if((residue>0u) && (residue<2u))
					{
						/*获取码位ID*/
						tempMaskId = ShortFromChar(pDataAddr);
						
						/*0和0xFFFF是无效的码位*/
						if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
						{
							ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
							ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_ALLAUTORETURN;
							ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
							ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ATS_AAR_ROUTE_MASK_LEN/2u)]);
							
                
							/*统计最大的有效码位*/
							if(ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
							{
								ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
							}
							else
							{
								/*do nothing*/
							}
                
							ConfigCiToAtsMaskCurSum[MaskRow]++;
						}
						
						pDataAddr+=2u;
						BuChang++;
					}
					else
					{
						pDataAddr+=2u;
						BuChang++;
					}
					funcRtn = 1u;
				}
			}
		}
	}

	return funcRtn;
}


/*********************************************
*函数功能：CI-ZC车库门码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmCIZCGaragedoor(UINT8 * FSDataName)
{
	UINT8 funcRtn = 1u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
    UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 residue = 0u;
    
	UINT8 MaskType[]={1u,MASK_TYPE_GARAGEDOOR_STATE,MASK_TYPE_GARAGEDOOR_APPLYCLOSE_STATE,MASK_TYPE_GARAGEDOOR_ALLOWCLOSE_STATE,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_GARAGE_DOOR_MASK_ID,&pDataAddr,&DataSize);
	if(0u == funcRtn)
	{
		funcRtn = 0u;
	}
	else
	{
		if(0u != DataSize%CI_ZC_GARAGE_DOOR_MASK_LEN)
		{
			funcRtn = 0u;
		}
		else
		{
			if(0u == DataSize)
			{
				/*无数据*/
				funcRtn = 1u;
			}
			else
			{
			}
			for(;DataSize>0u;DataSize-=2u)
			{
				residue = BuChang%(CI_ZC_GARAGE_DOOR_MASK_LEN/2u);
				if(0u == residue)
				{
					DeviceID = ShortFromChar(pDataAddr);
					pDataLin = pDataAddr + CI_ZC_GARAGE_DOOR_MASK_LEN -2u;
					BuChang++;
					MaskRow = ShortFromChar(pDataLin);
					pDataAddr+=2u;
					/*访问数组不能越界，越界直接返回失败*/
					if(CI_SUM_MAX <= MaskRow)
					{
						funcRtn = 0u;
						break;
					}
					else
					{
					}

				}
				else if(3u > residue)
				{
					/*获取码位ID*/
					tempMaskId = ShortFromChar(pDataAddr);

					/*0和0xFFFF是无效的码位*/
					if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
					{
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_GARAGEDOOR;
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_GARAGE_DOOR_MASK_LEN/2u)]);

		                
						/*统计最大的有效码位*/
						if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
						{
							ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
						}
						else
						{
							/*do nothing*/
						}
		                
						ConfigCiToZcMaskCurSum[MaskRow]++;
					}
					else
					{
					}

					pDataAddr+=2u;
					BuChang++;
				}
				else
				{
					pDataAddr+=2u;
					BuChang++;
				}
                if ( 0u == funcRtn)
                {
                    break;
                }
				else
				{
				}
			}
		}

	}

    return funcRtn;
}

/*********************************************
*函数功能：CI-ZC 防淹门状态码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8 MaskCfgStruFrmCIZCFloodGateMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr = NULL;
	UINT8* pDataLin = NULL;
	UINT16 index = 0u;/*索引*/
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;/*联锁ID*/
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;/*余数*/
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[]={0u,MASK_TYPE_FD_OPENLOCK_TO_ZC,MASK_TYPE_FLOODGATE_CLOSEAPLAY_STATE,MASK_TYPE_FLOODGATE_SQGM_TOZC,MASK_TYPE_FLOODGATE_YXGM_FROMZC,0u};
	UINT16 BuChang = 0u;

	if (NULL == FSDataName)
	{
		funcRtn = 0u;
	}
	else
	{
		funcRtn = 1u;
	}
	if (1u == funcRtn)
	{
		funcRtn = dquGetConfigData((CHAR*)FSDataName,CI_ZC_MASK_TYPE,CI_ZC_FLOODGATE_MASK_ID,&pDataAddr,&DataSize);
	}

	if (1u == funcRtn)
	{
		if((DataSize%CI_ZC_FLOODGATE_MASK_LEN) != 0u)
		{
			funcRtn = 0u;
		}
		else
		{
			if(DataSize == 0u)
			{
				/*无数据*/
				funcRtn = 1u;
			}

			for(;DataSize>0u;DataSize-=2u)
			{   
				residue = BuChang%(CI_ZC_FLOODGATE_MASK_LEN/2u);
				if(0u == residue)
				{/*余数为0，表明是第一列,在余数为0的时候，求出id和联锁ID*/
					DeviceID = ShortFromChar((UINT8*)(&pDataAddr[index]));
					/*pDataLin = pDataAddr + (CI_ZC_FLOODGATE_MASK_LEN -2u);*/ /*取最后一列的地址*/
					pDataLin = (UINT8*)(&pDataAddr[index + (CI_ZC_FLOODGATE_MASK_LEN -2u)]);/*取最后一列的地址*/
					BuChang++;
					MaskRow = ShortFromChar(pDataLin);
					/*pDataAddr+=2;*/
					index +=2u;
					/*访问数组不能越界，越界直接返回失败*/
					if(MaskRow >= CI_SUM_MAX)
					{
						funcRtn = 0u;
						break;
					}
				}
				else if ((0u < residue) && (residue < ((CI_ZC_FLOODGATE_MASK_LEN/2u) -2u)))/*2列到4列为CI-ZC防淹门，列5是zc-ci，列6是CIid，总共6列，需要-2*/
				{
					/*获取码位ID*/
					tempMaskId = ShortFromChar((UINT8*)(&pDataAddr[index]));

					/*0和0xFFFF是无效的码位*/
					if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
					{
						if ((MaskRow < CI_SUM_MAX)&&(tempMaskId < CI_TO_ZC_MASK_SUM_MAX))
						{
							ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
							ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_FLOODGATE;
							ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
							ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_FLOODGATE_MASK_LEN/2u)]);


							/*统计最大的有效码位*/
							if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
							{
								ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
							}
							else
							{
								/*do nothing*/
							}

							ConfigCiToZcMaskCurSum[MaskRow]++;
						}
						
					}
					/*pDataAddr+=2u;*/
					index +=2u;
					BuChang++;
				}
				else if (residue == (UINT16)((CI_ZC_FLOODGATE_MASK_LEN/2u) -2u))/*处理zc-ci码位*/
				{
					/*获取码位ID*/
					tempMaskId = ShortFromChar((UINT8*)(&pDataAddr[index]));

					/*0和0xFFFF是无效的码位*/
					if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
					{
						if ((MaskRow < CI_SUM_MAX)&&(tempMaskId < ZC_TO_CI_MASK_SUM_MAX))
						{
							ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
							ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_FLOODGATE;
							ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
							ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_FLOODGATE_MASK_LEN/2u)]);


							/*统计最大的有效码位*/
							if(ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
							{
								ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
							}
							else
							{
								/*do nothing*/
							}

							ConfigZcToCiMaskCurSum[MaskRow]++;
						}
					}

					/*pDataAddr+=2u;*/
					index +=2u;
					BuChang++;
				}
				else
				{
					/*pDataAddr+=2u;*/
					index +=2u;
					BuChang++;
				}
				if ( 0u == funcRtn)
				{
					break;
				}
			}
		}
	}

	return funcRtn;
}
/*********************************************
*函数功能：CI-ZC SPKS开关状态码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8 MaskCfgDtStruFrmCIZCSPKSMask(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT8 MaskType[]={0u,MASK_TYPE_SPKS_OPENSTATE_ZC,0u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_SPKS_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn == 0u)
	{
		funcRtn = 0u;
	}
	else
	{
		if(DataSize%CI_ZC_SPKS_MASK_LEN != 0u)
		{
			funcRtn = 0u;
		}
		else
		{
			if(DataSize == 0u)
			{
				/*无数据*/
				funcRtn = 1u;
			}

			for(;DataSize>0u;DataSize-=2u)
			{   
				residue = BuChang%(CI_ZC_SPKS_MASK_LEN/2u);
				if(0u == residue)
				{
					DeviceID = ShortFromChar(pDataAddr);
					pDataLin = pDataAddr + CI_ZC_SPKS_MASK_LEN - 2u;
					MaskRow = ShortFromChar(pDataLin);

					/*访问数组不能越界，越界直接返回失败*/
					if(MaskRow >= CI_SUM_MAX)
					{
						funcRtn = 0u;
						break;
					}

					pDataAddr+=2u;
					BuChang++;
				}
				else if(residue == 1u)
				{
					/*获取码位ID*/
					tempMaskId = ShortFromChar(pDataAddr);

					/*0和0xFFFF是无效的码位*/
					if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
					{
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SPKS;
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
						ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_SPKS_MASK_LEN/2u)]);


						/*统计最大的有效码位*/
						if(ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToZcMaskIdMax[MaskRow])
						{
							ConfigCiToZcMaskIdMax[MaskRow] = ConfigCiToZcMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
						}
						else
						{
							/*do nothing*/
						}

						ConfigCiToZcMaskCurSum[MaskRow]++;
					}
					pDataAddr+=2u;
					BuChang++;
				}
				else
				{
					pDataAddr+=2u;
					BuChang++;
				}
			}
		}

	}

	return funcRtn;
}


/*********************************************
*函数功能：ZC-CI车库门码位
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmZCCIGaragedoor(UINT8 * FSDataName)
{
	UINT8 funcRtn = 1u;
	UINT8* pDataAddr,*pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow=0u;
	UINT16 DeviceID=0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 residue = 0u;

	UINT8 MaskType[]={1u,MASK_TYPE_GARAGEDOOR_STATE,MASK_TYPE_GARAGEDOOR_APPLYCLOSE_STATE,MASK_TYPE_GARAGEDOOR_ALLOWCLOSE_STATE,1u};
	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigData(FSDataName,CI_ZC_MASK_TYPE,CI_ZC_GARAGE_DOOR_MASK_ID,&pDataAddr,&DataSize);
	if(funcRtn==0u)
	{
		funcRtn = 0u;
	}
	else
	{
		if(DataSize%CI_ZC_GARAGE_DOOR_MASK_LEN != 0u)
		{
			funcRtn = 0u;
		}
		else
		{
			if(DataSize == 0u)
			{
				/*无数据*/
				funcRtn = 1u;
			}
			for(;DataSize>0u;DataSize-=2u)
			{
				residue = BuChang%(CI_ZC_GARAGE_DOOR_MASK_LEN/2u);
				if(residue == 0u)
				{
					DeviceID = ShortFromChar(pDataAddr);
					pDataLin = pDataAddr + CI_ZC_GARAGE_DOOR_MASK_LEN -2u;
					BuChang++;
					MaskRow = ShortFromChar(pDataLin);
					pDataAddr+=2u;
					/*访问数组不能越界，越界直接返回失败*/
					if(MaskRow >= CI_SUM_MAX)
					{
						funcRtn = 0u;
						break;
					}
				}
				else if(residue==3u)
				{
					/*获取码位ID*/
					tempMaskId = ShortFromChar(pDataAddr);

					/*0和0xFFFF是无效的码位*/
					if((0xFFFFu != tempMaskId)&&(0u != tempMaskId))
					{
						ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
						ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_GARAGEDOOR;
						ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
						ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang%(CI_ZC_GARAGE_DOOR_MASK_LEN/2u)]);


						/*统计最大的有效码位*/
						if(ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
						{
							ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
						}
						else
						{
							/*do nothing*/
						}

						ConfigZcToCiMaskCurSum[MaskRow]++;
					}

					pDataAddr+=2u;
					BuChang++;
				}
				else
				{
					pDataAddr+=2u;
					BuChang++;
				}
                if ( 0u == funcRtn)
                {
                    break;
                }
			}
		}

	}

	return funcRtn;
}

/*********************************************
*函数功能：CI到ATS码位表解析 适配28.0.0.14
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSSwitchMask2(UINT8 * FSDataName)
{
	UINT8 funcRtn = CI_ERROR;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow = 0u;  /*码位矩阵行数*/
	UINT16 DeviceID = 0u; /*设备ID*/
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 rowCount = 0u;
	UINT8 rowLenth = 0u;/*行字节数*/

			/*对应表格的每一列*/
	UINT8 MaskType[] = { 0u,MASK_TYPE_SWITCH_DINGWEI,MASK_TYPE_SWITCH_FANWEI,MASK_TYPE_SWITCH_SIKAI,MASK_TYPE_SWITCH_JICHA,
		MASK_TYPE_SWITCH_MOVING,MASK_TYPE_SWITCH_DANSUO,MASK_TYPE_SWITCH_FENGSUO,MASK_TYPE_SWITCH_YINDAOSUO,MASK_TYPE_SWITCH_PROTECTLOCK,MASK_TYPE_SWITCH_BYPASS,
		MASK_TYPE_SWITCH_OPEN_CAP,0u };
	UINT16 BuChang = 0u;/*步长*/
	funcRtn = dquGetConfigDataNew(FSDataName, CI_ATS_MASK_TYPE, CI_ATS_SWITCH_MASK_ID, &pDataAddr, &DataSize, &rowCount);
	if (funcRtn == 0u)
	{
		/*不做处理*/
	}
	else
	{
		funcRtn = CI_SUCCESS;
		/*数据读取正常*/
		if ((0u < DataSize) && (0u < rowCount))
		{
			if (0u == DataSize % rowCount)
			{
				/*一行字节数*/
				rowLenth = (UINT8)(DataSize / rowCount);
				for (; DataSize>0u; DataSize -= 2u)
				{
					residue = (UINT16)(BuChang % (rowLenth / 2u));
					/*第一列是用来计算行的，一般是一个id号*/
					if (0u == residue)
					{
						DeviceID = ShortFromChar(pDataAddr);

						pDataLin = pDataAddr + rowLenth - 2u;
						MaskRow = ShortFromChar(pDataLin);

						/*访问数组不能越界，越界直接返回失败*/
						if (MaskRow < CI_SUM_MAX)
						{
							pDataAddr += 2u;
							BuChang++;
						}
						else
						{
							funcRtn = CI_ERROR;
							break;
						}
					}
					/*第二列往后才是码位值*/
					else if ((0u < residue) && (residue < ((rowLenth / 2u) - 1u)))
					{
						/*获取码位ID*/
						tempMaskId = ShortFromChar(pDataAddr);

						/*0和0xFFFF是无效的码位*/
						if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
						{
							if ((CI_SUM_MAX > MaskRow) && (CI_TO_ATS_MASK_SUM_MAX > tempMaskId) && (0u <tempMaskId))/*检查是否为有效码位值*/
							{
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_SWITCH;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
								ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang % (rowLenth / 2u)]);
								/*统计最大的有效码位*/
								if (ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
								{
									ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
								}
								else
								{
									/*do nothing*/
								}

								ConfigCiToAtsMaskCurSum[MaskRow]++;
							}
							else
							{
								funcRtn = CI_ERROR;
								break;
							}
						}

						pDataAddr += 2u;
						BuChang++;
					}
					else
					{
						pDataAddr += 2u;
						BuChang++;
					}
				}
			}
			else
			{
				funcRtn = CI_ERROR;
			}
		}
		else
		{
			funcRtn = CI_SUCCESS;
		}
	}
	return funcRtn;
}

/*********************************************
*函数功能：CI-ATS物理区段码位  适配28.0.0.14数据结构
*参数说明：FSDataName件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgDtStruFrmCIATSPhySecMask2(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 MaskRow = 0u;
	UINT16 DeviceID = 0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/
	UINT16 rowCount = 0u;
	UINT16 rowLenth = 0u;/*行字节数*/
	UINT8 MaskType[] = {
		1u,
		MASK_TYPE_PHYSECTION_STARTLOCK,
		MASK_TYPE_PHYSECTION_FLOCK,
		MASK_TYPE_PHYSECTION_PRERESET,
		MASK_TYPE_PHYSEC_CENTERDETAIN_UP,
		MASK_TYPE_PHYSEC_CENTERDETAIN_DOWN,
		MASK_TYPE_PHYSEC_STATIONDETAIN_UP,
		MASK_TYPE_PHYSEC_STATIONDETAIN_DOWN,
		MASK_TYPE_PHYSEC_FLOCK_SPKS
	};

	UINT16 BuChang = 0u;
	funcRtn = dquGetConfigDataNew(FSDataName, CI_ATS_MASK_TYPE, CI_ATS_PHYSEC_MASK_ID, &pDataAddr, &DataSize, &rowCount);
	if (0u == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
	}

	if (0u == DataSize)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}

	if (0u != DataSize%rowCount)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
		rowLenth = (UINT16)(DataSize/rowCount);
	}
	for (; DataSize>0u; DataSize -= CI_ATS_DATA_ELEMENT_LEN)
	{
		residue = BuChang % (rowLenth / CI_ATS_DATA_ELEMENT_LEN);
		if (0u == residue)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + rowLenth - CI_ATS_DATA_ELEMENT_LEN;
			MaskRow = ShortFromChar(pDataLin);

			/*访问数组不能越界，越界直接返回失败*/
			if (CI_SUM_MAX <= MaskRow)
			{
				funcRtn = 0u;
				return funcRtn;
			}
			else
			{
			}

			pDataAddr += CI_ATS_DATA_ELEMENT_LEN;
			BuChang++;
		}
		else if (residue < ((rowLenth / CI_ATS_DATA_ELEMENT_LEN) - 1u))
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
			{
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PHYSEC;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang % (rowLenth / CI_ATS_DATA_ELEMENT_LEN)]);


				/*统计最大的有效码位*/
				if (ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigCiToAtsMaskIdMax[MaskRow])
				{
					ConfigCiToAtsMaskIdMax[MaskRow] = ConfigCiToAtsMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigCiToAtsMaskCurSum[MaskRow]++;
			}
			else
			{
			}

			pDataAddr += CI_ATS_DATA_ELEMENT_LEN;
			BuChang++;
		}
		else
		{
			pDataAddr += CI_ATS_DATA_ELEMENT_LEN;
			BuChang++;
		}
	}
	funcRtn = 1u;
	return funcRtn;
}

/*********************************************
*函数功能：ZC-CI计轴区段码位-面向数据结构28.0.0.14
*参数说明：FSName文件指针
*返回值：0，失败；1，成功
*********************************************/
UINT8  MaskCfgStruFrmZCCIAxleSgmtMask2(UINT8 * FSDataName)
{
	UINT8 funcRtn = 0u;
	UINT8* pDataAddr, *pDataLin;
	UINT32 DataSize = 0u;
	UINT16 i = 0u;
	UINT16 MaskRow = 0u;
	UINT16 DeviceID = 0u;
	UINT16 residue = 0u;
	UINT16 tempMaskId = 0u; /*码位ID临时变量*/

	UINT16 wPhysicId = 0u;
	UINT8 MaskType[] = { 1u,MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_OCCUPY,
		MASK_TYPE_PHYSECTION_ROUTELOCK,MASK_TYPE_PHYSECTION_JUMPLOCK_ZC,MASK_TYPE_AXISSECTION_DETAIN_UP,MASK_TYPE_AXISSECTION_DETAIN_DOWN,
		MASK_TYPE_AXISSECTION_ARB,MASK_TYPE_LIECHE_STOPSTATE,
		MASK_TYPE_PHYSECTION_HEAD_STD,MASK_TYPE_PHYSECTION_HEAD_XTD,MASK_TYPE_PHYSECTION_JUMPLOCK_APPLY,
		MASK_TYPE_PHYSECTION_JUMPLOCK_CANCEL,1u };
	UINT16 BuChang = 0u;
	UINT16 realRow = 0U;
	UINT16 rowLenth = 0U;
	funcRtn = dquGetConfigDataNew(FSDataName, CI_ZC_MASK_TYPE, CI_ZC_AXLE_SGMT_MASK_ID, &pDataAddr, &DataSize, &realRow);
	if (0U == funcRtn)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	if (DataSize == 0u)
	{
		/*无数据*/
		funcRtn = 1u;
		return funcRtn;
	}
	if (0U != DataSize%realRow)
	{
		funcRtn = 0u;
		return funcRtn;
	}
	else
	{
		rowLenth = (UINT16)(DataSize / realRow);
	}
	for (; DataSize>0u; DataSize -= 2u)
	{
		residue = BuChang % (rowLenth / 2u);

		if (residue == 0u)
		{
			DeviceID = ShortFromChar(pDataAddr);
			pDataLin = pDataAddr + rowLenth - 2u;
			BuChang++;
			MaskRow = ShortFromChar(pDataLin);
			pDataAddr += 2u;
			/*访问数组不能越界，越界直接返回失败*/
			if (MaskRow >= CI_SUM_MAX)
			{
				funcRtn = 0u;
				return funcRtn;
			}

			for (i = 0u; i<dsuDataLenStru.wAxleSgmtLen; i++)
			{
				if (dsuStaticHeadStru.pAxleSgmtStru[i].wId == DeviceID)
				{
					DeviceID = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;

					/* 配置数据中以计轴区段配置，一个物理对应多个计轴区段
					* 如果前后两个为相同的物理区段，则直接跳过不进行读取
					*/
					/*配置数据中以计轴区段配置，一个物理对应多个计轴区段,
					如果前后两个为相同的物理区段,但前面计轴区段码位无效时，后面计轴区段码位要进行初始化，这样处理如果
					前后计轴区段都有效（码位相同），则后面覆盖前面，不会出现逻辑错误*/
					wPhysicId = dsuStaticHeadStru.pAxleSgmtStru[i].wRelatePhysicalSgmtId;

					/*找到相应的CI_ID，可退出for循环*/
					break;
				}
			}

			if (i == dsuDataLenStru.wAxleSgmtLen)
			{
				/* 没有找到，则直接退出 */
				funcRtn = 0u;
				return funcRtn;
			}
		}
		else if ((8u <= residue) && (residue <((rowLenth / 2u) - 1u)))
		{
			/*获取码位ID*/
			tempMaskId = ShortFromChar(pDataAddr);

			/*0和0xFFFF是无效的码位*/
			if ((0xFFFFu != tempMaskId) && (0u != tempMaskId))
			{
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = DeviceID;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceType = CI_DEVICE_TYPE_PHYSEC;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId = tempMaskId;
				ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType = (UINT8)(MaskType[BuChang % (rowLenth / 2u)]);
				/*如果码位类型为跳跃锁闭申请，则设备ID设置为计轴区段ID，因为设置跳跃锁闭需要检查道岔状态*/
				if ((MASK_TYPE_PHYSECTION_JUMPLOCK_APPLY == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
					|| (MASK_TYPE_PHYSECTION_JUMPLOCK_CANCEL == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType)
					|| (MASK_TYPE_AXISSECTION_ARB == ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskType))
				{
					ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].DeviceId = dsuStaticHeadStru.pAxleSgmtStru[i].wId;
				}
				/*统计最大的有效码位*/
				if (ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId > ConfigZcToCiMaskIdMax[MaskRow])
				{
					ConfigZcToCiMaskIdMax[MaskRow] = ConfigZcToCiMaskConfigDataStru[MaskRow][tempMaskId].MaskId;
				}
				else
				{
					/*do nothing*/
				}

				ConfigZcToCiMaskCurSum[MaskRow]++;
			}
			pDataAddr += 2u;
			BuChang++;
		}
		else
		{
			/* 过滤其他的 */
			pDataAddr += 2u;
			BuChang++;
		}
	}

	funcRtn = 1u;
	return funcRtn;

}
