2011-03-29 20:35:11 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* arch/avr/include/syscall.h
|
|
|
|
*
|
2021-03-28 21:35:35 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2011-03-29 20:35:11 +08:00
|
|
|
*
|
2021-03-28 21:35:35 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-03-29 20:35:11 +08:00
|
|
|
*
|
2021-03-28 21:35:35 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2011-03-29 20:35:11 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-06 05:00:04 +08:00
|
|
|
/* This file should never be included directly but, rather, only indirectly
|
2011-03-29 20:35:11 +08:00
|
|
|
* through include/syscall.h or include/sys/sycall.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ARCH_AVR_INCLUDE_SYSCALL_H
|
|
|
|
#define __ARCH_AVR_INCLUDE_SYSCALL_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-02-25 01:49:58 +08:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <stdint.h>
|
2011-03-29 20:35:11 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-04-08 22:04:12 +08:00
|
|
|
* Pre-processor Definitions
|
2011-03-29 20:35:11 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
2022-02-25 01:49:58 +08:00
|
|
|
#define SYS_syscall 0x80
|
2011-03-29 20:35:11 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
2022-02-25 01:49:58 +08:00
|
|
|
* Public Types
|
2011-03-29 20:35:11 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-10-03 07:42:29 +08:00
|
|
|
* Public Data
|
2011-03-29 20:35:11 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2015-06-13 09:26:01 +08:00
|
|
|
extern "C"
|
|
|
|
{
|
2011-03-29 20:35:11 +08:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2022-02-25 01:49:58 +08:00
|
|
|
/* SWI with SYS_ call number and six parameters */
|
|
|
|
|
|
|
|
uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1, uintptr_t parm2,
|
|
|
|
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5,
|
|
|
|
uintptr_t parm6);
|
|
|
|
|
|
|
|
/* SWI with SYS_ call number and no parameters */
|
|
|
|
|
|
|
|
static inline uintptr_t sys_call0(unsigned int nbr)
|
|
|
|
{
|
|
|
|
return sys_call6(nbr, 0, 0, 0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SWI with SYS_ call number and one parameter */
|
|
|
|
|
|
|
|
static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
|
|
|
|
{
|
|
|
|
return sys_call6(nbr, parm1, 0, 0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SWI with SYS_ call number and two parameters */
|
|
|
|
|
|
|
|
static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
|
|
|
|
uintptr_t parm2)
|
|
|
|
{
|
|
|
|
return sys_call6(nbr, parm1, parm2, 0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SWI with SYS_ call number and three parameters */
|
|
|
|
|
|
|
|
static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1,
|
|
|
|
uintptr_t parm2, uintptr_t parm3)
|
|
|
|
{
|
|
|
|
return sys_call6(nbr, parm1, parm2, parm3, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SWI with SYS_ call number and four parameters */
|
|
|
|
|
|
|
|
static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1,
|
|
|
|
uintptr_t parm2, uintptr_t parm3,
|
|
|
|
uintptr_t parm4)
|
|
|
|
{
|
|
|
|
return sys_call6(nbr, parm1, parm2, parm3, parm4, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SWI with SYS_ call number and five parameters */
|
|
|
|
|
|
|
|
static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1,
|
|
|
|
uintptr_t parm2, uintptr_t parm3,
|
|
|
|
uintptr_t parm4, uintptr_t parm5)
|
|
|
|
{
|
|
|
|
return sys_call6(nbr, parm1, parm2, parm3, parm4, parm5, 0);
|
|
|
|
}
|
|
|
|
|
2011-03-29 20:35:11 +08:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ARCH_AVR_INCLUDE_SYSCALL_H */
|