-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathtimer.h
More file actions
28 lines (27 loc) · 677 Bytes
/
timer.h
File metadata and controls
28 lines (27 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#define PIT_CTRL 0x0043
#define PIT_CNT0 0x0040
#define TIMER_MAX 500
#define TIMER_UNALLOCED 0
#define TIMER_ALLOCED 1
#define TIMER_USING 2
#define TIME_MAX 0xffffffff
struct Timer
{
int timeout;
int flag;
struct Buffer *timeoutBuffer;
char timeoutData;
};
struct TimerCTL
{
unsigned int count,next;//nextΪÏÂÒ»´Î³¬Ê±Ê±¼ä
struct Timer timer[TIMER_MAX];
};
extern struct TimerCTL timerctl;
extern struct Timer *taskTimer;
void initPit();
struct Timer *allocTimer();
void freeTimer(struct Timer *timer);
void initTimer(struct Timer *timer,struct Buffer *buffer,unsigned char timeoutData);
void setTimer(struct Timer *timer,unsigned int timeout);