EM-ODP  3.7.0
Event Machine on ODP
event_machine_helper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Nokia Siemens Networks
3  * Copyright (c) 2015-2024, 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 #ifndef EVENT_MACHINE_HELPER_H_
33 #define EVENT_MACHINE_HELPER_H_
34 
35 #pragma GCC visibility push(default)
36 
37 /**
38  * @file
39  * Event Machine helper functions and macros
40  *
41  */
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
49 
50 /**
51  * Format error string
52  *
53  * Creates an error report string from EM internal errors.
54  * Main use case: application error handlers to create an error report from
55  * EM internal errors.
56  *
57  * @param[out] str Output string pointer
58  * @param size Maximum string length in characters
59  * @param eo EO handle
60  * @param error Error code (EM internal)
61  * @param escope Error scope (EM internal)
62  * @param args Variable arguments as passed to the error handler
63  *
64  * @return Output string length.
65  */
66 int em_error_format_string(char *str /*out*/, size_t size, em_eo_t eo,
67  em_status_t error, em_escope_t escope, va_list args);
68 /**
69  * @brief Print EM related version information
70  *
71  * Prints the EM version information, as well as version information for the
72  * used ODP and HW etc. (similar to what EM prints at startup).
73  *
74  * For EM API version strings, defines and macros see
75  * include/event_machine/api/event_machine_version.h
76  *
77  * The printed content may vary from one EM release to the next.
78  */
79 void em_version_print(void);
80 
81 /**
82  * @brief Print miscellaneous EM information
83  *
84  * Print information about the running EM instance.
85  * Mainly for debug or startup logging needs.
86  *
87  * The printed content may vary from one EM release to the next.
88  */
89 void em_info_print(void);
90 
91 /*
92  * Physical core ids
93  ***************************************
94  */
95 
96 /**
97  * Converts a logical core id to a physical core id
98  *
99  * Mainly needed when interfacing HW specific APIs.
100  *
101  * @param core Logical (Event Machine) core id
102  *
103  * @return Physical core id or -1 on error.
104  */
105 int em_core_id_get_physical(int core);
106 
107 /**
108  * Converts a logical core mask to a physical core mask
109  *
110  * Mainly needed when interfacing HW specific APIs.
111  *
112  * @param[out] phys Core mask of physical core ids
113  * @param logic Core mask of logical (Event Machine) core ids
114  */
115 void em_core_mask_get_physical(em_core_mask_t *phys /*out*/,
116  const em_core_mask_t *logic);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #pragma GCC visibility pop
123 #endif /* EVENT_MACHINE_HELPER_H_ */
em_version_print
void em_version_print(void)
Print EM related version information.
Definition: event_machine_helper.c:95
em_error_format_string
int em_error_format_string(char *str, size_t size, em_eo_t eo, em_status_t error, em_escope_t escope, va_list args)
Definition: event_machine_helper.c:39
em_info_print
void em_info_print(void)
Print miscellaneous EM information.
Definition: event_machine_helper.c:100
em_core_mask_t
Definition: event_machine_hw_types.h:242
em_core_id_get_physical
int em_core_id_get_physical(int core)
Definition: event_machine_helper.c:106
em_escope_t
uint32_t em_escope_t
Definition: event_machine_types.h:348
em_status_t
uint32_t em_status_t
Definition: event_machine_types.h:321
event_machine_hw_types.h
event_machine_types.h
em_core_mask_get_physical
void em_core_mask_get_physical(em_core_mask_t *phys, const em_core_mask_t *logic)
Definition: event_machine_helper.c:112