Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More sys_uart packets #11332

Merged
merged 3 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Utilities/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2849,7 +2849,7 @@ void thread_ctrl::set_native_priority(int priority)

if (int err = pthread_setschedparam(pthread_self(), policy, &param))
{
sig_log.error("pthraed_setschedparam() failed: %d", err);
sig_log.error("pthread_setschedparam() failed: %d", err);
}
#endif
}
Expand Down
33 changes: 33 additions & 0 deletions Utilities/simple_ringbuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ simple_ringbuf::simple_ringbuf(u32 size)
set_buf_size(size);
}

simple_ringbuf::simple_ringbuf(simple_ringbuf&& other)
{
rw_ptr = other.rw_ptr.load();
buf_size = other.buf_size;
buf = std::move(other.buf);
initialized = other.initialized.observe();

other.buf_size = 0;
other.rw_ptr = 0;
other.initialized = false;
}

simple_ringbuf& simple_ringbuf::operator=(simple_ringbuf&& other)
{
if (this == &other) return *this;

rw_ptr = other.rw_ptr.load();
buf_size = other.buf_size;
buf = std::move(other.buf);
initialized = other.initialized.observe();

other.buf_size = 0;
other.rw_ptr = 0;
other.initialized = false;

return *this;
}

u32 simple_ringbuf::get_free_size()
{
const u64 _rw_ptr = rw_ptr;
Expand All @@ -19,6 +47,11 @@ u32 simple_ringbuf::get_used_size()
return buf_size - 1 - get_free_size();
}

u32 simple_ringbuf::get_total_size()
{
return buf_size;
}

void simple_ringbuf::set_buf_size(u32 size)
{
ensure(size);
Expand Down
7 changes: 7 additions & 0 deletions Utilities/simple_ringbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ class simple_ringbuf
simple_ringbuf() {};
simple_ringbuf(u32 size);

simple_ringbuf(const simple_ringbuf&) = delete;
simple_ringbuf& operator=(const simple_ringbuf&) = delete;

simple_ringbuf(simple_ringbuf&& other);
simple_ringbuf& operator=(simple_ringbuf&& other);

u32 get_free_size();
u32 get_used_size();
u32 get_total_size();

// Thread unsafe functions.
void set_buf_size(u32 size);
Expand Down
5 changes: 4 additions & 1 deletion rpcs3/Emu/Cell/lv2/lv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,10 @@ void lv2_obj::sleep(cpu_thread& cpu, const u64 timeout)
{
vm::temporary_unlock(cpu);
cpu_counter::remove(&cpu);
std::lock_guard{g_mutex}, sleep_unlocked(cpu, timeout);
{
std::lock_guard lock{g_mutex};
sleep_unlocked(cpu, timeout);
}
g_to_awake.clear();
}

Expand Down
41 changes: 41 additions & 0 deletions rpcs3/Emu/Cell/lv2/sys_rsxaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,47 @@
#include "Emu/Memory/vm_ptr.h"
#include "Emu/Cell/ErrorCodes.h"

enum : u32
{
SYS_RSXAUDIO_SERIAL_STREAM_CNT = 4,
SYS_RSXAUDIO_STREAM_SIZE = 1024,
SYS_RSXAUDIO_DATA_BLK_SIZE = 256,

SYS_RSXAUDIO_RINGBUF_BLK_SZ_SERIAL = 0x1000,
SYS_RSXAUDIO_RINGBUF_BLK_SZ_SPDIF = 0x400,

SYS_RSXAUDIO_RINGBUF_SZ = 16,

SYS_RSXAUDIO_AVPORT_CNT = 5,

SYS_RSXAUDIO_FREQ_BASE_384K = 384000,
SYS_RSXAUDIO_FREQ_BASE_352K = 352800,

SYS_RSXAUDIO_PORT_SERIAL = 0,
SYS_RSXAUDIO_PORT_SPDIF_0 = 1,
SYS_RSXAUDIO_PORT_SPDIF_1 = 2,
SYS_RSXAUDIO_PORT_INVALID = 0xFF,
SYS_RSXAUDIO_PORT_CNT = 3,

SYS_RSXAUDIO_SPDIF_CNT = 2,
};

enum class RsxaudioAvportIdx : u8
{
HDMI_0 = 0,
HDMI_1 = 1,
AVMULTI = 2,
SPDIF_0 = 3,
SPDIF_1 = 4,
};

enum class RsxaudioSampleSize : u8
{
_16BIT = 2,
_32BIT = 4,
};


// SysCalls

error_code sys_rsxaudio_initialize(vm::ptr<u32> handle);
Expand Down
Loading