summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/cpusetprintsupport.c
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2014-02-06 12:42:24 -0600
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-03-07 09:07:59 -0600
commit9db8705cc8ad2863dc0173b846783487742b313e (patch)
tree8e3c8ee82053cc68097e359a3087e418c13e9d69 /cpukit/score/src/cpusetprintsupport.c
parentspcpuset01: Add check for sys/cpuset.h. (diff)
downloadrtems-9db8705cc8ad2863dc0173b846783487742b313e.tar.bz2
score: Add cpuset support to Score.
This new Score Handler provides a structure to manage a cpu_set_t plus helper routines to validate the contents against the current system configuration.
Diffstat (limited to 'cpukit/score/src/cpusetprintsupport.c')
-rw-r--r--cpukit/score/src/cpusetprintsupport.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/cpukit/score/src/cpusetprintsupport.c b/cpukit/score/src/cpusetprintsupport.c
new file mode 100644
index 0000000000..a56305e443
--- /dev/null
+++ b/cpukit/score/src/cpusetprintsupport.c
@@ -0,0 +1,84 @@
+/**
+ * @file
+ *
+ * @brief CPU Set Print Support Routines
+ * @ingroup ScoreCpuset
+ */
+
+/*
+ * COPYRIGHT (c) 2014.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <inttypes.h>
+#include <rtems/bspIo.h>
+#include <rtems/score/cpusetimpl.h>
+
+#ifdef __RTEMS_HAVE_SYS_CPUSET_H__
+
+ void _CPU_set_Show_with_plugin(
+ void *context,
+ rtems_printk_plugin_t print,
+ const char *description,
+ const cpu_set_t *cpuset
+ );
+
+ /*
+ * _CPU_set_Show_with_plugin
+ *
+ * This routine shows cpuset cpuset using a
+ * print plugin .
+ */
+ void _CPU_set_Show_with_plugin(
+ void *context,
+ rtems_printk_plugin_t print,
+ const char *description,
+ const cpu_set_t *cpuset
+ )
+ {
+ int i;
+
+ if ( !print )
+ return;
+
+ (*print)(context ,"%s: ", description);
+ for(i=0; i<_NCPUWORDS; i++)
+ (*print)(context ,"%x", cpuset->__bits[i]);
+ (*print)(context ,"\n");
+ }
+
+ /*
+ * _CPU_set_Show
+ *
+ * This routine shows a cpuset using the
+ * printk plugin.
+ */
+ void _CPU_set_Show( const char *description, const cpu_set_t *cpuset)
+ {
+ _CPU_set_Show_with_plugin( NULL, printk_plugin, description, cpuset );
+ }
+
+ /*
+ * _CPU_set_Show_default
+ *
+ * This routine shows the default cpuset.
+ */
+ void _CPU_set_Show_default( const char *description )
+ {
+ const CPU_set_Control *ctl;
+ ctl = _CPU_set_Default();
+ _CPU_set_Show( description, ctl->set );
+ }
+#endif