static void WriteByte(uint8_t byte,uint8_t address) { LowerCS(); TransferByte(address); TransferByte(byte); RaiseCS(); }
static void WriteBytes(uint8_t *bytes,uint8_t address,int numbytes) { if(numbytes>1) address|=MultiByteCommand; LowerCS(); TransferByte(address); for(int i=0;i<numbytes;i++) TransferByte(bytes[i]); RaiseCS(); }
static uint8_t ReadByte(uint8_t address) { LowerCS(); TransferByte(address|ReadCommand); uint8_t byte=TransferByte(0); RaiseCS(); return byte; }
static void ReadBytes(uint8_t *buffer,uint8_t address,int numbytes) { if(numbytes>1) address|=ReadCommand|MultiByteCommand; else address|=ReadCommand; LowerCS(); TransferByte(address); for(int i=0;i<numbytes;i++) buffer[i]=TransferByte(0); RaiseCS(); }
void IEXIDevice::DMAWrite(u32 address, u32 size) { while (size--) { u8 byte = Memory::Read_U8(address++); TransferByte(byte); } }
void IEXIDevice::DMAWrite(u32 _uAddr, u32 _uSize) { // _dbg_assert_(EXPANSIONINTERFACE, 0); while (_uSize--) { u8 uByte = Memory::Read_U8(_uAddr++); TransferByte(uByte); } }
// --- interface IEXIDevice --- void IEXIDevice::ImmWrite(u32 _uData, u32 _uSize) { while (_uSize--) { u8 uByte = _uData >> 24; TransferByte(uByte); _uData <<= 8; } }
void IEXIDevice::DMARead(u32 address, u32 size) { while (size--) { u8 byte = 0; TransferByte(byte); Memory::Write_U8(byte, address++); } }
u32 IEXIDevice::ImmRead(u32 _uSize) { u32 uResult = 0; u32 uPosition = 0; while (_uSize--) { u8 uByte = 0; TransferByte(uByte); uResult |= uByte << (24-(uPosition++ * 8)); } return uResult; }