kernel: convert alert APIs to system calls
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
313b20d648
commit
310e987dd5
2 changed files with 29 additions and 4 deletions
|
@ -2747,7 +2747,7 @@ extern void k_alert_init(struct k_alert *alert, k_alert_handler_t handler,
|
|||
* @retval -EBUSY Returned without waiting.
|
||||
* @retval -EAGAIN Waiting period timed out.
|
||||
*/
|
||||
extern int k_alert_recv(struct k_alert *alert, s32_t timeout);
|
||||
__syscall int k_alert_recv(struct k_alert *alert, s32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Signal an alert.
|
||||
|
@ -2763,7 +2763,7 @@ extern int k_alert_recv(struct k_alert *alert, s32_t timeout);
|
|||
*
|
||||
* @return N/A
|
||||
*/
|
||||
extern void k_alert_send(struct k_alert *alert);
|
||||
__syscall void k_alert_send(struct k_alert *alert);
|
||||
|
||||
/**
|
||||
* @} end addtogroup alert_apis
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <init.h>
|
||||
#include <toolchain.h>
|
||||
#include <linker/sections.h>
|
||||
#include <syscall_handler.h>
|
||||
|
||||
extern struct k_alert _k_alert_list_start[];
|
||||
extern struct k_alert _k_alert_list_end[];
|
||||
|
@ -73,7 +74,7 @@ void k_alert_init(struct k_alert *alert, k_alert_handler_t handler,
|
|||
_k_object_init(alert);
|
||||
}
|
||||
|
||||
void k_alert_send(struct k_alert *alert)
|
||||
void _impl_k_alert_send(struct k_alert *alert)
|
||||
{
|
||||
if (alert->handler == K_ALERT_IGNORE) {
|
||||
/* ignore the alert */
|
||||
|
@ -90,7 +91,31 @@ void k_alert_send(struct k_alert *alert)
|
|||
}
|
||||
}
|
||||
|
||||
int k_alert_recv(struct k_alert *alert, s32_t timeout)
|
||||
#ifdef CONFIG_USERSPACE
|
||||
u32_t _handler_k_alert_send(u32_t alert, u32_t arg2, u32_t arg3,
|
||||
u32_t arg4, u32_t arg5, u32_t arg6, void *ssf)
|
||||
{
|
||||
_SYSCALL_ARG1;
|
||||
|
||||
_SYSCALL_IS_OBJ(alert, K_OBJ_ALERT, 0, ssf);
|
||||
_impl_k_alert_send((struct k_alert *)alert);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int _impl_k_alert_recv(struct k_alert *alert, s32_t timeout)
|
||||
{
|
||||
return k_sem_take(&alert->sem, timeout);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
u32_t _handler_k_alert_recv(u32_t alert, u32_t timeout, u32_t arg3,
|
||||
u32_t arg4, u32_t arg5, u32_t arg6, void *ssf)
|
||||
{
|
||||
_SYSCALL_ARG2;
|
||||
|
||||
_SYSCALL_IS_OBJ(alert, K_OBJ_ALERT, 0, ssf);
|
||||
return _impl_k_alert_recv((struct k_alert *)alert, timeout);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue