Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
semihost.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022, Commonwealth Scientific and Industrial Research
3 * Organisation (CSIRO) ABN 41 687 119 230.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Based on the ARM semihosting API from:
8 * https://github.com/ARM-software/abi-aa/blob/main/semihosting/semihosting.rst
9 *
10 * RISC-V semihosting also follows these conventions:
11 * https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc
12 */
13
23#ifndef ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_H_
24#define ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_H_
25
28 /*
29 * File I/O operations
30 */
31
52
53 /*
54 * Terminal I/O operations
55 */
56
63
64 /*
65 * Time operations
66 */
71
72 /*
73 * System/Misc. operations
74 */
75
82 SEMIHOST_SYSTEM = 0x12
83};
84
104};
105
114long semihost_exec(enum semihost_instr instr, void *args);
115
122
128void semihost_poll_out(char c);
129
140long semihost_open(const char *path, long mode);
141
150long semihost_close(long fd);
151
160long semihost_flen(long fd);
161
171long semihost_seek(long fd, long offset);
172
183long semihost_read(long fd, void *buf, long len);
184
195long semihost_write(long fd, const void *buf, long len);
196
201#endif /* ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_H_ */
void semihost_poll_out(char c)
Write a byte to the console.
semihost_open_mode
Modes to open a file with.
Definition: semihost.h:91
long semihost_open(const char *path, long mode)
Open a file on the host system.
char semihost_poll_in(void)
Read a byte from the console.
long semihost_write(long fd, const void *buf, long len)
Write the contents of a buffer into a file.
long semihost_seek(long fd, long offset)
Seeks to an absolute position in a file.
long semihost_exec(enum semihost_instr instr, void *args)
Manually execute a semihosting instruction.
long semihost_close(long fd)
Close a file.
semihost_instr
Semihosting instructions.
Definition: semihost.h:27
long semihost_flen(long fd)
Query the size of a file.
long semihost_read(long fd, void *buf, long len)
Read the contents of a file into a buffer.
@ SEMIHOST_OPEN_R_PLUS
Definition: semihost.h:94
@ SEMIHOST_OPEN_AB
Definition: semihost.h:101
@ SEMIHOST_OPEN_W
Definition: semihost.h:96
@ SEMIHOST_OPEN_A
Definition: semihost.h:100
@ SEMIHOST_OPEN_WB_PLUS
Definition: semihost.h:99
@ SEMIHOST_OPEN_RB
Definition: semihost.h:93
@ SEMIHOST_OPEN_A_PLUS
Definition: semihost.h:102
@ SEMIHOST_OPEN_WB
Definition: semihost.h:97
@ SEMIHOST_OPEN_AB_PLUS
Definition: semihost.h:103
@ SEMIHOST_OPEN_RB_PLUS
Definition: semihost.h:95
@ SEMIHOST_OPEN_R
Definition: semihost.h:92
@ SEMIHOST_OPEN_W_PLUS
Definition: semihost.h:98
@ SEMIHOST_READ
Read from a file at the current cursor position.
Definition: semihost.h:39
@ SEMIHOST_OPEN
Open a file or stream on the host system.
Definition: semihost.h:33
@ SEMIHOST_ELAPSED
Definition: semihost.h:68
@ SEMIHOST_RENAME
Rename a file on the host system.
Definition: semihost.h:51
@ SEMIHOST_TICKFREQ
Definition: semihost.h:69
@ SEMIHOST_WRITE0
Write a NULL terminated string to the debug terminal.
Definition: semihost.h:60
@ SEMIHOST_WRITEC
Write one character to the debug terminal.
Definition: semihost.h:58
@ SEMIHOST_SYSTEM
Definition: semihost.h:82
@ SEMIHOST_ISERROR
Definition: semihost.h:81
@ SEMIHOST_REMOVE
Remove a file on the host system.
Definition: semihost.h:49
@ SEMIHOST_HEAPINFO
Definition: semihost.h:80
@ SEMIHOST_CLOSE
Closes a file on the host which has been opened by SEMIHOST_OPEN.
Definition: semihost.h:41
@ SEMIHOST_GET_CMDLINE
Get commandline parameters for the application to run with.
Definition: semihost.h:79
@ SEMIHOST_CLOCK
Definition: semihost.h:67
@ SEMIHOST_WRITE
Write to a file or stream.
Definition: semihost.h:37
@ SEMIHOST_SEEK
Set the file cursor to a given position in a file.
Definition: semihost.h:45
@ SEMIHOST_TMPNAM
Get a temporary absolute file path to create a temporary file.
Definition: semihost.h:47
@ SEMIHOST_ERRNO
Retrieve the errno variable from semihosting operations.
Definition: semihost.h:77
@ SEMIHOST_ISTTY
Check whether a file is associated with a stream/terminal.
Definition: semihost.h:35
@ SEMIHOST_READC
Read one character from the debug terminal.
Definition: semihost.h:62
@ SEMIHOST_FLEN
Get the length of a file.
Definition: semihost.h:43
@ SEMIHOST_TIME
Definition: semihost.h:70