2020-02-28 19:22:32 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-02-28 19:22:32 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/OwnPtr.h>
|
|
|
|
#include <AK/Types.h>
|
|
|
|
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
2020-03-22 03:12:45 +03:00
|
|
|
#include <Kernel/Interrupts/IRQController.h>
|
2020-02-28 19:22:32 +03:00
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
|
|
class SpuriousInterruptHandler final : public GenericInterruptHandler {
|
|
|
|
public:
|
|
|
|
static void initialize(u8 interrupt_number);
|
|
|
|
virtual ~SpuriousInterruptHandler();
|
2021-06-05 09:00:18 +03:00
|
|
|
virtual bool handle_interrupt(const RegisterState& regs) override;
|
2020-02-28 19:22:32 +03:00
|
|
|
|
|
|
|
void register_handler(GenericInterruptHandler&);
|
|
|
|
void unregister_handler(GenericInterruptHandler&);
|
|
|
|
|
|
|
|
virtual bool eoi() override;
|
|
|
|
|
|
|
|
virtual size_t sharing_devices_count() const override { return 1; }
|
|
|
|
virtual bool is_shared_handler() const override { return false; }
|
|
|
|
virtual bool is_sharing_with_others() const override { return false; }
|
|
|
|
|
2020-03-05 20:13:55 +03:00
|
|
|
virtual HandlerType type() const override { return HandlerType::SpuriousInterruptHandler; }
|
2021-03-23 20:51:15 +03:00
|
|
|
virtual const char* purpose() const override;
|
2020-03-08 03:35:57 +03:00
|
|
|
virtual const char* controller() const override;
|
2020-02-28 19:22:32 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
void enable_interrupt_vector();
|
|
|
|
void disable_interrupt_vector();
|
|
|
|
explicit SpuriousInterruptHandler(u8 interrupt_number);
|
|
|
|
bool m_enabled;
|
2020-12-19 09:49:15 +03:00
|
|
|
bool m_real_irq { false };
|
2020-02-28 23:33:41 +03:00
|
|
|
RefPtr<IRQController> m_responsible_irq_controller;
|
2020-02-28 19:22:32 +03:00
|
|
|
OwnPtr<GenericInterruptHandler> m_real_handler;
|
|
|
|
};
|
|
|
|
}
|