summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/cpusetprintsupport.c
blob: 13cffd9242907f06742ba99d59a43defb758a25d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
 * @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/printer.h>
#include <rtems/score/cpusetimpl.h>

#ifdef __RTEMS_HAVE_SYS_CPUSET_H__

  void _CPU_set_Show_with_plugin(
    const rtems_printer *printer,
    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(
    const rtems_printer *printer,
    const char          *description,
    const cpu_set_t     *cpuset
  )
  {
    int i;
    rtems_printf(printer ,"%s: ", description);
    for(i=0; i<_NCPUWORDS; i++)
      rtems_printf(printer ,"%" PRIx32 "", cpuset->__bits[i]);
    rtems_printf(printer ,"\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)
  {
    rtems_printer printer;
    rtems_print_printer_printk( &printer );
    _CPU_set_Show_with_plugin( &printer, 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