[pulseaudio-discuss] [PATCH 2/6 v3] core: Distinguish Cortex processors (A8, A9, A15)
Peter Meerwald
pmeerw at pmeerw.net
Tue Jul 24 01:20:32 PDT 2012
From: Peter Meerwald <p.meerwald at bct-electronic.com>
Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
---
src/pulsecore/cpu-arm.c | 23 ++++++++++++++++++++---
src/pulsecore/cpu-arm.h | 5 ++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c
index 8ed5847..8baa3bd 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -83,7 +83,7 @@ pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
#if defined (__arm__)
#if defined (__linux__)
char *cpuinfo, *line;
- int arch;
+ int arch, part;
/* We need to read the CPU flags from /proc/cpuinfo because there is no user
* space support to get the CPU features. This only works on linux AFAIK. */
@@ -104,6 +104,20 @@ 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"))) {
+ part = strtoul(line, NULL, 0);
+ if (part == 0xc08)
+ *flags |= PA_CPU_ARM_CORTEX_A8;
+ else if (part == 0xc09)
+ *flags |= PA_CPU_ARM_CORTEX_A9;
+ else if (part == 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;
@@ -124,13 +138,16 @@ pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
}
pa_xfree(cpuinfo);
- pa_log_info("CPU flags: %s%s%s%s%s%s",
+ pa_log_info("CPU flags: %s%s%s%s%s%s%s%s%s",
(*flags & PA_CPU_ARM_V6) ? "V6 " : "",
(*flags & PA_CPU_ARM_V7) ? "V7 " : "",
(*flags & PA_CPU_ARM_VFP) ? "VFP " : "",
(*flags & PA_CPU_ARM_EDSP) ? "EDSP " : "",
(*flags & PA_CPU_ARM_NEON) ? "NEON " : "",
- (*flags & PA_CPU_ARM_VFPV3) ? "VFPV3 " : "");
+ (*flags & PA_CPU_ARM_VFPV3) ? "VFPV3 " : "",
+ (*flags & PA_CPU_ARM_CORTEX_A8) ? "Cortex-A8 " : "",
+ (*flags & PA_CPU_ARM_CORTEX_A9) ? "Cortex-A9 " : "",
+ (*flags & PA_CPU_ARM_CORTEX_A15) ? "Cortex-A15 " : "");
if (*flags & PA_CPU_ARM_NEON) {
pa_volume_func_init_neon(*flags);
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