Added shuffle2's (unused for now) GBA Serial Interface device code. This calls for implementing a pad type chooser window, anyone in?

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2071 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-02-02 21:40:08 +00:00
parent ae2fa6e35c
commit 22135b7696
3 changed files with 169 additions and 0 deletions

View File

@ -626,6 +626,14 @@
RelativePath=".\Src\HW\SI_Device.h"
>
</File>
<File
RelativePath=".\Src\HW\SI_DeviceGBAController.cpp"
>
</File>
<File
RelativePath=".\Src\HW\SI_DeviceGBAController.h"
>
</File>
<File
RelativePath=".\Src\HW\SI_DeviceGCController.cpp"
>

View File

@ -0,0 +1,99 @@
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "SI_Device.h"
#include "SI_DeviceGBAController.h"
#include "../PluginManager.h"
#include "EXI_Device.h"
CSIDevice_GBA::CSIDevice_GBA(int _iDeviceNumber) :
ISIDevice(_iDeviceNumber)
{
}
int CSIDevice_GBA::RunBuffer(u8* _pBuffer, int _iLength)
{
// for debug logging only
ISIDevice::RunBuffer(_pBuffer, _iLength);
int iPosition = 0;
while(iPosition < _iLength)
{
// read the command
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
iPosition++;
// handle it
switch(command)
{
case CMD_RESET:
{
*(u32*)&_pBuffer[0] = SI_GBA;
iPosition = _iLength; // break the while loop
LOG(SERIALINTERFACE, "SI-GBA CMD_RESET");
}
break;
case CMD_STATUS: //Same behavior as CMD_RESET: send 0x0004, then lower 8 bits of SIOSTAT
{
*(u32*)&_pBuffer[0] = SI_GBA;
iPosition = _iLength; // break the while loop
LOG(SERIALINTERFACE, "SI-GBA CMD_STATUS");
}
break;
case CMD_WRITE:
{
LOG(SERIALINTERFACE, "SI-GBA CMD_WRITE");
}
break;
case CMD_READ:
{
LOG(SERIALINTERFACE, "SI-GBA CMD_READ");
}
break;
default:
{
LOG(SERIALINTERFACE, "unknown SI-GBA command (0x%x)", command);
//PanicAlert("SI: Unknown command");
iPosition = _iLength;
}
break;
}
}
return iPosition;
}
// __________________________________________________________________________________________________
// GetData
//
bool
CSIDevice_GBA::GetData(u32& _Hi, u32& _Low)
{
LOG(SERIALINTERFACE, "SI-GBA GetData Hi: (0x%x) Low: (0x%x)", _Hi, _Low);
return true;
}
// __________________________________________________________________________________________________
// SendCommand
//
void
CSIDevice_GBA::SendCommand(u32 _Cmd)
{
LOG(SERIALINTERFACE, "SI-GBA SendCommand: (0x%x)", _Cmd);
}

View File

@ -0,0 +1,62 @@
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// =====================================================================================================
// GameBoy Advance
// =====================================================================================================
class CSIDevice_GBA : public ISIDevice
{
private:
// commands
enum EBufferCommands
{
CMD_RESET = 0xFF,
CMD_STATUS = 0x00,
CMD_WRITE = 0x15,
CMD_READ = 0x14
};
//0x4000158 - JOYSTAT - Receive Status Register (R/W) (ON THE GBA)
//Bit Explanation
//0 Not used
//1 Receive Status Flag (0=Remote GBA is/was receiving) (Read Only?)
//2 Not used
//3 Send Status Flag (1=Remote GBA is/was sending) (Read Only?)
//4-5 General Purpose Flag (Not assigned, may be used for whatever purpose)
//6-15 Not used
//--------------------------------------
//Bit 1 is automatically set when writing to local JOY_TRANS.
//Bit 3 is automatically reset when reading from local JOY_RECV.
int DeviceNum;
public:
// constructor
CSIDevice_GBA(int _iDeviceNumber);
// run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data
virtual bool GetData(u32& _Hi, u32& _Low);
// send a command directly
virtual void SendCommand(u32 _Cmd);
};