]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/drivers-frst/hpet/src/hpet.cc
update
[l4.git] / l4 / pkg / drivers-frst / hpet / src / hpet.cc
1 /*
2  * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9
10 #include <l4/drivers/hpet>
11
12 #include <stdio.h>
13
14 void
15 L4::Driver::Hpet::print_state() const
16 {
17   printf("HPET Information:\n");
18   printf("Rev-id:               0x%x\n", rev_id());
19   printf("Num timers:           %d\n", num_tim_cap());
20   printf("Count size:           %s\n", count_size_cap() ? "64bit" : "32bit");
21   printf("Legacy capable:       %s\n", leg_rt_cap() ? "Yes" : "No");
22   printf("Legacy enabled:       %s\n", leg_rt_cnf() ? "Yes" : "No");
23   printf("Vedor ID:             0x%x\n", vendor_id());
24   printf("Counter clock period: 0x%x / %u\n", counter_clk_period(),
25                                               counter_clk_period());
26   printf("Frequency (Hz):       %lld\n", 1000000000000000ULL / counter_clk_period());
27
28   printf("Enabled:              %s\n", enabled() ? "Yes" : "No");
29
30   printf("Main counter value:   %lld\n", main_counter_val());
31
32   printf("Raw values:           %16llx %16llx\n", cap_and_id(), conf());
33
34
35   for (unsigned i = 0; i < num_tim_cap(); ++i)
36     {
37       printf("HPET Timer-%d Information:\n", i);
38       timer(i)->print_state();
39     }
40 }
41
42 void
43 L4::Driver::Hpet::Timer::print_state() const
44 {
45   printf(" Int type:             %s\n", is_int_type_level() ? "Level" : "Edge");
46   printf(" IRQ enabled:          %s\n", is_int_enabled() ? "Yes" : "No");
47   printf(" Mode:                 %s\n", is_periodic() ? "Periodic" : "Non-periodic");
48   printf(" Periodic int capable: %s\n", periodic_int_capable() ? "Yes" : "No");
49   printf(" Can 64bit:            %s\n", can_64bit() ? "Yes" : "No");
50   printf(" Forced to 32bit:      %s\n", forced_32bit() ? "Yes" : "No");
51   printf(" Can FSB/MSI:          %s\n", can_fsb() ? "Yes" : "No");
52   printf(" Does FSB/MSI:         %s\n", is_fsb() ? "Yes" : "No");
53   printf(" IRQs available:       %x\n", ints_avail());
54   printf(" IRQ set:              %d\n", int_route_cnf());
55   printf(" Comparator value:     %lld\n", comparator());
56   printf(" Raw values:           %16llx %16llx\n", conf_and_cap(), comp());
57 }
58