evtimer_msg.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016-2017 Kaspar Schleiser <kaspar@schleiser.de>
3  * SPDX-FileCopyrightText: 2017 Freie Universität Berlin
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
20 #include "msg.h"
21 #include "evtimer.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
32 
37 typedef struct {
41 
50 static inline void evtimer_add_msg(evtimer_msg_t *evtimer,
52  kernel_pid_t target_pid)
53 {
54  /* use sender_pid field to get target_pid into callback function */
55  event->msg.sender_pid = target_pid;
56  evtimer_add(evtimer, &event->event);
57 }
58 
65 {
67  msg_send_int(&mevent->msg, mevent->msg.sender_pid);
68 }
69 
75 static inline void evtimer_init_msg(evtimer_t *evtimer)
76 {
78 }
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
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:135
static void _evtimer_msg_handler(evtimer_event_t *event)
Event handler for IPC messages.
Definition: evtimer_msg.h:64
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:50
evtimer_t evtimer_msg_t
IPC-message event timer.
Definition: evtimer_msg.h:31
static void evtimer_init_msg(evtimer_t *evtimer)
Initializes event timer to handle events via IPC.
Definition: evtimer_msg.h:75
void evtimer_add(evtimer_t *evtimer, evtimer_event_t *event)
Adds event to an event timer.
event structure
Definition: event.h:142
Generic event.
Definition: evtimer.h:52
IPC-message event.
Definition: evtimer_msg.h:37
msg_t msg
the IPC message to generate on event
Definition: evtimer_msg.h:39
evtimer_event_t event
base class
Definition: evtimer_msg.h:38
Event timer.
Definition: evtimer.h:65
Describes a message object which can be sent between threads.
Definition: msg.h:192
kernel_pid_t sender_pid
PID of sending thread.
Definition: msg.h:193