From b3f57dfd201a0d624b8ce4eb9849354383fcc3bd Mon Sep 17 00:00:00 2001 From: Jaswinder Singh Rajput Date: Tue, 26 Oct 2010 14:22:14 -0700 Subject: [PATCH] --- yaml --- r: 217501 b: refs/heads/master c: aaaddfe0b3bb449b8734bf29bbd36141076e5277 h: refs/heads/master i: 217499: a8a6b0b1d9b4c35f69f5ab872c2fb8ea5a296c1e v: v3 --- [refs] | 2 +- trunk/Documentation/timers/hpet_example.c | 27 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 3d731d957538..ed7bf87b82a7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0ca01763a028d0034042a9397534bc1f27848652 +refs/heads/master: aaaddfe0b3bb449b8734bf29bbd36141076e5277 diff --git a/trunk/Documentation/timers/hpet_example.c b/trunk/Documentation/timers/hpet_example.c index 4bfafb7bc4c5..9a3e7012c190 100644 --- a/trunk/Documentation/timers/hpet_example.c +++ b/trunk/Documentation/timers/hpet_example.c @@ -97,6 +97,33 @@ hpet_open_close(int argc, const char **argv) void hpet_info(int argc, const char **argv) { + struct hpet_info info; + int fd; + + if (argc != 1) { + fprintf(stderr, "hpet_info: device-name\n"); + return; + } + + fd = open(argv[0], O_RDONLY); + if (fd < 0) { + fprintf(stderr, "hpet_info: open of %s failed\n", argv[0]); + return; + } + + if (ioctl(fd, HPET_INFO, &info) < 0) { + fprintf(stderr, "hpet_info: failed to get info\n"); + goto out; + } + + fprintf(stderr, "hpet_info: hi_irqfreq 0x%lx hi_flags 0x%lx ", + info.hi_ireqfreq, info.hi_flags); + fprintf(stderr, "hi_hpet %d hi_timer %d\n", + info.hi_hpet, info.hi_timer); + +out: + close(fd); + return; } void