/********************************************************
*
* 文 件 名： PlatDataManage.c
* 版权说明： 北京交控科技有限公司
* 创建时间： 2023-12-12
* 作    者： 联锁组
* 功能描述： 从平台接收的平台设备数据处理
* 函数包括：
* 使用注意：
* 修改记录：
* by lc 20231212创建
*
********************************************************/


#include "PlatDataManage.h"

extern PlatHeartDataStruct RecvHeartDataStru ;  /*平台心跳帧数据结构*/
extern PlatGPIODataStruct RecvPlatDataStruGPIO;/*平台0x2D帧数据结构 GPIO采集状态*/
extern PlatGPIOToleranceDataStruct gPlatDataGPIOTolercance;/*平台硬件采集故障容忍记录数据*/



/*
* 功能描述： 清空指定通控板卡发送的心跳数据
* 参数说明： 板卡ID
* 返回值  ： 无
*/
void ClearnCCUHeartData(UINT8 boardId)
{
	/*A系通控*/
	if (BOARD_TYPE_CCUA == boardId)
	{
		RecvHeartDataStru.voltageA_CCA = 0U;  /*24VA电源_电压*1000*/
		RecvHeartDataStru.voltageB_CCA = 0U;  /*24VB电源_电压*1000*/
		RecvHeartDataStru.currentA_CCA = 0U;  /*24VA电源_电流*1000*/
		RecvHeartDataStru.currentB_CCA = 0U;  /*24VV电源_电流*1000*/
		RecvHeartDataStru.voltageCoup_CCA = 0U;  /*24V电源_电压*1000*/
		RecvHeartDataStru.currentCoup_CCA = 0U;  /*24V电源_电流*1000*/
		RecvHeartDataStru.temperature_CCA = 0U;  /*温度值*1000*/
		RecvHeartDataStru.check_EEPROM_CCA = 0U;  /*EEPROM存储检验*/
		RecvHeartDataStru.commStartCycle_CCA = 0U; /*通信周期*/
	}
	else if (BOARD_TYPE_CCUB == boardId)
	{
		RecvHeartDataStru.voltageA_CCB = 0U;  /*24VA电源_电压*1000*/
		RecvHeartDataStru.voltageB_CCB = 0U;  /*24VB电源_电压*1000*/
		RecvHeartDataStru.currentA_CCB = 0U;  /*24VA电源_电流*1000*/
		RecvHeartDataStru.currentB_CCB = 0U;  /*24VV电源_电流*1000*/
		RecvHeartDataStru.voltageCoup_CCB = 0U;  /*24V电源_电压*1000*/
		RecvHeartDataStru.currentCoup_CCB = 0U;  /*24V电源_电流*1000*/
		RecvHeartDataStru.temperature_CCB = 0U;  /*温度值*1000*/
		RecvHeartDataStru.check_EEPROM_CCB = 0U;  /*EEPROM存储检验*/
		RecvHeartDataStru.commStartCycle_CCB = 0U; /*通信周期*/
	}
	else if (BOARD_TYPE_SEBA == boardId)
	{
		RecvHeartDataStru.commStartCycle_SEBA = 0U; /*通信周期*/
	}
	else if (BOARD_TYPE_SEBB == boardId)
	{
		RecvHeartDataStru.commStartCycle_SEBB = 0U; /*通信周期*/
	}
	else
	{
		/*不处理*/
	}
}

