From 12a05b3bcd85ff4aa930e7a1fb8795d5a6bfdf81 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Tue, 22 Mar 2022 16:59:18 -0400 Subject: arm: smh: Add some file manipulation commands In order to add filesystem support, we will need to be able to seek and write files. Add the appropriate helper functions. Signed-off-by: Sean Anderson --- include/semihosting.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include') diff --git a/include/semihosting.h b/include/semihosting.h index d8337b6269b..b53c6504440 100644 --- a/include/semihosting.h +++ b/include/semihosting.h @@ -50,6 +50,17 @@ long smh_open(const char *fname, enum smh_open_mode mode); */ long smh_read(long fd, void *memp, size_t len); +/** + * smh_write() - Write data to a file + * @fd: A file descriptor returned from smh_open() + * @memp: Pointer to a buffer of memory of at least @len bytes + * @len: The number of bytes to read + * @written: Pointer which will be updated with the actual bytes written + * + * Return: 0 on success or negative error on failure + */ +long smh_write(long fd, const void *memp, size_t len, ulong *written); + /** * smh_close() - Close an open file * @fd: A file descriptor returned from smh_open() @@ -66,4 +77,13 @@ long smh_close(long fd); */ long smh_flen(long fd); +/** + * smh_seek() - Seek to a position in a file + * @fd: A file descriptor returned from smh_open() + * @pos: The offset (in bytes) to seek to + * + * Return: 0 on success or negative error on failure + */ +long smh_seek(long fd, long pos); + #endif /* _SEMIHOSTING_H */ -- cgit v1.2.3