You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "WorkCmdPciPortCheck.h"
|
|
|
|
|
#include "ExceptionMsg.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "PciPortMgr.h"
|
|
|
|
|
#include "PciCh365Mgr.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PER_CHECK_DELAY 50 //ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>(ms)
|
|
|
|
|
|
|
|
|
|
CWorkCmdPciPortCheck::CWorkCmdPciPortCheck(CString &CtrlContent,bool NeedState)
|
|
|
|
|
:m_CtrlContent(CtrlContent),m_NeedState(NeedState)
|
|
|
|
|
{
|
|
|
|
|
m_MaxCheckDelay = 0;
|
|
|
|
|
}
|
|
|
|
|
CWorkCmdPciPortCheck::~CWorkCmdPciPortCheck(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>pci <20>˿<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>׳<EFBFBD><D7B3>쳣
|
|
|
|
|
bool CWorkCmdPciPortCheck::Excute()
|
|
|
|
|
{
|
|
|
|
|
if(gLogMgr->IsDebuging())//<2F><><EFBFBD><EFBFBD>״ֻ̬<CCAC><D6BB>ʱ
|
|
|
|
|
{
|
|
|
|
|
//Sleep(gLogMgr->GetDebugCmdDelay());
|
|
|
|
|
//return true;
|
|
|
|
|
}
|
|
|
|
|
bool ret;
|
|
|
|
|
if(m_MaxCheckDelay>0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int CurDelay = 0;//<2F><>ǰ<EFBFBD><C7B0>ʱʱ<CAB1><CAB1>
|
|
|
|
|
while(CurDelay<m_MaxCheckDelay)
|
|
|
|
|
{
|
|
|
|
|
ret = ReadPortState();
|
|
|
|
|
if(ret == m_NeedState)//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
Sleep(PER_CHECK_DELAY);
|
|
|
|
|
CurDelay += PER_CHECK_DELAY;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ret = ReadPortState();
|
|
|
|
|
}
|
|
|
|
|
if(ret != m_NeedState)
|
|
|
|
|
{
|
|
|
|
|
CString str(m_CtrlContent+_T("<EFBFBD>˿ڼ<EFBFBD><EFBFBD><EFBFBD>ERR"));
|
|
|
|
|
CExceptionMsg Msg;
|
|
|
|
|
Msg.SetMsg(str);
|
|
|
|
|
throw Msg;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
void CWorkCmdPciPortCheck::WirteLog()
|
|
|
|
|
{
|
|
|
|
|
CString str = "[WorkCmd]";
|
|
|
|
|
str += _T("[<5B><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>][")+m_CtrlContent+"]";
|
|
|
|
|
gLogMgr->WriteDebugLog(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CWorkCmdPciPortCheck::ReadPortState()
|
|
|
|
|
{
|
|
|
|
|
bool ret;
|
|
|
|
|
ret = gPciCh365Mgr->ReadPortState(gPciPortMgr->GetCtrlPort(m_CtrlContent));
|
|
|
|
|
return ret;
|
|
|
|
|
}
|