/*
* 功能描述： 仿真模式下，将平台心跳帧数据设为正常值
* 参数说明： 无
* 返回值  ： 无
*/
void SetCCUHeartDataNormal(void)
{
	RecvHeartDataStru.voltageA_CCA = 24000U;  /*24VA电源_电压*1000*/
	RecvHeartDataStru.voltageB_CCA = 24000U;  /*24VB电源_电压*1000*/
	RecvHeartDataStru.currentA_CCA = 5000U;  /*24VA电源_电流*1000*/
	RecvHeartDataStru.currentB_CCA = 5000U;  /*24VV电源_电流*1000*/
	RecvHeartDataStru.voltageCoup_CCA = 24000U;  /*24V电源_电压*1000*/
	RecvHeartDataStru.currentCoup_CCA = 5000U;  /*24V电源_电流*1000*/
	RecvHeartDataStru.temperature_CCA = 0U;  /*温度值*1000*/
	RecvHeartDataStru.check_EEPROM_CCA = 0U;  /*EEPROM存储检验*/
	RecvHeartDataStru.voltageA_CCB = 24000U;  /*24VA电源_电压*1000*/
	RecvHeartDataStru.voltageB_CCB = 24000U;  /*24VB电源_电压*1000*/
	RecvHeartDataStru.currentA_CCB = 5000U;  /*24VA电源_电流*1000*/
	RecvHeartDataStru.currentB_CCB = 5000U;  /*24VV电源_电流*1000*/
	RecvHeartDataStru.voltageCoup_CCB = 24000U;  /*24V电源_电压*1000*/
	RecvHeartDataStru.currentCoup_CCB = 5000U;  /*24V电源_电流*1000*/
	RecvHeartDataStru.temperature_CCB = 0U;  /*温度值*1000*/
	RecvHeartDataStru.check_EEPROM_CCB = 0U;  /*EEPROM存储检验*/
	RecvHeartDataStru.commState_CCA = CCU_COMMSTATUS_GOOD;
	RecvHeartDataStru.commState_CCB = CCU_COMMSTATUS_GOOD;
	RecvHeartDataStru.commState_SEBA = CCU_COMMSTATUS_GOOD;
	RecvHeartDataStru.commState_SEBB = CCU_COMMSTATUS_GOOD;
}

/*
* 功能描述： 仿真模式下，将平台GPIOP采集数据设为正常值
* 参数说明： 无
* 返回值  ： 无
*/
void SetCCUPlatGPIODataNormal(void)
{
	RecvPlatDataStruGPIO.powerANodeState = NODE_STATUS_CLOSE;
	RecvPlatDataStruGPIO.powerBNodeState = NODE_STATUS_CLOSE;
	RecvPlatDataStruGPIO.ModepowerAState_PUA = POWER_STATUS_NORMAL;
	RecvPlatDataStruGPIO.ModepowerBState_PUA = POWER_STATUS_NORMAL;
	RecvPlatDataStruGPIO.ModepowerAState_PUB = POWER_STATUS_NORMAL;
	RecvPlatDataStruGPIO.ModepowerBState_PUB = POWER_STATUS_NORMAL; 
}

/*
* 功能描述： 获取指定采集点处电压
* 参数说明： UINT8 pointType 采集点类型
* 返回值  ： 采集电压
*/
UINT16 GetCollectPointVoltage(UINT8 pointType)
{
	UINT16 retVal = 0U;
	switch (pointType)
	{
	case COLLECT_MODEA_CCUA:
	{
		retVal = RecvHeartDataStru.voltageA_CCA;
		break;
	}
	case COLLECT_MODEA_CCUB:
	{
		retVal = RecvHeartDataStru.voltageA_CCB;
		break;
	}
	case COLLECT_MODEB_CCUA:
	{
		retVal = RecvHeartDataStru.voltageB_CCA;
		break;
	}
	case COLLECT_MODEB_CCUB:
	{
		retVal = RecvHeartDataStru.voltageB_CCB;
		break;
	}
	case COLLECT_COUPLING_CCUA:
	{
		retVal = RecvHeartDataStru.voltageCoup_CCA;
		break;
	}
	case COLLECT_COUPLING_CCUB:
	{
		retVal = RecvHeartDataStru.voltageCoup_CCB;
		break;
	}
	default:
		/*不可达分支*/
		break;
	}

	return retVal;
}


