【翻译】(9)CPU Features

介绍了Android NDK提供的cpufeatures库,该库可用于运行时检测目标设备的CPU家族及支持的特性。支持ARM家族,并提供了检测ARMv7指令集、VFPv3 FPU扩展及NEON向量指令集的功能。

-----------------

英文文档见android-ndk-r5b的documentation.html

属于Android Native Development Kit (NDK)的一部分

见http://developer.android.com/sdk/ndk/(需要代理)

翻译仅个人见解

-----------------

 

Android NDK CPU Features detection library:

 

Android NDK CPU特性检测库:

-------------------------------------------

 

This NDK provides a small library named "cpufeatures" that can be used at runtime to detect the target device's CPU family and the optional features it supports.

 

NDK提供一个名为cpufeatures的小型库,它可以用于在运行期检测目标设备的CPU家族和它支持的可选特性。

 

Usage:

 

用法:

------

 

The library is available as an import module. To use it, you must:

 

这个库作为导入模块可用。要使用它,你必须:

 

To use it, you must:

 

要使用它,你必须:

 

  * List 'cpufeatures' in your list of static library dependencies, as in:

 

  * 在你的静态库依赖列表中列出cpufeatures,正如这样:

 

        LOCAL_STATIC_LIBRARIES := cpufeatures

 

  * At the end of your Android.mk, import the 'android/cpufeatures' module, as in:

 

  * 在你的Android.mk结束处,导入android/cpufeatures模块,正如这样:

 

        $(call import-module,android/cpufeatures)

 

  * In your source code, include the header named <cpu-features.h>

 

  * 在你的源代码中,包含名为<cpu-features.h>的头文件

 

Here is a simple example:

 

这里是一个简单示例:

 

<project-path>/jni/Android.mk:

    LOCAL_PATH := $(call my-dir)

 

    include $(CLEAR_VARS)

    LOCAL_MODULE := <your-module-name>

    LOCAL_SRC_FILES := <your-source-files>

    LOCAL_STATIC_LIBRARIES := cpufeatures

    include $(BUILD_SHARED_LIBRARY)

 

    $(call import-module,android/cpufeatures)

 

 

Features:

 

特性:

---------

 

Two functions are provided for now:

 

现在提供两个函数:

 

   AndroidCpuFamily   android_getCpuFamily();

 

Returns the target device's CPU Family as an enum. For now, the only supported family is ANDROID_CPU_FAMILY_ARM.

 

用一个枚举值返回目标设备的CPU家族。现在,唯一支持的家族是ANDROID_CPU_FAMILY_ARM。

 

   uint64_t   android_getCpuFeatures();

 

Returns the set of optional features supported by the device's CPU. The result is a set of bit-flags, each corresponding to one CPU Family-specific optional feature.

 

返回设备CPU支持的可选特性。结构是一个位标志集合,每个位标志对应一项CPU家族特定的可选特性。

 

Currently, only the following flags are defined, for the ARM CPU Family:

 

