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