/*
* 功能描述： 获取指定采集点处电流
* 参数说明： UINT8 pointType 采集点类型
* 返回值  ： 采集电流
*/
UINT16 GetCollectPointCurrent(UINT8 pointType)
{
	UINT16 retVal = 0U;
	switch (pointType)
	{
	case COLLECT_MODEA_CCUA:
	{
		retVal = RecvHeartDataStru.currentA_CCA;
		break;
	}
	case COLLECT_MODEA_CCUB:
	{
		retVal = RecvHeartDataStru.currentA_CCB;
		break;
	}
	case COLLECT_MODEB_CCUA:
	{
		retVal = RecvHeartDataStru.currentB_CCA;
		break;
	}
	case COLLECT_MODEB_CCUB:
	{
		retVal = RecvHeartDataStru.currentB_CCB;
		break;
	}
	case COLLECT_COUPLING_CCUA:
	{
		retVal = RecvHeartDataStru.currentCoup_CCA;
		break;
	}
	case COLLECT_COUPLING_CCUB:
	{
		retVal = RecvHeartDataStru.currentCoup_CCB;
		break;
	}
	default:
		/*不可达分支*/
		break;
	}

	return retVal;
}


/*
* 功能描述： 获取电源插箱A的空开辅助触点状态
* 参数说明： 无
* 返回值  ： 0x55 触电闭合
*           0xaa 触电断开
*/
UINT8 GetPowerANodeStatue(void)
{
	UINT8 retVal = 0U;
	if (NODE_STATUS_CLOSE == RecvPlatDataStruGPIO.powerANodeState)
	{
		retVal = NODE_STATUS_CLOSE;
	}
	else
	{
		retVal = NODE_STATUS_BREAK;
	}

	return retVal;
}

/*
* 功能描述： 获取电源插箱B的空开辅助触点状态
* 参数说明： 无
* 返回值  ： 0x55 触电闭合
*           0xaa 触电断开
*/
UINT8 GetPowerBNodeStatue(void)
{
	UINT8 retVal = 0U;
	if (NODE_STATUS_CLOSE == RecvPlatDataStruGPIO.powerBNodeState)
	{
		retVal = NODE_STATUS_CLOSE;
	}
	else
	{
		retVal = NODE_STATUS_BREAK;
	}

	return retVal;
}

/*
* 功能描述： 获取通控A通信状态
* 参数说明： 无
* 返回值  ： 0x55 通信正常
*           0xaa 通信中断
*/
UINT8 GetCCUACommStatus(void)
{
	UINT8 retVal = 0U;

	if (CCU_COMMSTATUS_GOOD == RecvHeartDataStru.commState_CCA)
	{
		retVal = CCU_COMMSTATUS_GOOD;
	}
	else
	{
		retVal = CCU_COMMSTATUS_BAD;
	}
	return retVal;
}

/*
* 功能描述： 获取通控B通信状态
* 参数说明： 无
* 返回值  ： 0x55 通信正常
*           0xaa 通信中断
*/
UINT8 GetCCUBCommStatus(void)
{
	UINT8 retVal = 0U;

	if (CCU_COMMSTATUS_GOOD == RecvHeartDataStru.commState_CCB)
	{
		retVal = CCU_COMMSTATUS_GOOD;
	}
	else
	{
		retVal = CCU_COMMSTATUS_BAD;
	}
	return retVal;
}

/*
* 功能描述： 获取扩展板A通信状态
* 参数说明： 无
* 返回值  ： 0x55 通信正常
*           0xaa 通信中断
*/
UINT8 GetSEBACommStatus(void)
{
	UINT8 retVal = 0U;

	if (CCU_COMMSTATUS_GOOD == RecvHeartDataStru.commState_SEBA)
	{
		retVal = CCU_COMMSTATUS_GOOD;
	}
	else
	{
		retVal = CCU_COMMSTATUS_BAD;
	}
	return retVal;
}

