1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2024 Andes Technology Corporation
4  */
5 #ifndef __KERNEL_SEMIHOSTING_H
6 #define __KERNEL_SEMIHOSTING_H
7 
8 #include <stddef.h>
9 #include <stdint.h>
10 #include <sys/fcntl.h>
11 #include <util.h>
12 
13 /* Perform architecture-specific semihosting instructions. */
14 uintptr_t __do_semihosting(uintptr_t op, uintptr_t arg);
15 
16 char semihosting_sys_readc(void);
17 void semihosting_sys_writec(char c);
18 int semihosting_open(const char *fname, int flags);
19 size_t semihosting_read(int fd, void *ptr, size_t len);
20 size_t semihosting_write(int fd, const void *ptr, size_t len);
21 int semihosting_close(int fd);
22 
23 #endif /* __KERNEL_SEMIHOSTING_H */
24