DMA List commands

cellAudio: multiple queue support
sys_cond simplified
cellFsMkdir (?)
This commit is contained in:
Nekotekina 2014-03-15 19:43:14 +04:00
parent 024aa0660c
commit 60d922da11
11 changed files with 215 additions and 175 deletions

View file

@ -60,6 +60,8 @@ int cellAudioInit()
memset(buffer2, 0, sizeof(buffer2));
memset(oal_buffer.get(), 0, oal_buffer_size * sizeof(u16));
Array<u64> keys;
if(m_audio_out)
{
m_audio_out->Init();
@ -144,8 +146,16 @@ int cellAudioInit()
}
// send aftermix event (normal audio event)
// TODO: check event source
Emu.GetEventManager().SendEvent(m_config.event_key, 0x10103000e010e07, 0, 0, 0);
{
std::lock_guard<std::mutex> lock(m_config.m_mutex);
keys.SetCount(m_config.m_keys.GetCount());
memcpy(keys.GetPtr(), m_config.m_keys.GetPtr(), sizeof(u64) * keys.GetCount());
}
for (u32 i = 0; i < keys.GetCount(); i++)
{
// TODO: check event source
Emu.GetEventManager().SendEvent(keys[i], 0x10103000e010e07, 0, 0, 0);
}
oal_buffer_offset += sizeof(buffer) / sizeof(float);
@ -441,22 +451,27 @@ int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key)
{
cellAudio.Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.GetAddr(), key.GetAddr());
while (Emu.GetEventManager().CheckKey(m_config.event_key))
std::lock_guard<std::mutex> lock(m_config.m_mutex);
u64 event_key = 0;
while (Emu.GetEventManager().CheckKey((event_key << 48) | 0x80004d494f323221))
{
m_config.event_key++; // experimental
event_key++; // experimental
//return CELL_AUDIO_ERROR_EVENT_QUEUE;
}
event_key = (event_key << 48) | 0x80004d494f323221; // left part: 0x8000, 0x8001, 0x8002 ...
EventQueue* eq = new EventQueue(SYS_SYNC_FIFO, SYS_PPU_QUEUE, m_config.event_key, m_config.event_key, 32);
EventQueue* eq = new EventQueue(SYS_SYNC_FIFO, SYS_PPU_QUEUE, event_key, event_key, 32);
if (!Emu.GetEventManager().RegisterKey(eq, m_config.event_key))
if (!Emu.GetEventManager().RegisterKey(eq, event_key))
{
delete eq;
return CELL_AUDIO_ERROR_EVENT_QUEUE;
}
m_config.m_keys.AddCpy(event_key);
id = cellAudio.GetNewId(eq);
key = m_config.event_key;
key = event_key;
return CELL_OK;
}
@ -471,7 +486,9 @@ int cellAudioSetNotifyEventQueue(u64 key)
{
cellAudio.Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key);
//m_config.event_key = key;
std::lock_guard<std::mutex> lock(m_config.m_mutex);
m_config.m_keys.AddCpy(key);
/*EventQueue* eq;
if (!Emu.GetEventManager().GetEventQueue(key, eq))
@ -494,13 +511,30 @@ int cellAudioRemoveNotifyEventQueue(u64 key)
{
cellAudio.Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key);
EventQueue* eq;
if (!Emu.GetEventManager().GetEventQueue(key, eq))
std::lock_guard<std::mutex> lock(m_config.m_mutex);
bool found = false;
for (u32 i = 0; i < m_config.m_keys.GetCount(); i++)
{
if (m_config.m_keys[i] == key)
{
m_config.m_keys.RemoveAt(i);
found = true;
break;
}
}
if (!found)
{
// ???
return CELL_AUDIO_ERROR_PARAM;
}
m_config.event_key = 0x80004d494f323221;
/*EventQueue* eq;
if (!Emu.GetEventManager().GetEventQueue(key, eq))
{
return CELL_AUDIO_ERROR_PARAM;
}*/
// TODO: disconnect port