/*
* 功能描述： 获取扩展板B通信状态
* 参数说明： 无
* 返回值  ： 0x55 通信正常
*           0xaa 通信中断
*/
UINT8 GetSEBBCommStatus(void)
{
	UINT8 retVal = 0U;

	if (CCU_COMMSTATUS_GOOD == RecvHeartDataStru.commState_SEBB)
	{
		retVal = CCU_COMMSTATUS_GOOD;
	}
	else
	{
		retVal = CCU_COMMSTATUS_BAD;
	}
	return retVal;
}

/*
* 功能描述： 获取指定采集点处GPIO采集的电源状态 1\2\3\4采集点
* 参数说明： UINT8 pointType 采集点类型
* 返回值  ：  0x55 电源状态正常
*           0xaa 电源状态异常
*/
UINT8 GetGPIOCollectPointStatus(UINT8 pointType)
{
	UINT8 powerState = 0U;
	switch (pointType)
	{
	case COLLECT_MODEA_CCUA:
	{
		powerState = RecvPlatDataStruGPIO.ModepowerAState_PUA;
		break;
	}
	case COLLECT_MODEA_CCUB:
	{
		powerState = RecvPlatDataStruGPIO.ModepowerAState_PUB;
		break;
	}
	case COLLECT_MODEB_CCUA:
	{
		powerState = RecvPlatDataStruGPIO.ModepowerBState_PUA;
		break;
	}
	case COLLECT_MODEB_CCUB:
	{
		powerState = RecvPlatDataStruGPIO.ModepowerBState_PUB;
		break;
	}
	default:
		/*不可达分支*/
		break;
	}


	return powerState;
}


/*
* 功能描述： 检查某处采集点电压是否在额定范围
* 参数说明： UINT8 pointType  采集点类型
* 返回值  ： 0 电压为0
*           0x55   在额定范围内
*           0xaa    超限
*           0xbb    欠压
*/
UINT8 CheckPointVoltageState(UINT8 pointType)
{
	UINT8 retVal = CHECK_VOLTAGE_ZERO;
	UINT16 voltage = 0U; /*采集点5处电压*/
	
	/*获取该采集点电压*/
	voltage = GetCollectPointVoltage(pointType);

	if (VOLTAGE_MAX_TO_0 > voltage)
	{
		retVal = CHECK_VOLTAGE_ZERO;
	}
	else if ((RATED_VOLTAGE_MIN <= voltage) && (RATED_VOLTAGE_MAX >= voltage))
	{
		retVal = CHECK_VOLTAGE_NOMAL;
	}
	else if (RATED_VOLTAGE_MAX < voltage)
	{
		retVal = CHECK_VOLTAGE_OVERRUN;
	}
	else if (RATED_VOLTAGE_MIN > voltage)
	{
		retVal = CHECK_VOLTAGE_FEWER;
	}
	else
	{
		/*不可达分支，导向0电压*/
	}
	return retVal;
}



/*
* 功能描述： 检查联锁A系电源插箱故障状态
* 参数说明： 无
* 返回值  ： CI_SUCCESS 未故障
*           CI_ERROR   故障
*/
UINT8 CheckRCIAPowerFaultState(void)
{
	UINT8 retVal = CI_ERROR;
	UINT8 cxABreakFlag = 0U; /*A系电源插箱空开断开检查*/
	UINT8 chCheckState = 0U;
	UINT32 dwErrorStartCyc = 0U;
	UINT32 dwCurCyc = 0U;
	cxABreakFlag = GetPowerANodeStatue();
	dwErrorStartCyc = gPlatDataGPIOTolercance.powerANode_TolCyc;
	dwCurCyc = Get2oo2CurCycleNum();
	/* 1、A系电源插箱空开断开 */
	if (NODE_STATUS_BREAK == cxABreakFlag)
	{
		/*A系电源故障状态*/
		chCheckState = SystemOverTimeCheck(dwErrorStartCyc, IO_POWERSTATE_TOLERANCE);
		if (CI_TIME_NO == chCheckState)
		{
			gPlatDataGPIOTolercance.powerANode_TolCyc = dwCurCyc;
			retVal = CI_SUCCESS;
		}
		else if(CI_TIME_IN == chCheckState)
		{
			retVal = CI_SUCCESS;/*继续容忍*/
		}
		else
		{
			retVal = CI_ERROR;
			debug_infor_printf((const)"PLATIO_A_Node_Power_FaultState StartTime%d\n", dwErrorStartCyc);
		}
	}
	else
	{
		retVal = CI_SUCCESS;
		gPlatDataGPIOTolercance.powerANode_TolCyc = 0U;
	}
	return retVal;
}

