This commit is contained in:
Glenn Maynard
2004-08-24 22:44:06 +00:00
parent fb425bcc8f
commit 6091b87526
@@ -18,39 +18,35 @@ static const bool SCREEN_DEBUG = false;
LightsDriver_LinuxParallel::LightsDriver_LinuxParallel() LightsDriver_LinuxParallel::LightsDriver_LinuxParallel()
{ {
// Give port's permissions and reset all bits to zero // Give port's permissions and reset all bits to zero
ioperm(PORT_ADDRESS,1,1); ioperm( PORT_ADDRESS, 1, 1 );
outb(0,PORT_ADDRESS); outb( 0, PORT_ADDRESS );
} }
LightsDriver_LinuxParallel::~LightsDriver_LinuxParallel() LightsDriver_LinuxParallel::~LightsDriver_LinuxParallel()
{ {
// Reset all bits to zero and free the port's permissions // Reset all bits to zero and free the port's permissions
outb(0,PORT_ADDRESS); outb( 0, PORT_ADDRESS );
ioperm(PORT_ADDRESS,1,0); ioperm( PORT_ADDRESS, 1, 0 );
} }
void LightsDriver_LinuxParallel::Set( const LightsState *ls ) void LightsDriver_LinuxParallel::Set( const LightsState *ls )
{ {
// Set LightState to port // Set LightState to port
CString s; CString s;
unsigned char output;
int i = 0;
// Prepare Screen Output too for debugging // Prepare Screen Output too for debugging
s += "LinuxParallel Lights Driver Debug\n"; s += "LinuxParallel Lights Driver Debug\n";
s += "Lights Mode: " + LightsModeToString(LIGHTSMAN->GetLightsMode()) + "\n"; s += "Lights Mode: " + LightsModeToString(LIGHTSMAN->GetLightsMode()) + "\n";
// Cabinet Lights // Cabinet Lights
i = 0; int i = 0;
output = 0; unsigned char output = 0;
s += "Cabinet Bits: "; s += "Cabinet Bits: ";
FOREACH_CabinetLight( cl ) FOREACH_CabinetLight( cl )
{ {
s += ls->m_bCabinetLights[cl] ? '1' : '0'; s += ls->m_bCabinetLights[cl] ? '1' : '0';
if ( ls->m_bCabinetLights[cl] ) if ( ls->m_bCabinetLights[cl] )
{
output += (unsigned char)pow((double)2,i); output += (unsigned char)pow((double)2,i);
}
i++; i++;
} }
s += "\n"; s += "\n";
@@ -60,18 +56,17 @@ void LightsDriver_LinuxParallel::Set( const LightsState *ls )
{ {
s += ssprintf("Controller%d Bits: ",gc+1); s += ssprintf("Controller%d Bits: ",gc+1);
for( int gb=0; gb<iNumGameButtonsToShow; gb++ ) for( int gb=0; gb<iNumGameButtonsToShow; gb++ )
{
s += ls->m_bGameButtonLights[gc][gb] ? '1' : '0'; s += ls->m_bGameButtonLights[gc][gb] ? '1' : '0';
}
s += "\n"; s += "\n";
} }
s += ssprintf("Output Port: 0x%x\n", PORT_ADDRESS); s += ssprintf("Output Port: 0x%x\n", PORT_ADDRESS);
s += ssprintf("Output Byte: %i\n", output); s += ssprintf("Output Byte: %i\n", output);
if ( SCREEN_DEBUG ) { SCREENMAN->SystemMessageNoAnimate( s ); } if( SCREEN_DEBUG )
SCREENMAN->SystemMessageNoAnimate( s );
// Send byte to port // Send byte to port
outb(output, PORT_ADDRESS); outb( output, PORT_ADDRESS );
} }
/* /*