mirror of
https://github.com/dingusdev/dingusppc.git
synced 2026-12-01 06:23:18 -10:00
Compare commits
13
Commits
mmu
..
awacs-pdm-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
117b8dccfc | ||
|
|
2b4b0e8320 | ||
|
|
90d050531e | ||
|
|
b5ddcf8ece | ||
|
|
e97da11386 | ||
|
|
10be145179 | ||
|
|
0236493902 | ||
|
|
b87585cf0e | ||
|
|
a69bffaad4 | ||
|
|
38ba5cbfa8 | ||
|
|
74b851d4e0 | ||
|
|
b3a38cdac3 | ||
|
|
70da33b2af |
No files matched your search
@@ -8,19 +8,17 @@ Be warned the program is highly unfinished and could use a lot of testing. Any f
|
||||
|
||||
While many other PowerPC emus exist (PearPC, Sheepshaver), none of them currently attempt emulation of PowerPC Macs accurately (except for QEMU).
|
||||
|
||||
This program aims to not only improve upon what Sheepshaver, PearPC, and other PowerPC Mac emulators have done, but also to provide a better debugging environment. This currently is designed to work best with PowerPC NuBus and Old World ROMs, including those of the Power Mac 6100, 7200, and G3 Beige.
|
||||
This program aims to not only improve upon what Sheepshaver, PearPC, and other PowerPC Mac emulators have done, but also to provide a better debugging environment. This currently is designed to work best with PowerPC Old World ROMs, including those of the Power Mac 6100, 7200, and G3 Beige.
|
||||
|
||||
## Implemented Features
|
||||
|
||||
Several machines have been implemented to varying degrees, like many Old World PowerPC Macs, early New World PowerPC Macs, and the Pippin.
|
||||
|
||||
This emulator has a debugging environment, complete with a disassembler.
|
||||
This emulator has a debugging environment, complete with a disassembler. We also have implemented enough to allow Open Firmware to boot, going so far as to allow audio playback of the boot-up jingles.
|
||||
|
||||
## How to Use
|
||||
|
||||
This program currently uses the command prompt to work.
|
||||
|
||||
There are a few command line arguments one can enter when starting the program.
|
||||
There are a few command line arguments one must enter when starting the program.
|
||||
|
||||
```
|
||||
-r, --realtime
|
||||
@@ -38,31 +36,21 @@ Enter the interactive debugger.
|
||||
-b, --bootrom TEXT:FILE
|
||||
```
|
||||
|
||||
Specifies the Boot ROM path. It otherwise looks for bootrom.bin.
|
||||
Specifies the Boot ROM path (optional; looks for bootrom.bin by default)
|
||||
|
||||
```
|
||||
-m, --machine TEXT
|
||||
```
|
||||
|
||||
Specify machine ID. Otherwise, the emulator will attempt to determine machine ID from the boot rom otherwise.
|
||||
Specify machine ID (optional; will attempt to determine machine ID from the boot rom otherwise)
|
||||
|
||||
As of now, the most complete machines are the Power Mac 6100, the Power Mac 7500, and the Power Mac G3 Beige.
|
||||
|
||||
To go into to the debugger regardless of how you started the emulator, press Control and C on the terminal window.
|
||||
As of now, the most complete machines are the Power Mac 6100 (SCSI emulation in progress) and the Power Mac G3 Beige (SCSI + ATA emulation in progress, No ATI Rage acceleration).
|
||||
|
||||
## How to Compile
|
||||
|
||||
You need to install development tools first.
|
||||
|
||||
At minimum, a C++20 compliant compiler and [CMake](https://cmake.org) are required.
|
||||
|
||||
Clone the repository using the appropriate command:
|
||||
|
||||
```
|
||||
git clone https://github.com/dingusdev/dingusppc
|
||||
```
|
||||
|
||||
If this is from a mirror, replace the argument with the source you want to use instead.
|
||||
At least, a C++20 compliant compiler and [CMake](https://cmake.org) are required.
|
||||
|
||||
You will also have to recursive clone or run
|
||||
```
|
||||
@@ -112,3 +100,7 @@ make testppc
|
||||
- 2 GB of RAM
|
||||
- 2 GB of Hard Disk Space
|
||||
- Graphics Card with a minimum resolution of 800*600
|
||||
|
||||
## Compiler Requirements
|
||||
|
||||
- Any C++20 compatible compiler
|
||||
@@ -106,7 +106,6 @@ enum SPR : int {
|
||||
SPRG1 = 273,
|
||||
SPRG2 = 274,
|
||||
SPRG3 = 275,
|
||||
EAR = 282,
|
||||
TBL_S = 284, // supervisor TBL
|
||||
TBU_S = 285, // supervisor TBU
|
||||
PVR = 287,
|
||||
@@ -304,11 +303,6 @@ enum XER : uint32_t {
|
||||
SO = 1UL << 31
|
||||
};
|
||||
|
||||
enum DSISR : uint32_t {
|
||||
PROT = 1UL << 27,
|
||||
STORE = 1UL << 25
|
||||
};
|
||||
|
||||
//for inf and nan checks
|
||||
enum FPOP : int {
|
||||
DIV = 0x12,
|
||||
|
||||
+14
-20
@@ -540,11 +540,12 @@ static TLBEntry* tlb2_target_entry(uint32_t gp_va)
|
||||
}
|
||||
}
|
||||
|
||||
static TLBEntry* itlb2_refill(uint32_t guest_va) {
|
||||
static TLBEntry* itlb2_refill(uint32_t guest_va)
|
||||
{
|
||||
BATResult bat_res;
|
||||
uint32_t phys_addr;
|
||||
TLBEntry* tlb_entry = nullptr;
|
||||
uint16_t flags = 0;
|
||||
TLBEntry *tlb_entry;
|
||||
uint16_t flags = 0;
|
||||
|
||||
/* instruction address translation if enabled */
|
||||
if (ppc_state.msr & MSR::IR) {
|
||||
@@ -554,13 +555,11 @@ static TLBEntry* itlb2_refill(uint32_t guest_va) {
|
||||
} else {
|
||||
bat_res = ppc_block_address_translation<BATType::IBAT>(guest_va);
|
||||
}
|
||||
|
||||
if (bat_res.hit) {
|
||||
// check block protection
|
||||
// only PP = 0 (no access) causes ISI exception
|
||||
if (!bat_res.prot) {
|
||||
mmu_exception_handler(Except_Type::EXC_ISI, 0x08000000);
|
||||
return nullptr; // Stop refill on exception
|
||||
}
|
||||
phys_addr = bat_res.phys;
|
||||
flags |= TLBFlags::TLBE_FROM_BAT; // tell the world we come from
|
||||
@@ -568,7 +567,7 @@ static TLBEntry* itlb2_refill(uint32_t guest_va) {
|
||||
// page address translation
|
||||
PATResult pat_res = page_address_translation(guest_va, true, !!(ppc_state.msr & MSR::PR), 0);
|
||||
phys_addr = pat_res.phys;
|
||||
flags |= TLBFlags::TLBE_FROM_PAT; // tell the world we come from
|
||||
flags = TLBFlags::TLBE_FROM_PAT; // tell the world we come from
|
||||
}
|
||||
} else { // instruction translation disabled
|
||||
phys_addr = guest_va;
|
||||
@@ -578,23 +577,18 @@ static TLBEntry* itlb2_refill(uint32_t guest_va) {
|
||||
AddressMapEntry* rgn_desc = mem_ctrl_instance->find_range(phys_addr);
|
||||
if (rgn_desc) {
|
||||
if (rgn_desc->type & RT_MMIO) {
|
||||
// TODO: ISI or Machine Check for this?
|
||||
mmu_exception_handler(Except_Type::EXC_ISI, 0x40000000);
|
||||
ABORT_F("Instruction fetch from MMIO region at 0x%08X!\n", phys_addr);
|
||||
}
|
||||
// refill the secondary TLB
|
||||
const uint32_t page_base = guest_va & ~0xFFFUL;
|
||||
tlb_entry = tlb2_target_entry<TLBType::ITLB>(page_base);
|
||||
tlb_entry->tag = page_base;
|
||||
tlb_entry->flags = flags | TLBFlags::PAGE_MEM;
|
||||
|
||||
// Calculate offset based on page base to ensure alignment
|
||||
tlb_entry->host_va_offs_r = (int64_t)rgn_desc->mem_ptr - (int64_t)page_base +
|
||||
((phys_addr & ~0xFFFUL) - rgn_desc->start);
|
||||
|
||||
const uint32_t tag = guest_va & ~0xFFFUL;
|
||||
tlb_entry = tlb2_target_entry<TLBType::ITLB>(tag);
|
||||
tlb_entry->tag = tag;
|
||||
tlb_entry->flags = flags | TLBFlags::PAGE_MEM;
|
||||
tlb_entry->host_va_offs_r = (int64_t)rgn_desc->mem_ptr - guest_va +
|
||||
(phys_addr - rgn_desc->start);
|
||||
tlb_entry->phys_tag = phys_addr & ~0xFFFUL;
|
||||
} else {
|
||||
// TODO: ISI or Machine Check for this?
|
||||
mmu_exception_handler(Except_Type::EXC_ISI, 0x40000000);
|
||||
ABORT_F("Instruction fetch from unmapped memory at 0x%08X!\n", phys_addr);
|
||||
}
|
||||
|
||||
return tlb_entry;
|
||||
@@ -624,7 +618,7 @@ static TLBEntry* dtlb2_refill(uint32_t guest_va, int is_write, bool is_dbg = fal
|
||||
LOG_F(9, "BAT DSI exception in TLB2 refill!");
|
||||
if (!is_dbg)
|
||||
LOG_F(9, "Attempt to write to read-only region, LA=0x%08X, PC=0x%08X!", guest_va, ppc_state.pc);
|
||||
ppc_state.spr[SPR::DSISR] = DSISR::PROT | (is_write << 25);
|
||||
ppc_state.spr[SPR::DSISR] = 0x08000000 | (is_write << 25);
|
||||
ppc_state.spr[SPR::DAR] = guest_va;
|
||||
mmu_exception_handler(Except_Type::EXC_DSI, 0);
|
||||
}
|
||||
|
||||
+4
-45
@@ -936,11 +936,6 @@ void dppc_interpreter::ppc_mfspr(uint32_t opcode) {
|
||||
}
|
||||
|
||||
switch (ref_spr) {
|
||||
case SPR::XER:
|
||||
case SPR::LR:
|
||||
case SPR::CTR:
|
||||
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
|
||||
break;
|
||||
case SPR::MQ:
|
||||
if (!(is_601 || include_601)) {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
||||
@@ -992,23 +987,8 @@ void dppc_interpreter::ppc_mfspr(uint32_t opcode) {
|
||||
ppc_state.spr[TBL_S] = uint32_t(tbr_value);
|
||||
break;
|
||||
}
|
||||
case SPR::DSISR:
|
||||
case SPR::DAR:
|
||||
case SPR::SRR0:
|
||||
case SPR::SRR1:
|
||||
case SPR::PVR:
|
||||
case SPR::EAR:
|
||||
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
|
||||
break;
|
||||
case SPR::SPRG0:
|
||||
case SPR::SPRG1:
|
||||
case SPR::SPRG2:
|
||||
case SPR::SPRG3:
|
||||
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
|
||||
break;
|
||||
default:
|
||||
// FIXME: Unknown SPR should be noop or illegal instruction.
|
||||
LOG_F(ERROR, "Mystery SPR in MFSPR: %d", ref_spr);
|
||||
ppc_state.gpr[reg_d] = ppc_state.spr[ref_spr];
|
||||
}
|
||||
}
|
||||
@@ -1030,13 +1010,6 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
|
||||
uint32_t val = ppc_state.gpr[reg_d];
|
||||
|
||||
switch (ref_spr) {
|
||||
case SPR::XER:
|
||||
ppc_state.spr[ref_spr] = val & 0xe000ff7f;
|
||||
break;
|
||||
case SPR::LR:
|
||||
case SPR::CTR:
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
break;
|
||||
case SPR::MQ:
|
||||
if (is_601 || include_601)
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
@@ -1046,13 +1019,13 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
|
||||
case SPR::RTCL_U:
|
||||
case SPR::RTCU_U:
|
||||
case SPR::DEC_U:
|
||||
if (is_601) {
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
}
|
||||
else {
|
||||
if (!is_601) {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
||||
}
|
||||
break;
|
||||
case SPR::XER:
|
||||
ppc_state.spr[ref_spr] = val & 0xe000ff7f;
|
||||
break;
|
||||
case SPR::SDR1:
|
||||
if (ppc_state.spr[ref_spr] != val) {
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
@@ -1085,19 +1058,6 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
|
||||
ppc_state.spr[TBL_S] = (uint32_t)tbr_wr_value;
|
||||
ppc_state.spr[TBU_S] = val;
|
||||
break;
|
||||
case SPR::DSISR:
|
||||
case SPR::DAR:
|
||||
case SPR::SRR0:
|
||||
case SPR::SRR1:
|
||||
case SPR::EAR:
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
break;
|
||||
case SPR::SPRG0:
|
||||
case SPR::SPRG1:
|
||||
case SPR::SPRG2:
|
||||
case SPR::SPRG3:
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
break;
|
||||
case SPR::PVR:
|
||||
break;
|
||||
case 528:
|
||||
@@ -1124,7 +1084,6 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
|
||||
break;
|
||||
default:
|
||||
// FIXME: Unknown SPR should be noop or illegal instruction.
|
||||
LOG_F(ERROR, "Mystery SPR in MTSPR: %d", ref_spr);
|
||||
ppc_state.spr[ref_spr] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,8 +321,7 @@ int main() {
|
||||
initialize_ppc_opcode_table(); //kludge
|
||||
// MPC601 sets MSR[ME] bit during hard reset / Power-On.
|
||||
// Also set MSR[FP] bit so we can test FPU instructions.
|
||||
int new_msr = (MSR::ME | MSR::IP | MSR::FP);
|
||||
ppc_msr_did_change(ppc_state.msr, new_msr, false);
|
||||
ppc_state.msr = (MSR::ME | MSR::IP | MSR::FP);
|
||||
|
||||
cout << "Running DingusPPC emulator tests..." << endl << endl;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ uint16_t AtaBaseDevice::read(const uint8_t reg_addr) {
|
||||
void AtaBaseDevice::write(const uint8_t reg_addr, const uint16_t value) {
|
||||
switch (reg_addr) {
|
||||
case ATA_Reg::DATA:
|
||||
if (this->is_selected() && this->has_data()) {
|
||||
if (is_selected() && this->has_data()) {
|
||||
*this->cur_data_ptr++ = BYTESWAP_16(value);
|
||||
this->chunk_cnt -= 2;
|
||||
if (this->chunk_cnt <= 0) {
|
||||
@@ -160,7 +160,7 @@ void AtaBaseDevice::write(const uint8_t reg_addr, const uint16_t value) {
|
||||
break;
|
||||
}
|
||||
this->r_command = value;
|
||||
if (this->is_selected() || this->r_command == DIAGNOSTICS) {
|
||||
if (is_selected() || this->r_command == DIAGNOSTICS) {
|
||||
perform_command();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -56,8 +56,7 @@ enum ATA_Reg : int {
|
||||
COMMAND = 0x07, // command (write)
|
||||
ALT_STATUS = 0x16, // alt status (read)
|
||||
DEV_CTRL = 0x16, // device control (write)
|
||||
TIME_CONFIG = 0x20, // Apple ASIC specific timing configuration
|
||||
INT_REG = 0x30, // Interrupt Register (read) 0x40 = int request (KeyLargo only)
|
||||
TIME_CONFIG = 0x20 // Apple ASIC specific timing configuration
|
||||
};
|
||||
|
||||
/** ATAPI specific register offsets. */
|
||||
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
|
||||
void register_device(int id, AtaInterface* dev_obj);
|
||||
|
||||
virtual uint32_t read(const uint8_t reg_addr, const int size);
|
||||
virtual void write(const uint8_t reg_addr, const uint32_t val, const int size);
|
||||
uint32_t read(const uint8_t reg_addr, const int size);
|
||||
void write(const uint8_t reg_addr, const uint32_t val, const int size);
|
||||
|
||||
int xfer_from(uint8_t *buf, int len) override;
|
||||
int xfer_to(uint8_t *buf, int len) override;
|
||||
@@ -93,8 +93,8 @@ public:
|
||||
|
||||
int device_postinit() override;
|
||||
|
||||
virtual uint32_t read(const uint8_t reg_addr, const int size) override;
|
||||
virtual void write(const uint8_t reg_addr, const uint32_t val, const int size) override;
|
||||
uint32_t read(const uint8_t reg_addr, const int size);
|
||||
void write(const uint8_t reg_addr, const uint32_t val, const int size);
|
||||
|
||||
private:
|
||||
uint32_t ch_config = 0; // timing configuration for this channel
|
||||
|
||||
@@ -488,7 +488,7 @@ DmaPullResult DMAChannel::pull_data(uint32_t req_len, uint32_t *avail_len, uint8
|
||||
if (this->ch_stat & CH_STAT_DEAD || !(this->ch_stat & CH_STAT_ACTIVE)) {
|
||||
// dead or idle channel? -> no more data
|
||||
LOG_F(WARNING, "%s: Dead/idle channel -> no more data", this->get_name().c_str());
|
||||
return DmaPullResult::NoMoreData;
|
||||
return DmaPullResult::NoMorePullData;
|
||||
}
|
||||
|
||||
// interpret DBDMA program until we get data or become idle
|
||||
@@ -513,10 +513,10 @@ DmaPullResult DMAChannel::pull_data(uint32_t req_len, uint32_t *avail_len, uint8
|
||||
this->res_count += this->queue_len;
|
||||
this->queue_len = 0;
|
||||
}
|
||||
return DmaPullResult::MoreData; // tell the caller there is more data
|
||||
return DmaPullResult::MorePullData; // tell the caller there is more data
|
||||
}
|
||||
|
||||
return DmaPullResult::NoMoreData; // tell the caller there is no more data
|
||||
return DmaPullResult::NoMorePullData; // tell the caller there is no more data
|
||||
}
|
||||
|
||||
int DMAChannel::push_data(const char* src_ptr, int len) {
|
||||
|
||||
@@ -29,8 +29,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <string>
|
||||
|
||||
enum DmaPullResult : int {
|
||||
MoreData, // data source has more data to be pulled
|
||||
NoMoreData, // data source has no more data to be pulled
|
||||
MorePullData, // data source has more data to be pulled
|
||||
NoMorePullData, // data source has no more data to be pulled
|
||||
};
|
||||
|
||||
enum DmaPushResult : int {
|
||||
MorePushData, // data source has more data to be pushed
|
||||
NoMorePushData, // data source has no more data to be pushed
|
||||
};
|
||||
|
||||
class DmaOutChannel {
|
||||
|
||||
@@ -143,12 +143,6 @@ enum ScsiCommand : uint8_t {
|
||||
READ_TOC = 0x43,
|
||||
SET_CD_SPEED = 0xBB,
|
||||
READ_CD = 0xBE,
|
||||
|
||||
// vendor specific commands
|
||||
VENDOR_09 = 0x09,
|
||||
EJECT = 0xC0,
|
||||
READ_CDDA = 0xD8, //TOSHIBA
|
||||
READ_CDDA_MSF = 0xD9, //TOSHIBA
|
||||
};
|
||||
|
||||
enum ScsiSense : int {
|
||||
|
||||
@@ -45,8 +45,6 @@ void ScsiCdrom::process_command()
|
||||
{
|
||||
uint32_t lba;
|
||||
|
||||
uint32_t cdda_start, cdda_end, cdda_len;
|
||||
|
||||
this->pre_xfer_action = nullptr;
|
||||
this->post_xfer_action = nullptr;
|
||||
|
||||
@@ -100,19 +98,6 @@ void ScsiCdrom::process_command()
|
||||
this->switch_phase(ScsiPhase::DATA_IN);
|
||||
}
|
||||
break;
|
||||
case ScsiCommand::READ_CDDA:
|
||||
lba = READ_DWORD_BE_U(&cmd[2]);
|
||||
cdda_len = READ_DWORD_BE_U(&cmd[6]);
|
||||
this->read(lba, cdda_len, 12);
|
||||
break;
|
||||
case ScsiCommand::READ_CDDA_MSF:
|
||||
cdda_start = (cmd[3] * 60 * 75) + (cmd[4] * 75) + cmd[5];
|
||||
cdda_end = (cmd[7] * 60 * 75) + (cmd[8] * 75) + cmd[9];
|
||||
|
||||
cdda_len = (cdda_end > cdda_start) ? (cdda_end - cdda_start) : 0;
|
||||
|
||||
this->read(cdda_start, cdda_len, 12);
|
||||
break;
|
||||
default:
|
||||
LOG_F(ERROR, "%s: unsupported command 0x%X", this->name.c_str(), cmd[0]);
|
||||
this->illegal_command(cmd);
|
||||
|
||||
+121
-23
@@ -78,8 +78,11 @@ AMIC::AMIC() : MMIODevice()
|
||||
// initialize sound HW
|
||||
this->snd_out_dma = std::unique_ptr<AmicSndOutDma>(new AmicSndOutDma());
|
||||
this->snd_out_dma->init_interrupts(this, DMA1_INT_SOUND << DMA1_INT_SHIFT);
|
||||
this->snd_in_dma = std::unique_ptr<AmicSndInDma>(new AmicSndInDma());
|
||||
this->snd_in_dma->init_interrupts(this, DMA0_INT_SOUND << DMA0_INT_SHIFT);
|
||||
this->awacs = std::unique_ptr<AwacDevicePdm> (new AwacDevicePdm());
|
||||
this->awacs->set_dma_out(this->snd_out_dma.get());
|
||||
this->awacs->set_dma_in(this->snd_in_dma.get());
|
||||
|
||||
// initialize on-board video
|
||||
this->disp_id = std::unique_ptr<DisplayID> (new DisplayID());
|
||||
@@ -150,6 +153,10 @@ uint32_t AMIC::read(uint32_t rgn_start, uint32_t offset, int size)
|
||||
}
|
||||
case 0x14: // Sound registers
|
||||
switch (offset) {
|
||||
case AMICReg::Snd_Ctrl_0:
|
||||
case AMICReg::Snd_Ctrl_1:
|
||||
case AMICReg::Snd_Ctrl_2:
|
||||
return this->imm_snd_regs[offset & 3];
|
||||
case AMICReg::Snd_Stat_0:
|
||||
case AMICReg::Snd_Stat_1:
|
||||
case AMICReg::Snd_Stat_2:
|
||||
@@ -167,8 +174,12 @@ uint32_t AMIC::read(uint32_t rgn_start, uint32_t offset, int size)
|
||||
}
|
||||
case AMICReg::Snd_Out_Ctrl:
|
||||
return this->snd_out_ctrl;
|
||||
case AMICReg::Snd_In_Ctrl:
|
||||
return this->snd_in_ctrl;
|
||||
case AMICReg::Snd_Out_DMA:
|
||||
return this->snd_out_dma->read_stat();
|
||||
case AMICReg::Snd_In_DMA:
|
||||
return this->snd_in_dma->read_stat();
|
||||
}
|
||||
break;
|
||||
case 0x16: // SWIM3 registers
|
||||
@@ -250,19 +261,19 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
|
||||
uint32_t mask;
|
||||
|
||||
// subdevices registers
|
||||
switch(offset >> 12) {
|
||||
case 0: // VIA1 registers
|
||||
switch (offset >> 12) {
|
||||
case 0: // VIA1 registers
|
||||
case 1:
|
||||
this->viacuda->write(offset >> 9, value);
|
||||
return;
|
||||
case 4: // SCC registers
|
||||
case 4: // SCC registers
|
||||
if ((offset & 0xF) < 0x0C)
|
||||
this->escc->write(compat_to_macrisc[(offset >> 1) & 0xF], value);
|
||||
else
|
||||
LOG_F(ERROR, "AMIC SCC write @%x.%c = %0*x",
|
||||
offset, SIZE_ARG(size), size * 2, value);
|
||||
return;
|
||||
case 0xA: // MACE registers
|
||||
case 0xA: // MACE registers
|
||||
this->mace->write((offset >> 4) & 0x1F, value);
|
||||
return;
|
||||
case 0x10:
|
||||
@@ -271,8 +282,8 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
|
||||
else
|
||||
this->scsi->write((offset >> 4) & 0xF, value);
|
||||
return;
|
||||
case 0x14: // Sound registers
|
||||
switch(offset) {
|
||||
case 0x14: // Sound registers
|
||||
switch (offset) {
|
||||
case AMICReg::Snd_Ctrl_0:
|
||||
case AMICReg::Snd_Ctrl_1:
|
||||
case AMICReg::Snd_Ctrl_2:
|
||||
@@ -282,42 +293,66 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
|
||||
if ((this->imm_snd_regs[0] & 0xC0) == PDM_SND_CTRL_VALID) {
|
||||
this->awacs->write_ctrl(
|
||||
(this->imm_snd_regs[1] >> 4) | (this->imm_snd_regs[0] & 0x3F),
|
||||
((this->imm_snd_regs[1] & 0xF) << 8) | this->imm_snd_regs[2]
|
||||
);
|
||||
((this->imm_snd_regs[1] & 0xF) << 8) | this->imm_snd_regs[2]);
|
||||
}
|
||||
return;
|
||||
case AMICReg::Snd_Buf_Size_Hi:
|
||||
case AMICReg::Snd_Buf_Size_Lo:
|
||||
SET_SIZE_BYTE(this->snd_buf_size, offset, value);
|
||||
this->snd_buf_size &= ~3; // sound buffer size is always a multiple of 4
|
||||
this->snd_buf_size &= ~3; // sound buffer size is always a multiple of 4
|
||||
LOG_F(9, "AMIC: Sound buffer size set to 0x%X", this->snd_buf_size);
|
||||
return;
|
||||
case AMICReg::Snd_Out_Ctrl:
|
||||
if ((value & 1) != (this->snd_out_ctrl & 1)) {
|
||||
if (value & 1) {
|
||||
this->snd_out_dma->init(this->dma_base & ~0x3FFFF,
|
||||
this->snd_buf_size);
|
||||
this->snd_out_dma->init(this->dma_base & ~0x3FFFF, this->snd_buf_size);
|
||||
this->snd_out_dma->enable();
|
||||
this->awacs->set_sample_rate((this->snd_out_ctrl >> 1) & 3);
|
||||
this->awacs->dma_out_start();
|
||||
this->snd_out_ctrl |= 1;
|
||||
} else {
|
||||
this->snd_out_dma->disable();
|
||||
this->awacs->dma_out_pause();
|
||||
this->snd_out_ctrl &= 0xFE;
|
||||
}
|
||||
}
|
||||
this->snd_out_ctrl = value;
|
||||
return;
|
||||
case AMICReg::Snd_In_Ctrl:
|
||||
LOG_F(INFO, "AMIC Sound In Ctrl updated, val=%x", value);
|
||||
if ((value & 1) != (this->snd_in_ctrl & 1)) {
|
||||
if (value & 1) {
|
||||
this->snd_in_dma->init(this->dma_base & ~0x3FFFF, this->snd_buf_size);
|
||||
this->snd_in_dma->enable();
|
||||
this->awacs->set_sample_rate((this->snd_out_ctrl >> 1) & 3);
|
||||
this->awacs->dma_in_start();
|
||||
}
|
||||
} else {
|
||||
this->snd_in_dma->disable();
|
||||
this->awacs->dma_in_pause();
|
||||
}
|
||||
|
||||
if (value & 0x40) {
|
||||
this->via2_ifr |= 0x10;
|
||||
this->ack_via2_int(VIA2_INT_SOUND, 0);
|
||||
} else {
|
||||
this->via2_ifr |= 0x10;
|
||||
this->ack_via2_int(VIA2_INT_SOUND, 1);
|
||||
}
|
||||
this->snd_in_ctrl = value;
|
||||
return;
|
||||
case AMICReg::Snd_Out_DMA:
|
||||
this->snd_out_dma->write_dma_out_ctrl(value);
|
||||
return;
|
||||
case AMICReg::Snd_In_DMA:
|
||||
LOG_F(WARNING, "SND IN DMA Value: 0x%x", value);
|
||||
this->snd_in_dma->write_dma_in_ctrl(value);
|
||||
return;
|
||||
}
|
||||
case 0x16: // SWIM3 registers
|
||||
case 0x17:
|
||||
case 0x16: // SWIM3 registers
|
||||
case 0x17: {
|
||||
this->swim3->write((offset >> 9) & 0xF, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch(offset) {
|
||||
@@ -328,6 +363,7 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
|
||||
}
|
||||
break;
|
||||
case AMICReg::VIA2_IFR:
|
||||
case AMICReg::VIA2_IFR_RBV:
|
||||
// if bit 7 is set, clear the corresponding IRQ bit for each "1" in value
|
||||
// writing any value to VIA2_IFR with bit 7 cleared has no effect
|
||||
if (value & 0x80) {
|
||||
@@ -598,10 +634,9 @@ AmicSndOutDma::AmicSndOutDma() : DmaOutChannel("SndOut")
|
||||
this->enabled = false;
|
||||
}
|
||||
|
||||
void AmicSndOutDma::init(uint32_t buf_base, uint32_t buf_samples)
|
||||
{
|
||||
this->out_buf0 = buf_base + AMIC_SND_BUF0_OFFS;
|
||||
this->out_buf1 = buf_base + AMIC_SND_BUF1_OFFS;
|
||||
void AmicSndOutDma::init(uint32_t buf_base, uint32_t buf_samples) {
|
||||
this->out_buf0 = buf_base + AMIC_SND_OUT_BUF0_OFFS;
|
||||
this->out_buf1 = buf_base + AMIC_SND_OUT_BUF1_OFFS;
|
||||
|
||||
this->out_buf_len = buf_samples * 2 * 2;
|
||||
|
||||
@@ -659,7 +694,7 @@ DmaPullResult AmicSndOutDma::pull_data(uint32_t req_len, uint32_t *avail_len,
|
||||
// if it's false stop delivering sound data
|
||||
// this will effectively stop audio playback
|
||||
if (this->snd_buf_num && !this->enabled) {
|
||||
return DmaPullResult::NoMoreData;
|
||||
return DmaPullResult::NoMorePullData;
|
||||
}
|
||||
|
||||
this->cur_buf_pos = 0; // reset buffer position
|
||||
@@ -675,7 +710,70 @@ DmaPullResult AmicSndOutDma::pull_data(uint32_t req_len, uint32_t *avail_len,
|
||||
*p_data = res.host_va;
|
||||
this->cur_buf_pos += len;
|
||||
*avail_len = len;
|
||||
return DmaPullResult::MoreData;
|
||||
return DmaPullResult::MorePullData;
|
||||
}
|
||||
|
||||
|
||||
AmicSndInDma::AmicSndInDma() : DmaInChannel("SndIn") {
|
||||
this->dma_in_ctrl = 0;
|
||||
this->enabled = false;
|
||||
}
|
||||
|
||||
void AmicSndInDma::init(uint32_t buf_base, uint32_t buf_samples) {
|
||||
this->in_buf0 = buf_base + AMIC_SND_IN_BUF0_OFFS;
|
||||
this->in_buf1 = buf_base + AMIC_SND_IN_BUF1_OFFS;
|
||||
|
||||
this->in_buf_len = buf_samples * 2 * 2;
|
||||
|
||||
this->snd_buf_num = 0;
|
||||
this->cur_buf_pos = 0;
|
||||
this->irq_level = 0;
|
||||
}
|
||||
|
||||
uint8_t AmicSndInDma::read_stat() {
|
||||
return this->dma_in_ctrl;
|
||||
}
|
||||
|
||||
void AmicSndInDma::write_dma_in_ctrl(uint8_t value) {
|
||||
if (value & PDM_DMA_INTS_MASK) {
|
||||
this->dma_in_ctrl &= ~(value & PDM_DMA_INTS_MASK);
|
||||
this->update_irq();
|
||||
}
|
||||
// update sound input DMA interrupt enable bits
|
||||
this->dma_in_ctrl = value;
|
||||
}
|
||||
|
||||
int AmicSndInDma::push_data(const char* src_ptr, int len) {
|
||||
len = 0x2000;
|
||||
const char* silence[0x2000] = {(char *)0};
|
||||
|
||||
MapDmaResult res = mmu_map_dma_mem(
|
||||
(this->snd_buf_num ? this->in_buf1 : this->in_buf0),
|
||||
len, false);
|
||||
uint8_t* p_data = res.host_va;
|
||||
if (!res.is_writable) {
|
||||
ABORT_F("AMIC: attempting DMA write to read-only memory");
|
||||
}
|
||||
std::memcpy(p_data, silence, len);
|
||||
|
||||
this->addr_ptr += len;
|
||||
this->byte_count -= len;
|
||||
if (!this->byte_count) {
|
||||
//LOG_F(WARNING, "AMIC: DMA interrupts not implemented yet");
|
||||
}
|
||||
|
||||
this->snd_buf_num ^= 1;
|
||||
|
||||
return DmaPushResult::NoMorePushData;
|
||||
}
|
||||
|
||||
void AmicSndInDma::update_irq() {
|
||||
uint8_t new_level = !!((this->dma_in_ctrl >> 4) & this->dma_in_ctrl);
|
||||
if (new_level != this->irq_level) {
|
||||
this->irq_level = new_level;
|
||||
TimerManager::get_instance()->add_immediate_timer(
|
||||
[this] { this->int_ctrl->ack_dma_int(this->snd_dma_irq_id, this->irq_level); });
|
||||
}
|
||||
}
|
||||
|
||||
// ============================ Floppy DMA stuff ===============================
|
||||
@@ -726,7 +824,7 @@ int AmicFloppyDma::push_data(const char* src_ptr, int len)
|
||||
DmaPullResult AmicFloppyDma::pull_data(uint32_t req_len, uint32_t *avail_len,
|
||||
uint8_t **p_data)
|
||||
{
|
||||
return DmaPullResult::NoMoreData;
|
||||
return DmaPullResult::NoMorePullData;
|
||||
}
|
||||
|
||||
// ============================ SCSI DMA stuff ================================
|
||||
@@ -822,7 +920,7 @@ void AmicSerialXmitDma::write_ctrl(const uint8_t value)
|
||||
DmaPullResult AmicSerialXmitDma::pull_data(uint32_t req_len, uint32_t *avail_len,
|
||||
uint8_t **p_data)
|
||||
{
|
||||
return DmaPullResult::NoMoreData;
|
||||
return DmaPullResult::NoMorePullData;
|
||||
}
|
||||
|
||||
static std::vector<std::string> Amic_Subdevices = {
|
||||
@@ -833,4 +931,4 @@ static const DeviceDescription Amic_Descriptor = {
|
||||
AMIC::create, Amic_Subdevices, {}, HWCompType::MMIO_DEV | HWCompType::INT_CTRL
|
||||
};
|
||||
|
||||
REGISTER_DEVICE(Amic, Amic_Descriptor);
|
||||
REGISTER_DEVICE(Amic, Amic_Descriptor);
|
||||
+59
-8
@@ -82,13 +82,16 @@ enum : uint64_t {
|
||||
/** DMA interrupt bits. */
|
||||
enum : uint64_t {
|
||||
DMA0_INT_SHIFT = 24,
|
||||
DMA0_INT_SOUND = 1 << 1,
|
||||
DMA1_INT_SHIFT = 32,
|
||||
DMA1_INT_SOUND = 1 << 1,
|
||||
};
|
||||
|
||||
/** AMIC sound buffers are located at fixed offsets from DMA base. */
|
||||
#define AMIC_SND_BUF0_OFFS 0x10000
|
||||
#define AMIC_SND_BUF1_OFFS 0x12000
|
||||
#define AMIC_SND_IN_BUF0_OFFS 0xC000
|
||||
#define AMIC_SND_IN_BUF1_OFFS 0xE000
|
||||
#define AMIC_SND_OUT_BUF0_OFFS 0x10000
|
||||
#define AMIC_SND_OUT_BUF1_OFFS 0x12000
|
||||
|
||||
// PDM HWInit source defines two constants: kExpBit = 0x80 and kCmdBit = 0x40
|
||||
// I don't know what they mean but it seems that their combination will
|
||||
@@ -135,6 +138,48 @@ private:
|
||||
uint8_t irq_level = 0;
|
||||
};
|
||||
|
||||
class AmicSndInDma : public DmaInChannel {
|
||||
public:
|
||||
AmicSndInDma();
|
||||
~AmicSndInDma() = default;
|
||||
|
||||
void init(uint32_t buf_base, uint32_t buf_samples);
|
||||
void enable() {
|
||||
this->enabled = true;
|
||||
}
|
||||
void disable() {
|
||||
this->enabled = false;
|
||||
}
|
||||
uint8_t read_stat();
|
||||
void update_irq();
|
||||
void write_dma_in_ctrl(uint8_t value);
|
||||
uint32_t get_cur_buf_pos() {
|
||||
return this->cur_buf_pos;
|
||||
}
|
||||
int push_data(const char* src_ptr, int len);
|
||||
|
||||
void init_interrupts(InterruptCtrl* int_ctrl, uint64_t irq_id) {
|
||||
this->int_ctrl = int_ctrl;
|
||||
this->snd_dma_irq_id = irq_id;
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled = false;
|
||||
uint8_t dma_in_ctrl;
|
||||
|
||||
uint32_t in_buf0;
|
||||
uint32_t in_buf1;
|
||||
uint32_t in_buf_len;
|
||||
uint32_t snd_buf_num;
|
||||
uint32_t cur_buf_pos;
|
||||
|
||||
InterruptCtrl* int_ctrl = nullptr;
|
||||
uint64_t snd_dma_irq_id = 0;
|
||||
uint32_t addr_ptr;
|
||||
uint16_t byte_count;
|
||||
uint8_t irq_level = 0;
|
||||
};
|
||||
|
||||
/** AMIC-specific floppy DMA implementation. */
|
||||
class AmicFloppyDma : public DmaBidirChannel {
|
||||
public:
|
||||
@@ -282,16 +327,20 @@ enum AMICReg : uint32_t {
|
||||
Floppy_DMA_Ctrl = 0x32068,
|
||||
|
||||
SCC_DMA_Xmt_A_Ctrl = 0x32088,
|
||||
// = 0x32092, // byte, read
|
||||
// = 0x32093, // byte, read
|
||||
SCC_RXA_Addr_Ptr_0 = 0x32090, // byte, read
|
||||
SCC_RXA_Addr_Ptr_1 = 0x32091, // byte, read
|
||||
SCC_RXA_Addr_Ptr_2 = 0x32092, // byte, read
|
||||
SCC_RXA_Addr_Ptr_3 = 0x32093, // byte, read
|
||||
SCC_RXA_Byte_Cnt_Hi = 0x32094, // 5 bits, read; byte, write 0x10
|
||||
SCC_RXA_Byte_Cnt_Lo = 0x32095, // 8 bits, read; byte, write 0x00
|
||||
SCC_DMA_Rcv_A_Ctrl = 0x32098,
|
||||
// = 0x320A4, // byte, write 0x00
|
||||
// = 0x320A5, // byte, write 0x07
|
||||
SCC_TXB_Byte_Cnt_Hi = 0x320A4, // byte, write 0x00
|
||||
SCC_TXB_Byte_Cnt_Lo = 0x320A5, // byte, write 0x07
|
||||
SCC_DMA_Xmt_B_Ctrl = 0x320A8,
|
||||
// = 0x320B2, // byte, read
|
||||
// = 0x320B3, // byte, read
|
||||
SCC_RXB_Addr_Ptr_0 = 0x320B0, // byte, read
|
||||
SCC_RXB_Addr_Ptr_1 = 0x320B1, // byte, read
|
||||
SCC_RXB_Addr_Ptr_2 = 0x320B2, // byte, read
|
||||
SCC_RXB_Addr_Ptr_3 = 0x320B3, // byte, read
|
||||
SCC_RXB_Byte_Cnt_Hi = 0x320B4, // 5 bits, read; byte, write 0x10
|
||||
SCC_RXB_Byte_Cnt_Lo = 0x320B5, // 8 bits, read; byte, write 0x00
|
||||
SCC_DMA_Rcv_B_Ctrl = 0x320B8,
|
||||
@@ -335,6 +384,7 @@ private:
|
||||
uint32_t scsi_dma_base = 0; // physical base address for SCSI DMA
|
||||
uint16_t snd_buf_size = 0; // sound buffer size in bytes
|
||||
uint8_t snd_out_ctrl = 0;
|
||||
uint8_t snd_in_ctrl = 0;
|
||||
|
||||
// floppy DMA state
|
||||
uint32_t floppy_addr_ptr;
|
||||
@@ -373,6 +423,7 @@ private:
|
||||
|
||||
std::unique_ptr<AwacDevicePdm> awacs;
|
||||
std::unique_ptr<AmicSndOutDma> snd_out_dma;
|
||||
std::unique_ptr<AmicSndInDma> snd_in_dma;
|
||||
std::unique_ptr<AmicFloppyDma> floppy_dma;
|
||||
std::unique_ptr<AmicScsiDma> curio_dma;
|
||||
std::unique_ptr<AmicSerialXmitDma> escc_xmit_b_dma;
|
||||
|
||||
@@ -350,22 +350,10 @@ public:
|
||||
return std::unique_ptr<MacIoTwo>(new MacIoTwo("paddington", MIO_DEV_ID_PADDINGTON));
|
||||
}
|
||||
|
||||
void set_fp_id(uint8_t id) {
|
||||
this->fp_id = id;
|
||||
}
|
||||
|
||||
void set_mon_id(uint8_t id) {
|
||||
this->mon_id = id;
|
||||
}
|
||||
|
||||
void set_media_bay_id(uint8_t id) {
|
||||
this->mb_id = id;
|
||||
}
|
||||
|
||||
void set_cpu_id(uint8_t id) {
|
||||
this->cpu_id = id;
|
||||
}
|
||||
|
||||
// MMIO device methods
|
||||
uint32_t read(uint32_t rgn_start, uint32_t offset, int size) override;
|
||||
void write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size) override;
|
||||
|
||||
@@ -44,13 +44,11 @@ MacIoTwo::MacIoTwo(std::string name, uint16_t dev_id) : MacIoBase(name, dev_id)
|
||||
this->ide0_dma->connect(this->ide_0);
|
||||
this->ide_0->connect(this->ide0_dma.get());
|
||||
|
||||
this->ide_1 = dynamic_cast<IdeChannel*>(gMachineObj->get_comp_by_name_optional("Ide1"));
|
||||
this->ide_1 = dynamic_cast<IdeChannel*>(gMachineObj->get_comp_by_name("Ide1"));
|
||||
this->ide1_dma = std::unique_ptr<DMAChannel> (new DMAChannel("Ide1-Dma"));
|
||||
this->ide1_dma->register_dma_int(this, this->register_dma_int(IntSrc::DMA_IDE1));
|
||||
if (this->ide_1) {
|
||||
this->ide1_dma->connect(this->ide_1);
|
||||
this->ide_1->connect(this->ide1_dma.get());
|
||||
}
|
||||
this->ide1_dma->connect(this->ide_1);
|
||||
this->ide_1->connect(this->ide1_dma.get());
|
||||
|
||||
// connect Ethernet HW (Heathrow and Paddington)
|
||||
if (this->device_id != MIO_DEV_ID_OHARE) {
|
||||
@@ -110,10 +108,10 @@ uint32_t MacIoTwo::read(uint32_t rgn_start, uint32_t offset, int size) {
|
||||
value = this->viacuda->read((offset >> 9) & 0xF);
|
||||
break;
|
||||
case 0x20: // IDE 0
|
||||
value = this->ide_0->read((offset >> 4) & 0xFF, size);
|
||||
value = this->ide_0->read((offset >> 4) & 0x1F, size);
|
||||
break;
|
||||
case 0x21: // IDE 1
|
||||
value = this->ide_1 ? this->ide_1->read((offset >> 4) & 0xFF, size) : 0;
|
||||
value = this->ide_1->read((offset >> 4) & 0x1F, size);
|
||||
break;
|
||||
default:
|
||||
if (sub_addr >= 0x60) {
|
||||
@@ -172,11 +170,10 @@ void MacIoTwo::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int si
|
||||
this->viacuda->write((offset >> 9) & 0xF, value);
|
||||
break;
|
||||
case 0x20: // IDE 0
|
||||
this->ide_0->write((offset >> 4) & 0xFF, value, size);
|
||||
this->ide_0->write((offset >> 4) & 0x1F, value, size);
|
||||
break;
|
||||
case 0x21: // IDE 1
|
||||
if (this->ide_1)
|
||||
this->ide_1->write((offset >> 4) & 0xFF, value, size);
|
||||
this->ide_1->write((offset >> 4) & 0x1F, value, size);
|
||||
break;
|
||||
default:
|
||||
if (sub_addr >= 0x60) {
|
||||
|
||||
@@ -442,7 +442,7 @@ void EsccChannel::dma_out_tx()
|
||||
uint8_t *data;
|
||||
uint32_t avail_len;
|
||||
|
||||
if (dma_ch[1]->pull_data(256, &avail_len, &data) == MoreData) {
|
||||
if (dma_ch[1]->pull_data(256, &avail_len, &data) == MorePullData) {
|
||||
while(avail_len) {
|
||||
this->send_byte(*data++);
|
||||
avail_len--;
|
||||
|
||||
+16
-10
@@ -99,7 +99,7 @@ void AwacsBase::dma_out_pause() {
|
||||
this->out_stream_running = false;
|
||||
}
|
||||
|
||||
static const char sound_input_data[2048] = {0};
|
||||
static const char sound_input_data[8192] = {0};
|
||||
static int sound_in_status = 0x10;
|
||||
|
||||
void AwacsBase::dma_in_data() {
|
||||
@@ -107,15 +107,15 @@ void AwacsBase::dma_in_data() {
|
||||
this->dma_in_ch->push_data(sound_input_data, sizeof(sound_input_data));
|
||||
|
||||
if (dma_in_ch->is_in_active()) {
|
||||
auto dbdma_ch = dynamic_cast<DMAChannel*>(dma_in_ch);
|
||||
sound_in_status <<= 1;
|
||||
if (!sound_in_status)
|
||||
sound_in_status = 1;
|
||||
dbdma_ch->set_stat(sound_in_status);
|
||||
LOG_F(INFO, "%s: status:%x", this->name.c_str(), sound_in_status);
|
||||
//auto dbdma_ch = dynamic_cast<DMAChannel*>(dma_in_ch);
|
||||
//sound_in_status <<= 1;
|
||||
//if (!sound_in_status)
|
||||
// sound_in_status = 1;
|
||||
//dbdma_ch->set_stat(sound_in_status);
|
||||
//LOG_F(INFO, "%s: status:%x", this->name.c_str(), sound_in_status);
|
||||
|
||||
this->dma_in_timer_id = TimerManager::get_instance()->add_oneshot_timer(
|
||||
10000,
|
||||
20000,
|
||||
[this]() {
|
||||
// re-enter the sequencer with the state specified in next_state
|
||||
this->dma_in_timer_id = 0;
|
||||
@@ -135,10 +135,16 @@ void AwacsBase::dma_in_stop() {
|
||||
this->dma_in_timer_id = 0;
|
||||
}
|
||||
LOG_F(ERROR, "%s: dma_in_stop", this->name.c_str());
|
||||
if (this->out_stream_ready) {
|
||||
snd_server->close_out_stream();
|
||||
this->out_stream_ready = false;
|
||||
this->out_stream_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
void AwacsBase::dma_in_pause() {
|
||||
LOG_F(ERROR, "%s: dma_in_pause", this->name.c_str());
|
||||
this->in_stream_running = false;
|
||||
}
|
||||
|
||||
//=========================== PDM-style AWACs =================================
|
||||
@@ -192,7 +198,7 @@ uint32_t AwacsScreamer::snd_ctrl_read(uint32_t offset, int size) {
|
||||
value = this->snd_ctrl_reg;
|
||||
break;
|
||||
case AWAC_CODEC_CTRL_REG:
|
||||
value = this->is_busy;
|
||||
value = this->is_busy ? AWAC_BUSY_BIT : 0;
|
||||
break;
|
||||
case AWAC_CODEC_STATUS_REG:
|
||||
value = (AWAC_AVAILABLE << 8) | (AWAC_MAKER_CRYSTAL << 16) |
|
||||
@@ -232,7 +238,7 @@ void AwacsScreamer::snd_ctrl_write(uint32_t offset, uint32_t value, int size) {
|
||||
LOG_F(9, "%s subframe = %d, reg = %d, data = %08X", this->name.c_str(),
|
||||
subframe, reg_num, data);
|
||||
if (!subframe)
|
||||
this->shadow_regs[reg_num] = data;
|
||||
this->codec_ctrl_reg = data;
|
||||
break;
|
||||
case AWAC_CLIP_COUNT:
|
||||
this->clip_count = BYTESWAP_32(value);
|
||||
|
||||
@@ -73,8 +73,11 @@ protected:
|
||||
|
||||
bool out_stream_ready = false;
|
||||
bool out_stream_running = false;
|
||||
bool in_stream_ready = false;
|
||||
bool in_stream_running = false;
|
||||
int cur_sample_rate = -1;
|
||||
int out_sample_rate = -1;
|
||||
int in_sample_rate = -1;
|
||||
};
|
||||
|
||||
/** AWACs PDM-style sound codec. */
|
||||
|
||||
@@ -69,6 +69,10 @@ void BurgundyCodec::snd_ctrl_write(uint32_t offset, uint32_t value, int size) {
|
||||
value = BYTESWAP_32(value);
|
||||
|
||||
switch (offset) {
|
||||
case AWAC_SOUND_CTRL_REG:
|
||||
this->snd_ctrl_reg = BYTESWAP_32(value);
|
||||
this->set_sample_rate((this->snd_ctrl_reg >> 8) & 7);
|
||||
break;
|
||||
case AWAC_CODEC_CTRL_REG:
|
||||
this->last_ctrl_data = value;
|
||||
reg_addr = (value >> 12) & 0xFF;
|
||||
|
||||
@@ -58,6 +58,8 @@ private:
|
||||
uint8_t read_pos = 0;
|
||||
uint8_t data_byte = 0;
|
||||
|
||||
uint32_t snd_ctrl_reg = 0;
|
||||
|
||||
uint32_t reg_array[BURGUNDY_NUM_REGS] = {};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
The AMIC is the I/O controller used in the Power Mac 6100. Appropriately, it's the abbreviation for Apple Memory Mapped I/O Controller.
|
||||
Physically, it's located at 0x50F00000.
|
||||
The AMIC is the I/O controller used in the Power Mac 6100. Physically, it's located at 0x50F00000.
|
||||
|
||||
It also:
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ It also has a unique 37-pin connector dubbed the Geekport to allow hobbyists to
|
||||
| CPU 0 Interrupt Mask | 0x7FFFF0F0 | |
|
||||
| CPU 1 Interrupt Mask | 0x7FFFF1F0 | |
|
||||
| Interrupt sources | 0x7FFFF2F0 | |
|
||||
| Cross-processor interrupts | 0x7FFFF3F0 | |
|
||||
| Cross-proccessor interrupts | 0x7FFFF3F0 | |
|
||||
| Proc. resets, other stuff | 0x7FFFF4F0 | |
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# ROMs
|
||||
# ROM
|
||||
|
||||
Old World ROMs are always 4 megabytes (MB). The first three MB are reserved for the 68k code, while the last MB is for the PowerPC boot-up code.
|
||||
The Old World ROM is always 4 megabytes (MB). The first three MB are reserved for the 68k code, while the last MB is for the PowerPC boot-up code.
|
||||
|
||||
New World ROMs are 1 MB stubs containing Open Firmware and some basic drivers, but has an additional ROM stored on the Mac's hard disk to provide Toolbox functionality. The ROMs stored on the Mac's hard disk also had updates distributed.
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ pci_B1
|
||||
pci_C1
|
||||
```
|
||||
|
||||
Specified what devices are connected to a particular PCI slot. Not supported on NuBus machines such as the Power Mac 6100.
|
||||
Specified what devices are conntected to a particular PCI slot. Not supported on NuBus machines such as the Power Mac 6100.
|
||||
|
||||
```
|
||||
--adb_devices TEXT
|
||||
@@ -214,7 +214,7 @@ Currently, the Power Mac 6100 cannot boot any OS image containing Mac OS 9.0 or
|
||||
|
||||
### ATI Mach Support
|
||||
|
||||
The GUI engine is currently not fully implemented. As such, UI elements might not be rendered when trying to use this video card. To circumvent this, you may wish to move the ATI Accelerator extension to the Extensions (Disabled) folder.
|
||||
The GUI engine is currently not fully implemented. As such, UI elements might not be rendered when trying to use this video card. To circumenvent this, you may wish to move the ATI Accelerator extension to the Extensions (Disabled) folder.
|
||||
|
||||
### Currently Unimplemented Features
|
||||
|
||||
|
||||
Reference in new issue
Block a user