/*
* 功能描述： 检查联锁B系电源插箱故障状态
* 参数说明： 无
* 返回值  ： CI_SUCCESS 未故障
*           CI_ERROR   故障
*/
UINT8 CheckRCIBPowerFaultState(void)
{
	UINT8 retVal = CI_ERROR;
	UINT8 cxBBreakFlag = 0U; /*B系电源插箱空开断开检查*/
	UINT8 chCheckState = 0U;
	UINT32 dwErrorStartCyc = 0U;
	UINT32 dwCurCyc = 0U;
	cxBBreakFlag = GetPowerBNodeStatue();
	dwErrorStartCyc = gPlatDataGPIOTolercance.powerBNode_TolCyc;
	dwCurCyc = Get2oo2CurCycleNum();
	/* 1、B系电源插箱空开断开*/
	if (NODE_STATUS_BREAK == cxBBreakFlag)
	{
		/*B系电源故障状态*/
		chCheckState = SystemOverTimeCheck(dwErrorStartCyc, IO_POWERSTATE_TOLERANCE);
		if (CI_TIME_NO == chCheckState)
		{
			gPlatDataGPIOTolercance.powerBNode_TolCyc = dwCurCyc;
			retVal = CI_SUCCESS;
		}
		else if (CI_TIME_IN == chCheckState)
		{
			retVal = CI_SUCCESS;/*继续容忍*/
		}
		else
		{
			retVal = CI_ERROR;
			debug_infor_printf((const)"PLATIO_B_Node_Power_FaultState StartTime%d\n", dwErrorStartCyc);
		}
	}
	else
	{
		retVal = CI_SUCCESS;
		gPlatDataGPIOTolercance.powerBNode_TolCyc = 0U;
	}
	return retVal;
}


/*
* 功能描述： 检查联锁A系电源模块故障状态
* 参数说明： 无
* 返回值  ： CI_SUCCESS 未故障
*           CI_ERROR   故障
*/
UINT8 CheckRCIAPowerModeFaultState(void)
{
	UINT8 retVal = CI_ERROR;

	UINT8 powerAPUBAState = 0U; /*PUB A采集的24VA电源状态 1*/
	UINT8 powerBPUBAState = 0U; /*PUB A采集的24VB电源状态 3*/
	UINT8 vol1Flag = 0U;       /*CPI A采集24VA电源 1*/
	UINT8 vol3Flag = 0U;       /*CPI A采集24VB电源 3*/
	UINT8 chCheckState = 0U;
	UINT32 dwErrorStartCyc = 0U;
	UINT32 dwCurCyc = 0U;

	powerAPUBAState = GetGPIOCollectPointStatus(COLLECT_MODEA_CCUA);
	powerBPUBAState = GetGPIOCollectPointStatus(COLLECT_MODEB_CCUA);
	vol1Flag = CheckPointVoltageState(COLLECT_MODEA_CCUA);
	vol3Flag = CheckPointVoltageState(COLLECT_MODEB_CCUA);
	dwErrorStartCyc = gPlatDataGPIOTolercance.powerAMode_TolCyc;
	dwCurCyc = Get2oo2CurCycleNum();

	/* 1、PUB A采集的24VA电源异常、或24VB电源异常
	   2、CPI A采集24VA电源、或24VB电源电压为0V */

	if (((CHECK_VOLTAGE_ZERO == vol1Flag) || (CHECK_VOLTAGE_ZERO == vol3Flag))
		&& ((POWER_STATUS_ABNORMAL == powerAPUBAState) || (POWER_STATUS_ABNORMAL == powerBPUBAState)))
	{
		/*检查容忍*/
		chCheckState = SystemOverTimeCheck(dwErrorStartCyc, IO_POWERSTATE_TOLERANCE);
		if (CI_TIME_NO == chCheckState)
		{
			gPlatDataGPIOTolercance.powerAMode_TolCyc = dwCurCyc;
			retVal = CI_SUCCESS;
		}
		else if (CI_TIME_IN == chCheckState)
		{
			retVal = CI_SUCCESS;/*继续容忍*/
		}
		else
		{
			retVal = CI_ERROR;
			debug_infor_printf((const)"PLATIO_A_Mode_Power_FaultState StartTime%d\n", dwErrorStartCyc);
		}
	}
	else
	{
		retVal = CI_SUCCESS;
		gPlatDataGPIOTolercance.powerAMode_TolCyc = 0U;
	}
	
	return retVal;
}

