#include <command.h>
#include <env.h>
#include <log.h>
+#include <semihosting.h>
#define SYSOPEN 0x01
#define SYSCLOSE 0x02
* Open a file on the host. Mode is "r" or "rb" currently. Returns a file
* descriptor or -1 on error.
*/
-static long smh_open(const char *fname, char *modestr)
+long smh_open(const char *fname, char *modestr)
{
long fd;
unsigned long mode;
/*
* Read 'len' bytes of file into 'memp'. Returns 0 on success, else failure
*/
-static long smh_read(long fd, void *memp, size_t len)
+long smh_read(long fd, void *memp, size_t len)
{
long ret;
struct smh_read_s {
/*
* Close the file using the file descriptor
*/
-static long smh_close(long fd)
+long smh_close(long fd)
{
long ret;
/*
* Get the file length from the file descriptor
*/
-static long smh_len_fd(long fd)
+long smh_flen(long fd)
{
long ret;
if (fd == -1)
return -1;
- len = smh_len_fd(fd);
+ len = smh_flen(fd);
if (len < 0) {
smh_close(fd);
return -1;
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2022 Sean Anderson <sean.anderson@seco.com>
+ */
+
+#ifndef _SEMIHOSTING_H
+#define _SEMIHOSTING_H
+
+long smh_open(const char *fname, char *modestr);
+long smh_read(long fd, void *memp, size_t len);
+long smh_close(long fd);
+long smh_flen(long fd);
+
+#endif /* _SEMIHOSTING_H */