blob: 85152ba1f5f79ba55839690da78b7d910a5e1a9f [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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_INTERFACE_CPU_FEATURES_WRAPPER_H_
12#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CPU_FEATURES_WRAPPER_H_
13
14#if defined(__cplusplus) || defined(c_plusplus)
15extern "C" {
16#endif
17
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000018#include <typedefs.h>
19
20// List of features in x86.
niklase@google.com470e71d2011-07-07 08:21:25 +000021typedef enum {
22 kSSE2,
23 kSSE3
24} CPUFeature;
25
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000026// List of features in ARM.
27enum {
28 kCPUFeatureARMv7 = (1 << 0),
29 kCPUFeatureVFPv3 = (1 << 1),
30 kCPUFeatureNEON = (1 << 2),
31 kCPUFeatureLDREXSTREX = (1 << 3)
32};
33
niklase@google.com470e71d2011-07-07 08:21:25 +000034typedef int (*WebRtc_CPUInfo)(CPUFeature feature);
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000035
36// Returns true if the CPU supports the feature.
niklase@google.com470e71d2011-07-07 08:21:25 +000037extern WebRtc_CPUInfo WebRtc_GetCPUInfo;
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000038
niklase@google.com470e71d2011-07-07 08:21:25 +000039// No CPU feature is available => straight C path.
40extern WebRtc_CPUInfo WebRtc_GetCPUInfoNoASM;
41
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000042// Return the features in an ARM device.
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000043// It detects the features in the hardware platform, and returns supported
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000044// values in the above enum definition as a bitmask.
45extern uint64_t WebRtc_GetCPUFeaturesARM(void);
46
niklase@google.com470e71d2011-07-07 08:21:25 +000047#if defined(__cplusplus) || defined(c_plusplus)
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000048} // extern "C"
niklase@google.com470e71d2011-07-07 08:21:25 +000049#endif
50
51#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CPU_FEATURES_WRAPPER_H_