blob: 739161afcaf5443c3c733a0117626b72ecc76111 [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
12#define SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Niels Möllera12c42a2018-07-25 16:05:48 +020014#include <stdint.h>
15
niklase@google.com470e71d2011-07-07 08:21:25 +000016#if defined(__cplusplus) || defined(c_plusplus)
17extern "C" {
18#endif
19
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000020// List of features in x86.
Karl Wiberg79eb1d92017-11-08 12:26:07 +010021typedef enum { kSSE2, kSSE3 } CPUFeature;
niklase@google.com470e71d2011-07-07 08:21:25 +000022
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000023// List of features in ARM.
24enum {
Karl Wiberg79eb1d92017-11-08 12:26:07 +010025 kCPUFeatureARMv7 = (1 << 0),
26 kCPUFeatureVFPv3 = (1 << 1),
27 kCPUFeatureNEON = (1 << 2),
28 kCPUFeatureLDREXSTREX = (1 << 3)
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000029};
30
niklase@google.com470e71d2011-07-07 08:21:25 +000031typedef int (*WebRtc_CPUInfo)(CPUFeature feature);
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000032
33// Returns true if the CPU supports the feature.
niklase@google.com470e71d2011-07-07 08:21:25 +000034extern WebRtc_CPUInfo WebRtc_GetCPUInfo;
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000035
niklase@google.com470e71d2011-07-07 08:21:25 +000036// No CPU feature is available => straight C path.
37extern WebRtc_CPUInfo WebRtc_GetCPUInfoNoASM;
38
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000039// Return the features in an ARM device.
phoglund@webrtc.orgb15d2852012-11-21 08:02:57 +000040// It detects the features in the hardware platform, and returns supported
kma@webrtc.orgb59c0312011-12-03 18:34:50 +000041// values in the above enum definition as a bitmask.
42extern uint64_t WebRtc_GetCPUFeaturesARM(void);
43
niklase@google.com470e71d2011-07-07 08:21:25 +000044#if defined(__cplusplus) || defined(c_plusplus)
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000045} // extern "C"
niklase@google.com470e71d2011-07-07 08:21:25 +000046#endif
47
Karl Wiberg79eb1d92017-11-08 12:26:07 +010048#endif // SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_