本文整理汇总了C++中ipc_msg_queue类的典型用法代码示例。如果您正苦于以下问题:C++ ipc_msg_queue类的具体用法?C++ ipc_msg_queue怎么用?C++ ipc_msg_queue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ipc_msg_queue类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EnqueueEvent
namespace WII_IPC_HLE_Interface
{
typedef std::map<u32, std::shared_ptr<IWII_IPC_HLE_Device>> TDeviceMap;
static TDeviceMap g_DeviceMap;
// STATE_TO_SAVE
#define IPC_MAX_FDS 0x18
#define ES_MAX_COUNT 2
static std::shared_ptr<IWII_IPC_HLE_Device> g_FdMap[IPC_MAX_FDS];
static bool es_inuse[ES_MAX_COUNT];
static std::shared_ptr<IWII_IPC_HLE_Device> es_handles[ES_MAX_COUNT];
typedef std::deque<u32> ipc_msg_queue;
static ipc_msg_queue request_queue; // ppc -> arm
static ipc_msg_queue reply_queue; // arm -> ppc
static ipc_msg_queue ack_queue; // arm -> ppc
static int event_enqueue;
static u64 last_reply_time;
static const u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
static const u64 ENQUEUE_ACKNOWLEDGEMENT_FLAG = 0x200000000ULL;
static void EnqueueEvent(u64 userdata, int cycles_late = 0)
{
if (userdata & ENQUEUE_ACKNOWLEDGEMENT_FLAG)
{
ack_queue.push_back((u32)userdata);
}
else if (userdata & ENQUEUE_REQUEST_FLAG)
{
request_queue.push_back((u32)userdata);
}
else
{
reply_queue.push_back((u32)userdata);
}
Update();
}
static u32 num_devices;
template <typename T>
std::shared_ptr<T> AddDevice(const char* deviceName)
{
auto device = std::make_shared<T>(num_devices, deviceName);
g_DeviceMap[num_devices] = device;
num_devices++;
return device;
}
void Init()
{
bool Wee_speeak_support = SConfig::GetInstance().bWiiSpeakSupport;
_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init");
CWII_IPC_HLE_Device_es::m_ContentFile = "";
num_devices = 0;
// Build hardware devices
if (Wee_speeak_support)
{
AddDevice<CWII_IPC_HLE_Device_usb_oh0>("/dev/usb/oh0");
AddDevice<CWII_IPC_HLE_Device_usb_ven>("/dev/usb/ven");
AddDevice<CWII_IPC_HLE_Device_usb_oh0_57e_308>("/dev/usb/oh0/57e/308");
AddDevice<CWII_IPC_HLE_Device_usb_oh0_46d_a03>("/dev/usb/oh0/46d/a03");
}
AddDevice<CWII_IPC_HLE_Device_usb_oh1_57e_305>("/dev/usb/oh1/57e/305");
AddDevice<CWII_IPC_HLE_Device_stm_immediate>("/dev/stm/immediate");
AddDevice<CWII_IPC_HLE_Device_stm_eventhook>("/dev/stm/eventhook");
AddDevice<CWII_IPC_HLE_Device_fs>("/dev/fs");
// IOS allows two ES devices at a time
for (u32 j=0; j<ES_MAX_COUNT; j++)
{
es_handles[j] = AddDevice<CWII_IPC_HLE_Device_es>("/dev/es");
es_inuse[j] = false;
}
AddDevice<CWII_IPC_HLE_Device_di>("/dev/di");
AddDevice<CWII_IPC_HLE_Device_net_kd_request>("/dev/net/kd/request");
AddDevice<CWII_IPC_HLE_Device_net_kd_time>("/dev/net/kd/time");
AddDevice<CWII_IPC_HLE_Device_net_ncd_manage>("/dev/net/ncd/manage");
AddDevice<CWII_IPC_HLE_Device_net_wd_command>("/dev/net/wd/command");
AddDevice<CWII_IPC_HLE_Device_net_ip_top>("/dev/net/ip/top");
AddDevice<CWII_IPC_HLE_Device_net_ssl>("/dev/net/ssl");
AddDevice<CWII_IPC_HLE_Device_usb_kbd>("/dev/usb/kbd");
AddDevice<CWII_IPC_HLE_Device_sdio_slot0>("/dev/sdio/slot0");
AddDevice<CWII_IPC_HLE_Device_stub>("/dev/sdio/slot1");
#if defined(__LIBUSB__) || defined(_WIN32)
AddDevice<CWII_IPC_HLE_Device_hid>("/dev/usb/hid");
#else
AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/hid");
#endif
AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/oh1");
AddDevice<IWII_IPC_HLE_Device>("_Unimplemented_Device_");
event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEvent);
//.........这里部分代码省略.........
开发者ID:Jack-Walker,项目名称:Ishiiruka,代码行数:101,代码来源:WII_IPC_HLE.cpp
示例2: EnqueueEventCallback
static void EnqueueEventCallback(u64 userdata, int)
{
if (userdata & ENQUEUE_ACKNOWLEDGEMENT_FLAG)
{
ack_queue.push_back((u32)userdata);
}
else if (userdata & ENQUEUE_REQUEST_FLAG)
{
request_queue.push_back((u32)userdata);
}
else
{
reply_queue.push_back((u32)userdata);
}
Update();
}
开发者ID:calmbrain,项目名称:dolphin,代码行数:16,代码来源:WII_IPC_HLE.cpp
示例3: Reset
void Reset(bool _bHard)
{
CoreTiming::RemoveAllEvents(event_enqueue);
for (IWII_IPC_HLE_Device*& dev : g_FdMap)
{
if (dev != nullptr && !dev->IsHardware())
{
// close all files and delete their resources
dev->Close(0, true);
delete dev;
}
dev = nullptr;
}
for (bool& in_use : es_inuse)
{
in_use = false;
}
for (const auto& entry : g_DeviceMap)
{
if (entry.second)
{
// Force close
entry.second->Close(0, true);
// Hardware should not be deleted unless it is a hard reset
if (_bHard)
delete entry.second;
}
}
if (_bHard)
{
g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end());
}
request_queue.clear();
reply_queue.clear();
last_reply_time = 0;
}
开发者ID:calmbrain,项目名称:dolphin,代码行数:43,代码来源:WII_IPC_HLE.cpp
示例4: Reset
void Reset(bool _bHard)
{
CoreTiming::RemoveAllEvents(event_enqueue);
for (auto& dev : g_FdMap)
{
if (dev && !dev->IsHardware())
{
// close all files and delete their resources
dev->Close(0, true);
}
dev.reset();
}
for (bool& in_use : es_inuse)
{
in_use = false;
}
for (const auto& entry : g_DeviceMap)
{
if (entry.second)
{
// Force close
entry.second->Close(0, true);
}
}
if (_bHard)
{
g_DeviceMap.clear();
}
request_queue.clear();
reply_queue.clear();
last_reply_time = 0;
}
开发者ID:Jack-Walker,项目名称:Ishiiruka,代码行数:38,代码来源:WII_IPC_HLE.cpp
示例5: Update
// This is called every IPC_HLE_PERIOD from SystemTimers.cpp
// Takes care of routing ipc <-> ipc HLE
void Update()
{
if (!WII_IPCInterface::IsReady())
return;
if (request_queue.size())
{
WII_IPCInterface::GenerateAck(request_queue.front());
INFO_LOG(WII_IPC_HLE, "||-- Acknowledge IPC Request @ 0x%08x", request_queue.front());
u32 command = request_queue.front();
request_queue.pop_front();
ExecuteCommand(command);
return;
}
if (reply_queue.size())
{
WII_IPCInterface::GenerateReply(reply_queue.front());
INFO_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", reply_queue.front());
reply_queue.pop_front();
return;
}
if (ack_queue.size())
{
WII_IPCInterface::GenerateAck(ack_queue.front());
WARN_LOG(WII_IPC_HLE, "<<-- Double-ack to IPC Request @ 0x%08x", ack_queue.front());
ack_queue.pop_front();
return;
}
}
开发者ID:calmbrain,项目名称:dolphin,代码行数:33,代码来源:WII_IPC_HLE.cpp
注:本文中的ipc_msg_queue类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论