本文整理汇总了C++中IOSleep函数的典型用法代码示例。如果您正苦于以下问题:C++ IOSleep函数的具体用法?C++ IOSleep怎么用?C++ IOSleep使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IOSleep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: USBTrace
//================================================================================================
//
// ResetControllerState
//
//================================================================================================
//
IOReturn
AppleUSBOHCI::ResetControllerState(void)
{
USBTrace( kUSBTOHCI, KTPOHCIResetControllerState, (uintptr_t)this, 0, 0, 0);
// Disable All OHCI Interrupts
_pOHCIRegisters->hcInterruptDisable = HostToUSBLong(kOHCIHcInterrupt_MIE);
IOSync();
// Place the USB bus into the Reset State
_pOHCIRegisters->hcControl = HostToUSBLong((kOHCIFunctionalState_Reset << kOHCIHcControl_HCFSPhase));
IOSync();
// always make sure we stay in reset for at least 50 ms
IOSleep(50);
// Clear all Processing Registers
_pOHCIRegisters->hcHCCA = 0;
_pOHCIRegisters->hcControlHeadED = 0;
_pOHCIRegisters->hcControlCurrentED = 0;
_pOHCIRegisters->hcBulkHeadED = 0;
_pOHCIRegisters->hcBulkCurrentED = 0;
IOSync();
// turn off the global power
OHCIRootHubPower(0 /* kOff */);
// go ahead and reset the controller
_pOHCIRegisters->hcCommandStatus = HostToUSBLong(kOHCIHcCommandStatus_HCR); // Reset OHCI
IOSync();
IOSleep(1); // the spec says 10 microseconds
return kIOReturnSuccess;
}
示例2: DEBUG_LOG
void CodecCommander::performCodecReset()
{
/*
Reset is created by sending two Function Group resets, potentially separated
by an undefined number of idle frames, but no other valid commands.
This Function Group “Double” reset shall do a full initialization and reset
most settings to their power on defaults.
This function can be used to reset codec on dekstop boards, for example H87-HD3,
to overcome audio loss and jack sense problem after sleep with AppleHDA v2.6.0+
*/
if (!coldBoot)
{
DEBUG_LOG("CodecCommander: cc: --> resetting codec\n");
mIntelHDA->sendCommand(1, HDA_VERB_RESET, HDA_PARM_NULL);
IOSleep(100); // define smaller delays ????
mIntelHDA->sendCommand(1, HDA_VERB_RESET, HDA_PARM_NULL);
IOSleep(100);
// forcefully set power state to D3
mIntelHDA->sendCommand(1, HDA_VERB_SET_PSTATE, HDA_PARM_PS_D3_HOT);
eapdPoweredDown = true;
DEBUG_LOG("CodecCommander: cc: --> hda codec power restored\n");
}
}
示例3: ite_family_enter
bool SuperIODevice::detectITEFamilyChip()
{
// IT87XX can enter only on port 0x2E
port = 0x2E;
ite_family_enter(port);
id = superio_listen_port_word(port, kSuperIOChipIDRegister);
HWSensorsDebugLog("probing device on 0x%x, id=0x%x", port, id);
ldn = 0;
vendor = "";
switch (id) {
case IT8512F:
case IT8712F:
case IT8716F:
case IT8718F:
case IT8720F:
case IT8721F:
case IT8726F:
case IT8620E:
case IT8728F:
case IT8752F:
case IT8771E:
case IT8772E:
model = id;
ldn = kFintekITEHardwareMonitorLDN;
vendor = "ITE";
break;
}
if (model != 0 && ldn != 0) {
HWSensorsDebugLog("detected %s %s, starting address sanity checks", vendor, superio_get_model_name(model));
superio_select_logical_device(port, ldn);
IOSleep(10);
address = superio_listen_port_word(port, kSuperIOBaseAddressRegister);
IOSleep(10);
UInt16 verify = superio_listen_port_word(port, kSuperIOBaseAddressRegister);
IOSleep(10);
ite_family_exit(port);
if (address != verify || address < 0x100 || (address & 0xF007) != 0)
return false;
return true;
}
else ite_family_exit(port);
return false;
}
示例4: debugIOLog
IOReturn AudioProj10PowerObject::setHardwarePowerOn(){
debugIOLog (3, "+ AudioProj10PowerObject::setHardwarePowerOn");
IOReturn result = kIOReturnSuccess;
UInt32 progOut;
IOService *keyLargo = 0;
keyLargo = IOService::waitForService(IOService::serviceMatching("KeyLargo"));
if(keyLargo){
long gpioOffset = kPowerObjectOffset;
UInt8 value = kPowerOn;
keyLargo->callPlatformFunction("keyLargo_writeRegUInt8", false, (void *)&gpioOffset, (void *)(UInt32)value, 0, 0);
}
IOSleep(80);
progOut = audioPluginRef->sndHWGetProgOutput();
progOut &= ~kSndHWProgOutput0;
audioPluginRef->sndHWSetProgOutput(progOut);
IOSleep(200);
if(audioPluginRef) {
audioPluginRef->sndHWSetPowerState(kIOAudioDeviceActive);
audioPluginRef->setDeviceDetectionActive();
}
debugIOLog (3, "- AudioProj10PowerObject::setHardwarePowerOn");
return result;
}
示例5: ite_family_enter
bool SuperIODevice::detectITEFamilyChip()
{
// IT87XX can enter only on port 0x2E
port = 0x2E;
ite_family_enter(port);
id = superio_listen_port_word(port, kSuperIOChipIDRegister);
ldn = 0;
vendor = "";
switch (id) {
case IT8512F:
case IT8712F:
case IT8716F:
case IT8718F:
case IT8720F:
case IT8721F:
case IT8726F:
case IT8728F:
case IT8752F:
case IT8771E:
case IT8772E:
model = id;
ldn = kFintekITEHardwareMonitorLDN;
vendor = "ITE";
break;
}
if (model != 0 && ldn != 0) {
superio_select_logical_device(port, ldn);
IOSleep(10);
address = superio_listen_port_word(port, kSuperIOBaseAddressRegister);
IOSleep(10);
UInt16 verify = superio_listen_port_word(port, kSuperIOBaseAddressRegister);
IOSleep(10);
ite_family_exit(port);
if (address != verify || address < 0x100 || (address & 0xF007) != 0)
return false;
return true;
}
else ite_family_exit(port);
return false;
}
示例6: DEBUG_LOG
IOReturn CodecCommander::setPowerState(unsigned long powerStateOrdinal, IOService *policyMaker)
{
if (kPowerStateSleep == powerStateOrdinal) {
DEBUG_LOG("CodecCommander: cc: --> asleep\n");
eapdPoweredDown = true;
// though this probably has been determined after parsing codec power state, we set this as false again
coldBoot = false;
}
else if (kPowerStateNormal == powerStateOrdinal) {
DEBUG_LOG("CodecCommander: cc: --> awake\n");
updateCount = 0;
// This operation has to be performed right at wake or codec will enter power mode 0 immediately!
// *****
// set EAPD bit at wake or cold boot
if (eapdPoweredDown) {
DEBUG_LOG("CodecCommander: cc: --> hda codec power restored\n");
// delay setting by 100ms, otherwise immediate command won't be received
IOSleep(100);
setOutputs();
}
// only when this is done we can stars a check workloop!
// *****
// if infinite checking requested
if (checkInfinite){
// if checking infinitely then make sure to delay workloop
if (coldBoot) {
fTimer->setTimeoutMS(20000); // create a nasty 20sec delay for AudioEngineOutput to initialize
}
// if we are waking it will be already initialized
else {
fTimer->setTimeoutMS(100); // so fire timer for workLoop almost immediately
}
DEBUG_LOG("CodecCommander: cc: --> workloop started\n");
}
// generate audio stream at wake if requested
if (!coldBoot && generatePop){
// apply delay or it will not trigger a system event
IOSleep(streamDelay);
createAudioStream();
}
// simulate headphone jack replug
simulateHedphoneJack();
}
return IOPMAckImplied;
}
示例7: bfe_wait_bit
static int
bfe_wait_bit( struct bfe_softc * sc, u_int32_t reg, u_int32_t bit,
u_long timeout, const int clear )
{
u_long i;
int use_sleep = 0;
/* [email protected]: long timeouts polls are done using a blocking wait */
if (timeout >= 10000) {
use_sleep = 1;
timeout /= 1000;
}
for (i = 0; i < timeout; i++) {
u_int32_t val = CSR_READ_4(sc, reg);
if (clear && !(val & bit))
break;
if (!clear && (val & bit))
break;
if (use_sleep)
IOSleep(10);
else
DELAY(10);
}
if (i == timeout) {
DEBUG_LOG("bfe%d: BUG! Timeout waiting for bit %08x of register "
"%x to %s.\n", sc->bfe_unit, bit, reg,
(clear ? "clear" : "set"));
return -1;
}
return 0;
}
示例8: USBLog
IOReturn
AppleUSBUHCI::RHResumePortCompletion(UInt32 port)
{
UInt16 value;
USBLog(5, "AppleUSBUHCI[%p]::RHResumePortCompletion - finishing resume on port %d", this, (int)port);
if (!_rhPortBeingResumed[port-1])
{
USBLog(1, "AppleUSBUHCI[%p]::RHResumePortCompletion - port %d does not appear to be resuming!", this, (int)port);
USBTrace( kUSBTUHCI, kTPUHCIRHResumePortCompletion, (uintptr_t)this, (int)port, 0, kIOReturnInternalError );
return kIOReturnInternalError;
}
if (!_controllerAvailable)
{
USBLog(5, "AppleUSBEHCI[%p]::RHResumePortCompletion - cannot finish resume on port %d because the controller is unavailable", this, (int)port);
_rhPortBeingResumed[port-1] = false;
return kIOReturnInternalError;
}
value = ReadPortStatus(port-1) & kUHCI_PORTSC_MASK;
value &= ~(kUHCI_PORTSC_RD | kUHCI_PORTSC_SUSPEND);
USBLog(5, "AppleUSBUHCI[%p]: de-asserting resume signal by writing (%p)", this, (void*)value);
WritePortStatus(port-1, value);
IOSync();
IOSleep(2); // allow it to kick in
_rhPortBeingResumed[port-1] = false;
_portSuspendChange[port-1] = true;
EnsureUsability();
return kIOReturnSuccess;
}
示例9: DEBUG_LOG
IOReturn
SATSMARTUserClient::HandleTerminate ( IOService * provider )
{
IOReturn status = kIOReturnSuccess;
DEBUG_LOG("%s[%p]::%s\n", getClassName(), this, __FUNCTION__);
while ( fOutstandingCommands != 0 )
{
IOSleep ( 10 );
}
// Check if we have our provider open.
if ( provider->isOpen ( this ) )
{
// Yes we do, so close the connection
DEBUG_LOG("%s[%p]::%s closing provider\n", getClassName(), this, __FUNCTION__);
provider->close ( this, kIOATASMARTUserClientAccessMask );
}
// Decouple us from the IORegistry.
detach ( provider );
fProvider = NULL;
DEBUG_LOG("%s[%p]::%s result %d\n", getClassName(), this, __FUNCTION__, status);
return status;
}
示例10: while
bool
IOATABlockStorageDriver::finalize ( IOOptionBits options )
{
if ( fPowerManagementInitialized )
{
while ( fPowerTransitionInProgress )
{
IOSleep ( 1 );
}
fCommandGate->commandWakeup ( &fCurrentPowerState, false );
PMstop ( );
if ( fPowerManagementThread != NULL )
{
// If the power management thread is scheduled, unschedule it.
thread_call_cancel ( fPowerManagementThread );
}
fPowerManagementInitialized = false;
}
return super::finalize ( options );
}
示例11: OUTVID
float X3100monitor::getSensorValue(FakeSMCSensor *sensor)
{
if (sensor->getGroup() == kFakeSMCTemperatureSensor) {
short value = 0;
if (mmio_base) {
OUTVID(TIC1, 3);
// if ((INVID16(TSC1) & (1<<15)) && !(INVID16(TSC1) & (1<<8)))//enabled and ready
for (int i=0; i<1000; i++) { //attempts to ready
if (INVID16(TSS1) & (1<<10)) //valid?
break;
IOSleep(10);
}
value = INVID8(TR1);
}
return 150 - value;
}
return 0;
}
示例12: OUTVID
bool GmaSensors::willReadSensorValue(FakeSMCSensor *sensor, float *outValue)
{
if (sensor->getGroup() == kFakeSMCTemperatureSensor) {
short value = 0;
if (mmio_base) {
OUTVID(TIC1, 3);
// if ((INVID16(TSC1) & (1<<15)) && !(INVID16(TSC1) & (1<<8)))//enabled and ready
for (int i=0; i<1000; i++) { //attempts to ready
if (INVID16(TSS1) & (1<<10)) //valid?
break;
IOSleep(10);
}
value = INVID8(TR1);
}
*outValue = (float)(150 - value);
}
return true;
}
示例13: ELG
IOReturn AppleRS232Serial::setPowerState(unsigned long powerStateOrdinal, IOService *whatDevice)
{
bool ok;
UInt32 counter = 0;
ELG(0, powerStateOrdinal, "setPowerState - powerStateOrdinal");
retain(); // paranoia is your friend, make sure we're not freed
fWaitForGatedCmd = true; // could do this async, but let's be sync initially
ok = thread_call_enter1(fPowerThreadCall, (void *)powerStateOrdinal); // schedule work on workloop
if (ok) { // if thread was already pending ...
ALERT(0, 0, "setPowerState - thread already pending?"); // a 'never' in current flow
release(); // don't need/want the retain, so undo it
}
while (fWaitForGatedCmd) { // we're being sync for now, wait for it to finish
IOSleep(2); // it should be very fast
counter++;
}
ELG(0, counter, "setPowerState - finished after N sleeps of 2ms each");
return IOPMAckImplied; // we're done
}/* end setPowerState */
示例14: msleep_interruptible
unsigned long msleep_interruptible(unsigned int msecs)
{
// FIXME, make into interruptable sleep
// Sleep the calling thread for a number of milliseconds
IOSleep(msecs);
return(0);
}
示例15: DbgPrint
IOReturn AttansicL2Ethernet::disable(IONetworkInterface *netif)
{
DbgPrint("disable()\n");
at_adapter *adapter=&adapter_;
setLinkStatus(kIONetworkLinkValid, 0);
transmitQueue_->flush();
transmitQueue_->stop();
transmitQueue_->setCapacity(0);
at_reset_hw(adapter);
IOSleep(1);
at_irq_disable(adapter);
adapter->link_speed = SPEED_0;
adapter->link_duplex = -1;
// pretty wrong place for DMA stuff cleaning, eh?
if (adapter->pdev && adapter->pdev->isOpen () ) adapter->pdev->close(this);
return kIOReturnSuccess;
}