Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::hardwarecommunication::AdvancedProgrammableInterruptController Class Reference

Handles both the Local APIC (boot core) and IO APIC. More...

#include <apic.h>

Public Member Functions

 AdvancedProgrammableInterruptController (AdvancedConfigurationAndPowerInterface *acpi)
 Construct a new Advanced Programmable Interrupt Controller object and initialises the Local APIC and IO APIC, disabling the legacy PIC.
 
 ~AdvancedProgrammableInterruptController ()
 Destroy the Advanced Programmable Interrupt Controller object and frees the Local APIC and IO APIC.
 
LocalAPIClocal_apic () const
 Get the local apic.
 
IOAPICio_apic () const
 Get the io apic.
 

Detailed Description

Handles both the Local APIC (boot core) and IO APIC.

Todo:
Should either handle all Local APICs or none (only boot core right now, others accessed per core directly which is inconsistent)

Definition at line 228 of file apic.h.

Constructor & Destructor Documentation

◆ AdvancedProgrammableInterruptController()

AdvancedProgrammableInterruptController::AdvancedProgrammableInterruptController ( AdvancedConfigurationAndPowerInterface acpi)
explicit

Construct a new Advanced Programmable Interrupt Controller object and initialises the Local APIC and IO APIC, disabling the legacy PIC.

Parameters
acpiThe ACPI interface to get the MADT from

Definition at line 415 of file apic.cpp.

416: m_pic_master_command_port(0x20),
417 m_pic_master_data_port(0x21),
418 m_pic_slave_command_port(0xA0),
419 m_pic_slave_data_port(0xA1)
420{
421
422 // Register this APIC
423 Logger::INFO() << "Setting up APIC\n";
425
426 // Init the Local APIC
427 Logger::DEBUG() << "Initialising Local APIC\n";
428 m_local_apic = new LocalAPIC();
429
430 // Disable the legacy mode PIC
431 Logger::DEBUG() << "Disabling PIC\n";
432 disable_pic();
433
434 // Init the IO APIC
435 Logger::DEBUG() << "Initialising IO APIC\n";
436 m_io_apic = new IOAPIC(acpi);
437}
static Logger DEBUG()
Gets active logger set to DEBUG level.
Definition logger.cpp:193
static Logger INFO()
Gets active logger set to info level.
Definition logger.cpp:171
Handles the IO APIC in the system (one per system)
Definition apic.h:193
static InterruptManager * active_interrupt_manager()
Gets the active interrupt manager.
void set_apic(AdvancedProgrammableInterruptController *apic)
Sets the APIC.
Handles the local APIC for the current core.
Definition apic.h:24

References MaxOS::hardwarecommunication::InterruptManager::active_interrupt_manager(), MaxOS::Logger::DEBUG(), MaxOS::Logger::INFO(), and MaxOS::hardwarecommunication::InterruptManager::set_apic().

◆ ~AdvancedProgrammableInterruptController()

AdvancedProgrammableInterruptController::~AdvancedProgrammableInterruptController ( )

Destroy the Advanced Programmable Interrupt Controller object and frees the Local APIC and IO APIC.

Definition at line 442 of file apic.cpp.

442 {
443
444 // Free the memory
445 delete m_local_apic;
446 delete m_io_apic;
447}

Member Function Documentation

◆ io_apic()

IOAPIC * AdvancedProgrammableInterruptController::io_apic ( ) const

Get the io apic.

Returns
The io apic

Definition at line 490 of file apic.cpp.

490 {
491
492 return m_io_apic;
493}

Referenced by MaxOS::system::CPU::find_cores().

◆ local_apic()

LocalAPIC * AdvancedProgrammableInterruptController::local_apic ( ) const

Get the local apic.

Returns
The local apic

Definition at line 480 of file apic.cpp.

480 {
481
482 return m_local_apic;
483}

Referenced by MaxOS::drivers::clock::Clock::calibrate(), and MaxOS::system::CPU::CPU().


The documentation for this class was generated from the following files: