niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ |
| 12 | #define SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
| 14 | #if defined(__cplusplus) || defined(c_plusplus) |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame^] | 18 | #include "typedefs.h" // NOLINT(build/include) |
kma@webrtc.org | b59c031 | 2011-12-03 18:34:50 +0000 | [diff] [blame] | 19 | |
| 20 | // List of features in x86. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | typedef enum { |
| 22 | kSSE2, |
| 23 | kSSE3 |
| 24 | } CPUFeature; |
| 25 | |
kma@webrtc.org | b59c031 | 2011-12-03 18:34:50 +0000 | [diff] [blame] | 26 | // List of features in ARM. |
| 27 | enum { |
| 28 | kCPUFeatureARMv7 = (1 << 0), |
| 29 | kCPUFeatureVFPv3 = (1 << 1), |
| 30 | kCPUFeatureNEON = (1 << 2), |
| 31 | kCPUFeatureLDREXSTREX = (1 << 3) |
| 32 | }; |
| 33 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | typedef int (*WebRtc_CPUInfo)(CPUFeature feature); |
phoglund@webrtc.org | b15d285 | 2012-11-21 08:02:57 +0000 | [diff] [blame] | 35 | |
| 36 | // Returns true if the CPU supports the feature. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | extern WebRtc_CPUInfo WebRtc_GetCPUInfo; |
phoglund@webrtc.org | b15d285 | 2012-11-21 08:02:57 +0000 | [diff] [blame] | 38 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | // No CPU feature is available => straight C path. |
| 40 | extern WebRtc_CPUInfo WebRtc_GetCPUInfoNoASM; |
| 41 | |
kma@webrtc.org | b59c031 | 2011-12-03 18:34:50 +0000 | [diff] [blame] | 42 | // Return the features in an ARM device. |
phoglund@webrtc.org | b15d285 | 2012-11-21 08:02:57 +0000 | [diff] [blame] | 43 | // It detects the features in the hardware platform, and returns supported |
kma@webrtc.org | b59c031 | 2011-12-03 18:34:50 +0000 | [diff] [blame] | 44 | // values in the above enum definition as a bitmask. |
| 45 | extern uint64_t WebRtc_GetCPUFeaturesARM(void); |
| 46 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | #if defined(__cplusplus) || defined(c_plusplus) |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 48 | } // extern "C" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | #endif |
| 50 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 51 | #endif // SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ |