arch: common: semihost: Move semihost structs into a separate header

Move semihost_x_args structs to include/semihost_types.h so that
semihost implementations can access their elements if needed.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
This commit is contained in:
Tahsin Mutlugun 2025-06-16 17:25:44 +03:00 committed by Benjamin Cabé
commit 38d0300035
2 changed files with 47 additions and 35 deletions

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2022, Commonwealth Scientific and Industrial Research
* Organisation (CSIRO) ABN 41 687 119 230.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_TYPES_H_
#define ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_TYPES_H_
struct semihost_poll_in_args {
long zero;
} __packed;
struct semihost_open_args {
const char *path;
long mode;
long path_len;
} __packed;
struct semihost_close_args {
long fd;
} __packed;
struct semihost_flen_args {
long fd;
} __packed;
struct semihost_seek_args {
long fd;
long offset;
} __packed;
struct semihost_read_args {
long fd;
char *buf;
long len;
} __packed;
struct semihost_write_args {
long fd;
const char *buf;
long len;
} __packed;
#endif /* ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_TYPES_H_ */

View file

@ -8,41 +8,7 @@
#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/arch/common/semihost.h>
struct semihost_poll_in_args {
long zero;
} __packed;
struct semihost_open_args {
const char *path;
long mode;
long path_len;
} __packed;
struct semihost_close_args {
long fd;
} __packed;
struct semihost_flen_args {
long fd;
} __packed;
struct semihost_seek_args {
long fd;
long offset;
} __packed;
struct semihost_read_args {
long fd;
char *buf;
long len;
} __packed;
struct semihost_write_args {
long fd;
const char *buf;
long len;
} __packed;
#include "semihost_types.h"
char semihost_poll_in(void)
{