QString SubsurfaceSysInfo::osVersion() { #if defined(Q_OS_IOS) int major = (int(MacintoshVersion) >> 4) & 0xf; int minor = int(MacintoshVersion) & 0xf; if (Q_LIKELY(major < 10 && minor < 10)) { char buf[4] = { char(major + '0'), '.', char(minor + '0'), '\0' }; return QString::fromLatin1(buf, 3); } return QString::number(major) + QLatin1Char('.') + QString::number(minor); #elif defined(Q_OS_OSX) int minor = int(MacintoshVersion) - 2; // we're not running on Mac OS 9 Q_ASSERT(minor < 100); char buf[] = "10.0\0"; if (Q_LIKELY(minor < 10)) { buf[3] += minor; } else { buf[3] += minor / 10; buf[4] = '0' + minor % 10; } return QString::fromLatin1(buf); #elif defined(Q_OS_WIN) const char *version = winVer_helper(); if (version) return QString::fromLatin1(version).toLower(); // fall through // Android and Blackberry should not fall through to the Unix code #elif defined(Q_OS_ANDROID) // TBD #elif defined(Q_OS_BLACKBERRY) deviceinfo_details_t *deviceInfo; if (deviceinfo_get_details(&deviceInfo) == BPS_SUCCESS) { QString bbVersion = QString::fromLatin1(deviceinfo_details_get_device_os_version(deviceInfo)); deviceinfo_free_details(&deviceInfo); return bbVersion; } #elif defined(Q_OS_UNIX) QUnixOSVersion unixOsVersion = detectUnixVersion(); if (!unixOsVersion.versionIdentifier.isEmpty()) return unixOsVersion.versionIdentifier; #endif // fallback return unknownText(); }
QString RegisterService::deviceModel() const { QString deviceModel; if (bps_initialize() == BPS_SUCCESS) { qDebug() << "bps initialized"; deviceinfo_details_t *deviceDetails = 0; if (deviceinfo_get_details(&deviceDetails) == BPS_SUCCESS) { deviceModel = deviceinfo_details_get_hardware_id(deviceDetails); deviceinfo_free_details(&deviceDetails); } else { qDebug() << "error retrieving device details"; } bps_shutdown(); } else { qDebug() << "error initializing bps"; } return deviceModel; }
// Detects the various cpu features void CPUInfo::Detect() { // Set some defaults here // When ARMv8 cpus come out, these need to be updated. HTT = false; OS64bit = false; CPU64bit = false; Mode64bit = false; vendor = VENDOR_ARM; // Get the information about the CPU #if defined(__SYMBIAN32__) || defined(BLACKBERRY) || defined(IOS) bool isVFP3 = false; bool isVFP4 = false; #ifdef IOS isVFP3 = true; // Check for swift arch (VFP4) #ifdef __ARM_ARCH_7S__ isVFP4 = true; #endif strcpy(brand_string, "Apple"); num_cores = 2; #elif defined(BLACKBERRY) isVFP3 = true; deviceinfo_details_t* details; deviceinfo_get_details(&details); num_cores = deviceinfo_details_get_processor_core_count(details); strcpy(brand_string, deviceinfo_details_get_processor_name(details)); if (!strncmp(brand_string, "MSM", 3)) isVFP4 = true; deviceinfo_free_details(&details); #elif defined(SYMBIAN) strcpy(brand_string, "Samsung ARMv6"); num_cores = 1; #endif // Hardcode this for now bSwp = true; bHalf = true; bThumb = false; bFastMult = true; bVFP = true; bEDSP = true; bThumbEE = isVFP3; bNEON = isVFP3; bVFPv3 = isVFP3; bTLS = true; bVFPv4 = isVFP4; bIDIVa = isVFP4; bIDIVt = isVFP4; bFP = false; bASIMD = false; #else strncpy(cpu_string, GetCPUString(), sizeof(cpu_string)); bSwp = CheckCPUFeature("swp"); bHalf = CheckCPUFeature("half"); bThumb = CheckCPUFeature("thumb"); bFastMult = CheckCPUFeature("fastmult"); bVFP = CheckCPUFeature("vfp"); bEDSP = CheckCPUFeature("edsp"); bThumbEE = CheckCPUFeature("thumbee"); bNEON = CheckCPUFeature("neon"); bVFPv3 = CheckCPUFeature("vfpv3"); bTLS = CheckCPUFeature("tls"); bVFPv4 = CheckCPUFeature("vfpv4"); bIDIVa = CheckCPUFeature("idiva"); bIDIVt = CheckCPUFeature("idivt"); // Qualcomm Krait supports IDIVA but it doesn't report it. Check for krait. if (GetCPUImplementer() == 0x51 && GetCPUPart() == 0x6F) // Krait(300) is 0x6F, Scorpion is 0x4D bIDIVa = bIDIVt = true; // These two require ARMv8 or higher bFP = CheckCPUFeature("fp"); bASIMD = CheckCPUFeature("asimd"); num_cores = GetCoreCount(); #endif // On android, we build a separate library for ARMv7 so this is fine. // TODO: Check for ARMv7 on other platforms. #if defined(__ARM_ARCH_7A__) bArmV7 = true; #else bArmV7 = false; #endif }
// Detects the various cpu features void CPUInfo::Detect() { // Set some defaults here HTT = false; #ifdef ARM64 OS64bit = true; CPU64bit = true; Mode64bit = true; #else OS64bit = false; CPU64bit = false; Mode64bit = false; #endif vendor = VENDOR_ARM; // Get the information about the CPU #if !defined(__linux__) bool isVFP3 = false; bool isVFP4 = false; #ifdef IOS isVFP3 = true; // Check for swift arch (VFP4) #ifdef __ARM_ARCH_7S__ isVFP4 = true; #endif strcpy(brand_string, "Apple A"); num_cores = 2; #elif defined(BLACKBERRY) isVFP3 = true; deviceinfo_details_t* details; deviceinfo_get_details(&details); num_cores = deviceinfo_details_get_processor_core_count(details); strcpy(brand_string, deviceinfo_details_get_processor_name(details)); if (!strncmp(brand_string, "MSM", 3)) isVFP4 = true; deviceinfo_free_details(&details); #else strcpy(brand_string, "Unknown"); num_cores = 1; #endif strncpy(cpu_string, brand_string, sizeof(cpu_string)); // Hardcode this for now bSwp = true; bHalf = true; bThumb = false; bFastMult = true; bVFP = true; bEDSP = true; bThumbEE = isVFP3; bNEON = isVFP3; bVFPv3 = isVFP3; bTLS = true; bVFPv4 = isVFP4; bIDIVa = isVFP4; bIDIVt = isVFP4; bFP = false; bASIMD = false; #else // __linux__ strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string)); strncpy(brand_string, GetCPUBrandString().c_str(), sizeof(brand_string)); bSwp = CheckCPUFeature("swp"); bHalf = CheckCPUFeature("half"); bThumb = CheckCPUFeature("thumb"); bFastMult = CheckCPUFeature("fastmult"); bVFP = CheckCPUFeature("vfp"); bEDSP = CheckCPUFeature("edsp"); bThumbEE = CheckCPUFeature("thumbee"); bNEON = CheckCPUFeature("neon"); bVFPv3 = CheckCPUFeature("vfpv3"); bTLS = CheckCPUFeature("tls"); bVFPv4 = CheckCPUFeature("vfpv4"); bIDIVa = CheckCPUFeature("idiva"); bIDIVt = CheckCPUFeature("idivt"); // Qualcomm Krait supports IDIVA but it doesn't report it. Check for krait (0x4D = Plus, 0x6F = Pro). unsigned short CPUPart = GetCPUPart(); if (GetCPUImplementer() == 0x51 && (CPUPart == 0x4D || CPUPart == 0x6F)) bIDIVa = bIDIVt = true; // These two require ARMv8 or higher bFP = CheckCPUFeature("fp"); bASIMD = CheckCPUFeature("asimd"); num_cores = GetCoreCount(); #endif #ifdef ARM64 // Whether the above detection failed or not, on ARM64 we do have ASIMD/NEON. bNEON = true; bASIMD = true; #endif }
int InitMachine(void) { int J; /* Initialize variables */ UseZoom = UseZoom<1? 1:UseZoom>5? 5:UseZoom; InMenu = 0; FastForward = 0; OutImage.Data = 0; KeyReady = 0; /* Initialize system resources */ if (!InitQNX(Title,UseZoom*WIDTH,UseZoom*HEIGHT)) return 0; /* Set visual effects */ BPSSetEffects(UseEffects); /* Create main image buffer */ if(!NewImage(&OutImage,WIDTH,HEIGHT)) { TrashQNX(); return(0); } ClearImage(&OutImage,PIXEL(0,0,0)); CropImage(&ScrImage,&OutImage,XOFFSET,YOFFSET,(TI83_FAMILY?5:4)*TIWIDTH,4*TIHEIGHT); /* Initialize video to main image */ SetVideo(&OutImage,0,0,WIDTH,HEIGHT); /* Set colors */ XPal[0] = White = PIXEL(255,255,255); XPal[1] = Black = PIXEL(0,0,0); /* Attach keyboard handler */ SetKeyHandler(HandleKeys); /* Attach mouse handler */ SetMouseHandler(HandleMouse); /* Initialize sound */ InitSound(UseSound,150); SndSwitch=(1<<4)-1; SndVolume=255/4; SetChannels(SndVolume,SndSwitch); /* Initialize sync timer if needed */ if((SyncFreq>0)&&!SetSyncTimer(SyncFreq*UPeriod/100)) SyncFreq=0; deviceinfo_details_t* data; deviceinfo_get_details(&data); const char* os = deviceinfo_details_get_device_os(data); if (strcmp(os, "BlackBerry 10") == 0) { int i = 0; while (TouchMap[i].KeyCode) { TouchMap[i].X = TouchMap[i].X * 1.28; TouchMap[i].W = TouchMap[i].W * 1.28; TouchMap[i].Y = TouchMap[i].Y * 1.25; TouchMap[i].H = TouchMap[i].H * 1.25; i++; } } deviceinfo_free_details(&data); /* Done */ return(1); }