1 /*
2  * Copyright (c) 2006-2023, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2022-02-24     GuEe-GUI     first version
9  * 2023-02-21     GuEe-GUI     update API
10  */
11 
12 #ifndef __HYPERCALL_H__
13 #define __HYPERCALL_H__
14 
15 #include <rtdef.h>
16 #include <smccc.h>
17 
18 #define HYPERCALL_START 0xc5000000 /* HVC64 */
19 #define HYPERCALL_END   0xc500ffff /* HVC64 */
20 
rt_hw_hypercall(rt_uint32_t w0,rt_uint64_t x1,rt_uint64_t x2,rt_uint64_t x3,rt_uint64_t x4,rt_uint64_t x5,rt_uint64_t x6,rt_uint32_t w7)21 rt_inline rt_uint32_t rt_hw_hypercall(rt_uint32_t w0, rt_uint64_t x1, rt_uint64_t x2,
22         rt_uint64_t x3, rt_uint64_t x4, rt_uint64_t x5, rt_uint64_t x6, rt_uint32_t w7)
23 {
24     struct arm_smccc_res_t res;
25 
26     arm_smccc_hvc(w0, x1, x2, x3, x4, x5, x6, w7, &res, RT_NULL);
27 
28     return res.a0;
29 }
30 
31 rt_err_t rt_hv_version(rt_uint32_t *out_version);
32 rt_err_t rt_hv_debug(rt_uint32_t id, rt_uint32_t argc,
33         rt_ubase_t arg0, rt_ubase_t arg1, rt_ubase_t arg2,
34         rt_ubase_t arg3, rt_ubase_t arg4);
35 rt_err_t rt_hv_console(char c);
36 
37 #endif /* __HYPERCALL_H__ */
38