EM-ODP  3.7.0
Event Machine on ODP
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 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * @brief Create EM's internal unscheduled control queues at startup.
48  */
50 
51 /**
52  * @brief Delete EM's internal unscheduled control queues at teardown.
53  */
55 
56 /**
57  * @brief Poll EM's internal unscheduled control queues during dispatch.
58  */
59 void poll_unsched_ctrl_queue(void);
60 
61 /**
62  * @brief Sends an internal control event to each core set in 'mask'.
63  *
64  * When all cores set in 'mask' has processed the event an additional
65  * internal 'done' msg is sent to synchronize - this done-event can then
66  * trigger any notifications for the user that the operation was completed.
67  * Processing of the 'done' event will also call the 'f_done_callback'
68  * function if given.
69  *
70  * @return 0 on success, otherwise return the number of ctrl events that could
71  * not be sent due to error
72  */
73 int send_core_ctrl_events(const em_core_mask_t *const mask, em_event_t ctrl_event,
74  void (*f_done_callback)(void *arg_ptr),
75  void *f_done_arg_ptr,
76  int num_notif, const em_notif_t notif_tbl[],
77  bool sync_operation);
78 
79 /**
80  * @brief Helper func: Allocate & set up the internal 'done' event with
81  * function callbacks and notification events. Creates the needed event group
82  * and applies the event group count. A successful setup returns the event group
83  * ready for use with em_send_group().
84  *
85  * @return An event group successfully 'applied' with count and notifications.
86  * @retval EM_EVENT_GROUP_UNDEF on error
87  *
88  * @see evgrp_abort_delete() below for deleting the event group returned by this
89  * function.
90  */
91 em_event_group_t internal_done_w_notif_req(int event_group_count,
92  void (*f_done_callback)(void *arg_ptr),
93  void *f_done_arg_ptr,
94  int num_notif, const em_notif_t notif_tbl[],
95  bool sync_operation);
96 
97 /**
98  * @brief Helper func to send notifications events
99  */
100 em_status_t send_notifs(const int num_notif, const em_notif_t notif_tbl[]);
101 
102 /**
103  * @brief Check that the usage of a notification is valid
104  */
105 em_status_t check_notif(const em_notif_t *const notif);
106 
107 /**
108  * @brief Check that the usage of a table of notifications is valid
109  */
110 em_status_t check_notif_tbl(const int num_notif, const em_notif_t notif_tbl[]);
111 
112 /**
113  * @brief internal_done_w_notif_req() 'companion' to abort and delete the
114  * event group created by the mentioned function.
115  */
116 void evgrp_abort_delete(em_event_group_t event_group);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* EM_INTERNAL_EVENT_H_ */
check_notif
em_status_t check_notif(const em_notif_t *const notif)
Check that the usage of a notification is valid.
Definition: em_internal_event.c:450
check_notif_tbl
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.
Definition: em_internal_event.c:477
poll_unsched_ctrl_queue
void poll_unsched_ctrl_queue(void)
Poll EM's internal unscheduled control queues during dispatch.
Definition: em_internal_event.c:540
send_notifs
em_status_t send_notifs(const int num_notif, const em_notif_t notif_tbl[])
Helper func to send notifications events.
Definition: em_internal_event.c:423
em_core_mask_t
Definition: event_machine_hw_types.h:242
send_core_ctrl_events
int send_core_ctrl_events(const em_core_mask_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 core set in 'mask'.
Definition: em_internal_event.c:135
em_status_t
uint32_t em_status_t
Definition: event_machine_types.h:321
em_notif_t
Definition: event_machine_types.h:268
evgrp_abort_delete
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 ...
Definition: em_internal_event.c:406
internal_done_w_notif_req
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...
Definition: em_internal_event.c:335
create_ctrl_queues
em_status_t create_ctrl_queues(void)
Create EM's internal unscheduled control queues at startup.
Definition: em_internal_event.c:41
delete_ctrl_queues
em_status_t delete_ctrl_queues(void)
Delete EM's internal unscheduled control queues at teardown.
Definition: em_internal_event.c:96