source: rtems/cpukit/score/src/cpusetprintsupport.c @ 99fc1d1d

5
Last change on this file since 99fc1d1d was 506bfc8, checked in by Sebastian Huber <sebastian.huber@…>, on 06/21/16 at 11:30:15

Move printer initialization to separate header

The RTEMS print user need to know nothing about a particular printer
implementation. In particular get rid of the <stdio.h> include which
would be visible via <rtems.h>.

  • Property mode set to 100644
File size: 1.7 KB
Line 
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/printer.h>
27#include <rtems/score/cpusetimpl.h>
28
29#ifdef __RTEMS_HAVE_SYS_CPUSET_H__
30
31  void _CPU_set_Show_with_plugin(
32    const rtems_printer *printer,
33    const char          *description,
34    const cpu_set_t     *cpuset
35  );
36
37  /*
38   * _CPU_set_Show_with_plugin
39   *
40   * This routine shows cpuset cpuset using a
41   * print plugin .
42   */
43  void _CPU_set_Show_with_plugin(
44    const rtems_printer *printer,
45    const char          *description,
46    const cpu_set_t     *cpuset
47  )
48  {
49    int i;
50    rtems_printf(printer ,"%s: ", description);
51    for(i=0; i<_NCPUWORDS; i++)
52      rtems_printf(printer ,"%" PRIx32 "", cpuset->__bits[i]);
53    rtems_printf(printer ,"\n");
54  }
55
56  /*
57   * _CPU_set_Show
58   *
59   * This routine shows a cpuset using the
60   * printk plugin.
61   */
62  void _CPU_set_Show( const char *description, const cpu_set_t   *cpuset)
63  {
64    rtems_printer printer;
65    rtems_print_printer_printk( &printer );
66    _CPU_set_Show_with_plugin( &printer, description, cpuset );
67  }
68
69  /*
70   * _CPU_set_Show_default
71   *
72   * This routine shows the default cpuset.
73   */
74 void _CPU_set_Show_default( const char *description )
75  {
76    const CPU_set_Control *ctl;
77    ctl = _CPU_set_Default();
78    _CPU_set_Show( description, ctl->set );
79  }
80#endif
Note: See TracBrowser for help on using the repository browser.