forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpu.h
More file actions
90 lines (56 loc) · 1.8 KB
/
cpu.h
File metadata and controls
90 lines (56 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2018 Intel Corporation. All rights reserved.
*
* Author: Tomasz Leman <tomasz.m.leman@intel.com>
*/
/**
* \file zephyr/include/sof/lib/cpu.h
* \brief CPU header file
* \authors Tomasz Leman <tomasz.m.leman@intel.com>
*/
#ifndef __SOF_LIB_CPU_H__
#define __SOF_LIB_CPU_H__
#include <platform/lib/cpu.h>
#if !defined(__ASSEMBLER__) && !defined(LINKER)
#include <stdbool.h>
#include <zephyr/arch/arch_inlines.h>
#if CONFIG_PM
#include <zephyr/pm/pm.h>
void cpu_notify_state_entry(enum pm_state state);
void cpu_notify_state_exit(enum pm_state state);
#endif /* CONFIG_PM */
/* let the compiler optimise when in single core mode */
#if CONFIG_MULTICORE && CONFIG_SMP
static inline int cpu_get_id(void)
{
return arch_proc_id();
}
static inline bool cpu_is_primary(int id)
{
return id == PLATFORM_PRIMARY_CORE_ID;
}
static inline bool cpu_is_me(int id)
{
return id == cpu_get_id();
}
int cpu_enable_core(int id);
void cpu_disable_core(int id);
int cpu_is_core_enabled(int id);
int cpu_enabled_cores(void);
void cpu_power_down_core(uint32_t flags);
int cpu_restore_secondary_cores(void);
int cpu_secondary_cores_prepare_d0ix(void);
#else
static inline int cpu_get_id(void) { return 0; };
static inline bool cpu_is_primary(int id) { return 1; };
static inline bool cpu_is_me(int id) { return 1; };
static inline int cpu_enable_core(int id) { return 0; };
static inline void cpu_disable_core(int id) { };
static inline int cpu_is_core_enabled(int id) { return 1; };
static inline int cpu_enabled_cores(void) { return 1; };
static inline int cpu_restore_secondary_cores(void) { return 0; };
static inline int cpu_secondary_cores_prepare_d0ix(void) { return 0; };
#endif /* CONFIG_MULTICORE && CONFIG_SMP */
#endif
#endif /* __SOF_LIB_CPU_H__ */