summaryrefslogtreecommitdiff
path: root/Kernel/Devices/Audio/Management.h
blob: 703bdb8c39ce3870c1c04f54f5ba0e2cfe91f0a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Badge.h>
#include <AK/Error.h>
#include <AK/IntrusiveList.h>
#include <AK/NonnullRefPtr.h>
#include <AK/OwnPtr.h>
#include <AK/Types.h>
#include <Kernel/Devices/Audio/Controller.h>

namespace Kernel {

class AudioManagement {

public:
    AudioManagement();
    static AudioManagement& the();

    static MajorNumber audio_type_major_number();
    static MinorNumber generate_storage_minor_number();

    bool initialize();

private:
    ErrorOr<NonnullRefPtr<AudioController>> determine_audio_device(PCI::DeviceIdentifier const& device_identifier) const;

    void enumerate_hardware_controllers();
    SpinlockProtected<IntrusiveList<&AudioController::m_node>, LockRank::None> m_controllers_list;
};

}