/*
* 功能描述： 检查联锁B系电源模块故障状态
* 参数说明： 无
* 返回值  ： CI_SUCCESS 未故障
*           CI_ERROR   故障
*/
UINT8 CheckRCIBPowerModeFaultState(void)
{
	UINT8 retVal = CI_ERROR;

	UINT8 powerAPUBBState = 0U; /*PUB A采集的24VA电源状态 2*/
	UINT8 powerBPUBBState = 0U; /*PUB A采集的24VB电源状态 4*/
	UINT8 vol2Flag = 0U;       /*CPI B采集24VA电源 2*/
	UINT8 vol4Flag = 0U;       /*CPI B采集24VB电源 4*/
	UINT8 chCheckState = 0U;
	UINT32 dwErrorStartCyc = 0U;
	UINT32 dwCurCyc = 0U;

	powerAPUBBState = GetGPIOCollectPointStatus(COLLECT_MODEA_CCUB);
	powerBPUBBState = GetGPIOCollectPointStatus(COLLECT_MODEB_CCUB);
	vol2Flag = CheckPointVoltageState(COLLECT_MODEA_CCUB);
	vol4Flag = CheckPointVoltageState(COLLECT_MODEB_CCUB);
	dwErrorStartCyc = gPlatDataGPIOTolercance.powerBMode_TolCyc;
	dwCurCyc = Get2oo2CurCycleNum();

	/* 1、PUB B采集的24VA电源异常、或24VB电源异常
       2、CPI B采集24VA电源、或24VB电源电压为0V */
	if (((CHECK_VOLTAGE_ZERO == vol2Flag) || (CHECK_VOLTAGE_ZERO == vol4Flag))
		&& ((POWER_STATUS_ABNORMAL == powerAPUBBState) || (POWER_STATUS_ABNORMAL == powerBPUBBState)))
	{
		/*检查容忍*/
		chCheckState = SystemOverTimeCheck(dwErrorStartCyc, IO_POWERSTATE_TOLERANCE);
		if (CI_TIME_NO == chCheckState)
		{
			gPlatDataGPIOTolercance.powerBMode_TolCyc = dwCurCyc;
			retVal = CI_SUCCESS;
		}
		else if (CI_TIME_IN == chCheckState)
		{
			retVal = CI_SUCCESS;/*继续容忍*/
		}
		else
		{
			retVal = CI_ERROR;
			debug_infor_printf((const)"PLATIO_B_Mode_Power_FaultState StartTime%d\n", dwErrorStartCyc);
		}
	}
	else
	{
		retVal = CI_SUCCESS;
		gPlatDataGPIOTolercance.powerBMode_TolCyc = 0U;
	}

	return retVal;
}





