Zephyr Project API
3.2.0
A Scalable Open Source RTOS
arch_inlines.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Intel Corporation
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_ARCH_RISCV_ARCH_INLINES_H_
8
#define ZEPHYR_INCLUDE_ARCH_RISCV_ARCH_INLINES_H_
9
10
#ifndef _ASMLANGUAGE
11
12
#include <
zephyr/kernel_structs.h
>
13
14
static
ALWAYS_INLINE
uint32_t
arch_proc_id
(
void
)
15
{
16
uint32_t
hartid;
17
18
#ifdef CONFIG_SMP
19
__asm__
volatile
(
"csrr %0, mhartid"
:
"=r"
(hartid));
20
#else
21
hartid = 0;
22
#endif
23
24
return
hartid;
25
}
26
27
static
ALWAYS_INLINE
_cpu_t *
arch_curr_cpu
(
void
)
28
{
29
/* linear hartid enumeration space assumed */
30
return
&_kernel.cpus[
arch_proc_id
()];
31
}
32
33
#endif
/* !_ASMLANGUAGE */
34
#endif
/* ZEPHYR_INCLUDE_ARCH_RISCV_ARCH_INLINES_H_ */
ALWAYS_INLINE
#define ALWAYS_INLINE
Definition:
common.h:124
kernel_structs.h
arch_curr_cpu
static ALWAYS_INLINE _cpu_t * arch_curr_cpu(void)
Definition:
arch_inlines.h:27
arch_proc_id
static ALWAYS_INLINE uint32_t arch_proc_id(void)
Definition:
arch_inlines.h:14
uint32_t
__UINT32_TYPE__ uint32_t
Definition:
stdint.h:90
include
zephyr
arch
riscv
arch_inlines.h
Generated on Tue Feb 28 2023 15:43:18 for Zephyr Project API by
1.9.2