serenity/Kernel/Bus/USB/USBController.h
Andreas Kling 79fa9765ca Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace!
This was a slightly tedious refactoring that took a long time, so it's
not unlikely that some bugs crept in.

Nevertheless, it does pass basic functionality testing, and it's just
real nice to finally see the same pattern in all contexts. :^)
2021-11-08 01:10:53 +01:00

39 lines
863 B
C++

/*
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/RefCounted.h>
#include <Kernel/Bus/USB/USBDevice.h>
#include <Kernel/Bus/USB/USBTransfer.h>
namespace Kernel::USB {
class USBController : public RefCounted<USBController> {
public:
virtual ~USBController() = default;
virtual ErrorOr<void> initialize() = 0;
virtual ErrorOr<void> reset() = 0;
virtual ErrorOr<void> stop() = 0;
virtual ErrorOr<void> start() = 0;
virtual ErrorOr<size_t> submit_control_transfer(Transfer&) = 0;
u8 allocate_address();
private:
u8 m_next_device_index { 1 };
IntrusiveListNode<USBController, NonnullRefPtr<USBController>> m_controller_list_node;
public:
using List = IntrusiveList<&USBController::m_controller_list_node>;
};
}