EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
event_machine_helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012, Nokia Siemens Networks
3 * Copyright (c) 2015-2026, 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
45
46#ifdef __cplusplus
47extern "C" {
48#endif
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 (including final '\0'), or 0 on invalid input
65 */
66int 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 */
79void 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 */
89void 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 * @note
100 * This may be a very slow operation and MUST NOT be used in the fast path!
101 *
102 * @param core Logical (Event Machine) core id
103 *
104 * @return Physical core id or -1 on error.
105 */
106int em_core_id_physical(int core);
107
108/* Backwards compatible naming ("get") */
109#define em_core_id_get_physical em_core_id_physical
110
111/**
112 * Converts a logical core mask to a physical core mask
113 *
114 * @note
115 * This may be a very slow operation and MUST NOT be used in the fast path!
116 *
117 * @param[out] phys Core mask of physical core ids
118 * @param logic Core mask of logical (Event Machine) core ids
119 */
120void em_core_mask_physical(em_core_mask_t *phys /*out*/,
121 const em_core_mask_t *logic);
122
123/* Backwards compatible naming ("get") */
124#define em_core_mask_get_physical em_core_mask_physical
125
126#ifdef __cplusplus
127}
128#endif
129
130#pragma GCC visibility pop
131#endif /* EVENT_MACHINE_HELPER_H_ */
void em_core_mask_physical(em_core_mask_t *phys, const em_core_mask_t *logic)
void em_version_print(void)
Print EM related version information.
int em_core_id_physical(int core)
void em_info_print(void)
Print miscellaneous EM information.
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)
uint32_t em_escope_t
uint32_t em_status_t