Rev 194 | Rev 242 | Go to most recent revision | 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) \ |
||
239 | giacomo | 37 | __asm__ __volatile__("xorl %%eax,%%eax\n\t" \ |
38 | "cpuid\n\t" \ |
||
39 | "rdtsc" \ |
||
40 | : "=a" (low), "=d" (high) \ |
||
41 | :: "ebx", "ecx") |
||
120 | giacomo | 42 | |
43 | #define rdtscll(val) \ |
||
239 | giacomo | 44 | __asm__ __volatile__("xorl %%eax,%%eax\n\t" \ |
45 | "cpuid\n\t" \ |
||
46 | "rdtsc" \ |
||
47 | : "=A" (val) \ |
||
48 | :: "ebx","ecx") |
||
120 | giacomo | 49 | |
50 | /* RTC */ |
||
51 | |||
52 | #define RTC_PORT(x) (0x70 + (x)) |
||
53 | |||
54 | #define CMOS_READ(addr,val) \ |
||
55 | { \ |
||
56 | outp(RTC_PORT(0),(addr)); \ |
||
57 | val = inp(RTC_PORT(1)); \ |
||
58 | } |
||
59 | |||
60 | #define CMOS_WRITE(addr,val) \ |
||
61 | { \ |
||
62 | outp(RTC_PORT(0),(addr)); \ |
||
63 | outp(RTC_PORT(1),(val)); \ |
||
64 | } |
||
65 | |||
66 | #define RTC_IRQ 8 |
||
67 | |||
131 | giacomo | 68 | void ll_init_advtimer(void); |
69 | void ll_restore_CMOS(void); |
||
70 | |||
120 | giacomo | 71 | END_DEF |
72 | #endif |