Overhauled and unified CD-ROM emulation;
Four CD-ROM drives are now emulated; ATAPI DMA is now emulated; Unified CD-ROM pass through to host drive handling; Applied all (applicable) mainline PCem commits.
This commit is contained in:
29
src/dma.c
29
src/dma.c
@@ -565,34 +565,39 @@ int dma_channel_write(int channel, uint16_t val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static uint32_t PageLengthReadWrite(uint32_t PhysAddress, uint32_t TotalSize)
|
||||
{
|
||||
uint32_t LengthSize;
|
||||
uint32_t Page;
|
||||
|
||||
Page = PhysAddress & 4095;
|
||||
LengthSize = (Page + 4096) - PhysAddress;
|
||||
if (LengthSize > TotalSize)
|
||||
LengthSize = TotalSize;
|
||||
|
||||
return LengthSize;
|
||||
if ((Page + TotalSize - 1) >= 4096)
|
||||
{
|
||||
TotalSize = 4096 - Page;
|
||||
}
|
||||
|
||||
return TotalSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
//DMA Bus Master Page Read/Write
|
||||
void DMAPageRead(uint32_t PhysAddress, void *DataRead, uint32_t TotalSize)
|
||||
{
|
||||
uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
|
||||
memcpy(DataRead, &ram[PhysAddress], PageLen);
|
||||
DataRead -= PageLen;
|
||||
TotalSize += PageLen;
|
||||
// uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
|
||||
memcpy(DataRead, &ram[PhysAddress], TotalSize);
|
||||
// DataRead -= PageLen;
|
||||
DataRead -= TotalSize;
|
||||
}
|
||||
|
||||
void DMAPageWrite(uint32_t PhysAddress, const void *DataWrite, uint32_t TotalSize)
|
||||
{
|
||||
uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
|
||||
memcpy(&ram[PhysAddress], DataWrite, PageLen);
|
||||
DataWrite -= PageLen;
|
||||
TotalSize += PageLen;
|
||||
// uint32_t PageLen = PageLengthReadWrite(PhysAddress, TotalSize);
|
||||
memcpy(&ram[PhysAddress], DataWrite, TotalSize);
|
||||
mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1);
|
||||
// DataWrite -= PageLen;
|
||||
DataWrite -= TotalSize;
|
||||
}
|
||||
|
||||
int dma_mode(int channel)
|
||||
|
||||
Reference in New Issue
Block a user