pipe.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2016 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <cstddef>
  6. #include <vector>
  7. #include "common/common_types.h"
  8. namespace DSP {
  9. namespace HLE {
  10. /// Reset the pipes by setting pipe positions back to the beginning.
  11. void ResetPipes();
  12. enum class DspPipe {
  13. Debug = 0,
  14. Dma = 1,
  15. Audio = 2,
  16. Binary = 3
  17. };
  18. constexpr size_t NUM_DSP_PIPE = 8;
  19. /**
  20. * Read a DSP pipe.
  21. * @param pipe_number The Pipe ID
  22. * @param length How much data to request.
  23. * @return The data read from the pipe. The size of this vector can be less than the length requested.
  24. */
  25. std::vector<u8> PipeRead(DspPipe pipe_number, u32 length);
  26. /**
  27. * How much data is left in pipe
  28. * @param pipe_number The Pipe ID
  29. * @return The amount of data remaning in the pipe. This is the maximum length PipeRead will return.
  30. */
  31. size_t GetPipeReadableSize(DspPipe pipe_number);
  32. /**
  33. * Write to a DSP pipe.
  34. * @param pipe_number The Pipe ID
  35. * @param buffer The data to write to the pipe.
  36. */
  37. void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer);
  38. enum class DspState {
  39. Off,
  40. On,
  41. Sleeping
  42. };
  43. /// Get the state of the DSP
  44. DspState GetDspState();
  45. } // namespace HLE
  46. } // namespace DSP