Merge pull request #6872 from lioncash/exi

EXI_DeviceEthernet: Minor cleanup
This commit is contained in:
Tilka 2018-05-17 02:17:22 +01:00 committed by GitHub
commit 5b96abf7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 44 deletions

View File

@ -63,7 +63,7 @@ bool CEXIETHERNET::SendFrame(const u8* frame, u32 size)
} }
} }
static void ReadThreadHandler(CEXIETHERNET* self) void CEXIETHERNET::ReadThreadHandler(CEXIETHERNET* self)
{ {
while (!self->readThreadShutdown.IsSet()) while (!self->readThreadShutdown.IsSet())
{ {

View File

@ -125,7 +125,7 @@ bool CEXIETHERNET::SendFrame(const u8* frame, u32 size)
} }
#ifdef __linux__ #ifdef __linux__
static void ReadThreadHandler(CEXIETHERNET* self) void CEXIETHERNET::ReadThreadHandler(CEXIETHERNET* self)
{ {
while (!self->readThreadShutdown.IsSet()) while (!self->readThreadShutdown.IsSet())
{ {

View File

@ -263,7 +263,7 @@ bool CEXIETHERNET::IsActivated()
return mHAdapter != INVALID_HANDLE_VALUE; return mHAdapter != INVALID_HANDLE_VALUE;
} }
static void ReadThreadHandler(CEXIETHERNET* self) void CEXIETHERNET::ReadThreadHandler(CEXIETHERNET* self)
{ {
while (!self->readThreadShutdown.IsSet()) while (!self->readThreadShutdown.IsSet())
{ {

View File

@ -26,9 +26,7 @@ CEXIETHERNET::CEXIETHERNET()
{ {
tx_fifo = std::make_unique<u8[]>(BBA_TXFIFO_SIZE); tx_fifo = std::make_unique<u8[]>(BBA_TXFIFO_SIZE);
mBbaMem = std::make_unique<u8[]>(BBA_MEM_SIZE); mBbaMem = std::make_unique<u8[]>(BBA_MEM_SIZE);
mRecvBuffer = std::make_unique<u8[]>(BBA_RECV_SIZE); mRecvBuffer = std::make_unique<u8[]>(BBA_RECV_SIZE);
mRecvBufferLength = 0;
MXHardReset(); MXHardReset();
@ -48,15 +46,6 @@ CEXIETHERNET::CEXIETHERNET()
// HACK: .. fully established 100BASE-T link // HACK: .. fully established 100BASE-T link
mBbaMem[BBA_NWAYS] = NWAYS_LS100 | NWAYS_LPNWAY | NWAYS_100TXF | NWAYS_ANCLPT; mBbaMem[BBA_NWAYS] = NWAYS_LS100 | NWAYS_LPNWAY | NWAYS_100TXF | NWAYS_ANCLPT;
#if defined(_WIN32)
mHAdapter = INVALID_HANDLE_VALUE;
memset(&mReadOverlapped, 0, sizeof(mReadOverlapped));
memset(&mWriteOverlapped, 0, sizeof(mWriteOverlapped));
mWritePending = false;
#elif defined(__linux__) || defined(__APPLE__)
fd = -1;
#endif
} }
CEXIETHERNET::~CEXIETHERNET() CEXIETHERNET::~CEXIETHERNET()

View File

@ -210,7 +210,7 @@ public:
void DMARead(u32 addr, u32 size) override; void DMARead(u32 addr, u32 size) override;
void DoState(PointerWrap& p) override; void DoState(PointerWrap& p) override;
// private: private:
struct struct
{ {
enum enum
@ -227,7 +227,7 @@ public:
u16 address; u16 address;
bool valid; bool valid;
} transfer; } transfer = {};
enum enum
{ {
@ -251,28 +251,14 @@ public:
TRANSFER = 0x80 TRANSFER = 0x80
}; };
u8 revision_id; u8 revision_id = 0; // 0xf0
u8 interrupt_mask; u8 interrupt_mask = 0;
u8 interrupt; u8 interrupt = 0;
u16 device_id; u16 device_id = 0xD107;
u8 acstart; u8 acstart = 0x4E;
u32 hash_challenge; u32 hash_challenge = 0;
u32 hash_response; u32 hash_response = 0;
u8 hash_status; u8 hash_status = 0;
EXIStatus()
{
device_id = 0xd107;
revision_id = 0; // 0xf0;
acstart = 0x4e;
interrupt_mask = 0;
interrupt = 0;
hash_challenge = 0;
hash_response = 0;
hash_status = 0;
}
} exi_status; } exi_status;
struct Descriptor struct Descriptor
@ -312,6 +298,7 @@ public:
std::unique_ptr<u8[]> tx_fifo; std::unique_ptr<u8[]> tx_fifo;
// TAP interface // TAP interface
static void ReadThreadHandler(CEXIETHERNET* self);
bool Activate(); bool Activate();
void Deactivate(); void Deactivate();
bool IsActivated(); bool IsActivated();
@ -321,16 +308,16 @@ public:
void RecvStop(); void RecvStop();
std::unique_ptr<u8[]> mRecvBuffer; std::unique_ptr<u8[]> mRecvBuffer;
u32 mRecvBufferLength; u32 mRecvBufferLength = 0;
#if defined(_WIN32) #if defined(_WIN32)
HANDLE mHAdapter; HANDLE mHAdapter = INVALID_HANDLE_VALUE;
OVERLAPPED mReadOverlapped; OVERLAPPED mReadOverlapped = {};
OVERLAPPED mWriteOverlapped; OVERLAPPED mWriteOverlapped = {};
std::vector<u8> mWriteBuffer; std::vector<u8> mWriteBuffer;
bool mWritePending; bool mWritePending = false;
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
int fd; int fd = -1;
#endif #endif
#if defined(WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ #if defined(WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \