⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wdog.h

📁 一个通讯管理机的源代码。比较好用。推荐
💻 H
字号:
#ifndef WDOG_H#define WDOG_H/**  *@author   */#include "msystem.h"#ifndef _UC7400#include <sys/io.h>#include <errno.h>#include <stdio.h>class CWDog {public:	CWDog()	{		m_bIsOpen = false;	}	~CWDog()	{		Close();	}	void Open()	{			if (iopl(3) == 0)		{//			cout << "open suc" <<endl;			inb(0x443);		}//		else cout << errno << endl;		if (ioperm(0x3f0,2,true) == 0)		{			outb(0x87,0x3f0);			outb(0x87,0x3f0);			outb(0x14,0x3f0);			outb(0x9c,0x3f1);			outb(0xaa,0x3f0);			ioperm(0x3f0,2,false);			m_bIsOpen = true;		}		else		{//			cout << errno << endl;		}	}	void Close()	{		if (m_bIsOpen)		{			if (ioperm(0x3f0,2,true) == 0)			{				cout << "close suc" <<endl;				outb(0x87,0x3f0);				outb(0x87,0x3f0);				outb(0x14,0x3f0);				outb(0x8c,0x3f1);				outb(0xaa,0x3f0);				ioperm(0x3f0,2,false);			}		}//		else//			cout << errno << endl;	}	void Flush()	{		if (iopl(3) == 0)		{//			cout << "Flush suc" <<endl;			inb(0x443);			outb(0,0x443);////			ioperm(0x443,1,false);		}//		else//			cout << errno << endl;	}protected:	bool	m_bIsOpen;};#else#include <moxadevice.h>class CWDog {public:	CWDog()	{		m_hWTD = -1;	}	~CWDog()	{		Close();	}	void Open()	{			m_hWTD = swtd_open();		if (m_hWTD > 0)		{//			cout << "open suc" <<endl;			swtd_enable(m_hWTD, 1000);//enable it and set it 1 seconds		}//		else cout << errno() << endl;	}	void Close()	{		if (m_hWTD > 0)		{			swtd_disable(m_hWTD);			swtd_close(m_hWTD);		}	}	void Flush()	{		if (m_hWTD > 0)			swtd_ack(m_hWTD);	}protected:	int		m_hWTD;};#endif#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -