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

📄 timer.h

📁 Jazmyn is a 32-bit, protected mode, multitasking OS which runs on i386 & above CPU`s. Its complete
💻 H
字号:
#ifndef _TIMER_H
#define _TIMER_H

class process;

#include "driver.h"

#define	TMR_CNT0	0x40
#define	TMR_CNT0	0x41
#define	TMR_CNT0	0x42
#define	TMR_CTRL	0x43

#define	TMR_SC0		0x00	/*	Select channel 0 	*/
#define	TMR_SC1		0x40	/*	Select channel 1 	*/
#define	TMR_SC2		0x80	/*	Select channel 2 	*/

#define	TMR_LOW		0x10	/*	RW low byte only 	*/
#define	TMR_HIGH	0x20	/*	RW high byte only 	*/
#define	TMR_BOTH	0x30	/*	RW both bytes 		*/

#define	TMR_MD0		0x00	/*	Mode 0 			*/
#define	TMR_MD1		0x02	/*	Mode 1 			*/
#define	TMR_MD2		0x04	/*	Mode 2 			*/
#define	TMR_MD3		0x06	/*	Mode 3 			*/
#define	TMR_MD4		0x08	/*	Mode 4 			*/
#define	TMR_MD5		0x0A	/*	Mode 5 			*/

#define	TMR_BCD		0x01	/*	BCD mode 		*/

#define	TMR_LATCH	0x00	/*	Latch command 		*/

#define	TMR_READ	0xF0	/*    Read command 		*/
#define	TMR_CNT		0x20	/*    CNT bit  (Active low, subtract it) */
#define	TMR_STAT	0x10	/*    Status bit  (Active low, subtract it) */
#define	TMR_CH2		0x08	/*    Channel 2 bit 		*/
#define	TMR_CH1		0x04	/*    Channel 1 bit 		*/
#define	TMR_CH0		0x02	/*    Channel 0 bit 		*/

#define	MAX_CALL	20
#define	PROG_HZ		18.206759

class timer : public driver
{
public:
	ullong	sys_boot_time;
	ullong	curr_time;
	struct
	{
		ullong end_time;
		void (*fun)();
	}call_arr[MAX_CALL];
public:
	timer(char *name);
	~timer();
        ullong  get_time();
	void	prog_pit(float Hz,byte ctrl);
	int	call_after(uint millisec,void (*fun)());
};

void    timer_handler();
int     timer_main(void *arg);

#endif

⌨️ 快捷键说明

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