LookingGlass/host/IVSHMEM.h
2017-10-31 23:22:55 +11:00

44 lines
751 B
C++

#pragma once
#define W32_LEAN_AND_MEAN
#include <Windows.h>
#include <stdbool.h>
class IVSHMEM
{
public:
static IVSHMEM * Get()
{
if (!m_instance)
m_instance = new IVSHMEM();
return m_instance;
}
bool Initialize();
void DeInitialize();
bool IsInitialized();
UINT64 GetSize();
UINT16 GetPeerID();
UINT16 GetVectors();
void * GetMemory();
HANDLE CreateVectorEvent(UINT16 vector);
bool RingDoorbell(UINT16 peerID, UINT16 door);
protected:
private:
static IVSHMEM * m_instance;
IVSHMEM();
~IVSHMEM();
bool m_initialized;
HANDLE m_handle;
UINT64 m_size ; bool m_gotSize ;
UINT16 m_peerID ; bool m_gotPeerID;
void * m_memory ; bool m_gotMemory;
UINT16 m_vectors; bool m_gotVectors;
};