timer.h

来自「一个微型操作系统源码」· C头文件 代码 · 共 72 行

H
72
字号
/* * OSV * Copyright (C) 2002 Ciprian DOSOFTEI <rocksoul@mail.com> * All rights reserved. *  * http://backster.free.fr/osv * * This file is part of the OSV project. OSV is free software, also known as * "open source"; you can redistribute it and/or modify it under the terms  * of the GNU General Public License (GPL), version 2, as published by the Free * Software Foundation (FSF). To explore alternate licensing terms, contact  * the author at rocksoul@mail.com or +40740649907. *  * OSV is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE.  See the GPL for more details.  You should have * received a copy of the GPL along with OSV; see the file COPYING.  If * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. */#ifndef INCTIMER#define INCTIMER#include <types.h>#include <asm/io.h>#define INTERVALSIZE 10#include <types.h>#define PIT_COUNTER0_REG 0x40#define PIT_COUNTER1_REG 0x41#define PIT_COUNTER2_REG 0x42#define PIT_CONTROL_REG 0x43typedef struct {  unsigned counting_style:1;  unsigned counter_mode:3;  unsigned counter_access:2;  unsigned counter_select:2;} NOALIGN _PIT_CONTROL;#define PIT_CSTYLE_16_BITS 0#define PIT_CSTYLE_BCD 1#define PIT_CM_MODE0 0#define PIT_CM_MODE1 1#define PIT_CM_MODE2 2#define PIT_CM_MODE3 3#define PIT_CM_MODE4 4#define PIT_CM_MODE5 5#define PIT_CA_LATCH_CMD 0#define PIT_CA_RW_0_7 1#define PIT_CA_RW_8_15 2#define PIT_CA_RW_0_7_8_15 3#define PIT_CSEL_COUNTER0 0#define PIT_CSEL_COUNTER1 1#define PIT_CSEL_COUNTER2 2typedef union {    _PIT_CONTROL fields;    byte value;} PIT_CONTROL;void initTimer();void delay_msec(const dword msec);dword get_count();#endif

⌨️ 快捷键说明

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