1 /*
2  *  Copyright (c) 2012 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 // You can download Android source at
12 // http://source.android.com/source/downloading.html
13 // Original files are in ndk/sources/android/cpufeatures
14 // Revision is Change-Id: I9a0629efba36a6023f05e5f092e7addcc1b7d2a9
15 
16 #ifndef CPU_FEATURES_H
17 #define CPU_FEATURES_H
18 
19 #include <sys/cdefs.h>
20 #include <stdint.h>
21 
22 __BEGIN_DECLS
23 
24 typedef enum {
25     ANDROID_CPU_FAMILY_UNKNOWN = 0,
26     ANDROID_CPU_FAMILY_ARM,
27     ANDROID_CPU_FAMILY_X86,
28 
29     ANDROID_CPU_FAMILY_MAX  /* do not remove */
30 
31 } AndroidCpuFamily;
32 
33 /* Return family of the device's CPU */
34 extern AndroidCpuFamily   android_getCpuFamily(void);
35 
36 enum {
37     ANDROID_CPU_ARM_FEATURE_ARMv7       = (1 << 0),
38     ANDROID_CPU_ARM_FEATURE_VFPv3       = (1 << 1),
39     ANDROID_CPU_ARM_FEATURE_NEON        = (1 << 2),
40     ANDROID_CPU_ARM_FEATURE_LDREX_STREX = (1 << 3),
41 };
42 
43 enum {
44     ANDROID_CPU_X86_FEATURE_SSSE3  = (1 << 0),
45     ANDROID_CPU_X86_FEATURE_POPCNT = (1 << 1),
46     ANDROID_CPU_X86_FEATURE_MOVBE  = (1 << 2),
47 };
48 
49 extern uint64_t    android_getCpuFeatures(void);
50 
51 /* Return the number of CPU cores detected on this device. */
52 extern int         android_getCpuCount(void);
53 
54 __END_DECLS
55 
56 #endif /* CPU_FEATURES_H */
57