37#ifndef _RTEMS_SCORE_PROCESSORMASKIMPL_H
38#define _RTEMS_SCORE_PROCESSORMASKIMPL_H
42#include <sys/cpuset.h>
61static inline void _Processor_mask_Zero( Processor_mask *mask )
63 __BIT_ZERO( CPU_MAXIMUM_PROCESSORS, mask );
74static inline bool _Processor_mask_Is_zero(
const Processor_mask *mask )
76 return __BIT_EMPTY( CPU_MAXIMUM_PROCESSORS, mask );
84static inline void _Processor_mask_Fill( Processor_mask *mask )
86 __BIT_FILL( CPU_MAXIMUM_PROCESSORS, mask );
95static inline void _Processor_mask_Assign(
96 Processor_mask *dst,
const Processor_mask *src
99 __BIT_COPY( CPU_MAXIMUM_PROCESSORS, src, dst );
108static inline void _Processor_mask_Set(
109 Processor_mask *mask,
113 __BIT_SET( CPU_MAXIMUM_PROCESSORS, index, mask );
122static inline void _Processor_mask_Clear(
123 Processor_mask *mask,
127 __BIT_CLR( CPU_MAXIMUM_PROCESSORS, index, mask );
139static inline bool _Processor_mask_Is_set(
140 const Processor_mask *mask,
144 return __BIT_ISSET( CPU_MAXIMUM_PROCESSORS, index, mask );
156static inline bool _Processor_mask_Is_equal(
157 const Processor_mask *a,
158 const Processor_mask *b
161 return !__BIT_CMP( CPU_MAXIMUM_PROCESSORS, a, b );
174static inline bool _Processor_mask_Has_overlap(
175 const Processor_mask *a,
176 const Processor_mask *b
179 return __BIT_OVERLAP( CPU_MAXIMUM_PROCESSORS, a, b );
192static inline bool _Processor_mask_Is_subset(
193 const Processor_mask *big,
194 const Processor_mask *small
197 return __BIT_SUBSET( CPU_MAXIMUM_PROCESSORS, big, small );
207static inline void _Processor_mask_And(
209 const Processor_mask *b,
210 const Processor_mask *c
213 __BIT_AND2( CPU_MAXIMUM_PROCESSORS, a, b, c );
223static inline void _Processor_mask_And_not(
225 const Processor_mask *b,
226 const Processor_mask *c
229 __BIT_ANDNOT2( CPU_MAXIMUM_PROCESSORS, a, b, c );
239static inline void _Processor_mask_Or(
241 const Processor_mask *b,
242 const Processor_mask *c
245 __BIT_OR2( CPU_MAXIMUM_PROCESSORS, a, b, c );
255static inline void _Processor_mask_Xor(
257 const Processor_mask *b,
258 const Processor_mask *c
261 __BIT_XOR2( CPU_MAXIMUM_PROCESSORS, a, b, c );
271static inline uint32_t _Processor_mask_Count(
const Processor_mask *a )
273 return (uint32_t) __BIT_COUNT( CPU_MAXIMUM_PROCESSORS, a );
283static inline uint32_t _Processor_mask_Find_last_set(
const Processor_mask *a )
285 return (uint32_t) __BIT_FLS( CPU_MAXIMUM_PROCESSORS, a );
297static inline uint32_t _Processor_mask_To_uint32_t(
298 const Processor_mask *mask,
302 long bits = mask->__bits[ index / _BITSET_BITS ];
304 return (uint32_t) ( bits >> ( 32 * ( ( index % _BITSET_BITS ) / 32 ) ) );
315static inline void _Processor_mask_From_uint32_t(
316 Processor_mask *mask,
321 _Processor_mask_Zero( mask );
322 mask->__bits[ __bitset_words( index ) ] = ((long) bits) << (32 * (index % _BITSET_BITS) / 32);
331static inline void _Processor_mask_From_index(
332 Processor_mask *mask,
336 __BIT_SETOF( CPU_MAXIMUM_PROCESSORS, (
int) index, mask );
340 PROCESSOR_MASK_COPY_LOSSLESS,
341 PROCESSOR_MASK_COPY_PARTIAL_LOSS,
342 PROCESSOR_MASK_COPY_COMPLETE_LOSS,
343 PROCESSOR_MASK_COPY_INVALID_SIZE
344} Processor_mask_Copy_status;
354static inline bool _Processor_mask_Is_at_most_partial_loss(
355 Processor_mask_Copy_status status
358 return (
unsigned int) status <= PROCESSOR_MASK_COPY_PARTIAL_LOSS;
401static inline Processor_mask_Copy_status _Processor_mask_To_cpu_set_t(
402 const Processor_mask *src,
431static inline Processor_mask_Copy_status _Processor_mask_From_cpu_set_t(
445extern const Processor_mask _Processor_mask_The_one_and_only;
Processor_mask_Copy_status _Processor_mask_Copy(long *dst, size_t dst_size, const long *src, size_t src_size)
Copies one mask to another.
Definition: processormaskcopy.c:46
This header file provides the interfaces of the Processor Mask.