#include "Sym8xxController.h"
UInt32 Sym8xxSCSIController::Sym8xxReadRegs( volatile UInt8 *chipRegs, UInt32 regOffset, UInt32 regSize )
{
if ( regSize == 1 )
{
return chipRegs[regOffset];
}
if ( regSize == 2 )
{
return OSSwapHostToLittleInt16( *(volatile u_int16_t *)&chipRegs[regOffset] );
}
else if (regSize == 4 )
{
return OSSwapHostToLittleInt32( *(volatile UInt32 *)&chipRegs[regOffset] );
}
else
{
kprintf("SCSI(SymBios875): Sym8xxReadRegs incorrect regSize\n\r" );
return 0;
}
}
void Sym8xxSCSIController::Sym8xxWriteRegs( volatile UInt8 *chipRegs, UInt32 regOffset, UInt32 regSize, UInt32 regValue )
{
if ( regSize == 1 )
{
chipRegs[regOffset] = regValue;
}
else if ( regSize == 2 )
{
volatile u_int16_t *p = (volatile u_int16_t *)&chipRegs[regOffset];
*p = OSSwapHostToLittleInt16( regValue );
}
else if ( regSize == 4 )
{
volatile UInt32 *p = (volatile UInt32 *)&chipRegs[regOffset];
*p = OSSwapHostToLittleInt32( regValue );
}
else
{
kprintf("SCSI(SymBios875): Sym8xxWriteRegs incorrect regSize\n\r" );
}
eieio();
}