API Reference Manual  1.46.0
api/spec/init.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2013-2018 Linaro Limited
3  * Copyright (c) 2019-2024 Nokia
4  */
5 
10 #ifndef ODP_API_SPEC_INIT_H_
11 #define ODP_API_SPEC_INIT_H_
12 #include <odp/visibility_begin.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <odp/api/std_types.h>
19 #include <odp/api/hints.h>
20 #include <odp/api/thread_types.h>
21 #include <odp/api/cpumask.h>
22 
36 #define ODP_TERM_FROM_SIGH ((uint64_t)0x1)
37 
43 #define ODP_TERM_LAST_FLAG ODP_TERM_FROM_SIGH
44 
48 typedef enum {
51 
54 
57 
60 
63 
66 
68 
92 int odp_override_log(odp_log_level_t level, const char *fmt, ...) ODP_PRINTF_FORMAT(2, 3);
93 
115 
117 typedef int (*odp_log_func_t)(odp_log_level_t level, const char *fmt, ...) ODP_PRINTF_FORMAT(2, 3);
118 
120 typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
121 
125 typedef enum {
133 
145 
147 
161 typedef struct odp_init_t {
166 
171 
187 
199 
202 
205 
213 
219 
221  struct {
226  uint64_t max_memory;
227  } shm;
228 
230 
237 
295  const odp_init_t *params,
296  const odp_platform_init_t *platform_params);
297 
321 
341 int odp_term_local(void);
342 
360 
392 int odp_term_abnormal(odp_instance_t instance, uint64_t flags, void *data);
393 
407 
423 
437 
451 
460 
465 #ifdef __cplusplus
466 }
467 #endif
468 
469 #include <odp/visibility_end.h>
470 #endif
ODP CPU masks and enumeration.
Standard C language types and definitions for ODP.
ODP thread.
#define ODP_PRINTF_FORMAT(x, y)
Printf format attribute.
Definition: spec/hints.h:49
#define ODP_NORETURN
Define a function that does not return.
Definition: spec/hints.h:28
int odp_instance(odp_instance_t *instance)
Get instance handle.
void odp_init_param_init(odp_init_t *param)
Initialize the odp_init_t to default values for all fields.
int void odp_override_abort(void) ODP_NORETURN
ODP abort function.
int(* odp_log_func_t)(odp_log_level_t level, const char *fmt,...) ODP_PRINTF_FORMAT(2
Replaceable logging function.
int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type)
Thread local ODP initialization.
uint64_t odp_instance_to_u64(odp_instance_t instance)
Get printable value for ODP instance handle.
odp_mem_model_t
Application memory model.
odp_log_level_t
ODP log level.
Definition: api/spec/init.h:48
int odp_init_global(odp_instance_t *instance, const odp_init_t *params, const odp_platform_init_t *platform_params)
Global ODP initialization.
odp_abort_func_t odp_abort_fn_get(void)
Get abort function.
int odp_term_local(void)
Thread local ODP termination.
int odp_term_global(odp_instance_t instance)
Global ODP termination.
uint64_t odp_instance_t
ODP instance ID.
int(*) typedef void(* odp_abort_func_t)(void) ODP_NORETURN
Replaceable abort function.
int odp_override_log(odp_log_level_t level, const char *fmt,...) ODP_PRINTF_FORMAT(2
ODP log function.
odp_log_func_t odp_log_fn_get(void)
Get current log function.
int odp_term_abnormal(odp_instance_t instance, uint64_t flags, void *data)
Abnormal ODP termination after a non-recoverable error.
void odp_log_thread_fn_set(odp_log_func_t func)
Set thread specific log function.
struct odp_init_t odp_init_t
Global initialization parameters.
@ ODP_MEM_MODEL_PROCESS
Process memory model: by default all memory is not shareable between processes.
@ ODP_MEM_MODEL_THREAD
Thread memory model: by default all memory is shareable between threads.
@ ODP_LOG_ERR
Error.
Definition: api/spec/init.h:56
@ ODP_LOG_DBG
Debug.
Definition: api/spec/init.h:50
@ ODP_LOG_UNIMPLEMENTED
Unimplemented.
Definition: api/spec/init.h:59
@ ODP_LOG_ABORT
Abort.
Definition: api/spec/init.h:62
@ ODP_LOG_PRINT
Print.
Definition: api/spec/init.h:65
@ ODP_LOG_WARN
Warning.
Definition: api/spec/init.h:53
enum odp_thread_type_e odp_thread_type_t
Thread type.
ODP compiler hints.
Global initialization parameters.
odp_log_func_t log_fn
Replacement for the default log fn.
struct odp_init_t::@37 shm
Shared memory parameters.
int num_control
Maximum number of control threads the user will run concurrently.
odp_abort_func_t abort_fn
Replacement for the default abort fn.
uint64_t max_memory
Maximum memory usage in bytes.
int num_worker
Maximum number of worker threads the user will run concurrently.
odp_mem_model_t mem_model
Application memory model.
const odp_cpumask_t * control_cpus
Pointer to bit mask mapping CPUs available to this ODP instance for running control threads.
odp_feature_t not_used
Unused features.
const odp_cpumask_t * worker_cpus
Pointer to bit mask mapping CPUs available to this ODP instance for running worker threads.
Definition of ODP features.