Skip to content

Commit

Permalink
Removed unneeded sleep() and log lines in SynopsisController.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieklinnenbank committed Dec 21, 2015
1 parent 70eadaa commit ff8b114
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions lib/libusb/SynopsisController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Error SynopsisController::initialize()

// Soft-Reset
softReset();
//DEBUG("software reset done");
NOTICE("software reset done");

// Setup DMA
m_io.write(RxFIFOSize, 1024);
Expand All @@ -83,8 +81,6 @@ Error SynopsisController::initialize()
addIRQHandler(0, (IRQHandlerFunction) &SynopsisController::interruptHandler); // TODO: ARM does not have IRQ_REG() yet
ProcessCtl(SELF, WatchIRQ, InterruptNumber);
ProcessCtl(SELF, EnableIRQ, InterruptNumber);
//DEBUG("interrupt handler installed");
NOTICE("interrupt handler installed");

// Clear all pending core interrupts
m_io.write(CoreIntMask, 0);
Expand All @@ -95,19 +91,13 @@ Error SynopsisController::initialize()

// Enable interrupts globally on the USB host controller.
m_io.set(AHBConfig, InterruptEnable);
//DEBUG("interrupts enabled");
NOTICE("interrupts enabled");
sleep(60);

// Power-on host port (virtual root hub)
u32 val = m_io.read(HostPortControl);
val &= ~(HostPortEnable | HostPortEnableChanged |
HostPortConnectChanged | HostPortCurrentChanged);
val |= HostPortPower;
m_io.write(HostPortControl, val);
//DEBUG("poweron host port");
//NOTICE("poweron host port");
sleep(60);

// Begin host port reset (raise the reset signal)
val = m_io.read(HostPortControl);
Expand All @@ -125,11 +115,6 @@ Error SynopsisController::initialize()
HostPortConnectChanged | HostPortCurrentChanged);
m_io.write(HostPortControl, val);

sleep(60);
DEBUG("host port reset done. root hub enabled");

hostPortChanged();

// Initialize channels
for (Size i = 0; i < ChannelCount; i++)
m_channels[i].initialize();
Expand Down Expand Up @@ -171,14 +156,14 @@ void SynopsisController::hostPortChanged()
u32 portStatus = m_io.read(HostPortControl);

NOTICE("connected = " << (int)(portStatus & HostPortConnect) <<
"connectedChanged = " << (int)(portStatus & HostPortConnectChanged) <<
"enabled = " << (int)(portStatus & HostPortEnable) <<
"enabledChanged = " << (int)(portStatus & HostPortEnableChanged) <<
"overcurrent = " << (int)(portStatus & HostPortCurrent) <<
"overcurrentChanged = " << (int)(portStatus & HostPortCurrentChanged) <<
"reset = " << (int)(portStatus & HostPortReset) <<
"power = " << (int)(portStatus & HostPortPower) <<
"speed = " << (int)(portStatus & HostPortSpeed));
" connectedChanged = " << (int)(portStatus & HostPortConnectChanged) <<
" enabled = " << (int)(portStatus & HostPortEnable) <<
" enabledChanged = " << (int)(portStatus & HostPortEnableChanged) <<
" overcurrent = " << (int)(portStatus & HostPortCurrent) <<
" overcurrentChanged = " << (int)(portStatus & HostPortCurrentChanged) <<
" reset = " << (int)(portStatus & HostPortReset) <<
" power = " << (int)(portStatus & HostPortPower) <<
" speed = " << (int)(portStatus & HostPortSpeed));

// Clear host port interrupt flags
portStatus &= ~(HostPortEnable | HostPortReset);
Expand All @@ -195,6 +180,11 @@ void SynopsisController::softReset()

// Wait until cleared
while (m_io.read(CoreReset) & 1);

// Wait for some time to give the hardware
// enough time to fully initialize. Without this wait,
// the hardware does not process transfers / interrupts properly.
sleep(60);
}

SynopsisChannel * SynopsisController::getChannel(const FileSystemMessage *msg,
Expand Down

0 comments on commit ff8b114

Please sign in to comment.