目前,只为ARM CPU家族定义了如下标志:

 

   ANDROID_CPU_ARM_FEATURE_ARMv7

      Indicates that the device's CPU supports the ARMv7-A instruction set as supported by the "armeabi-v7a" abi (see CPU-ARCH-ABIS.html). This corresponds to Thumb-2 and VFPv3-D16 instructions.

 

   ANDROID_CPU_ARM_FEATURE_ARMv7

      指出设备的CPU支持ARMv7-A指令集,它由armeabi-v7a的ABI(注:应用程序二进制接口,操作系统暴露的接口,使二进制程序不需要重新编译即可在兼容ABI的操作系统上运行)支持(参考CPU-ARCH-ABIS.html)。它对应Thumb-2和VFPv3-D16指令。

 

 

   ANDROID_CPU_ARM_FEATURE_VFPv3

      Indicates that the device's CPU supports the VFPv3 hardware FPU instruction set extension. Due to the definition of 'armeabi-v7a', this will always be the case if ANDROID_CPU_ARM_FEATURE_ARMv7 is returned.

 

   ANDROID_CPU_ARM_FEATURE_VFPv3

      指出设备CPU支持VFPv3硬件FPU(注:FPU是浮点运算单元的缩写)指令集扩展。由于armeabi-v7a的定义,它将总是返回ANDROID_CPU_ARM_FEATURE_ARMv7(注:这里的意思可能是,它总是和ANDROID_CPU_ARM_FEATURE_ARMv7一起返回)。

 

      Note that this corresponds to the minimum profile VFPv3-D16 that _only_ provides 16 hardware FP registers.

 

 注意它对应最小型号是VFPv3-D16,它只提供16个硬件浮点寄存器。

 

   ANDROID_CPU_ARM_FEATURE_NEON

      Indicates that the device's CPU supports the ARM Advanced SIMD (a.k.a. NEON) vector instruction set extension. Note that ARM mandates that such CPUs also implement VFPv3-D32, which provides 32 hardware FP registers (shared with the NEON unit).

 

   ANDROID_CPU_ARM_FEATURE_NEON

      指出设备CPU支持ARM高级SIMD(即NEON)(注:NEON技术是ARM SIMD扩展指令,用于多媒体处理的硬件加速)向量指令集扩展。注意ARM授权这种CPU还实现了VFPv3-D32,提供32个硬件浮点寄存器(与NEON单元共享)。

 

 

Important Note:

 

重要注意事项:

---------------

 

The cpufeatures library will be updated to support more CPU families and optional features in the future. It is designed to work as-is on all official Android platform versions.

 

cpufeatures库将被更新以支持未来更多CPU家族和可选特性。它被设计为在所有官方Android平台版本上保持原样地工作。

 

Change History:

 

修改历史:

---------------

 

Please see the comments in $NDK/sources/android/cpufeatures/cpu-features.c for the complete change history for this library.

 

请参考$NDK/sources/android/cpufeatures/cpu-features.c中的注释以获得这个库的完整修改历史。(注:估计写文档的人太懒...)

 

Secure Control Technology (SCT)CPU Traffic Management Secure Control Technology (SCT) allows for the tight control and management of traffic between the device and the CPU. In managed systems, unnecessary traffic to the CPU lowers the CPU efficiency and delays handling of other traffic that requires processing. Thus it is critical that only required traffic be sent to the CPU. In addition, not all traffic to the CPU is treated the same way. Traffic to the CPU must be identified by its type and each type of traffic must be assigned the correct set of attributes (for example, traffic class and maximum rate limit). This enables the CPU to effectively process traffic according to priorities. It also protects the CPU from denial-of-service attacks, which may prevent the CPU from performing its necessary processing. This section describes the SCT features for managing traffic between the device and the CPU. For details on CPU Interrupt handling, refer to Section 17.5.2.5, Switching Core Port Related Interrupts and Section 17.5.2.6, Switching Core Functional Units Related Interrupts . For details on FDB Address Updates to the CPU, refer to Section 17.5.3, Asynchronous Notifications for FDB Update Messages. 23.1 CPU Port The device includes several CPU ports. The number of CPU ports depends on the device variant. For further details about the number of CPU ports and their port indices, refer to the device Hardware Datasheet. The CPU port is represented in the device as a virtual ePort 63 (0x3F). This virtual CPU ePort can be mapped to one or more physical ports, which in turn can be mapped to one of the device SDMAs or MACs (refer to Section 19.4, Mapping To_CPU Packets to Physical Ports). Traffic to the CPU is subject to the same configuration options and egress queueing/scheduling features, as described in Section 16.2, Resources Management. The physical port used for traffic to the CPU must be configured as a cascade port (refer to Section 18.1, Cascade Ports). The CPU receives all packets from the device with a TO_CPU DSA tag. The TO_CPU DSA tag provides information such as the reason the packet was sent to the CPU (CPU code), the VLAN assignment, source device and port (refer to Section 23.2, Packets to the CPU). The CPU can send a packet to the device with a FROM_CPU or FORWARD DSA tag (refer to Section 23.3, Packets from CPU) 翻译并解释
最新发布
09-20
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值