本文整理汇总了C++中OSNumber::unsigned16BitValue方法的典型用法代码示例。如果您正苦于以下问题:C++ OSNumber::unsigned16BitValue方法的具体用法?C++ OSNumber::unsigned16BitValue怎么用?C++ OSNumber::unsigned16BitValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSNumber
的用法示例。
在下文中一共展示了OSNumber::unsigned16BitValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
bool SuperIOPlugin::start(IOService *provider)
{
if (!super::start(provider))
return false;
OSNumber *number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOHWMAddress));
if (!number || !(address = number->unsigned16BitValue())) {
HWSensorsFatalLog("wrong address provided");
return false;
}
number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOControlPort));
if (!number || !(port = number->unsigned8BitValue())) {
HWSensorsFatalLog("wrong port provided");
return false;
}
number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOModelValue));
if (!number || !(model = number->unsigned16BitValue())) {
HWSensorsFatalLog("wrong model provided");
return false;
}
OSString *string = OSDynamicCast(OSString, provider->getProperty(kSuperIOModelName));
if (!string || !(modelName = string->getCStringNoCopy())) {
HWSensorsFatalLog("wrong model name provided");
return false;
}
string = OSDynamicCast(OSString, provider->getProperty(kSuperIOVendorName));
if (!string || !(vendorName = string->getCStringNoCopy())) {
HWSensorsFatalLog("wrong vendor name provided");
return false;
}
if (!initialize())
return false;
OSString *modelString = OSString::withCString(modelName);
if (OSDictionary *configuration = getConfigurationNode(modelString))
{
addTemperatureSensors(configuration);
addVoltageSensors(configuration);
addTachometerSensors(configuration);
}
else HWSensorsWarningLog("no platform profile provided");
OSSafeReleaseNULL(modelString);
registerService();
HWSensorsInfoLog("started");
return true;
}
示例2: init
bool com_reidburke_air_IntelEnhancedSpeedStep::init(OSDictionary* dict) {
bool res = super::init(dict);
info("Initializing xnu-speedstep-air\n");
// read data
cpuid_update_generic_info();
/* Allocate our spinlock for later use */
Lock = IOSimpleLockAlloc();
/* Check for a patched kernel which properly implements rtc_clock_stepped() */
uint64_t magic = -1; // means autodetect
OSBoolean* debugMsgs = (OSBoolean*) dict->getObject("DebugMessages");
if (debugMsgs != 0)
DebugOn = debugMsgs->getValue();
else
DebugOn = false;
OSNumber* kernelFeatures = (OSNumber*) dict->getObject("KernelFeatures");
if (kernelFeatures != 0)
magic = kernelFeatures->unsigned8BitValue();
if (magic == 255) nanoseconds_to_absolutetime(~(0), &magic); //255uint = -1 int
if (magic == 1) {
RtcFixKernel = true;
Below1Ghz = false;
} else if (magic == 2) {
RtcFixKernel = true;
Below1Ghz = true;
} else if (magic == 3) {
RtcFixKernel = false;
Below1Ghz = true;
} else {
RtcFixKernel = false;
Below1Ghz = false;
}
checkForNby2Ratio(); // check and store in global variable before loading pstate override
if (getFSB() == false)
return false;
OSArray* overrideTable = (OSArray*) dict->getObject("PStateTable");
if (overrideTable != 0 )
loadPStateOverride(overrideTable);
OSNumber* defaultState = (OSNumber*) dict->getObject("DefaultPState");
if (defaultState != 0)
DefaultPState = defaultState->unsigned8BitValue();
else
DefaultPState = -1; // indicate no default state
OSNumber* maxLatency = (OSNumber*) dict->getObject("Latency");
if (maxLatency != 0)
MaxLatency = maxLatency->unsigned32BitValue();
else
MaxLatency = 0;
/* Make preliminary check */
if ( (strcmp(cpuid_info()->cpuid_vendor, CPUID_VID_INTEL) == 0) // Check it's actually Intel
&& ( cpuid_info()->cpuid_features & CPUID_FEATURE_EST) ) { // Check it supports EST
autostart = (OSNumber*) dict->getObject("AutoStart");
info( "do autostart %d \n", autostart->unsigned8BitValue() );
if ( autostart != 0 && autostart->unsigned8BitValue() == 1 ) {
Throttler = new AutoThrottler;
if (Throttler) {
dbg("Throttler instantiated.\n");
OSNumber* targetload = (OSNumber*) dict->getObject("TargetCPULoad");
if (targetload != 0)
Throttler->targetCPULoad = (targetload->unsigned16BitValue()) * 10;
else
Throttler->targetCPULoad = 700;
}
}
}
totalThrottles = 0;
frequencyUsage[0] = '\0';
/* Return whatever the superclass returned */
return res;
}
示例3: start
bool SuperIOMonitor::start(IOService *provider)
{
if (!super::start(provider))
return false;
OSNumber *number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOHWMAddress));
if (!number || !(address = number->unsigned16BitValue())) {
HWSensorsWarningLog("wrong address provided");
return false;
}
number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOControlPort));
if (!number || !(port = number->unsigned8BitValue())) {
HWSensorsWarningLog("wrong port provided");
return false;
}
number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOModelValue));
if (!number || !(model = number->unsigned16BitValue())) {
HWSensorsWarningLog("wrong model provided");
return false;
}
OSString *string = OSDynamicCast(OSString, provider->getProperty(kSuperIOModelName));
if (!string || !(modelName = string->getCStringNoCopy())) {
HWSensorsWarningLog("wrong model name provided");
return false;
}
string = OSDynamicCast(OSString, provider->getProperty(kSuperIOVendorName));
if (!string || !(vendorName = string->getCStringNoCopy())) {
HWSensorsWarningLog("wrong vendor name provided");
return false;
}
if (!initialize())
return false;
OSString *manufacturerName = OSDynamicCast(OSString, provider->getProperty("mb-manufacturer"));
OSString *productName = OSDynamicCast(OSString, provider->getProperty("mb-product"));
OSDictionary *configuration = NULL;
if (OSDictionary *list = OSDynamicCast(OSDictionary, getProperty("Sensors Configuration")))
{
if (OSDictionary *manufacturer = OSDynamicCast(OSDictionary, list->getObject(manufacturerName)))
if (!(configuration = lookupConfiguration(manufacturer, productName)))
if (!(configuration = lookupConfiguration(manufacturer, modelName)))
configuration = lookupConfiguration(manufacturer, "Default");
if (!configuration && !(configuration = lookupConfiguration(list, modelName)))
configuration = lookupConfiguration(list, "Default");
}
if (configuration) {
addTemperatureSensors(configuration);
addVoltageSensors(configuration);
addTachometerSensors(configuration);
registerService();
}
else HWSensorsWarningLog("no sensors configuration provided");
HWSensorsInfoLog("started");
return true;
}