[pulseaudio-discuss] [PATCH 07/10] core: Distinguish Cortex processors (A8, A9, A15)
Peter Meerwald
pmeerw at pmeerw.net
Fri Mar 29 08:56:48 PDT 2013
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 1378124..27d885f 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -83,7 +83,7 @@ void pa_cpu_get_arm_flags(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 @@ void pa_cpu_get_arm_flags(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 @@ void pa_cpu_get_arm_flags(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 " : "");
#endif
#endif
}
diff --git a/src/pulsecore/cpu-arm.h b/src/pulsecore/cpu-arm.h
index d9dc3d5..9446add 100644
--- a/src/pulsecore/cpu-arm.h
+++ b/src/pulsecore/cpu-arm.h
@@ -36,7 +36,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;
void pa_cpu_get_arm_flags(pa_cpu_arm_flag_t *flags);
--
1.7.9.5
More information about the pulseaudio-discuss
mailing list