1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 03:55:06 +00:00
serenity/Kernel/Bus/USB/UHCI/UHCIRootHub.h
sin-ack 566c5d1e99 AK+Kernel: Move KResult.h to Kernel/API for userspace access
This commit moves the KResult and KResultOr objects to Kernel/API to
signify that they may now be freely used by userspace code at points
where a syscall-related error result is to be expected. It also exposes
KResult and KResultOr to the global namespace to make it nicer to use
for userspace code.
2021-09-05 12:54:48 +02:00

39 lines
873 B
C++

/*
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullRefPtr.h>
#include <Kernel/API/KResult.h>
#include <Kernel/Bus/USB/USBHub.h>
#include <Kernel/Bus/USB/USBTransfer.h>
namespace Kernel::USB {
class UHCIController;
class UHCIRootHub {
public:
static KResultOr<NonnullOwnPtr<UHCIRootHub>> try_create(NonnullRefPtr<UHCIController>);
UHCIRootHub(NonnullRefPtr<UHCIController>);
~UHCIRootHub() = default;
KResult setup(Badge<UHCIController>);
u8 device_address() const { return m_hub->address(); }
KResultOr<size_t> handle_control_transfer(Transfer& transfer);
void check_for_port_updates() { m_hub->check_for_port_updates(); }
private:
NonnullRefPtr<UHCIController> m_uhci_controller;
RefPtr<Hub> m_hub;
};
}