Subversion Repositories shark

Rev

Rev 131 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
120 giacomo 1
/* Project:     OSLib
2
 * Description: The OS Construction Kit
3
 * Date:                1.6.2000
4
 * Idea by:             Luca Abeni & Gerardo Lamastra
5
 *
6
 * OSLib is an SO project aimed at developing a common, easy-to-use
7
 * low-level infrastructure for developing OS kernels and Embedded
8
 * Applications; it partially derives from the HARTIK project but it
9
 * currently is independently developed.
10
 *
11
 * OSLib is distributed under GPL License, and some of its code has
12
 * been derived from the Linux kernel source; also some important
13
 * ideas come from studying the DJGPP go32 extender.
14
 *
15
 * We acknowledge the Linux Community, Free Software Foundation,
16
 * D.J. Delorie and all the other developers who believe in the
17
 * freedom of software and ideas.
18
 *
19
 * For legalese, check out the included GPL license.
20
 */
21
 
22
/*      Advanced Timer
23
 *      Date: 8.4.2003
24
 *      Author: Giacomo Guidi <giacomo@gandalf.sssup.it>
25
 *
26
 */
27
 
28
#ifndef __ADVTIMER_H__
29
#define __ADVTIMER_H__
30
 
31
#include <ll/i386/defs.h>
32
BEGIN_DEF
33
 
34
/* TSC */
35
 
36
#define rdtsc(low,high) \
37
     __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
38
 
39
#define rdtscll(val) \
40
     __asm__ __volatile__("rdtsc" : "=A" (val))
41
 
42
/* RTC */
43
 
44
#define RTC_PORT(x)     (0x70 + (x))
45
 
46
#define CMOS_READ(addr,val)     \
47
{                               \
48
outp(RTC_PORT(0),(addr));       \
49
val = inp(RTC_PORT(1));         \
50
}
51
 
52
#define CMOS_WRITE(addr,val)    \
53
{                               \
54
outp(RTC_PORT(0),(addr));       \
55
outp(RTC_PORT(1),(val));        \
56
}
57
 
58
#define RTC_IRQ 8
59
 
131 giacomo 60
void ll_init_advtimer(void);
61
void ll_restore_CMOS(void);
62
 
120 giacomo 63
END_DEF
64
#endif