10.02_devices/2_src/uda.cpp
//
// DMARead():
// Read data from Qbus/Unibus memory into the returned buffer.
// Buffer returned is nullptr if memory could not be read.
// Caller is responsible for freeing the buffer when done.
// The address specified in 'address' must be word-aligned
// and the length must be even.
//
Read data from Qbus/Unibus memory into the returned buffer.
Buffer returned is nullptr if memory could not be read.
Caller is responsible for freeing the buffer when done.
The address specified in 'address' must be word-aligned
and the length must be even.
Read data from Qbus / Unibus memory into the returned buffer . Buffer returned is nullptr if memory could not be read . Caller is responsible for freeing the buffer when done . The address specified in ' address ' must be word - aligned and the length must be even .
uint8_t*
uda_c::DMARead(
    uint32_t address,
    size_t lengthInBytes,
    size_t bufferSize)
{
    assert (bufferSize >= lengthInBytes);
    assert((lengthInBytes % 2) == 0);
    assert (address < 2* qunibus->addr_space_word_count); 
    uint16_t* buffer = new uint16_t[bufferSize >> 1];
    assert(buffer);
    memset(reinterpret_cast<uint8_t*>(buffer), 0xc3, bufferSize);
    qunibusadapter->DMA(dma_request, true,
                QUNIBUS_CYCLE_DATI,
                address,
                buffer,
                lengthInBytes >> 1);
    if (dma_request.success)
    { 
	return reinterpret_cast<uint8_t*>(buffer);
    }
    else
    {
        return nullptr;     
    }
}
uint8_t * uda_c :: DMARead ( uint32_t address , size_t lengthInBytes , size_t bufferSize ) { assert ( bufferSize >= lengthInBytes ) ; assert ( ( lengthInBytes % 2 ) == 0 ) ; assert ( address < 2 * qunibus -> addr_space_word_count ) ; uint16_t * buffer = new uint16_t [ bufferSize >> 1 ] ; assert ( buffer ) ; memset ( reinterpret_cast < uint8_t * > ( buffer ) , 0xc3 , bufferSize ) ; qunibusadapter -> DMA ( dma_request , true , QUNIBUS_CYCLE_DATI , address , buffer , lengthInBytes >> 1 ) ; if ( dma_request . success ) { return reinterpret_cast < uint8_t * > ( buffer ) ; } else { return nullptr ; } }
DMARead():
Read data from Qbus/Unibus memory into the returned buffer.
DMARead () : Read data from Qbus / Unibus memory into the returned buffer .
// exceeds address space? test for IOpage too? //    ARM_DEBUG_PIN0(1) ; //printf("UDA.DMARead NXM: address=%07o,len=%d words, failing addr=%07o", //		address, lengthInBytes >> 1, dma_request.qunibus_end_addr ) ;