2006-12-10 02:18:48 -08:00
|
|
|
/*
|
2007-05-09 07:51:49 +02:00
|
|
|
* include/asm-xtensa/platform-iss/simcall.h
|
2006-12-10 02:18:48 -08:00
|
|
|
*
|
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
|
* for more details.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2001 Tensilica Inc.
|
2021-02-18 09:12:28 -08:00
|
|
|
* Copyright (C) 2017 - 2021 Cadence Design Systems Inc.
|
2006-12-10 02:18:48 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _XTENSA_PLATFORM_ISS_SIMCALL_H
|
|
|
|
|
#define _XTENSA_PLATFORM_ISS_SIMCALL_H
|
|
|
|
|
|
2021-02-18 10:18:00 -08:00
|
|
|
#include <linux/bug.h>
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_XTENSA_SIMCALL_ISS
|
2021-02-18 09:12:28 -08:00
|
|
|
#include <platform/simcall-iss.h>
|
2021-02-18 10:18:00 -08:00
|
|
|
#endif
|
|
|
|
|
#ifdef CONFIG_XTENSA_SIMCALL_GDBIO
|
|
|
|
|
#include <platform/simcall-gdbio.h>
|
|
|
|
|
#endif
|
2012-09-17 05:44:35 +04:00
|
|
|
|
2016-09-20 17:26:48 -07:00
|
|
|
static inline int simc_exit(int exit_code)
|
|
|
|
|
{
|
2021-02-18 10:18:00 -08:00
|
|
|
#ifdef SYS_exit
|
2016-09-20 17:26:48 -07:00
|
|
|
return __simc(SYS_exit, exit_code, 0, 0);
|
2021-02-18 10:18:00 -08:00
|
|
|
#else
|
|
|
|
|
WARN_ONCE(1, "%s: not implemented\n", __func__);
|
|
|
|
|
return -1;
|
|
|
|
|
#endif
|
2016-09-20 17:26:48 -07:00
|
|
|
}
|
|
|
|
|
|
2012-10-15 03:55:32 +04:00
|
|
|
static inline int simc_open(const char *file, int flags, int mode)
|
2012-09-17 05:44:35 +04:00
|
|
|
{
|
2013-04-15 08:39:41 +04:00
|
|
|
return __simc(SYS_open, (int) file, flags, mode);
|
2012-09-17 05:44:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int simc_close(int fd)
|
|
|
|
|
{
|
2013-04-15 08:39:41 +04:00
|
|
|
return __simc(SYS_close, fd, 0, 0);
|
2012-09-17 05:44:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int simc_ioctl(int fd, int request, void *arg)
|
|
|
|
|
{
|
2021-02-18 10:18:00 -08:00
|
|
|
#ifdef SYS_ioctl
|
2013-04-15 08:39:41 +04:00
|
|
|
return __simc(SYS_ioctl, fd, request, (int) arg);
|
2021-02-18 10:18:00 -08:00
|
|
|
#else
|
|
|
|
|
WARN_ONCE(1, "%s: not implemented\n", __func__);
|
|
|
|
|
return -1;
|
|
|
|
|
#endif
|
2012-09-17 05:44:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int simc_read(int fd, void *buf, size_t count)
|
|
|
|
|
{
|
2013-04-15 08:39:41 +04:00
|
|
|
return __simc(SYS_read, fd, (int) buf, count);
|
2012-09-17 05:44:35 +04:00
|
|
|
}
|
|
|
|
|
|
2012-10-15 03:55:32 +04:00
|
|
|
static inline int simc_write(int fd, const void *buf, size_t count)
|
2012-09-17 05:44:35 +04:00
|
|
|
{
|
2013-04-15 08:39:41 +04:00
|
|
|
return __simc(SYS_write, fd, (int) buf, count);
|
2012-09-17 05:44:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int simc_poll(int fd)
|
|
|
|
|
{
|
2021-02-18 10:18:00 -08:00
|
|
|
#ifdef SYS_select_one
|
2019-10-25 22:30:39 +02:00
|
|
|
long timeval[2] = { 0, 0 };
|
2012-09-17 05:44:35 +04:00
|
|
|
|
2019-10-25 22:30:39 +02:00
|
|
|
return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&timeval);
|
2021-02-18 10:18:00 -08:00
|
|
|
#else
|
|
|
|
|
WARN_ONCE(1, "%s: not implemented\n", __func__);
|
|
|
|
|
return -1;
|
|
|
|
|
#endif
|
2013-04-15 08:39:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int simc_lseek(int fd, uint32_t off, int whence)
|
|
|
|
|
{
|
|
|
|
|
return __simc(SYS_lseek, fd, off, whence);
|
2012-09-17 05:44:35 +04:00
|
|
|
}
|
2006-12-10 02:18:48 -08:00
|
|
|
|
2017-03-13 10:23:02 -07:00
|
|
|
static inline int simc_argc(void)
|
|
|
|
|
{
|
2021-02-18 10:18:00 -08:00
|
|
|
#ifdef SYS_iss_argc
|
2017-03-13 10:23:02 -07:00
|
|
|
return __simc(SYS_iss_argc, 0, 0, 0);
|
2021-02-18 10:18:00 -08:00
|
|
|
#else
|
|
|
|
|
WARN_ONCE(1, "%s: not implemented\n", __func__);
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
2017-03-13 10:23:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int simc_argv_size(void)
|
|
|
|
|
{
|
2021-02-18 10:18:00 -08:00
|
|
|
#ifdef SYS_iss_argv_size
|
2017-03-13 10:23:02 -07:00
|
|
|
return __simc(SYS_iss_argv_size, 0, 0, 0);
|
2021-02-18 10:18:00 -08:00
|
|
|
#else
|
|
|
|
|
WARN_ONCE(1, "%s: not implemented\n", __func__);
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
2017-03-13 10:23:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void simc_argv(void *buf)
|
|
|
|
|
{
|
2021-02-18 10:18:00 -08:00
|
|
|
#ifdef SYS_iss_set_argv
|
2017-03-13 10:23:02 -07:00
|
|
|
__simc(SYS_iss_set_argv, (int)buf, 0, 0);
|
2021-02-18 10:18:00 -08:00
|
|
|
#else
|
|
|
|
|
WARN_ONCE(1, "%s: not implemented\n", __func__);
|
|
|
|
|
#endif
|
2017-03-13 10:23:02 -07:00
|
|
|
}
|
|
|
|
|
|
2006-12-10 02:18:48 -08:00
|
|
|
#endif /* _XTENSA_PLATFORM_ISS_SIMCALL_H */
|