Solid

cpuinfo_arm.h
1/*
2 SPDX-FileCopyrightText: 2021 Alexey Minnekhanov <alexeymin@postmarketos.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef SOLID_BACKENDS_UDEV_CPUINFO_ARM_H
8#define SOLID_BACKENDS_UDEV_CPUINFO_ARM_H
9
10/**
11 * Detect if we are compiling for ARM 32-bit or 64-bit platforms.
12 * This works at least for gcc and clang (they both have the same
13 * default list of defined macros, which can be obtained by:
14 * - for clang: clang -dM -E - < /dev/null
15 * - for gcc: gcc -march=native -dM -E - </dev/null
16 */
17
18#if defined(__arm__) || defined(__aarch64__) || defined(__ARM_ARCH) || defined(__ARM_EABI__)
19#define BUILDING_FOR_ARM_TARGET
20#endif
21
22// don't even build the following code for non-ARM platforms
23#ifdef BUILDING_FOR_ARM_TARGET
24
25#include <QString>
26
27namespace Solid
28{
29namespace Backends
30{
31namespace UDev
32{
33/**
34 * @brief The ArmIdPart struct
35 * Describes specfic CPU Model. Is used to
36 * convert numerical CPU ID to name string.
37 */
38struct ArmIdPart {
39 const int id; //! CPU model ID; -1 means end of list
40 const char *name; //! CPU human-readable name
41};
42
43struct ArmCpuImplementer {
44 const int id; //! CPU vendor ID
45 const struct ArmIdPart *parts; //! pointer to an array of parts, last elemnt will have ID -1
46 const char *name; //! CPU vendor name
47};
48
49const ArmCpuImplementer *findArmCpuImplementer(int vendorId);
50QString findArmCpuModel(int vendorId, int modelId);
51
52} // namespace UDev
53} // namespace Backends
54} // namespace Solid
55
56#endif // BUILDING_FOR_ARM_TARGET
57
58#endif // SOLID_BACKENDS_UDEV_CPUINFO_ARM_H
QString name(GameStandardAction id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.