[pulseaudio-discuss] [PATCH] core: Distinguish Cortex processors (A8, A9, A15)

Peter Meerwald pmeerw at pmeerw.net
Mon Jul 9 09:01:34 PDT 2012


From: Peter Meerwald <p.meerwald at bct-electronic.com>

needed later on for ARM NEON optimization

Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
---
 src/pulsecore/cpu-arm.c |   12 ++++++++++++
 src/pulsecore/cpu-arm.h |    5 ++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c
index 8ed5847..e955765 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -104,6 +104,18 @@ pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
 
         pa_xfree(line);
     }
+    /* get the CPU part number */
+    if ((line = get_cpuinfo_line(cpuinfo, "CPU part"))) {
+        arch = strtoul(line, NULL, 0);
+        if (arch == 0xc08)
+            *flags |= PA_CPU_ARM_CORTEX_A8;
+        else if (arch == 0xc09)
+            *flags |= PA_CPU_ARM_CORTEX_A9;
+        else if (arch == 0xc0f)
+            *flags |= PA_CPU_ARM_CORTEX_A15;
+
+        pa_xfree(line);
+    }
     /* get the CPU features */
     if ((line = get_cpuinfo_line(cpuinfo, "Features"))) {
         const char *state = NULL;
diff --git a/src/pulsecore/cpu-arm.h b/src/pulsecore/cpu-arm.h
index 4117fce..598da2e 100644
--- a/src/pulsecore/cpu-arm.h
+++ b/src/pulsecore/cpu-arm.h
@@ -32,7 +32,10 @@ typedef enum pa_cpu_arm_flag {
     PA_CPU_ARM_VFP      = (1 << 2),
     PA_CPU_ARM_EDSP     = (1 << 3),
     PA_CPU_ARM_NEON     = (1 << 4),
-    PA_CPU_ARM_VFPV3    = (1 << 5)
+    PA_CPU_ARM_VFPV3    = (1 << 5),
+    PA_CPU_ARM_CORTEX_A8 = (1 << 6),
+    PA_CPU_ARM_CORTEX_A9 = (1 << 7),
+    PA_CPU_ARM_CORTEX_A15 = (1 << 8),
 } pa_cpu_arm_flag_t;
 
 pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags);
-- 
1.7.5.4



More information about the pulseaudio-discuss mailing list