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
27 extern "C" {
28 #endif
29 
35 
40 typedef struct {
44 
53 static 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 
78 static inline void evtimer_init_msg(evtimer_t *evtimer)
79 {
81 }
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif /* EVTIMER_MSG_H */
88 
evtimer_msg_event_t::msg
msg_t msg
the IPC message to generate on event
Definition: evtimer_msg.h:42
kernel_pid_t
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:125
evtimer_t
Event timer.
Definition: evtimer.h:79
evtimer_add
void evtimer_add(evtimer_t *evtimer, evtimer_event_t *event)
Adds event to an event timer.
_evtimer_msg_handler
static void _evtimer_msg_handler(evtimer_event_t *event)
Event handler for IPC messages.
Definition: evtimer_msg.h:67
evtimer_msg_t
evtimer_t evtimer_msg_t
IPC-message event timer.
Definition: evtimer_msg.h:34
event
event structure
Definition: event.h:142
msg.h
Messaging API for inter process communication.
evtimer_add_msg
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_msg_event_t::event
evtimer_event_t event
base class
Definition: evtimer_msg.h:41
evtimer.h
evtimer API definitions
evtimer_init_msg
static void evtimer_init_msg(evtimer_t *evtimer)
Initializes event timer to handle events via IPC.
Definition: evtimer_msg.h:78
msg_t::sender_pid
kernel_pid_t sender_pid
PID of sending thread.
Definition: msg.h:186
evtimer_event
Generic event.
Definition: evtimer.h:66
msg_t
Describes a message object which can be sent between threads.
Definition: msg.h:185
msg_send_int
int msg_send_int(msg_t *m, kernel_pid_t target_pid)
Send message from interrupt.
evtimer_msg_event_t
IPC-message event.
Definition: evtimer_msg.h:40
evtimer_init
void evtimer_init(evtimer_t *evtimer, evtimer_callback_t handler)
Initializes an event timer.