Loading...
Searching...
No Matches
evtimer_msg.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-17 Kaspar Schleiser <kaspar@schleiser.de>
3 * 2017 Freie Universität Berlin
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
20#ifndef EVTIMER_MSG_H
21#define EVTIMER_MSG_H
22
23#include "msg.h"
24#include "evtimer.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
35
44
53static inline void evtimer_add_msg(evtimer_msg_t *evtimer,
55 kernel_pid_t target_pid)
56{
57 /* use sender_pid field to get target_pid into callback function */
58 event->msg.sender_pid = target_pid;
59 evtimer_add(evtimer, &event->event);
60}
61
68{
70 msg_send_int(&mevent->msg, mevent->msg.sender_pid);
71}
72
78static inline void evtimer_init_msg(evtimer_t *evtimer)
79{
81}
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif /* EVTIMER_MSG_H */
evtimer API definitions
int msg_send_int(msg_t *m, kernel_pid_t target_pid)
Send message from interrupt.
int16_t kernel_pid_t
Unique process identifier.
Definition sched.h:139
static void _evtimer_msg_handler(evtimer_event_t *event)
Event handler for IPC messages.
Definition evtimer_msg.h:67
void evtimer_init(evtimer_t *evtimer, evtimer_callback_t handler)
Initializes an event timer.
static void evtimer_add_msg(evtimer_msg_t *evtimer, evtimer_msg_event_t *event, kernel_pid_t target_pid)
Adds event to an event timer that handles events via IPC.
Definition evtimer_msg.h:53
evtimer_t evtimer_msg_t
IPC-message event timer.
Definition evtimer_msg.h:34
static void evtimer_init_msg(evtimer_t *evtimer)
Initializes event timer to handle events via IPC.
Definition evtimer_msg.h:78
void evtimer_add(evtimer_t *evtimer, evtimer_event_t *event)
Adds event to an event timer.
event structure
Definition event.h:148
Generic event.
Definition evtimer.h:56
IPC-message event.
Definition evtimer_msg.h:40
msg_t msg
the IPC message to generate on event
Definition evtimer_msg.h:42
evtimer_event_t event
base class
Definition evtimer_msg.h:41
Event timer.
Definition evtimer.h:69
Describes a message object which can be sent between threads.
Definition msg.h:196
kernel_pid_t sender_pid
PID of sending thread.
Definition msg.h:197