• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Embedded Systems Software
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2025/26
      • Systemprogrammierung 2
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
      • Projekt angewandte Systemsoftwaretechnik
      • Aktuelle Entwicklung in Verteilten und Objektorientierten Betriebssystemen (für Bachelor-/Masterarbeit)
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Betriebssysteme

    Aufgabe 7: Anwendung

    • HPET
    • Comparator
    Classes | Public Member Functions | Protected Types | Protected Attributes | List of all members
    HPET::Comparator Class Reference

    Class abstracting a single HPET comparator. More...

    #include <machine/hpet.h>

    Classes

    union  ConfigAndCapabilitiesRegister
     Access Helper for comparators configuration register. More...
     
    struct  ConfigAndCapabilitiesRegister.__unnamed__
     

    Public Member Functions

     Comparator (const Comparator &)=delete
     
     Comparator (Comparator &&)=delete
     
    Comparator & operator= (const Comparator &)=delete
     
    Comparator & operator= (Comparator &&)=delete
     
    void enable ()
     Activates interrupts (for the current comparator).
     
    void disable ()
     Deactivates interrupts (for the current comparator).
     
    bool isEnabled () const
     Checks whether interrupts are enabled for the current comparator.
     
    bool supportsIOAPICSlot (unsigned slot) const
     Can this comparator trigger interrupts at an specific I/O-APIC Slot? More...
     
    bool supportsPeriodicInterrupts () const
     Is this comparator capable of sending peridic interrupts? More...
     
    bool isActive () const
     Check if this comparator triggered an interrupt. More...
     
    void setHandled ()
     Mark this comparator interrupt as handled. More...
     
    bool set (uint64_t usecs, uint8_t slot, bool periodic)
     Sets the comperator. More...
     

    Protected Types

    enum  TriggerMode {
      EDGE = 0,
      LEVEL = 1
    }
     Trigger mode for the interrupts generated by a comparator. More...
     
    enum  ComparatorMode {
      ONE_SHOT = 0,
      PERIODIC = 1
    }
     Comparator mode a comparator is running in. More...
     

    Protected Attributes

    volatile uint64_t config_register
     Comparator Configuration and Capability Register. More...
     
    volatile uint64_t value_register
     Comparator Value Register. More...
     
    volatile uint64_t fsb_register
     Comparator FSB Interrupt Route Register. More...
     

    Detailed Description

    Class abstracting a single HPET comparator.

    Abstracts the access to comparators. This class does not have any constructor, as it is used to encapsulate hardware structures already residing in memory.

    The Registers for HPET comparator n are memory mapped at HPET base address plus offset

    • 0x100 + 0x20 * n for Configuration and Capability Register
    • 0x108 + 0x20 * n for Comparator Value Register and
    • 0x110 + 0x20 * n for FSB Interrupt Route Register

    Use HPET::getComparator to obtain an instance for a particular HPET comparator.

    See also
    IA-PC HPET - 2.3.8 Timer N Configuration and Capabilities Register

    Class Documentation

    struct HPET::Comparator::ConfigAndCapabilitiesRegister.__unnamed__
    Class Members
    uint64_t __pad0__: 1
    TriggerMode trigger_mode: 1 Generate edge or level triggered interrupts.
    uint64_t interrupt_status: 1 Enable (1) or disable (0) interrupts.
    ComparatorMode comparator_mode: 1 periodic or one shot mode
    uint64_t periodic_capable: 1 Is timer capable of periodic mode (read-only)
    CounterSize counter_size: 1 32- or 64bit size (read-only)
    uint64_t set_value: 1 if set to 1, the accumulator can be set in software
    uint64_t __pad1__: 1
    uint64_t small_mode: 1 if set to 1 while supporting 64bit size, the timer runs in 32-bit mode
    uint64_t ioapic_slot: 5 I/O-APIC slot (must be set in mask supported_ioapic_slots)
    uint64_t fsb_interrupt_enabled: 1 if set to 1, the timer will use FSB interrupt mapping
    uint64_t fsb_interrupt_delivery: 1 if set to 1, the timer supports FSB interrupt mapping (read-only)
    uint64_t __pad2__: 16
    uint64_t supported_ioapic_slots: 32 bit mask containing the supported I/O APIC slots (read-only)

    Member Enumeration Documentation

    enum HPET::Comparator::TriggerMode
    protected

    Trigger mode for the interrupts generated by a comparator.

    Enumerator
    EDGE 

    edge triggered

    LEVEL 

    level triggered

    enum HPET::Comparator::ComparatorMode
    protected

    Comparator mode a comparator is running in.

    Enumerator
    ONE_SHOT 

    single shot (non-periodical)

    PERIODIC 

    periodical

    Member Function Documentation

    bool HPET::Comparator::supportsIOAPICSlot ( unsigned  slot) const
    inline

    Can this comparator trigger interrupts at an specific I/O-APIC Slot?

    The standard mapping (not legacy or FSB!) is able to route interrupts to some I/O APIC slots. The possible slots can be determined by the corresponding bit in supported_ioapic_slots of the ConfigAndCapabilitiesRegister

    Note
    Currently Qemu/KVM only supports one slot (2) for comparators, which is shared as well.
    See also
    IA-PC HPET - 2.4.2.2 Mapping Option #2: Standard Option
    Parameters
    slotI/O-APIC slot to check
    Returns
    true if comparator is capable to route interrupts to the given slot
    bool HPET::Comparator::supportsPeriodicInterrupts ( ) const
    inline

    Is this comparator capable of sending peridic interrupts?

    See also
    IA-PC HPET - 2.4.3.2 Mapping Option #2: Standard Option
    Returns
    true if comparator is capable of periodic interrupts
    bool HPET::Comparator::isActive ( ) const

    Check if this comparator triggered an interrupt.

    Reads the corresponding bit of the General Interrupt Status Register if this comparator triggered an interrupt

    Note
    Only works for comparators operating in LEVEL triggered mode!
    See also
    IA-PC HPET - 2.3.6 General Interrupt Status Register
    Returns
    true if interrupt was triggered
    void HPET::Comparator::setHandled ( )

    Mark this comparator interrupt as handled.

    Sets the corresponding bit of the General Interrupt Status Register to mark the interrupt of this comparator as handled.

    Note
    Only works for comparators operating in LEVEL triggered mode!
    See also
    IA-PC HPET - 2.3.6 General Interrupt Status Register
    bool HPET::Comparator::set ( uint64_t  usecs,
    uint8_t  slot,
    bool  periodic 
    )

    Sets the comperator.

    Calculates the required ticks, sets the mode and I/O APIC slot for this comparator.

    Since the I/O APIC slot might be shared with another device, the comparator should be configured to use level triggered interrupts (in standard interrupt mapping). The handler has to use isActive to verify that this HPET comparator was the source and mark it as handled.

    Note
    For periodic comperators, you need to reset the global counter to zero (using HPET::reset) to guarantee that the first interrupt will be fired (and therefore the comparator turns operational).
    The global counter should be disabled while configuring the comparator (or you might lose interrupts)
    See also
    IA-PC HPET - 2.3.9.2.2 Periodic Mode
    Parameters
    usecstime to wait in micro seconds.
    slotI/O APIC slot to be triggered on expiry of waiting time
    periodicIf set, the interrupt will be issued periodically
    Returns
    true iff comperator was set up successful, false otherwise.

    Member Data Documentation

    volatile uint64_t HPET::Comparator::config_register
    protected

    Comparator Configuration and Capability Register.

    In addition to global configuration and value registers, every HPET comparator comes with its own configuration register containing config used locally by the respective timer.

    Note
    Only 32- or 64-bit access allowed (use local temporary copy for modifications)
    See also
    IA-PC HPET - 2.3.8 Timer N Configuration and Capabilities Register
    volatile uint64_t HPET::Comparator::value_register
    protected

    Comparator Value Register.

    The comparator value register yields a different behavior depending on the timer mode:

    For single-shot timers, the interrupt is issued (if enabled) once, as soon as the global timer is equal to the configured value. When using 32-bit timers, an additional interrupt is issued when the global counter overflows.

    For periodic timers, the mode of operation is as follows:

    1. A first interrupt will be triggered when the global counter is equal to the value stored in this register.
    2. From there on, the HPET will automatically increase the value by the initial period. Reading from this registers will return the point in time the next interrupt will be issued.
    Note
    Only 32- or 64-bit access allowed
    See also
    IA-PC HPET - 2.3.10 Timer N FSB Interrupt Route Register
    volatile uint64_t HPET::Comparator::fsb_register
    protected

    Comparator FSB Interrupt Route Register.

    Note
    Currently, this register is not used by StuBS; it's definition is only here for the sake of completeness.
    See also
    IA-PC HPET - 2.3.9.1 Register Definition and Usage Model

    The documentation for this class was generated from the following files:
    • machine/hpet.h
    • machine/hpet.cc
    Friedrich-Alexander-Universität
    Erlangen-Nürnberg

    Schlossplatz 4
    91054 Erlangen
    • Impressum
    • Datenschutz
    • Barrierefreiheit
    • Facebook
    • RSS Feed
    • Xing
    Nach oben