summaryrefslogtreecommitdiffstats
path: root/src/audio_core/hle/pipe.h
blob: 382d35e873f81a5027693a4ff3016f8984dfa6ca (plain) (blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include <cstddef>
#include <vector>

#include "common/common_types.h"

namespace DSP {
namespace HLE {

/// Reset the pipes by setting pipe positions back to the beginning.
void ResetPipes();

enum class DspPipe {
    Debug = 0,
    Dma = 1,
    Audio = 2,
    Binary = 3,
    DspPipe_MAX
};

/**
 * Read a DSP pipe.
 * @param pipe_number The Pipe ID
 * @param length How much data to request.
 * @return The data read from the pipe. The size of this vector can be less than the length requested.
 */
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length);

/**
 * How much data is left in pipe
 * @param pipe_number The Pipe ID
 * @return The amount of data remaning in the pipe. This is the maximum length PipeRead will return.
 */
size_t GetPipeReadableSize(DspPipe pipe_number);

/**
 * Write to a DSP pipe.
 * @param pipe_number The Pipe ID
 * @param buffer The data to write to the pipe.
 */
void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer);

enum class DspState {
    Off,
    On,
    Sleeping
};
/// Get the state of the DSP
DspState GetDspState();

} // namespace HLE
} // namespace DSP