xtensa: hostfs: handle nonblock open for iss

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
This commit is contained in:
chenxiaoyi
2024-05-10 14:33:13 +08:00
committed by Xiang Xiao
parent 0fb1dc2b93
commit b6225676f4
3 changed files with 18 additions and 0 deletions
+8
View File
@@ -279,6 +279,14 @@ config XTENSA_SEMIHOSTING_HOSTFS
This doesn't support some directory operations like readdir because
of the limitations of semihosting mechanism.
config XTENSA_TARGET_ISS
bool "Target machine is Instruction Set Simulator"
default n
---help---
This setting determines whether the target is Cadence Instruction
Set Simulator, which might have some sepecial characteristics such
as how to open a file nonblock.
if XTENSA_SEMIHOSTING_HOSTFS
config XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
+5
View File
@@ -63,6 +63,11 @@
#define SIMCALL_O_RDWR 0x0002
#define SIMCALL_O_ACCMODE 0x0003
#define SIMCALL_O_APPEND 0x0400
#ifdef CONFIG_XTENSA_TARGET_ISS
# define SIMCALL_O_NONBLOCK 0x0080
#else
# define SIMCALL_O_NONBLOCK 0x0800
#endif
#define SIMCALL_O_CREAT 0x0040
#define SIMCALL_O_TRUNC 0x0200
#define SIMCALL_O_EXCL 0x0080
+5
View File
@@ -97,6 +97,11 @@ int host_open(const char *pathname, int flags, int mode)
simcall_flags |= SIMCALL_O_EXCL;
}
if ((flags & O_NONBLOCK) != 0)
{
simcall_flags |= SIMCALL_O_NONBLOCK;
}
#ifdef CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
up_clean_dcache(pathname, pathname + strlen(pathname) + 1);
#endif