Skip to content

Commit 38d0300

Browse files
ttmutkartben
authored andcommitted
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>
1 parent d5098a2 commit 38d0300

File tree

2 files changed

+47
-35
lines changed

2 files changed

+47
-35
lines changed

arch/common/include/semihost_types.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
8+
#ifndef ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_TYPES_H_
9+
#define ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_TYPES_H_
10+
11+
struct semihost_poll_in_args {
12+
long zero;
13+
} __packed;
14+
15+
struct semihost_open_args {
16+
const char *path;
17+
long mode;
18+
long path_len;
19+
} __packed;
20+
21+
struct semihost_close_args {
22+
long fd;
23+
} __packed;
24+
25+
struct semihost_flen_args {
26+
long fd;
27+
} __packed;
28+
29+
struct semihost_seek_args {
30+
long fd;
31+
long offset;
32+
} __packed;
33+
34+
struct semihost_read_args {
35+
long fd;
36+
char *buf;
37+
long len;
38+
} __packed;
39+
40+
struct semihost_write_args {
41+
long fd;
42+
const char *buf;
43+
long len;
44+
} __packed;
45+
46+
#endif /* ZEPHYR_INCLUDE_ARCH_COMMON_SEMIHOST_TYPES_H_ */

arch/common/semihost.c

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,7 @@
88
#include <string.h>
99
#include <zephyr/kernel.h>
1010
#include <zephyr/arch/common/semihost.h>
11-
12-
struct semihost_poll_in_args {
13-
long zero;
14-
} __packed;
15-
16-
struct semihost_open_args {
17-
const char *path;
18-
long mode;
19-
long path_len;
20-
} __packed;
21-
22-
struct semihost_close_args {
23-
long fd;
24-
} __packed;
25-
26-
struct semihost_flen_args {
27-
long fd;
28-
} __packed;
29-
30-
struct semihost_seek_args {
31-
long fd;
32-
long offset;
33-
} __packed;
34-
35-
struct semihost_read_args {
36-
long fd;
37-
char *buf;
38-
long len;
39-
} __packed;
40-
41-
struct semihost_write_args {
42-
long fd;
43-
const char *buf;
44-
long len;
45-
} __packed;
11+
#include "semihost_types.h"
4612

4713
char semihost_poll_in(void)
4814
{

0 commit comments

Comments
 (0)