1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief CPU Set Print Support Routines |
---|
5 | * @ingroup ScoreCpuset |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 2014. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifdef HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <string.h> |
---|
22 | #include <stdlib.h> |
---|
23 | #include <stdio.h> |
---|
24 | #include <ctype.h> |
---|
25 | #include <inttypes.h> |
---|
26 | #include <rtems/bspIo.h> |
---|
27 | #include <rtems/score/cpusetimpl.h> |
---|
28 | |
---|
29 | #ifdef __RTEMS_HAVE_SYS_CPUSET_H__ |
---|
30 | |
---|
31 | void _CPU_set_Show_with_plugin( |
---|
32 | void *context, |
---|
33 | rtems_printk_plugin_t print, |
---|
34 | const char *description, |
---|
35 | const cpu_set_t *cpuset |
---|
36 | ); |
---|
37 | |
---|
38 | /* |
---|
39 | * _CPU_set_Show_with_plugin |
---|
40 | * |
---|
41 | * This routine shows cpuset cpuset using a |
---|
42 | * print plugin . |
---|
43 | */ |
---|
44 | void _CPU_set_Show_with_plugin( |
---|
45 | void *context, |
---|
46 | rtems_printk_plugin_t print, |
---|
47 | const char *description, |
---|
48 | const cpu_set_t *cpuset |
---|
49 | ) |
---|
50 | { |
---|
51 | int i; |
---|
52 | |
---|
53 | if ( !print ) |
---|
54 | return; |
---|
55 | |
---|
56 | (*print)(context ,"%s: ", description); |
---|
57 | for(i=0; i<_NCPUWORDS; i++) |
---|
58 | (*print)(context ,"%x", cpuset->__bits[i]); |
---|
59 | (*print)(context ,"\n"); |
---|
60 | } |
---|
61 | |
---|
62 | /* |
---|
63 | * _CPU_set_Show |
---|
64 | * |
---|
65 | * This routine shows a cpuset using the |
---|
66 | * printk plugin. |
---|
67 | */ |
---|
68 | void _CPU_set_Show( const char *description, const cpu_set_t *cpuset) |
---|
69 | { |
---|
70 | _CPU_set_Show_with_plugin( NULL, printk_plugin, description, cpuset ); |
---|
71 | } |
---|
72 | |
---|
73 | /* |
---|
74 | * _CPU_set_Show_default |
---|
75 | * |
---|
76 | * This routine shows the default cpuset. |
---|
77 | */ |
---|
78 | void _CPU_set_Show_default( const char *description ) |
---|
79 | { |
---|
80 | const CPU_set_Control *ctl; |
---|
81 | ctl = _CPU_set_Default(); |
---|
82 | _CPU_set_Show( description, ctl->set ); |
---|
83 | } |
---|
84 | #endif |
---|