Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic infrastructure for the new AX HLE, currently not doing anything…
… besides answering mails
- Loading branch information
Showing
4 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// Copyright (C) 2003 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 Git repository and contact information can be found at | ||
// http://code.google.com/p/dolphin-emu/ | ||
|
||
#include "UCode_NewAX.h" | ||
#include "../../DSP.h" | ||
|
||
CUCode_NewAX::CUCode_NewAX(DSPHLE* dsp_hle, u32 crc) | ||
: IUCode(dsp_hle, crc) | ||
{ | ||
m_rMailHandler.PushMail(DSP_INIT); | ||
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); | ||
} | ||
|
||
CUCode_NewAX::~CUCode_NewAX() | ||
{ | ||
m_rMailHandler.Clear(); | ||
} | ||
|
||
void CUCode_NewAX::HandleCommandList(u32 addr) | ||
{ | ||
// Signal end of processing | ||
m_rMailHandler.PushMail(DSP_YIELD); | ||
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); | ||
} | ||
|
||
void CUCode_NewAX::HandleMail(u32 mail) | ||
{ | ||
// Indicates if the next message is a command list address. | ||
static bool next_is_cmdlist = false; | ||
bool set_next_is_cmdlist = false; | ||
|
||
if (next_is_cmdlist) | ||
{ | ||
HandleCommandList(mail); | ||
} | ||
else if (m_UploadSetupInProgress) | ||
{ | ||
PrepareBootUCode(mail); | ||
} | ||
else if (mail == MAIL_RESUME) | ||
{ | ||
// Acknowledge the resume request | ||
m_rMailHandler.PushMail(DSP_RESUME); | ||
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); | ||
} | ||
else if (mail == MAIL_NEWUCODE) | ||
{ | ||
soundStream->GetMixer()->SetHLEReady(false); | ||
m_UploadSetupInProgress = true; | ||
} | ||
else if (mail == MAIL_RESET) | ||
{ | ||
m_DSPHLE->SetUCode(UCODE_ROM); | ||
} | ||
else if (mail == MAIL_CONTINUE) | ||
{ | ||
// We don't have to do anything here - the CPU does not wait for a ACK | ||
// and sends a cmdlist mail just after. | ||
} | ||
else if ((mail & MAIL_CMDLIST_MASK) == MAIL_CMDLIST) | ||
{ | ||
// A command list address is going to be sent next. | ||
set_next_is_cmdlist = true; | ||
} | ||
else | ||
{ | ||
ERROR_LOG(DSPHLE, "Unknown mail sent to AX::HandleMail: %08x", mail); | ||
} | ||
|
||
next_is_cmdlist = set_next_is_cmdlist; | ||
} | ||
|
||
void CUCode_NewAX::MixAdd(short* out_buffer, int nsamples) | ||
{ | ||
// nsamples * 2 for left and right audio channel | ||
memset(out_buffer, 0, nsamples * 2 * sizeof (short)); | ||
} | ||
|
||
void CUCode_NewAX::Update(int cycles) | ||
{ | ||
// Used for UCode switching. | ||
if (NeedsResumeMail()) | ||
{ | ||
m_rMailHandler.PushMail(DSP_RESUME); | ||
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP); | ||
} | ||
} | ||
|
||
void CUCode_NewAX::DoState(PointerWrap& p) | ||
{ | ||
DoStateShared(p); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (C) 2003 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 Git repository and contact information can be found at | ||
// http://code.google.com/p/dolphin-emu/ | ||
|
||
#ifndef _UCODE_NEWAX_H | ||
#define _UCODE_NEWAX_H | ||
|
||
#include "UCodes.h" | ||
#include "UCode_AXStructs.h" | ||
|
||
class CUCode_NewAX : public IUCode | ||
{ | ||
public: | ||
CUCode_NewAX(DSPHLE* dsp_hle, u32 crc); | ||
virtual ~CUCode_NewAX(); | ||
|
||
void HandleMail(u32 mail); | ||
void MixAdd(short* out_buffer, int nsamples); | ||
void Update(int cycles); | ||
void DoState(PointerWrap& p); | ||
|
||
private: | ||
enum MailType | ||
{ | ||
MAIL_RESUME = 0xCDD10000, | ||
MAIL_NEWUCODE = 0xCDD10001, | ||
MAIL_RESET = 0xCDD10002, | ||
MAIL_CONTINUE = 0xCDD10003, | ||
|
||
// CPU sends 0xBABE0000 | cmdlist_size to the DSP | ||
MAIL_CMDLIST = 0xBABE0000, | ||
MAIL_CMDLIST_MASK = 0xFFFF0000 | ||
}; | ||
|
||
void HandleCommandList(u32 addr); | ||
}; | ||
|
||
#endif // !_UCODE_NEWAX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters