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 
11 #ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
12 #define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
13 
14 #if defined(__cplusplus) || defined(c_plusplus)
15 extern "C" {
16 #endif
17 
18 #include "webrtc/typedefs.h"
19 
20 // List of features in x86.
21 typedef enum {
22   kSSE2,
23   kSSE3
24 } CPUFeature;
25 
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 
34 typedef int (*WebRtc_CPUInfo)(CPUFeature feature);
35 
36 // Returns true if the CPU supports the feature.
37 extern WebRtc_CPUInfo WebRtc_GetCPUInfo;
38 
39 // No CPU feature is available => straight C path.
40 extern WebRtc_CPUInfo WebRtc_GetCPUInfoNoASM;
41 
42 // Return the features in an ARM device.
43 // It detects the features in the hardware platform, and returns supported
44 // values in the above enum definition as a bitmask.
45 extern uint64_t WebRtc_GetCPUFeaturesARM(void);
46 
47 #if defined(__cplusplus) || defined(c_plusplus)
48 }  // extern "C"
49 #endif
50 
51 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
52