EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
em_internal_event.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012, Nokia Siemens Networks
3 * Copyright (c) 2015, Nokia Solutions and Networks
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /**
33 * @file
34 *
35 * EM internal-event functions
36 *
37 */
38
39#ifndef EM_INTERNAL_EVENT_H_
40#define EM_INTERNAL_EVENT_H_
41
42#include <stdbool.h>
43
44#include <odp_api.h>
45
46#include <event_machine.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/**
53 * @brief Create EM's internal shared unscheduled control queue at startup
54 */
56
57/**
58 * @brief Create EM's internal unscheduled control queues at startup - one per core
59 */
61
62/**
63 * @brief Delete EM's internal unscheduled control queues at teardown.
64 */
66
67/**
68 * @brief Poll EM's internal unscheduled control queues during dispatch.
69 */
71
72/**
73 * @brief Sends an internal control event to each thread set in 'mask'.
74 *
75 * When all threads set in 'mask' have processed the event an additional
76 * internal 'done' msg is sent to synchronize - this done-event can then
77 * trigger any notifications for the user that the operation was completed.
78 * Processing of the 'done' event will also call the 'f_done_callback'
79 * function if given.
80 *
81 * @return 0 on success, otherwise return the number of ctrl events that could
82 * not be sent due to error
83 */
84int send_core_ctrl_events(const odp_thrmask_t *const mask, em_event_t ctrl_event,
85 void (*f_done_callback)(void *arg_ptr),
86 void *f_done_arg_ptr,
87 int num_notif, const em_notif_t notif_tbl[],
88 bool sync_operation);
89
90/**
91 * @brief Helper func: Allocate & set up the internal 'done' event with
92 * function callbacks and notification events. Creates the needed event group
93 * and applies the event group count. A successful setup returns the event group
94 * ready for use with em_send_group().
95 *
96 * @return An event group successfully 'applied' with count and notifications.
97 * @retval EM_EVENT_GROUP_UNDEF on error
98 *
99 * @see evgrp_abort_delete() below for deleting the event group returned by this
100 * function.
101 */
102em_event_group_t internal_done_w_notif_req(int event_group_count,
103 void (*f_done_callback)(void *arg_ptr),
104 void *f_done_arg_ptr,
105 int num_notif, const em_notif_t notif_tbl[],
106 bool sync_operation);
107
108/**
109 * @brief Helper func to send notifications events
110 */
111em_status_t send_notifs(const int num_notif, const em_notif_t notif_tbl[]);
112
113/**
114 * @brief Check that the usage of a notification is valid
115 */
116em_status_t check_notif(const em_notif_t *const notif);
117
118/**
119 * @brief Check that the usage of a table of notifications is valid
120 */
121em_status_t check_notif_tbl(const int num_notif, const em_notif_t notif_tbl[]);
122
123/**
124 * @brief internal_done_w_notif_req() 'companion' to abort and delete the
125 * event group created by the mentioned function.
126 */
127void evgrp_abort_delete(em_event_group_t event_group);
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif /* EM_INTERNAL_EVENT_H_ */
em_status_t check_notif(const em_notif_t *const notif)
Check that the usage of a notification is valid.
em_status_t create_ctrl_queue(void)
Create EM's internal unscheduled control queues at startup - one per core.
em_event_group_t internal_done_w_notif_req(int event_group_count, void(*f_done_callback)(void *arg_ptr), void *f_done_arg_ptr, int num_notif, const em_notif_t notif_tbl[], bool sync_operation)
Helper func: Allocate & set up the internal 'done' event with function callbacks and notification eve...
void poll_unsched_ctrl_queue(void)
Poll EM's internal unscheduled control queues during dispatch.
int send_core_ctrl_events(const odp_thrmask_t *const mask, em_event_t ctrl_event, void(*f_done_callback)(void *arg_ptr), void *f_done_arg_ptr, int num_notif, const em_notif_t notif_tbl[], bool sync_operation)
Sends an internal control event to each thread set in 'mask'.
em_status_t delete_ctrl_queues(void)
Delete EM's internal unscheduled control queues at teardown.
em_status_t check_notif_tbl(const int num_notif, const em_notif_t notif_tbl[])
Check that the usage of a table of notifications is valid.
em_status_t create_shared_ctrl_queue(void)
Create EM's internal shared unscheduled control queue at startup.
void evgrp_abort_delete(em_event_group_t event_group)
internal_done_w_notif_req() 'companion' to abort and delete the event group created by the mentioned ...
em_status_t send_notifs(const int num_notif, const em_notif_t notif_tbl[])
Helper func to send notifications events.
uint32_t em_status_t