[9db8705] | 1 | /** |
---|
| 2 | * @file rtems/score/cpusetimpl.h |
---|
| 3 | * |
---|
| 4 | * @brief Implementation Prototypes for CPU Set |
---|
| 5 | * |
---|
| 6 | * This file contains the implementation prototypes for |
---|
| 7 | * CPU set methods. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | /* |
---|
| 11 | * COPYRIGHT (c) 2014. |
---|
| 12 | * On-Line Applications Research Corporation (OAR). |
---|
| 13 | * |
---|
| 14 | * The license and distribution terms for this file may be |
---|
| 15 | * found in the file LICENSE in this distribution or at |
---|
| 16 | * http://www.rtems.org/license/LICENSE. |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #ifndef _RTEMS_SCORE_CPUSETIMPL_H |
---|
| 20 | #define _RTEMS_SCORE_CPUSETIMPL_H |
---|
| 21 | |
---|
| 22 | #include <rtems/score/cpuset.h> |
---|
[0712d17] | 23 | #include <rtems/score/smp.h> |
---|
| 24 | |
---|
| 25 | #include <limits.h> |
---|
[9db8705] | 26 | |
---|
| 27 | #ifdef __cplusplus |
---|
| 28 | extern "C" { |
---|
| 29 | #endif |
---|
| 30 | |
---|
| 31 | #ifdef __RTEMS_HAVE_SYS_CPUSET_H__ |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * _CPU_set_Is_valid |
---|
| 35 | * |
---|
| 36 | * This routine validates a cpuset size corresponds to |
---|
| 37 | * the system correct size, that at least one |
---|
| 38 | * valid cpu is set and that no invalid cpus are set. |
---|
| 39 | */ |
---|
[cfe457f] | 40 | bool _CPU_set_Is_valid( const cpu_set_t *cpuset, size_t setsize ); |
---|
[9db8705] | 41 | |
---|
| 42 | /** |
---|
| 43 | * _CPU_set_Show |
---|
| 44 | * |
---|
| 45 | * This routine will print the value of the given cpuset. |
---|
| 46 | */ |
---|
| 47 | void _CPU_set_Show( const char *description, const cpu_set_t *cpuset); |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * _CPU_set_Show_default |
---|
| 51 | * |
---|
| 52 | * This routine will print the value of the default cpuset. |
---|
| 53 | */ |
---|
| 54 | void _CPU_set_Show_default( const char *description ); |
---|
| 55 | |
---|
| 56 | /** |
---|
| 57 | * _CPU_set_Default |
---|
| 58 | * |
---|
| 59 | * This routine returns the default cpuset for |
---|
| 60 | * this system. |
---|
| 61 | */ |
---|
| 62 | const CPU_set_Control *_CPU_set_Default(void); |
---|
| 63 | |
---|
[0712d17] | 64 | RTEMS_INLINE_ROUTINE size_t _CPU_set_Maximum_CPU_count( |
---|
| 65 | size_t cpusetsize |
---|
| 66 | ) |
---|
| 67 | { |
---|
| 68 | return cpusetsize * CHAR_BIT; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | RTEMS_INLINE_ROUTINE bool _CPU_set_Is_large_enough( |
---|
| 72 | size_t cpusetsize |
---|
| 73 | ) |
---|
| 74 | { |
---|
| 75 | return _CPU_set_Maximum_CPU_count( cpusetsize ) |
---|
| 76 | >= _SMP_Get_processor_count(); |
---|
| 77 | } |
---|
| 78 | |
---|
[9db8705] | 79 | #endif |
---|
| 80 | |
---|
| 81 | /** |
---|
| 82 | * _CPU_set_Handler_initialization |
---|
| 83 | * |
---|
| 84 | * This routine validates a cpuset sets at least one |
---|
| 85 | * valid cpu and that it does not set any invalid |
---|
| 86 | * cpus. |
---|
| 87 | */ |
---|
| 88 | |
---|
| 89 | #if __RTEMS_HAVE_SYS_CPUSET_H__ && defined( RTEMS_SMP ) |
---|
| 90 | void _CPU_set_Handler_initialization(void); |
---|
| 91 | #else |
---|
| 92 | #define _CPU_set_Handler_initialization() do { } while ( 0 ) |
---|
| 93 | #endif |
---|
| 94 | |
---|
| 95 | /**@}*/ |
---|
| 96 | |
---|
| 97 | #ifdef __cplusplus |
---|
| 98 | } |
---|
| 99 | #endif |
---|
| 100 | #endif |
---|
| 101 | /* end of include file */ |
---|