Embedded Multicore Building Blocks V1.0.0
core_set.h
1 /*
2  * Copyright (c) 2014-2017, Siemens AG. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24  * POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #ifndef EMBB_BASE_C_CORE_SET_H_
28 #define EMBB_BASE_C_CORE_SET_H_
29 
30 #include <stdint.h>
31 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 
58 #ifdef DOXYGEN
59 typedef opaque_type embb_core_set_t;
60 #else
61 typedef struct embb_core_set_t {
62  uint64_t rep;
64 #endif /* else defined(DOXYGEN) */
65 
76 unsigned int embb_core_count_available();
77 
89  embb_core_set_t* core_set,
91  int initializer
94  );
95 
107 void embb_core_set_add(
108  embb_core_set_t* core_set,
110  unsigned int core_number
112  );
113 
126  embb_core_set_t* core_set,
128  unsigned int core_number
130  );
131 
143  const embb_core_set_t* core_set,
145  unsigned int core_number
147  );
148 
160  embb_core_set_t* set1,
162  const embb_core_set_t* set2
164  );
165 
177  embb_core_set_t* set1,
179  const embb_core_set_t* set2
181  );
182 
191 unsigned int embb_core_set_count(
192  const embb_core_set_t* core_set
194  );
195 
196 #ifdef __cplusplus
197 } /* Close extern "C" { */
198 #endif
199 
204 #endif /* EMBB_BASE_C_CORE_SET_H_ */
opaque_type embb_core_set_t
Opaque type representing a set of processor cores.
Definition: core_set.h:59
void embb_core_set_union(embb_core_set_t *set1, const embb_core_set_t *set2)
Computes the union of core set1 and set2.
unsigned int embb_core_count_available()
Returns the number of available processor cores.
void embb_core_set_init(embb_core_set_t *core_set, int initializer)
Initializes the specified core set.
void embb_core_set_add(embb_core_set_t *core_set, unsigned int core_number)
Adds a core to the specified set.
int embb_core_set_contains(const embb_core_set_t *core_set, unsigned int core_number)
Determines whether a core is contained in the specified set.
void embb_core_set_intersection(embb_core_set_t *set1, const embb_core_set_t *set2)
Computes the intersection of core set1 and set2.
unsigned int embb_core_set_count(const embb_core_set_t *core_set)
Returns the number of cores contained in the specified set.
void embb_core_set_remove(embb_core_set_t *core_set, unsigned int core_number)
Removes a core from the specified set.