| 788 | |
| 789 | template <LpcmDecCmdType type> |
| 790 | error_code LpcmDecContext::send_command(ppu_thread& ppu, auto&&... args) |
| 791 | { |
| 792 | ppu.state += cpu_flag::wait; |
| 793 | |
| 794 | if (error_code ret = sys_mutex_lock(ppu, queue_size_mutex, 0); ret != CELL_OK) |
| 795 | { |
| 796 | return ret; |
| 797 | } |
| 798 | |
| 799 | if (cmd_queue.full()) |
| 800 | { |
| 801 | ensure(sys_mutex_unlock(ppu, queue_size_mutex) == CELL_OK); // Error code isn't checked on LLE |
| 802 | return CELL_ADEC_ERROR_BUSY; |
| 803 | } |
| 804 | |
| 805 | // LLE copies the parameters directly into the context |
| 806 | if constexpr (type == LpcmDecCmdType::start_seq) |
| 807 | { |
| 808 | *lpcm_param = {args...}; |
| 809 | } |
| 810 | |
| 811 | if (error_code ret = sys_mutex_lock(ppu, queue_mutex, 0); ret != CELL_OK) |
| 812 | { |
| 813 | ensure(sys_mutex_unlock(ppu, queue_size_mutex) == CELL_OK); // Error code isn't checked on LLE |
| 814 | return ret; |
| 815 | } |
| 816 | |
| 817 | cmd_queue.emplace(type, std::forward<decltype(args)>(args)...); |
| 818 | |
| 819 | if (error_code ret = sys_mutex_unlock(ppu, queue_mutex); ret != CELL_OK || (ret = cmd_available.release(ppu)) != CELL_OK) |
| 820 | { |
| 821 | ensure(sys_mutex_unlock(ppu, queue_size_mutex) == CELL_OK); // Error code isn't checked on LLE |
| 822 | return ret; |
| 823 | } |
| 824 | |
| 825 | return sys_mutex_unlock(ppu, queue_size_mutex); |
| 826 | } |
| 827 | |
| 828 | inline error_code LpcmDecContext::release_output(ppu_thread& ppu) |
| 829 | { |
nothing calls this directly
no test coverage detected