Zephyr Project API  3.1.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
13
14static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
15{
16#ifdef CONFIG_SMP
17 uint32_t hartid;
18
19 __asm__ volatile("csrr %0, mhartid" : "=r" (hartid));
20
21 return &_kernel.cpus[hartid];
22#else
23 return &_kernel.cpus[0];
24#endif /* CONFIG_SMP */
25}
26
27#endif /* !_ASMLANGUAGE */
28#endif /* ZEPHYR_INCLUDE_ARCH_RISCV_ARCH_INLINES_H_ */
#define ALWAYS_INLINE
Definition: common.h:124
static ALWAYS_INLINE _cpu_t * arch_curr_cpu(void)
Definition: arch_inlines.h:14
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90