/*
* 功能描述： 检查联锁通信设备(通控)状态
* 参数说明： 无
* 返回值  ： CI_SUCCESS 通信正常
*           CI_ERROR   通信中断
*/
UINT8 CheckRCICommCCUDeviceStatue(void)
{
	UINT8 retVal = CI_ERROR;

	UINT8 commCCA = 0U; /*通控板A通信状态*/
	UINT8 commCCB = 0U; /*通控板B通信状态*/
	UINT8 commSEBA = 0U; /*扩展板A通信状态*/
	UINT8 commSEBB = 0U; /*扩展板B通信状态*/
	commCCA = GetCCUACommStatus();
	commCCB = GetCCUBCommStatus();
	commSEBA = GetSEBACommStatus();
	commSEBB = GetSEBBCommStatus();

	if ((CCU_COMMSTATUS_GOOD == commCCA) && (CCU_COMMSTATUS_GOOD == commCCB) && (CCU_COMMSTATUS_GOOD == commSEBA) && (CCU_COMMSTATUS_GOOD == commSEBB))
	{
		retVal = CI_SUCCESS;
	}
	else
	{
		retVal = CI_ERROR;
	}
	return retVal;
}


/*
* 功能描述：设置与指定通信板的通信状态
* 参数说明：UINT8 boardId 通信板卡ID
*         UINT8 commState 通信状态
* 返回值  ：
* BY LC
*/
void SetRCIandCCBoardCommStatus(UINT8 boardId, UINT8 commState)
{
	if ((CCU_COMMSTATUS_BAD == commState) || (CCU_COMMSTATUS_GOOD == commState))
	{
		if (BOARD_TYPE_CCUA == boardId)
		{
			RecvHeartDataStru.commState_CCA = commState;
		}
		else if (BOARD_TYPE_CCUB == boardId)
		{
			RecvHeartDataStru.commState_CCB = commState;
		}
		else if (BOARD_TYPE_SEBA == boardId)
		{
			RecvHeartDataStru.commState_SEBA = commState;
		}
		else if (BOARD_TYPE_SEBB == boardId)
		{
			RecvHeartDataStru.commState_SEBB = commState;
		}
		else
		{
			/*不执行*/
		}
	}
}


/*
* 功能描述：获取与指定通信板的通信状态
* 参数说明：UINT8 boardId 通信板卡ID
* 返回值  ：UINT8 commState 通信状态
* BY LC
*/
UINT8 GetRCIandCCBoardCommStatus(UINT8 boardId)
{
	UINT8 retVal = CCU_COMMSTATUS_BAD;

	if (BOARD_TYPE_CCUA == boardId)
	{
		retVal = RecvHeartDataStru.commState_CCA;
	}
	else if (BOARD_TYPE_CCUB == boardId)
	{
		retVal = RecvHeartDataStru.commState_CCB;
	}
	else
	{
		/*不执行*/
	}
	return retVal;
}


/*
* 功能描述：获取与指定通信板的通信开始周期数
* 参数说明：UINT8 boardId 通信板卡ID
* 返回值  ：UINT8 commState 通信状态
* BY LC
*/
UINT32 GetRCIandCCBoardCommCyCNum(UINT8 boardId)
{
	UINT32 retVal = 0U;

	if (BOARD_TYPE_CCUA == boardId)
	{
		retVal = RecvHeartDataStru.commStartCycle_CCA;
	}
	else if (BOARD_TYPE_CCUB == boardId)
	{
		retVal = RecvHeartDataStru.commStartCycle_CCB;
	}
	else if (BOARD_TYPE_SEBA == boardId)
	{
		retVal = RecvHeartDataStru.commStartCycle_SEBA;
	}
	else if (BOARD_TYPE_SEBB == boardId)
	{
		retVal = RecvHeartDataStru.commStartCycle_SEBB;
	}
	else
	{
		/*不执行*/
	}
	return retVal;
}