// IRQMThrd.cpp : implementation file // #include "stdafx.h" #include "IRQMSAMP.h" #include "IRQMThrd.h" #include "IRQMDlg.h" #include "ACCES32.h" #include "W32IRQM.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CIRQMThrd IMPLEMENT_DYNCREATE(CIRQMThrd, CWinThread) CIRQMThrd::CIRQMThrd() { } CIRQMThrd::~CIRQMThrd() { } BOOL CIRQMThrd::InitInstance() { // TODO: perform and per-thread initialization here Terminated = false; IRQCount = 0; return TRUE; } int CIRQMThrd::ExitInstance() { // TODO: perform any per-thread cleanup here return CWinThread::ExitInstance(); } BEGIN_MESSAGE_MAP(CIRQMThrd, CWinThread) //{{AFX_MSG_MAP(CIRQMThrd) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CIRQMThrd message handlers int CIRQMThrd::Run() { unsigned char IRQ_Occurred; char text[255]; ((CIRQMDlg*)MainWnd)->m_Status = " Waiting...Generate IRQs now"; MainWnd->UpdateData(false); do { IRQ_Occurred = DetectIRQ(IRQ); if (IRQ_Occurred) { IRQCount++; // send eoi SendEOI(IRQ); sprintf(text, " IRQ %d Count: %ld", IRQ, IRQCount); ((CIRQMDlg*)MainWnd)->m_IRQCount = text; sprintf(text, " Last IRQ: %d", IRQ); ((CIRQMDlg*)MainWnd)->m_LastIRQ = text; MainWnd->UpdateData(false); } } while (!Terminated); return CWinThread::Run(); } void CIRQMThrd::InitWnd(HWND hWnd, UCHAR TheIRQ) { MainWnd = CWnd::FromHandlePermanent(hWnd); IRQ = TheIRQ; } void CIRQMThrd::Terminate(void) { Terminated = true; }