Changeset 24d0ee57 in rtems


Ignore:
Timestamp:
May 20, 2016, 8:39:50 AM (3 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
1503c1c3
Parents:
b1860df5
git-author:
Chris Johns <chrisj@…> (05/20/16 08:39:50)
git-committer:
Chris Johns <chrisj@…> (05/25/16 05:47:34)
Message:

cpukit, testsuite: Add rtems_printf and rtems_printer support.

This change adds rtems_printf and related functions and wraps the
RTEMS print plugin support into a user API. All references to the
plugin are removed and replaced with the rtems_printer interface.

Printk and related functions are made to return a valid number of
characters formatted and output.

The function attribute to check printf functions has been added
to rtems_printf and printk. No changes to remove warrnings are part
of this patch set.

The testsuite has been moved over to the rtems_printer. The testsuite
has a mix of rtems_printer access and direct print control via the
tmacros.h header file. The support for begink/endk has been removed
as it served no purpose and only confused the code base. The testsuite
has not been refactored to use rtems_printf. This is future work.

Files:
3 added
87 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/include/irq-info.h

    rb1860df5 r24d0ee57  
    2424
    2525#include <rtems/shell.h>
    26 #include <rtems/bspIo.h>
     26#include <rtems/print.h>
    2727
    2828#ifdef __cplusplus
     
    3535 */
    3636void bsp_interrupt_report_with_plugin(
    37   void *context,
    38   rtems_printk_plugin_t print
     37  const rtems_printer *printer
    3938);
    4039
  • c/src/lib/libbsp/shared/src/irq-info.c

    rb1860df5 r24d0ee57  
    2222#include <inttypes.h>
    2323
     24#include <rtems/print.h>
     25
    2426#include <bsp/irq-generic.h>
    2527#include <bsp/irq-info.h>
    2628
    2729typedef struct {
    28   void *context;
    29   rtems_printk_plugin_t print;
     30  const rtems_printer *printer;
    3031  rtems_vector_number vector;
    3132} bsp_interrupt_report_entry;
     
    4243  const char *opt = options == RTEMS_INTERRUPT_UNIQUE ? "UNIQUE" : "SHARED";
    4344
    44   e->print(
    45     e->context,
    46     "%7" PRIu32 " | %-32s | %7s | %010p | %010p\n",
     45  rtems_printf(
     46    e->printer,
     47    "%7" PRIu32 " | %-32s | %7s | %p | %p\n",
    4748    e->vector,
    4849    info,
     
    5455
    5556void bsp_interrupt_report_with_plugin(
    56   void *context,
    57   rtems_printk_plugin_t print
     57  const rtems_printer *printer
    5858)
    5959{
    6060  rtems_vector_number v = 0;
    6161  bsp_interrupt_report_entry e = {
    62     .context = context,
    63     .print = print,
     62    .printer = printer,
    6463    .vector = 0
    6564  };
    6665
    67   print(
    68     context,
     66  rtems_printf(
     67    printer,
    6968    "-------------------------------------------------------------------------------\n"
    7069    "                             INTERRUPT INFORMATION\n"
     
    8382  }
    8483
    85   print(
    86     context,
     84  rtems_printf(
     85    printer,
    8786    "--------+----------------------------------+---------+------------+------------\n"
    8887  );
     
    9190void bsp_interrupt_report(void)
    9291{
    93   bsp_interrupt_report_with_plugin(NULL, printk_plugin);
     92  rtems_printer printer;
     93  rtems_print_printer_printk(&printer);
     94  bsp_interrupt_report_with_plugin(&printer);
    9495}
  • c/src/lib/libbsp/shared/src/irq-shell.c

    rb1860df5 r24d0ee57  
    2828static int bsp_interrupt_shell_main(int argc, char **argv)
    2929{
    30   bsp_interrupt_report_with_plugin(stdout, (rtems_printk_plugin_t) fprintf);
     30  rtems_printer printer;
     31  rtems_print_printer_printf(&printer);
     32  bsp_interrupt_report_with_plugin(&printer);
    3133
    3234  return 0;
  • cpukit/Makefile.am

    rb1860df5 r24d0ee57  
    9898
    9999include_rtems_HEADERS += include/rtems/bspIo.h
     100include_rtems_HEADERS += include/rtems/print.h
    100101include_rtems_HEADERS += include/rtems/userenv.h
    101102include_rtems_HEADERS += include/rtems/fs.h
  • cpukit/include/rtems/bspIo.h

    rb1860df5 r24d0ee57  
    3636 *  - BSP_poll_char
    3737 */
     38
     39/**
     40 * Print format function attribute for warning checks. Can be defined if
     41 * checking needs to be disabled.
     42 */
     43#ifndef RTEMS_PRINTF_ATTRIBUTE
     44#define RTEMS_PRINTF_ATTRIBUTE(_format_pos, _ap_pos) \
     45  __attribute__((format(__printf__, _format_pos, _ap_pos)))
     46#endif
    3847
    3948/**
     
    8594 * @param[in] fmt is a printf()-style format string
    8695 * @param[in] ap is a va_list pointer to arguments
     96 *
     97 * @return The number of characters output.
    8798 */
    88 extern void vprintk(const char *fmt, va_list ap);
     99extern int vprintk(const char *fmt, va_list ap);
    89100
    90101/**
     
    94105 *
    95106 * @param[in] fmt is a printf()-style format string
     107 *
     108 * @return The number of characters output.
    96109 */
    97 extern void printk(const char *fmt, ...);
     110extern int printk(const char *fmt, ...) RTEMS_PRINTF_ATTRIBUTE(1, 2);
    98111
    99112/**
     
    103116 *
    104117 * @param[in] s is the string to print
     118 *
     119 * @return The number of characters output.
    105120 */
    106 extern void putk(const char *s);
     121extern int putk(const char *s);
    107122
    108123/**
     
    119134 * certain reporting routines to redirect the output.
    120135 *
    121  * Methods following this prototype may be passed into RTEMS reporting
    122  * functions that allow their output to be redirected.  In particular,
    123  * the cpu usage, period usage, and stack usage reporting
    124  * functions use this.
     136 * Use the RTEMS Print interface to call these functions. Do not
     137 * directly use them.
    125138 *
    126139 * If the user provides their own "printf plugin", then they may
    127140 * redirect those reports as they see fit.
    128141 */
    129 typedef int (*rtems_printk_plugin_t)(void *, const char *format, ...);
     142typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap);
    130143
    131144/**
     
    137150 * @return The number of characters printed.
    138151 */
    139 extern int printk_plugin(void *context, const char *fmt, ...);
     152extern int printk_plugin(void *context, const char *fmt, va_list ap);
    140153
    141154/**
     
    150163 * @return The number of characters printed.
    151164 */
    152 extern int rtems_printf_plugin(void *context, const char *fmt, ...);
     165extern int rtems_printf_plugin(void *context, const char *fmt, va_list ap);
    153166
    154167/**@}*/
  • cpukit/libblock/include/rtems/blkdev.h

    rb1860df5 r24d0ee57  
    1717#include <rtems.h>
    1818#include <rtems/diskdevs.h>
    19 #include <rtems/bspIo.h>
     19#include <rtems/print.h>
    2020#include <sys/ioctl.h>
    2121#include <stdio.h>
     
    349349  uint32_t media_block_count,
    350350  uint32_t block_size,
    351   rtems_printk_plugin_t print,
    352   void *print_arg
     351  const rtems_printer* printer
    353352);
    354353
     
    357356 */
    358357void rtems_blkstats(
    359   FILE *output,
     358  const rtems_printer *printer,
    360359  const char *device,
    361360  bool reset
  • cpukit/libblock/src/blkdev-blkstats.c

    rb1860df5 r24d0ee57  
    3232#include <string.h>
    3333
    34 void rtems_blkstats(FILE *output, const char *device, bool reset)
     34void rtems_blkstats(const rtems_printer* printer, const char *device, bool reset)
    3535{
    3636  int fd = open(device, O_RDONLY);
     
    4646          rv = rtems_disk_fd_reset_device_stats(fd);
    4747          if (rv != 0) {
    48             fprintf(output, "error: reset stats: %s\n", strerror(errno));
     48            rtems_printf(printer, "error: reset stats: %s\n", strerror(errno));
    4949          }
    5050        } else {
     
    6565              media_block_count,
    6666              block_size,
    67               (rtems_printk_plugin_t) fprintf,
    68               output
     67              printer
    6968            );
    7069          } else {
    71             fprintf(output, "error: get stats: %s\n", strerror(errno));
     70            rtems_printf(printer, "error: get stats: %s\n", strerror(errno));
    7271          }
    7372        }
    7473      } else {
    75         fprintf(output, "error: not a block device\n");
     74        rtems_printf(printer, "error: not a block device\n");
    7675      }
    7776    } else {
    78       fprintf(output, "error: get file stats: %s\n", strerror(errno));
     77      rtems_printf(printer, "error: get file stats: %s\n", strerror(errno));
    7978    }
    8079
    8180    rv = close(fd);
    8281    if (rv != 0) {
    83       fprintf(output, "error: close device: %s\n", strerror(errno));
     82      rtems_printf(printer, "error: close device: %s\n", strerror(errno));
    8483    }
    8584  } else {
    86     fprintf(output, "error: open device: %s\n", strerror(errno));
     85    rtems_printf(printer, "error: open device: %s\n", strerror(errno));
    8786  }
    8887}
  • cpukit/libblock/src/blkdev-print-stats.c

    rb1860df5 r24d0ee57  
    3333  uint32_t media_block_count,
    3434  uint32_t block_size,
    35   rtems_printk_plugin_t print,
    36   void *print_arg
     35  const rtems_printer* printer
    3736)
    3837{
    39   (*print)(
    40      print_arg,
     38  rtems_printf(
     39     printer,
    4140     "-------------------------------------------------------------------------------\n"
    4241     "                               DEVICE STATISTICS\n"
  • cpukit/libcsupport/Makefile.am

    rb1860df5 r24d0ee57  
    113113    src/printk_plugin.c src/putk.c src/vprintk.c \
    114114    src/rtems_putc.c \
     115    src/print_fprintf.c \
     116    src/print_printf.c \
    115117    src/printf_plugin.c \
    116118    src/sup_fs_location.c \
  • cpukit/libcsupport/src/printf_plugin.c

    rb1860df5 r24d0ee57  
    2424#endif
    2525
    26 #include <rtems/bspIo.h>
     26#include <rtems/print.h>
    2727
    2828#include <stdio.h>
    2929
    30 int rtems_printf_plugin(void *context, const char *format, ...)
     30void rtems_print_printer_printf(rtems_printer *printer)
    3131{
    32   int rv;
    33   va_list ap;
     32  printer->context = NULL;
     33  printer->printer = rtems_printf_plugin;
     34}
    3435
    35   va_start(ap, format);
    36   rv = vprintf(format, ap);
    37   va_end(ap);
    38 
    39   return rv;
     36int rtems_printf_plugin(void *context, const char *format, va_list ap)
     37{
     38  (void) context;
     39  return vprintf(format, ap);
    4040}
  • cpukit/libcsupport/src/printk.c

    rb1860df5 r24d0ee57  
    3333 *  Kernel printf function requiring minimal infrastructure.
    3434 */
    35 void printk(const char *fmt, ...)
     35int printk(const char *fmt, ...)
    3636{
    37   va_list  ap;       /* points to each unnamed argument in turn */
    38 
     37  va_list ap;       /* points to each unnamed argument in turn */
     38  int     len;
    3939  va_start(ap, fmt); /* make ap point to 1st unnamed arg */
    40   vprintk(fmt, ap);
     40  len = vprintk(fmt, ap);
    4141  va_end(ap);        /* clean up when done */
     42  return len;
    4243}
  • cpukit/libcsupport/src/printk_plugin.c

    rb1860df5 r24d0ee57  
    2020
    2121#include <stdarg.h>
    22 #include <rtems/bspIo.h>
     22#include <rtems/print.h>
     23
     24void rtems_print_printer_printk(
     25  rtems_printer *printer
     26)
     27{
     28  printer->context = NULL;
     29  printer->printer = printk_plugin;
     30}
    2331
    2432int printk_plugin(
    2533  void *ignored,
    2634  const char *format,
    27   ...
     35  va_list ap
    2836)
    2937{
    30   va_list arg_pointer;
    31 
    3238  (void) ignored;
    33 
    34   va_start (arg_pointer, format);
    35 
    36   vprintk( format, arg_pointer );
    37 
    38   va_end(arg_pointer); /* clean up when done */
    39 
     39  vprintk( format, ap );
    4040  return 0;
    4141}
  • cpukit/libcsupport/src/putk.c

    rb1860df5 r24d0ee57  
    22 *  @file
    33 *
    4  *  @brief Write Character to Stream 
     4 *  @brief Write Character to Stream
    55 *  @ingroup libcsupport
    66 */
     
    2424 * Kernel putk (e.g. puts) function requiring minimal infrastrure.
    2525 */
    26 void putk(const char *s)
     26int putk(const char *s)
    2727{
    2828  const char *p;
     29  int len_out = 0;
    2930
    30   for (p=s ; *p ; p++ )
     31  for (p=s ; *p ; p++, len_out++ )
    3132    BSP_output_char(*p);
    3233  BSP_output_char('\n');
     34  return len_out + 1;
    3335}
  • cpukit/libcsupport/src/vprintk.c

    rb1860df5 r24d0ee57  
    3131#include <rtems/bspIo.h>
    3232
    33 static void printNum(
     33static int printNum(
    3434  long long num,
    3535  unsigned base,
     
    4646 *    as in printf: fmt - format string, ... - unnamed arguments.
    4747 */
    48 void vprintk(
     48int vprintk(
    4949  const char *fmt,
    5050  va_list     ap
    5151)
    5252{
     53  int len_out = 0;
    5354  for (; *fmt != '\0'; fmt++) {
    5455    unsigned base = 0;
     
    6768    if (c != '%') {
    6869      rtems_putc(c);
     70      ++len_out;
    6971      continue;
    7072    }
     
    102104      char chr = (char) va_arg(ap, int);
    103105      rtems_putc(chr);
     106      ++len_out;
    104107      continue;
    105108    }
     
    121124      /* leading spaces */
    122125      if ( !minus )
    123         for ( i=len ; i<width ; i++ )
     126        for ( i=len ; i<width ; i++, len_out++ )
    124127          rtems_putc(' ');
    125128
     
    130133
    131134      /* output the string */
    132       for ( i=0 ; i<width && *str ; str++ )
     135      for ( i=0 ; i<width && *str ; str++, len_out++ )
    133136        rtems_putc(*str);
    134137
    135138      /* trailing spaces */
    136139      if ( minus )
    137         for ( i=len ; i<width ; i++ )
     140        for ( i=len ; i<width ; i++, len_out++ )
    138141          rtems_putc(' ');
    139142
     
    155158    } else {
    156159      rtems_putc(c);
     160      ++len_out;
    157161      continue;
    158162    }
     
    173177    }
    174178
    175     printNum(num, base, sign, width, lead);
    176   }
     179    len_out += printNum(num, base, sign, width, lead);
     180  }
     181
     182  return len_out;
    177183}
    178184
     
    182188 *  @param[in] base is the base used to print the number
    183189 */
    184 static void printNum(
     190static int printNum(
    185191  long long num,
    186192  unsigned base,
     
    195201  #define UINT64_MAX_IN_OCTAL_FORMAT "1777777777777777777777"
    196202  char toPrint[sizeof(UINT64_MAX_IN_OCTAL_FORMAT)];
     203  int len_out = 0;
    197204
    198205  if ( sign && (num <  0) ) {
    199206    rtems_putc('-');
     207    ++len_out;
    200208    unsigned_num = (unsigned long long) -num;
    201209    if (maxwidth) maxwidth--;
     
    211219  toPrint[count++] = (char) unsigned_num;
    212220
    213   for (n=maxwidth ; n > count; n-- )
     221  for (n=maxwidth ; n > count; n--, len_out++ )
    214222    rtems_putc(lead);
    215223
    216   for (n = 0; n < count; n++) {
     224  for (n = 0; n < count; n++, len_out++) {
    217225    rtems_putc("0123456789ABCDEF"[(int)(toPrint[count-(n+1)])]);
    218226  }
     227
     228  return len_out;
    219229}
  • cpukit/libmisc/cpuuse/cpuusagereport.c

    rb1860df5 r24d0ee57  
    3535 */
    3636void rtems_cpu_usage_report_with_plugin(
    37   void                  *context,
    38   rtems_printk_plugin_t  print
     37  const rtems_printer *printer
    3938)
    4039{
     
    4544  char                 name[13];
    4645  uint32_t             ival, fval;
    47   Timestamp_Control  uptime, total, used, uptime_at_last_reset;
    48   uint32_t seconds, nanoseconds;
    49 
    50   if ( !print )
    51     return;
     46  Timestamp_Control    uptime, total, used, uptime_at_last_reset;
     47  uint32_t             seconds, nanoseconds;
    5248
    5349  /*
     
    5955  uptime_at_last_reset = CPU_usage_Uptime_at_last_reset;
    6056
    61   (*print)(
    62      context,
     57  rtems_printf(
     58     printer,
    6359     "-------------------------------------------------------------------------------\n"
    6460     "                              CPU USAGE BY THREAD\n"
     
    8480        rtems_object_get_name( the_thread->Object.id, sizeof(name), name );
    8581
    86         (*print)(
    87           context,
     82        rtems_printf(
     83          printer,
    8884          " 0x%08" PRIx32 " | %-38s |",
    8985          the_thread->Object.id,
     
    10399        nanoseconds = _Timestamp_Get_nanoseconds( &used ) /
    104100          TOD_NANOSECONDS_PER_MICROSECOND;
    105         (*print)( context,
     101        rtems_printf( printer,
    106102          "%7" PRIu32 ".%06" PRIu32 " |%4" PRIu32 ".%03" PRIu32 "\n",
    107103          seconds, nanoseconds,
     
    115111  nanoseconds = _Timestamp_Get_nanoseconds( &total ) /
    116112    TOD_NANOSECONDS_PER_MICROSECOND;
    117   (*print)(
    118      context,
     113  rtems_printf(
     114     printer,
    119115     "------------+----------------------------------------+---------------+---------\n"
    120116     " TIME SINCE LAST CPU USAGE RESET IN SECONDS:                    %7" PRIu32 ".%06" PRIu32 "\n"
     
    126122void rtems_cpu_usage_report( void )
    127123{
    128   rtems_cpu_usage_report_with_plugin( NULL, printk_plugin );
     124  rtems_printer printer;
     125  rtems_print_printer_printk( &printer );
     126  rtems_cpu_usage_report_with_plugin( &printer );
    129127}
  • cpukit/libmisc/cpuuse/cpuusagetop.c

    rb1860df5 r24d0ee57  
    4242
    4343/*
    44  * Common variable to sync the load monitor task.
    45  */
    46 typedef struct
    47 {
    48   void*                  context;
    49   rtems_printk_plugin_t  print;
    50 } rtems_cpu_usage_plugin;
    51 
    52 /*
    5344 * Use a struct for all data to allow more than one top and to support the
    5445 * thread iterator.
     
    6253  volatile uint32_t      poll_rate_usecs;
    6354  volatile uint32_t      show;
    64   rtems_cpu_usage_plugin plugin;
     55  const rtems_printer*   printer;
    6556  Timestamp_Control      zero;
    6657  Timestamp_Control      uptime;
     
    145136}
    146137
    147 #define CPU_usage_Equal_to( _lhs, _rhs ) \
    148         _Timestamp_Equal_to( _lhs, _rhs )
    149 
    150 #define CPU_usage_Set_to_zero( _time ) \
    151        _Timestamp_Set_to_zero( _time )
    152 
    153 #define CPU_usage_Less_than( _lhs, _rhs ) \
    154       _Timestamp_Less_than( _lhs, _rhs )
     138#define CPU_usage_Equal_to( _lhs, _rhs )  _Timestamp_Equal_to( _lhs, _rhs )
     139#define CPU_usage_Set_to_zero( _time )    _Timestamp_Set_to_zero( _time )
     140#define CPU_usage_Less_than( _lhs, _rhs ) _Timestamp_Less_than( _lhs, _rhs )
    155141
    156142static void
     
    158144{
    159145  if (size > (1024 * 1024))
    160     (*data->plugin.print)(data->plugin.context, "%4" PRIu32 "M %s",
    161                           size / (1024 * 1024), label);
     146    rtems_printf(data->printer, "%4" PRIu32 "M %s", size / (1024 * 1024), label);
    162147  else if (size > 1024)
    163     (*data->plugin.print)(data->plugin.context, "%4" PRIu32 "K %s",
    164                           size / 1024, label);
     148    rtems_printf(data->printer, "%4" PRIu32 "K %s", size / 1024, label);
    165149  else
    166     (*data->plugin.print)(data->plugin.context, "%4" PRIu32 " %s",
    167                           size, label);
     150    rtems_printf(data->printer, "%4" PRIu32 " %s", size, label);
    168151}
    169152
     
    185168      if (hours > 24)
    186169      {
    187         len += (*data->plugin.print)(data->plugin.context, "%" PRIu32 "d", hours / 24);
     170        len += rtems_printf(data->printer, "%" PRIu32 "d", hours / 24);
    188171        hours %= 24;
    189172      }
    190       len += (*data->plugin.print)(data->plugin.context, "%" PRIu32 "hr", hours);
     173      len += rtems_printf(data->printer, "%" PRIu32 "hr", hours);
    191174      mins %= 60;
    192175    }
    193     len += (*data->plugin.print)(data->plugin.context, "%" PRIu32 "m", mins);
     176    len += rtems_printf(data->printer, "%" PRIu32 "m", mins);
    194177    secs %= 60;
    195178  }
    196   len += (*data->plugin.print)(data->plugin.context, "%" PRIu32 ".%06" PRIu32, secs, usecs);
     179  len += rtems_printf(data->printer, "%" PRIu32 ".%06" PRIu32, secs, usecs);
    197180
    198181  if (len < length)
    199     (*data->plugin.print)(data->plugin.context, "%*c", length - len, ' ');
     182    rtems_printf(data->printer, "%*c", length - len, ' ');
    200183
    201184  return len;
     
    345328      if ((data->tasks == NULL) || (data->usage == NULL) || (data->current_usage == NULL))
    346329      {
    347         (*data->plugin.print)(data->plugin.context, "top worker: error: no memory\n");
     330        rtems_printf(data->printer, "top worker: error: no memory\n");
    348331        data->thread_run = false;
    349332        break;
     
    372355      if ((data->last_tasks == NULL) || (data->last_usage == NULL))
    373356      {
    374         (*data->plugin.print)(data->plugin.context, "top worker: error: no memory\n");
     357        rtems_printf(data->printer, "top worker: error: no memory\n");
    375358        data->thread_run = false;
    376359        break;
     
    397380
    398381    if (data->single_page)
    399       (*data->plugin.print)(data->plugin.context,
    400                             "\x1b[H\x1b[J"
    401                             " ENTER:Exit  SPACE:Refresh"
    402                             "  S:Scroll  A:All  <>:Order  +/-:Lines\n");
    403     (*data->plugin.print)(data->plugin.context,"\n");
     382      rtems_printf(data->printer,
     383                   "\x1b[H\x1b[J"
     384                   " ENTER:Exit  SPACE:Refresh"
     385                   "  S:Scroll  A:All  <>:Order  +/-:Lines\n");
     386    rtems_printf(data->printer, "\n");
    404387
    405388    /*
    406389     * Uptime and period of this sample.
    407390     */
    408     (*data->plugin.print)(data->plugin.context, "Uptime: ");
     391    rtems_printf(data->printer, "Uptime: ");
    409392    print_time(data, &data->uptime, 20);
    410     (*data->plugin.print)(data->plugin.context, " Period: ");
     393    rtems_printf(data->printer, " Period: ");
    411394    print_time(data, &data->period, 20);
    412395
     
    414397     * Task count, load and idle levels.
    415398     */
    416     (*data->plugin.print)(data->plugin.context, "\nTasks: %4i  ", data->task_count);
     399    rtems_printf(data->printer, "\nTasks: %4i  ", data->task_count);
    417400
    418401    _Timestamp_Subtract(&data->idle, &data->total, &load);
    419402    _Timestamp_Divide(&load, &data->uptime, &ival, &fval);
    420     (*data->plugin.print)(data->plugin.context,
    421                           "Load Average: %4" PRIu32 ".%03" PRIu32 "%%", ival, fval);
     403    rtems_printf(data->printer,
     404                 "Load Average: %4" PRIu32 ".%03" PRIu32 "%%", ival, fval);
    422405    _Timestamp_Subtract(&data->current_idle, &data->current, &load);
    423406    _Timestamp_Divide(&load, &data->period, &ival, &fval);
    424     (*data->plugin.print)(data->plugin.context,
    425                           "  Load: %4" PRIu32 ".%03" PRIu32 "%%", ival, fval);
     407    rtems_printf(data->printer,
     408                 "  Load: %4" PRIu32 ".%03" PRIu32 "%%", ival, fval);
    426409    _Timestamp_Divide(&data->current_idle, &data->period, &ival, &fval);
    427     (*data->plugin.print)(data->plugin.context,
    428                           "  Idle: %4" PRIu32 ".%03" PRIu32 "%%", ival, fval);
     410    rtems_printf(data->printer,
     411                 "  Idle: %4" PRIu32 ".%03" PRIu32 "%%", ival, fval);
    429412
    430413    /*
     
    433416    if (rtems_configuration_get_unified_work_area())
    434417    {
    435       (*data->plugin.print)(data->plugin.context, "\nMem: ");
     418      rtems_printf(data->printer, "\nMem: ");
    436419      print_memsize(data, wksp.Free.total, "free");
    437420      print_memsize(data, wksp.Used.total, "used");
     
    441424      region_information_block libc_heap;
    442425      malloc_info(&libc_heap);
    443       (*data->plugin.print)(data->plugin.context, "\nMem: Wksp: ");
     426      rtems_printf(data->printer, "\nMem: Wksp: ");
    444427      print_memsize(data, wksp.Free.total, "free");
    445428      print_memsize(data, wksp.Used.total, "used  Heap: ");
     
    450433    print_memsize(data, data->stack_size, "stack\n");
    451434
    452     (*data->plugin.print)(data->plugin.context,
     435    rtems_printf(data->printer,
    453436       "\n"
    454437        " ID         | NAME                | RPRI | CPRI   | TIME                | TOTAL   | CURRENT\n"
     
    488471        snprintf(name, sizeof(name) - 1, "(%p)", thread->Start.Entry.Kinds.Numeric.entry);
    489472
    490       (*data->plugin.print)(data->plugin.context,
    491                             " 0x%08" PRIx32 " | %-19s |  %3" PRId32 " |  %3" PRId32 "   | ",
    492                             thread->Object.id,
    493                             name,
    494                             thread->real_priority,
    495                             thread->current_priority);
     473      rtems_printf(data->printer,
     474                   " 0x%08" PRIx32 " | %-19s |  %3" PRId32 " |  %3" PRId32 "   | ",
     475                   thread->Object.id,
     476                   name,
     477                   thread->real_priority,
     478                   thread->current_priority);
    496479
    497480      usage = data->usage[i];
     
    503486      print_time(data, &usage, 19);
    504487      _Timestamp_Divide(&usage, &data->total, &ival, &fval);
    505       (*data->plugin.print)(data->plugin.context,
    506                             " |%4" PRIu32 ".%03" PRIu32, ival, fval);
     488      rtems_printf(data->printer,
     489                   " |%4" PRIu32 ".%03" PRIu32, ival, fval);
    507490      _Timestamp_Divide(&current_usage, &data->period, &ival, &fval);
    508       (*data->plugin.print)(data->plugin.context,
    509                             " |%4" PRIu32 ".%03" PRIu32 "\n", ival, fval);
     491      rtems_printf(data->printer,
     492                   " |%4" PRIu32 ".%03" PRIu32 "\n", ival, fval);
    510493    }
    511494
     
    515498      while (i > 0)
    516499      {
    517         (*data->plugin.print)(data->plugin.context, "\x1b[K\n");
     500        rtems_printf(data->printer, "\x1b[K\n");
    518501        i--;
    519502      }
     
    526509    if ((sc != RTEMS_SUCCESSFUL) && (sc != RTEMS_TIMEOUT))
    527510    {
    528       (*data->plugin.print)(data->plugin.context,
    529                             "error: event receive: %s\n", rtems_status_text(sc));
     511      rtems_printf(data->printer,
     512                   "error: event receive: %s\n", rtems_status_text(sc));
    530513      break;
    531514    }
     
    543526
    544527void rtems_cpu_usage_top_with_plugin(
    545   void                  *context,
    546   rtems_printk_plugin_t  print
     528  const rtems_printer *printer
    547529)
    548530{
     
    554536  int                    show_lines = 25;
    555537
    556   if ( !print )
    557     return;
    558 
    559538  memset(&data, 0, sizeof(data));
    560539
     
    564543  data.poll_rate_usecs = 3000;
    565544  data.show = show_lines;
    566   data.plugin.context = context;
    567   data.plugin.print = print;
     545  data.printer = printer;
    568546
    569547  sc = rtems_task_set_priority (RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
     
    571549  if (sc != RTEMS_SUCCESSFUL)
    572550  {
    573     (*print)(
    574        context,
    575        "error: cannot obtain the current priority: %s\n",
    576        rtems_status_text (sc)
    577     );
     551    rtems_printf (printer,
     552                  "error: cannot obtain the current priority: %s\n", rtems_status_text (sc));
    578553    return;
    579554  }
     
    588563  if (sc != RTEMS_SUCCESSFUL)
    589564  {
    590     (*print)(
    591        context,
    592        "error: cannot create helper thread: %s\n",
    593        rtems_status_text (sc)
    594     );
     565    rtems_printf (printer,
     566                  "error: cannot create helper thread: %s\n", rtems_status_text (sc));
    595567    return;
    596568  }
    597569
    598   sc = rtems_task_start (
    599     id, rtems_cpuusage_top_thread, (rtems_task_argument) &data
    600   );
     570  sc = rtems_task_start (id, rtems_cpuusage_top_thread, (rtems_task_argument) &data);
    601571  if (sc != RTEMS_SUCCESSFUL)
    602572  {
    603     (*print)(
    604        context,
    605        "error: cannot start helper thread: %s\n",
    606        rtems_status_text (sc)
    607     );
     573    rtems_printf (printer,
     574                  "error: cannot start helper thread: %s\n", rtems_status_text (sc));
    608575    rtems_task_delete (id);
    609576    return;
     
    625592        rtems_task_wake_after (RTEMS_MICROSECONDS_TO_TICKS (100000));
    626593
    627       (*print)(context, "load monitoring stopped.\n");
     594      rtems_printf (printer, "load monitoring stopped.\n");
    628595      return;
    629596    }
     
    677644}
    678645
    679 void rtems_cpu_usage_top( void )
    680 {
    681   rtems_cpu_usage_top_with_plugin( NULL, printk_plugin );
    682 }
     646void rtems_cpu_usage_top (void)
     647{
     648  rtems_printer printer;
     649  rtems_print_printer_printk (&printer);
     650  rtems_cpu_usage_top_with_plugin (&printer);
     651}
  • cpukit/libmisc/cpuuse/cpuuse.h

    rb1860df5 r24d0ee57  
    11/**
    22 * @file rtems/cpuuse.h
    3  * 
     3 *
    44 * @defgroup libmisc_cpuuse CPU Usage
    55 *
     
    2424
    2525#include <rtems.h>
    26 #include <rtems/bspIo.h>
     26#include <rtems/print.h>
    2727
    2828#include <rtems/score/timestamp.h>
     
    4444 */
    4545
    46 void rtems_cpu_usage_report_with_plugin(
    47   void                  *context,
    48   rtems_printk_plugin_t  handler
    49 );
     46void rtems_cpu_usage_report_with_plugin( const rtems_printer *printer );
    5047
    5148/**
     
    6360 *   to a print plugin.
    6461 */
    65 void rtems_cpu_usage_top_with_plugin(
    66   void                  *context,
    67   rtems_printk_plugin_t  print
    68 );
     62void rtems_cpu_usage_top_with_plugin( const rtems_printer *printer );
    6963
    7064/**
  • cpukit/libmisc/fb/mw_print.c

    rb1860df5 r24d0ee57  
    4444)
    4545{
    46   uid_print_message_with_plugin( NULL, printk_plugin, uid );
     46  rtems_printer printer;
     47  rtems_print_printer_printk(&printer);
     48  uid_print_message_with_plugin( &printer, uid );
    4749}
    4850
    4951void uid_print_message_with_plugin(
    50   void                  *context,
    51   rtems_printk_plugin_t  handler,
     52  const rtems_printer   *printer,
    5253  struct MW_UID_MESSAGE *uid
    5354)
     
    5758  switch (uid->type) {
    5859    case MV_UID_INVALID:
    59       (*handler)( context, "MV_UID_INVALID\n" );
     60      rtems_printf( printer, "MV_UID_INVALID\n" );
    6061      break;
    6162    case MV_UID_REL_POS:
    62       (*handler)(
    63         context,
     63      rtems_printf(
     64        printer,
    6465        "MV_UID_REL_POS - %s x=%d y=%d z=%d\n",
    6566        uid_buttons( uid->m.pos.btns, buttons, sizeof(buttons)),
     
    7071      break;
    7172    case MV_UID_ABS_POS:
    72       (*handler)(
    73         context,
     73      rtems_printf(
     74        printer,
    7475        "MV_UID_ABS_POS - %s x=%d y=%d z=%d\n",
    7576        uid_buttons( uid->m.pos.btns, buttons, sizeof(buttons)),
     
    8081      break;
    8182    case MV_UID_KBD:
    82       (*handler)( context,
     83      rtems_printf( printer,
    8384        "MV_UID_KBD - code=0x%04x modifiers=0x%02x mode=0x%02x\n",
    8485        uid->m.kbd.code,        /* keycode or scancode        */
     
    8889      break;
    8990   case MV_UID_TIMER:
    90       (*handler)( context, "MV_UID_TIMER\n" );
     91      rtems_printf( printer, "MV_UID_TIMER\n" );
    9192      break;
    9293    default:
    93       (*handler)( context, "Invalid device type\n" );
     94      rtems_printf( printer, "Invalid device type\n" );
    9495      break;
    9596  }
  • cpukit/libmisc/fb/mw_uid.h

    rb1860df5 r24d0ee57  
    1919
    2020#include <sys/types.h>
    21 #include <rtems/bspIo.h>
     21#include <rtems/print.h>
    2222
    2323/**
     
    180180 * style method of choice.
    181181 *
    182  * @param[in] context is a pointer to a data area which may be
    183  *            used by some print handlers
    184  * @param[in] handler is the fprintf style method to invoke
     182 * @param[in] RTEMS printer
    185183 * @param[in] uid points to the message to print
    186184 */
    187185void uid_print_message_with_plugin(
    188   void                  *context,
    189   rtems_printk_plugin_t  handler,
     186  const rtems_printer   *printer,
    190187  struct MW_UID_MESSAGE *uid
    191188);
  • cpukit/libmisc/shell/main_blkstats.c

    rb1860df5 r24d0ee57  
    3232  bool reset = false;
    3333  const char *device;
     34  rtems_printer printer;
    3435
    3536  if (argc == 2) {
     
    4243  }
    4344
     45  rtems_print_printer_printf(&printer);
     46
    4447  if (ok) {
    45     rtems_blkstats(stdout, device, reset);
     48    rtems_blkstats(&printer, device, reset);
    4649  } else {
    47     fprintf(stdout, "usage: %s\n", rtems_shell_BLKSTATS_Command.usage);
     50    rtems_printf(&printer, "usage: %s\n", rtems_shell_BLKSTATS_Command.usage);
    4851  }
    4952
  • cpukit/libmisc/shell/main_cpuuse.c

    rb1860df5 r24d0ee57  
    3131   */
    3232  if ( argc == 1 ) {
    33     rtems_cpu_usage_report_with_plugin(stdout, (rtems_printk_plugin_t)fprintf);
     33    rtems_printer printer;
     34    rtems_print_printer_fprintf(&printer, stdout);
     35    rtems_cpu_usage_report_with_plugin(&printer);
    3436    return 0;
    3537  }
  • cpukit/libmisc/shell/main_perioduse.c

    rb1860df5 r24d0ee57  
    3030   */
    3131  if ( argc == 1 ) {
     32    rtems_printer printer;
     33    rtems_print_printer_printf(&printer);
    3234    rtems_rate_monotonic_report_statistics_with_plugin(
    33       stdout,
    34       (rtems_printk_plugin_t)fprintf
     35      &printer
    3536    );
    3637    return 0;
  • cpukit/libmisc/shell/main_profreport.c

    rb1860df5 r24d0ee57  
    2525static int rtems_shell_main_profreport(int argc, char **argv)
    2626{
     27  rtems_printer printer;
     28  rtems_print_printer_printf(&printer);
    2729  rtems_profiling_report_xml(
    2830    "Shell",
    29     (rtems_profiling_printf) fprintf,
    30     stdout,
     31    &printer,
    3132    0,
    3233    "  "
  • cpukit/libmisc/shell/main_stackuse.c

    rb1860df5 r24d0ee57  
    2626)
    2727{
    28   rtems_stack_checker_report_usage_with_plugin(
    29     stdout,
    30     (rtems_printk_plugin_t)fprintf
    31   );
     28  rtems_printer printer;
     29  rtems_print_printer_printf(&printer);
     30  rtems_stack_checker_report_usage_with_plugin( &printer );
    3231  return 0;
    3332}
  • cpukit/libmisc/shell/main_top.c

    rb1860df5 r24d0ee57  
    3131   */
    3232  if ( argc == 1 ) {
    33     rtems_cpu_usage_top_with_plugin(stdout, (rtems_printk_plugin_t)fprintf);
     33    rtems_printer printer;
     34    rtems_print_printer_fprintf(&printer, stdout);
     35    rtems_cpu_usage_top_with_plugin(&printer);
    3436    return 0;
    3537  }
  • cpukit/libmisc/stackchk/check.c

    rb1860df5 r24d0ee57  
    388388 *  Try to print out how much stack was actually used by the task.
    389389 */
    390 static void                   *print_context;
    391 static rtems_printk_plugin_t   print_handler;
     390static const rtems_printer* printer;
    392391
    393392static void Stack_check_Dump_threads_usage(
     
    439438  #endif
    440439    {
    441       (*print_handler)(
    442         print_context,
     440      rtems_printf(
     441        printer,
    443442        "0x%08" PRIx32 "  %4s",
    444443        the_thread->Object.id,
     
    448447    #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
    449448      else {
    450         (*print_handler)( print_context, "0x%08" PRIx32 "  INTR", ~0 );
     449        rtems_printf( printer, "0x%08" PRIx32 "  INTR", ~0 );
    451450      }
    452451    #endif
    453452
    454   (*print_handler)(
    455     print_context,
     453  rtems_printf(
     454    printer,
    456455    " %010p - %010p %010p  %8" PRId32 "   ",
    457456    stack->area,
     
    462461
    463462  if (Stack_check_Initialized == 0) {
    464     (*print_handler)( print_context, "Unavailable\n" );
     463    rtems_printf( printer, "Unavailable\n" );
    465464  } else {
    466     (*print_handler)( print_context, "%8" PRId32 "\n", used );
     465    rtems_printf( printer, "%8" PRId32 "\n", used );
    467466  }
    468467
     
    490489
    491490void rtems_stack_checker_report_usage_with_plugin(
    492   void                  *context,
    493   rtems_printk_plugin_t  print
    494 )
    495 {
    496   if ( !print )
     491  const rtems_printer* printer_
     492)
     493{
     494  if ( printer != NULL || ! rtems_print_printer_valid ( printer_ ) )
    497495    return;
    498496
    499   print_context = context;
    500   print_handler = print;
    501 
    502   (*print)( context, "Stack usage by thread\n");
    503   (*print)( context,
     497  printer = printer_;
     498
     499  rtems_printf( printer, "Stack usage by thread\n");
     500  rtems_printf( printer,
    504501"    ID      NAME    LOW          HIGH     CURRENT     AVAILABLE     USED\n"
    505502  );
     
    513510  #endif
    514511
    515   print_context = NULL;
    516   print_handler = NULL;
     512  printer = NULL;
    517513}
    518514
    519515void rtems_stack_checker_report_usage( void )
    520516{
    521   rtems_stack_checker_report_usage_with_plugin( NULL, printk_plugin );
    522 }
     517  rtems_printer printer;
     518  rtems_print_printer_printk(&printer);
     519  rtems_stack_checker_report_usage_with_plugin( &printer );
     520}
  • cpukit/libmisc/stackchk/stackchk.h

    rb1860df5 r24d0ee57  
    2626
    2727#include <rtems/score/thread.h> /* Thread_Control */
    28 #include <rtems/bspIo.h>
     28#include <rtems/print.h>
    2929
    3030/**
     
    7272 */
    7373void rtems_stack_checker_report_usage_with_plugin(
    74   void                  *context,
    75   rtems_printk_plugin_t  print
     74  const rtems_printer *printer
    7675);
    7776
  • cpukit/libmisc/testsupport/test.h

    rb1860df5 r24d0ee57  
    1717
    1818#include <rtems.h>
    19 #include <rtems/bspIo.h>
     19#include <rtems/print.h>
    2020#include <rtems/score/atomic.h>
    2121#include <rtems/score/smpbarrier.h>
     
    3737 */
    3838extern const char rtems_test_name[];
     39
     40/**
     41 * @brief Each test must define a printer.
     42 */
     43extern rtems_printer rtems_test_printer;
    3944
    4045/**
     
    5459
    5560/**
    56  * @brief Prints a begin of test message.
    57  *
    58  * @param[in] printf_func The formatted output function.
    59  * @param[in, out] printf_arg The formatted output function argument.
     61 * @brief Begin of test message format string.
     62 */
     63#define TEST_BEGIN_STRING "\n\n*** BEGIN OF TEST %s ***\n", rtems_test_name
     64
     65/**
     66 * @brief End of test message format string.
     67 */
     68#define TEST_END_STRING "*** END OF TEST %s ***\n", rtems_test_name
     69
     70/**
     71 * @brief Prints a begin of test message using printf().
    6072 *
    6173 * @returns As specified by printf().
    6274 */
    63 int rtems_test_begin_with_plugin(
    64   rtems_printk_plugin_t printf_func,
    65   void *printf_arg
    66 );
    67 
    68 /**
    69  * @brief Prints a begin of test message using printf().
     75int rtems_test_begin(void);
     76
     77/**
     78 * @brief Prints an end of test message using printf().
    7079 *
    7180 * @returns As specified by printf().
    7281 */
    73 static inline int rtems_test_begin(void)
    74 {
    75   return rtems_test_begin_with_plugin(rtems_printf_plugin, NULL);
    76 }
    77 
    78 /**
    79  * @brief Prints a begin of test message using printk().
     82int rtems_test_end(void);
     83
     84/**
     85 * @brief Prints via the RTEMS printer.
    8086 *
    8187 * @returns As specified by printf().
    8288 */
    83 static inline int rtems_test_begink(void)
    84 {
    85   return rtems_test_begin_with_plugin(printk_plugin, NULL);
    86 }
    87 
    88 /**
    89  * @brief Prints an end of test message.
    90  *
    91  * @param[in] printf_func The formatted output function.
    92  * @param[in, out] printf_arg The formatted output function argument.
    93  *
    94  * @returns As specified by printf().
    95  */
    96 int rtems_test_end_with_plugin(
    97   rtems_printk_plugin_t printf_func,
    98   void *printf_arg
    99 );
    100 
    101 /**
    102  * @brief Prints an end of test message using printf().
    103  *
    104  * @returns As specified by printf().
    105  */
    106 static inline int rtems_test_end(void)
    107 {
    108   return rtems_test_end_with_plugin(rtems_printf_plugin, NULL);
    109 }
    110 
    111 /**
    112  * @brief Prints an end of test message using printk().
    113  *
    114  * @returns As specified by printf().
    115  */
    116 static inline int rtems_test_endk(void)
    117 {
    118   return rtems_test_end_with_plugin(printk_plugin, NULL);
    119 }
     89int rtems_test_print(const char* format, ...) RTEMS_PRINTF_ATTRIBUTE(1, 2);
    12090
    12191/**
  • cpukit/libmisc/testsupport/testbeginend.c

    rb1860df5 r24d0ee57  
    1919#include <rtems/test.h>
    2020
    21 int rtems_test_begin_with_plugin(
    22   rtems_printk_plugin_t printf_func,
    23   void *printf_arg
    24 )
     21int rtems_test_begin(void)
    2522{
    26   return (*printf_func)(
    27     printf_arg,
    28     "\n\n*** BEGIN OF TEST %s ***\n",
    29     rtems_test_name
     23  return rtems_printf(
     24    &rtems_test_printer,
     25    TEST_BEGIN_STRING
    3026  );
    3127}
    3228
    33 int rtems_test_end_with_plugin(
    34   rtems_printk_plugin_t printf_func,
    35   void *printf_arg
     29int rtems_test_end(void)
     30{
     31  return rtems_printf(
     32    &rtems_test_printer,
     33    TEST_END_STRING
     34  );
     35}
     36
     37int rtems_test_print(
     38  const char* format,
     39  ...
    3640)
    3741{
    38   return (*printf_func)(
    39     printf_arg,
    40     "*** END OF TEST %s ***\n",
    41     rtems_test_name
     42  va_list ap;
     43  int len;
     44  va_start(ap, format);
     45  len = rtems_vprintf(
     46    &rtems_test_printer,
     47    format,
     48    ap
    4249  );
     50  va_end(ap);
     51  return len;
    4352}
  • cpukit/libmisc/testsupport/testextension.c

    rb1860df5 r24d0ee57  
    3434#if defined(RTEMS_PROFILING)
    3535  rtems_interrupt_lock_context lock_context;
     36  rtems_printer printer;
     37
     38  rtems_print_printer_printk( &printer );
    3639
    3740  /*
     
    5154    rtems_profiling_report_xml(
    5255      rtems_test_name,
    53       printk_plugin,
    54       NULL,
     56      &printer,
    5557      1,
    5658      "  "
  • cpukit/preinstall.am

    rb1860df5 r24d0ee57  
    225225PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/bspIo.h
    226226
     227$(PROJECT_INCLUDE)/rtems/print.h: include/rtems/print.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
     228        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/print.h
     229PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/print.h
     230
    227231$(PROJECT_INCLUDE)/rtems/userenv.h: include/rtems/userenv.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
    228232        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/userenv.h
  • cpukit/rtems/include/rtems/rtems/ratemon.h

    rb1860df5 r24d0ee57  
    3636#include <rtems/score/thread.h>
    3737#include <rtems/score/watchdog.h>
    38 #include <rtems/bspIo.h>
     38#include <rtems/print.h>
    3939
    4040#ifdef __cplusplus
     
    357357 *
    358358 *  This routine allows a thread to print the statistics information
    359  *  on ALL period instances which have non-zero counts using printk.
    360  *  The implementation of this directive straddles the fence between
    361  *  inside and outside of RTEMS.  It is presented as part of the Manager
    362  *  but actually uses other services of the Manager.
     359 *  on ALL period instances which have non-zero counts using the RTEMS
     360 *  printer. The implementation of this directive straddles the fence
     361 *  between inside and outside of RTEMS.  It is presented as part of
     362 *  the Manager but actually uses other services of the Manager.
    363363 */
    364364void rtems_rate_monotonic_report_statistics_with_plugin(
    365   void                  *context,
    366   rtems_printk_plugin_t  print
     365  const rtems_printer *printer
    367366);
    368367
  • cpukit/rtems/src/ratemonreportstatistics.c

    rb1860df5 r24d0ee57  
    2121#include <rtems/rtems/ratemonimpl.h>
    2222#include <rtems/rtems/object.h>
     23#include <rtems/print.h>
    2324
    2425#include <inttypes.h>
     
    3031
    3132void rtems_rate_monotonic_report_statistics_with_plugin(
    32   void                  *context,
    33   rtems_printk_plugin_t  print
     33  const rtems_printer *printer
    3434)
    3535{
     
    4040  char                                   name[5];
    4141
    42   if ( !print )
    43     return;
    44 
    45   (*print)( context, "Period information by period\n" );
    46   (*print)( context, "--- CPU times are in seconds ---\n" );
    47   (*print)( context, "--- Wall times are in seconds ---\n" );
     42  rtems_printf( printer, "Period information by period\n" );
     43  rtems_printf( printer, "--- CPU times are in seconds ---\n" );
     44  rtems_printf( printer, "--- Wall times are in seconds ---\n" );
    4845/*
    4946Layout by columns -- in memory of Hollerith :)
     
    5956\n");
    6057*/
    61   (*print)( context,
     58  rtems_printf( printer,
    6259      "   ID     OWNER COUNT MISSED     "
    6360      "     CPU TIME                  WALL TIME\n"
     
    9188     *  Print part of report line that is not dependent on granularity
    9289     */
    93     (*print)( context,
     90    rtems_printf( printer,
    9491      "0x%08" PRIx32 " %4s %5" PRId32 " %6" PRId32 " ",
    9592      id, name,
     
    10198     */
    10299    if (the_stats.count == 0) {
    103       (*print)( context, "\n" );
     100      rtems_printf( printer, "\n" );
    104101      continue;
    105102    }
     
    115112
    116113      _Timespec_Divide_by_integer( total_cpu, the_stats.count, &cpu_average );
    117       (*print)( context,
     114      rtems_printf( printer,
    118115        "%" PRId32 "."  NANOSECONDS_FMT "/"        /* min cpu time */
    119116        "%" PRId32 "."  NANOSECONDS_FMT "/"        /* max cpu time */
     
    138135
    139136      _Timespec_Divide_by_integer(total_wall, the_stats.count, &wall_average);
    140       (*print)( context,
     137      rtems_printf( printer,
    141138        "%" PRId32 "." NANOSECONDS_FMT "/"        /* min wall time */
    142139        "%" PRId32 "." NANOSECONDS_FMT "/"        /* max wall time */
     
    155152void rtems_rate_monotonic_report_statistics( void )
    156153{
    157   rtems_rate_monotonic_report_statistics_with_plugin( NULL, printk_plugin );
     154  rtems_printer printer;
     155  rtems_print_printer_printk( &printer );
     156  rtems_rate_monotonic_report_statistics_with_plugin( &printer );
    158157}
  • cpukit/sapi/include/rtems/profiling.h

    rb1860df5 r24d0ee57  
    2525
    2626#include <stdint.h>
     27
     28#include <rtems/print.h>
    2729
    2830#ifdef __cplusplus
     
    307309
    308310/**
    309  * @brief Function for formatted output.
    310  *
    311  * @param[in, out] arg Some argument.
    312  * @param[in] format The output format as specified by printf().
    313  * @param[in] ... More parameters according to format.
    314  *
    315  * @returns As specified by printf().
    316  *
    317  * @see rtems_profiling_report_xml().
    318  */
    319 typedef int (*rtems_profiling_printf)(void *arg, const char *format, ...);
    320 
    321 /**
    322311 * @brief Reports profiling data as XML.
    323312 *
    324313 * @param[in] name The name of the profiling report.
    325  * @param[in] printf_func The formatted output function.
    326  * @param[in, out] printf_arg The formatted output function argument.
     314 * @param[in] printer The RTEMS printer to send the output too.
    327315 * @param[in] indentation_level The current indentation level.
    328316 * @param[in] indentation The string used for indentation.
     
    332320int rtems_profiling_report_xml(
    333321  const char *name,
    334   rtems_profiling_printf printf_func,
    335   void *printf_arg,
     322  const rtems_printer *printer,
    336323  uint32_t indentation_level,
    337324  const char *indentation
  • cpukit/sapi/src/profilingreportxml.c

    rb1860df5 r24d0ee57  
    2424
    2525typedef struct {
    26   rtems_profiling_printf printf_func;
    27   void *printf_arg;
     26  const rtems_printer *printer;
    2827  uint32_t indentation_level;
    2928  const char *indentation;
     
    4443
    4544  for (i = 0; i < n; ++i) {
    46     int rv = (*ctx->printf_func)(ctx->printf_arg, "%s", ctx->indentation);
     45    int rv = rtems_printf(ctx->printer, "%s", ctx->indentation);
    4746
    4847    update_retval(ctx, rv);
     
    5756static void report_per_cpu(context *ctx, const rtems_profiling_per_cpu *per_cpu)
    5857{
    59   rtems_profiling_printf printf_func = ctx->printf_func;
    60   void *printf_arg = ctx->printf_arg;
    6158  int rv;
    6259
    6360  indent(ctx, 1);
    64   rv = (*printf_func)(
    65     printf_arg,
     61  rv = rtems_printf(
     62    ctx->printer,
    6663    "<PerCPUProfilingReport processorIndex=\"%" PRIu32 "\">\n",
    6764    per_cpu->processor_index
     
    7067
    7168  indent(ctx, 2);
    72   rv = (*printf_func)(
    73     printf_arg,
     69  rv = rtems_printf(
     70    ctx->printer,
    7471    "<MaxThreadDispatchDisabledTime unit=\"ns\">%" PRIu32
    7572      "</MaxThreadDispatchDisabledTime>\n",
     
    7976
    8077  indent(ctx, 2);
    81   rv = (*printf_func)(
    82     printf_arg,
     78  rv = rtems_printf(
     79    ctx->printer,
    8380    "<MeanThreadDispatchDisabledTime unit=\"ns\">%" PRIu64
    8481      "</MeanThreadDispatchDisabledTime>\n",
     
    9188
    9289  indent(ctx, 2);
    93   rv = (*printf_func)(
    94     printf_arg,
     90  rv = rtems_printf(
     91    ctx->printer,
    9592    "<TotalThreadDispatchDisabledTime unit=\"ns\">%" PRIu64
    9693      "</TotalThreadDispatchDisabledTime>\n",
     
    10097
    10198  indent(ctx, 2);
    102   rv = (*printf_func)(
    103     printf_arg,
     99  rv = rtems_printf(
     100    ctx->printer,
    104101    "<ThreadDispatchDisabledCount>%" PRIu64 "</ThreadDispatchDisabledCount>\n",
    105102    per_cpu->thread_dispatch_disabled_count
     
    108105
    109106  indent(ctx, 2);
    110   rv = (*printf_func)(
    111     printf_arg,
     107  rv = rtems_printf(
     108    ctx->printer,
    112109    "<MaxInterruptDelay unit=\"ns\">%" PRIu32 "</MaxInterruptDelay>\n",
    113110    per_cpu->max_interrupt_delay
     
    116113
    117114  indent(ctx, 2);
    118   rv = (*printf_func)(
    119     printf_arg,
     115  rv = rtems_printf(
     116    ctx->printer,
    120117    "<MaxInterruptTime unit=\"ns\">%" PRIu32
    121118      "</MaxInterruptTime>\n",
     
    125122
    126123  indent(ctx, 2);
    127   rv = (*printf_func)(
    128     printf_arg,
     124  rv = rtems_printf(
     125    ctx->printer,
    129126    "<MeanInterruptTime unit=\"ns\">%" PRIu64
    130127      "</MeanInterruptTime>\n",
     
    137134
    138135  indent(ctx, 2);
    139   rv = (*printf_func)(
    140     printf_arg,
     136  rv = rtems_printf(
     137    ctx->printer,
    141138    "<TotalInterruptTime unit=\"ns\">%" PRIu64 "</TotalInterruptTime>\n",
    142139    per_cpu->total_interrupt_time
     
    145142
    146143  indent(ctx, 2);
    147   rv = (*printf_func)(
    148     printf_arg,
     144  rv = rtems_printf(
     145    ctx->printer,
    149146    "<InterruptCount>%" PRIu64 "</InterruptCount>\n",
    150147    per_cpu->interrupt_count
     
    153150
    154151  indent(ctx, 1);
    155   rv = (*printf_func)(
    156     printf_arg,
     152  rv = rtems_printf(
     153    ctx->printer,
    157154    "</PerCPUProfilingReport>\n"
    158155  );
     
    162159static void report_smp_lock(context *ctx, const rtems_profiling_smp_lock *smp_lock)
    163160{
    164   rtems_profiling_printf printf_func = ctx->printf_func;
    165   void *printf_arg = ctx->printf_arg;
    166161  int rv;
    167162  uint32_t i;
    168163
    169164  indent(ctx, 1);
    170   rv = (*printf_func)(
    171     printf_arg,
     165  rv = rtems_printf(
     166    ctx->printer,
    172167    "<SMPLockProfilingReport name=\"%s\">\n",
    173168    smp_lock->name
     
    176171
    177172  indent(ctx, 2);
    178   rv = (*printf_func)(
    179     printf_arg,
     173  rv = rtems_printf(
     174    ctx->printer,
    180175    "<MaxAcquireTime unit=\"ns\">%" PRIu32 "</MaxAcquireTime>\n",
    181176    smp_lock->max_acquire_time
     
    184179
    185180  indent(ctx, 2);
    186   rv = (*printf_func)(
    187     printf_arg,
     181  rv = rtems_printf(
     182    ctx->printer,
    188183    "<MaxSectionTime unit=\"ns\">%" PRIu32 "</MaxSectionTime>\n",
    189184    smp_lock->max_section_time
     
    192187
    193188  indent(ctx, 2);
    194   rv = (*printf_func)(
    195     printf_arg,
     189  rv = rtems_printf(
     190    ctx->printer,
    196191    "<MeanAcquireTime unit=\"ns\">%" PRIu64
    197192      "</MeanAcquireTime>\n",
     
    204199
    205200  indent(ctx, 2);
    206   rv = (*printf_func)(
    207     printf_arg,
     201  rv = rtems_printf(
     202    ctx->printer,
    208203    "<MeanSectionTime unit=\"ns\">%" PRIu64
    209204      "</MeanSectionTime>\n",
     
    216211
    217212  indent(ctx, 2);
    218   rv = (*printf_func)(
    219     printf_arg,
     213  rv = rtems_printf(
     214    ctx->printer,
    220215    "<TotalAcquireTime unit=\"ns\">%" PRIu64 "</TotalAcquireTime>\n",
    221216    smp_lock->total_acquire_time
     
    224219
    225220  indent(ctx, 2);
    226   rv = (*printf_func)(
    227     printf_arg,
     221  rv = rtems_printf(
     222    ctx->printer,
    228223    "<TotalSectionTime unit=\"ns\">%" PRIu64 "</TotalSectionTime>\n",
    229224    smp_lock->total_section_time
     
    232227
    233228  indent(ctx, 2);
    234   rv = (*printf_func)(
    235     printf_arg,
     229  rv = rtems_printf(
     230    ctx->printer,
    236231    "<UsageCount>%" PRIu64 "</UsageCount>\n",
    237232    smp_lock->usage_count
     
    241236  for (i = 0; i < RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS; ++i) {
    242237    indent(ctx, 2);
    243     rv = (*printf_func)(
    244       printf_arg,
     238    rv = rtems_printf(
     239      ctx->printer,
    245240      "<ContentionCount initialQueueLength=\"%" PRIu32 "\">%"
    246241        PRIu64 "</ContentionCount>\n",
     
    252247
    253248  indent(ctx, 1);
    254   rv = (*printf_func)(
    255     printf_arg,
     249  rv = rtems_printf(
     250    ctx->printer,
    256251    "</SMPLockProfilingReport>\n"
    257252  );
     
    277272int rtems_profiling_report_xml(
    278273  const char *name,
    279   rtems_profiling_printf printf_func,
    280   void *printf_arg,
     274  const rtems_printer *printer,
    281275  uint32_t indentation_level,
    282276  const char *indentation
     
    285279#ifdef RTEMS_PROFILING
    286280  context ctx_instance = {
    287     .printf_func = printf_func,
    288     .printf_arg = printf_arg,
     281    .printer = printer,
    289282    .indentation_level = indentation_level,
    290283    .indentation = indentation,
     
    295288
    296289  indent(ctx, 0);
    297   rv = (*printf_func)(printf_arg, "<ProfilingReport name=\"%s\">\n", name);
     290  rv = rtems_printf(printer, "<ProfilingReport name=\"%s\">\n", name);
    298291  update_retval(ctx, rv);
    299292
     
    301294
    302295  indent(ctx, 0);
    303   rv = (*printf_func)(printf_arg, "</ProfilingReport>\n");
     296  rv = rtems_printf(printer, "</ProfilingReport>\n");
    304297  update_retval(ctx, rv);
    305298
     
    307300#else /* RTEMS_PROFILING */
    308301  (void) name;
    309   (void) printf_func;
    310   (void) printf_arg;
     302  (void) printer;
    311303  (void) indentation_level;
    312304  (void) indentation;
  • cpukit/score/src/cpusetprintsupport.c

    rb1860df5 r24d0ee57  
    2424#include <ctype.h>
    2525#include <inttypes.h>
    26 #include <rtems/bspIo.h>
     26#include <rtems/print.h>
    2727#include <rtems/score/cpusetimpl.h>
    2828
     
    3030
    3131  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
     32    const rtems_printer *printer,
     33    const char          *description,
     34    const cpu_set_t     *cpuset
    3635  );
    3736
     
    4342   */
    4443  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
     44    const rtems_printer *printer,
     45    const char          *description,
     46    const cpu_set_t     *cpuset
    4947  )
    5048  {
    5149    int i;
    52 
    53     if ( !print )
    54       return;
    55 
    56     (*print)(context ,"%s: ", description);
     50    rtems_printf(printer ,"%s: ", description);
    5751    for(i=0; i<_NCPUWORDS; i++)
    58       (*print)(context ,"%x", cpuset->__bits[i]);
    59     (*print)(context ,"\n");
     52      rtems_printf(printer ,"%x", cpuset->__bits[i]);
     53    rtems_printf(printer ,"\n");
    6054  }
    6155
     
    6862  void _CPU_set_Show( const char *description, const cpu_set_t   *cpuset)
    6963  {
    70     _CPU_set_Show_with_plugin( NULL, printk_plugin, description, cpuset );
     64    rtems_printer printer;
     65    rtems_print_printer_printk( &printer );
     66    _CPU_set_Show_with_plugin( &printer, description, cpuset );
    7167  }
    7268
  • testsuites/fstests/fsnofs01/init.c

    rb1860df5 r24d0ee57  
    496496static void Init(rtems_task_argument arg)
    497497{
    498   rtems_test_begink();
     498  TEST_BEGIN();
    499499
    500500  test_initial_values();
     
    507507  test_check_access();
    508508
    509   rtems_test_endk();
     509  TEST_END();
    510510  exit(0);
    511511}
  • testsuites/libtests/block02/init.c

    rb1860df5 r24d0ee57  
    2525#endif
    2626
     27#define TESTS_USE_PRINTK
    2728#include "tmacros.h"
    2829
     
    8384  rtems_test_assert(bd->dd == dd_a);
    8485
    85   rtems_test_endk();
     86  TEST_END();
    8687
    8788  exit(0);
     
    137138  dev_t dev_b = 0;
    138139
    139   rtems_test_begink();
     140  TEST_BEGIN();
    140141
    141142  sc = rtems_disk_io_initialize();
  • testsuites/libtests/block03/init.c

    rb1860df5 r24d0ee57  
    2525#endif
    2626
     27#define TESTS_USE_PRINTK
    2728#include "tmacros.h"
    2829
     
    7778  rtems_test_assert(bd->block == 0);
    7879
    79   rtems_test_endk();
     80  TEST_END();
    8081
    8182  exit(0);
     
    130131  dev_t dev = 0;
    131132
    132   rtems_test_begink();
     133  TEST_BEGIN();
    133134
    134135  sc = rtems_disk_io_initialize();
  • testsuites/libtests/block04/init.c

    rb1860df5 r24d0ee57  
    2525#endif
    2626
     27#define TESTS_USE_PRINTK
    2728#include "tmacros.h"
    2829
     
    102103  printk("H: release done: 0\n");
    103104
    104   rtems_test_endk();
     105  TEST_END();
    105106
    106107  exit(0);
     
    112113  dev_t dev = 0;
    113114
    114   rtems_test_begink();
     115  TEST_BEGIN();
    115116
    116117  sc = rtems_disk_io_initialize();
  • testsuites/libtests/block05/init.c

    rb1860df5 r24d0ee57  
    2525#endif
    2626
     27#define TESTS_USE_PRINTK
    2728#include "tmacros.h"
    2829#include <stdarg.h>
     
    427428  unsigned i = 0;
    428429
    429   rtems_test_begink();
     430  TEST_BEGIN();
    430431
    431432  task_id_init = rtems_task_self();
     
    506507  }
    507508
    508   rtems_test_endk();
     509  TEST_END();
    509510
    510511  exit(0);
  • testsuites/libtests/block06/init.c

    rb1860df5 r24d0ee57  
    3333#include <bsp.h>
    3434
    35 #include <tmacros.h>
     35#include "tmacros.h"
    3636
    3737const char rtems_test_name[] = "BLOCK 6";
  • testsuites/libtests/block07/init.c

    rb1860df5 r24d0ee57  
    2828#include <sys/stat.h>
    2929#include <fcntl.h>
     30
     31#define TESTS_USE_PRINTK
    3032#include "tmacros.h"
    3133
     
    103105  printk("L: release done: 0\n");
    104106
    105   rtems_test_endk();
     107  TEST_END();
    106108
    107109  exit(0);
     
    165167  dev_t dev = 0;
    166168
    167   rtems_test_begink();
     169  TEST_BEGIN();
    168170
    169171  sc = rtems_disk_io_initialize();
  • testsuites/libtests/block08/init.c

    rb1860df5 r24d0ee57  
    2020#endif
    2121
     22#include "tmacros.h"
     23
    2224#define CONFIGURE_INIT
    2325#include "system.h"
     
    3133rtems_task Init(rtems_task_argument argument)
    3234{
    33   rtems_test_begin();
     35  TEST_BEGIN();
    3436  run_bdbuf_tests();
    35   rtems_test_end();
     37  TEST_END();
    3638
    3739  exit(0);
    3840}
    39 
  • testsuites/libtests/block09/init.c

    rb1860df5 r24d0ee57  
    2424#include "config.h"
    2525#endif
     26
     27#define TESTS_USE_PRINTK
     28#include "tmacros.h"
    2629
    2730#include <assert.h>
     
    177180  rtems_disk_device *dd = NULL;
    178181
    179   rtems_test_begink();
     182  TEST_BEGIN();
    180183
    181184  sc = rtems_disk_io_initialize();
     
    225228  ASSERT_SC(sc);
    226229
    227   rtems_test_endk();
     230  TEST_END();
    228231
    229232  exit(0);
  • testsuites/libtests/block10/init.c

    rb1860df5 r24d0ee57  
    2424#endif
    2525
     26#define TESTS_USE_PRINTK
     27#include "tmacros.h"
     28
    2629#include <assert.h>
    2730#include <errno.h>
     
    403406  size_t i_p = 0;
    404407
    405   rtems_test_begink();
     408  TEST_BEGIN();
    406409
    407410  task_id_init = rtems_task_self();
     
    467470  }
    468471
    469   rtems_test_endk();
     472  TEST_END();
    470473
    471474  exit(0);
  • testsuites/libtests/block14/init.c

    rb1860df5 r24d0ee57  
    119119static void test_actions(rtems_disk_device *dd)
    120120{
     121  rtems_printer printer;
    121122  int i;
     123
     124  rtems_print_printer_printf(&printer);
    122125
    123126  for (i = 0; i < ACTION_COUNT; ++i) {
     
    156159  }
    157160
    158   rtems_blkdev_print_stats(&dd->stats, 0, 1, 2, rtems_printf_plugin, NULL);
     161  rtems_blkdev_print_stats(&dd->stats, 0, 1, 2, &printer);
    159162}
    160163
  • testsuites/libtests/capture01/init.c

    rb1860df5 r24d0ee57  
    3434
    3535const char rtems_test_name[] = "CAPTURE 1";
     36rtems_printer rtems_test_printer;
    3637
    3738rtems_task Init(
     
    4647  rtems_mode          old_mode;
    4748  rtems_name          to_name = rtems_build_name('I', 'D', 'L', 'E');;
     49
     50  rtems_print_printer_printf(&rtems_test_printer);
    4851
    4952  rtems_test_begin();
  • testsuites/libtests/complex/init.c

    rb1860df5 r24d0ee57  
    2828
    2929const char rtems_test_name[] = "COMPLEX";
     30rtems_printer rtems_test_printer;
    3031#endif
    3132
     
    6162{
    6263#if __rtems__
     64  rtems_print_printer_printf(&rtems_test_printer);
    6365  rtems_test_begin();
    6466#endif
    6567
    6668  docomplex();
    67   docomplexf(); 
     69  docomplexf();
    6870  docomplexl();
    6971#if __rtems__
  • testsuites/libtests/devnullfatal01/testcase.h

    rb1860df5 r24d0ee57  
    1313#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
    1414#define FATAL_ERROR_EXPECTED_ERROR       RTEMS_TOO_MANY
     15
     16#define TESTS_USE_PRINTK
    1517
    1618#include <rtems/devnull.h>
     
    2931  /* we will not run this far */
    3032}
    31 
  • testsuites/libtests/exit01/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <stdlib.h>
    2023
     
    2326
    2427#include <rtems.h>
    25 #include <rtems/test.h>
    2628
    2729const char rtems_test_name[] = "EXIT 1";
     
    6163      && counter == 3
    6264  ) {
    63     rtems_test_endk();
     65    TEST_END();
    6466  }
    6567}
     
    8688  rtems_id id;
    8789
    88   rtems_test_begink();
     90  TEST_BEGIN();
    8991
    9092  sc = rtems_task_create(
  • testsuites/libtests/exit02/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <stdlib.h>
    2023
     
    2326
    2427#include <rtems.h>
    25 #include <rtems/test.h>
    2628
    2729const char rtems_test_name[] = "EXIT 2";
     
    4547      && error == EXIT_STATUS
    4648  ) {
    47     rtems_test_endk();
     49    TEST_END();
    4850  }
    4951}
     
    6466  rtems_id id;
    6567
    66   rtems_test_begink();
     68  TEST_BEGIN();
    6769
    6870  sc = rtems_task_create(
  • testsuites/libtests/math/init.c

    rb1860df5 r24d0ee57  
    2323#endif
    2424
     25/*
     26 * @fixme This test should use the test macros but the include paths are
     27 *        are wrong in the build system.
     28 */
    2529#if __rtems__
    2630#include <bsp.h> /* for device driver prototypes */
     
    2832
    2933const char rtems_test_name[] = "MATH";
     34rtems_printer rtems_test_printer;
    3035#endif
    3136
     
    5964{
    6065#if __rtems__
     66  rtems_print_printer_printf(&rtems_test_printer);
    6167  rtems_test_begin();
    6268#endif
     
    6975  exit( 0 );
    7076}
    71 
  • testsuites/libtests/mathf/init.c

    rb1860df5 r24d0ee57  
    2828
    2929const char rtems_test_name[] = "MATHF";
     30rtems_printer rtems_test_printer;
    3031#endif
    3132
     
    5960{
    6061#if __rtems__
     62  rtems_print_printer_printf(&rtems_test_printer);
    6163  rtems_test_begin();
    6264#endif
    6365
    64   domathf(); 
     66  domathf();
    6567
    6668#if __rtems__
     
    6971  exit( 0 );
    7072}
    71 
  • testsuites/libtests/mathl/init.c

    rb1860df5 r24d0ee57  
    2828
    2929const char rtems_test_name[] = "MATHL";
     30rtems_printer rtems_test_printer;
    3031#endif
    3132
     
    5960{
    6061#if __rtems__
     62  rtems_print_printer_printf(&rtems_test_printer);
    6163  rtems_test_begin();
    6264#endif
    6365
    64   domathl(); 
     66  domathl();
    6567
    6668#if __rtems__
  • testsuites/libtests/mouse01/init.c

    rb1860df5 r24d0ee57  
    6161
    6262  termios_test_driver_set_rx_enqueue_now( true );
    63  
     63
    6464  termios_test_driver_set_rx( &actions[Mouse_Index], to_enqueue );
    6565  Mouse_Index += to_enqueue;
     
    9696)
    9797{
     98  rtems_printer printer;
     99  rtems_print_printer_printf( &printer );
    98100  uid_print_message_with_plugin(
    99     stdout,
    100     (rtems_printk_plugin_t)fprintf,
     101    &printer,
    101102    uid
    102103  );
     
    136137
    137138  open_it();
    138   register_it(); 
     139  register_it();
    139140  do {
    140141    more_data = enqueue_next_action(
    141142      Mouse_Actions,
    142       Mouse_Actions_Size, 
     143      Mouse_Actions_Size,
    143144      Mouse_Actions_Per_Iteration
    144145    );
    145146    receive_uid_message();
    146147  } while (more_data);
    147   close_it(); 
     148  close_it();
    148149  TEST_END();
    149150  rtems_test_exit( 0 );
  • testsuites/libtests/stackchk/init.c

    rb1860df5 r24d0ee57  
    102102    printk( "unexpected fatal error\n" );
    103103  } else {
    104     rtems_test_endk();
     104    TEST_END();
    105105  }
    106106}
  • testsuites/libtests/stackchk/system.h

    rb1860df5 r24d0ee57  
    1212 */
    1313
     14#define TESTS_USE_PRINTK
    1415#include <tmacros.h>
    1516
  • testsuites/libtests/uid01/init.c

    rb1860df5 r24d0ee57  
    7070)
    7171{
     72  rtems_printer printer;
     73  rtems_print_printer_printf( &printer );
    7274  uid_print_message_with_plugin(
    73     stdout,
    74     (rtems_printk_plugin_t)fprintf,
     75    &printer,
    7576    uid
    7677  );
     
    112113   * call will never return. We use this to check if patch was correct
    113114   * by passing a number of ticks greater than 0 and less than 1. If
    114    * patch was correct, this call will timeout instead of waiting 
     115   * patch was correct, this call will timeout instead of waiting
    115116   * indefinitely.
    116117   */
    117118  receive_uid_message();
    118119
    119   close_it(); 
     120  close_it();
    120121  TEST_END();
    121122  rtems_test_exit( 0 );
  • testsuites/psxtests/psxfatal_support/init.c

    rb1860df5 r24d0ee57  
    1212#endif
    1313
     14#define TESTS_USE_PRINTK
     15#include "tmacros.h"
     16
    1417#define CONFIGURE_INIT
    1518#include "system.h"
     
    2326  if (!done) {
    2427    done = true;
    25     rtems_test_begink();
     28    TEST_BEGIN();
    2629  }
    2730}
     
    9699      && error == FATAL_ERROR_EXPECTED_ERROR
    97100  ) {
    98     rtems_test_endk();
     101    TEST_END();
    99102  }
    100103}
    101 
  • testsuites/samples/capture/init.c

    rb1860df5 r24d0ee57  
    2828
    2929const char rtems_test_name[] = "CAPTURE ENGINE";
     30rtems_printer rtems_test_printer;
    3031
    3132volatile int can_proceed = 1;
     
    4748  rtems_mode          old_mode;
    4849
     50  rtems_print_printer_printf(&rtems_test_printer);
    4951  rtems_test_begin();
    5052
  • testsuites/samples/hello/init.c

    rb1860df5 r24d0ee57  
    2323
    2424const char rtems_test_name[] = "HELLO WORLD";
     25rtems_printer rtems_test_printer;
    2526
    2627rtems_task Init(
     
    2829)
    2930{
     31  rtems_print_printer_printf(&rtems_test_printer);
    3032  rtems_test_begin();
    3133  printf( "Hello World\n" );
  • testsuites/samples/paranoia/init.c

    rb1860df5 r24d0ee57  
    2020
    2121const char rtems_test_name[] = "PARANOIA";
     22rtems_printer rtems_test_printer;
    2223
    2324char *args[2] = { "paranoia", 0 };
     
    3637#endif
    3738
     39  rtems_print_printer_printf(&rtems_test_printer);
    3840  rtems_test_begin();
    3941  paranoia(1, args);
  • testsuites/smptests/smp05/init.c

    rb1860df5 r24d0ee57  
    2828static void success(void)
    2929{
    30   rtems_test_end_with_plugin(locked_printf_plugin, NULL);
     30  rtems_test_end();
    3131  rtems_test_exit( 0 );
    3232}
     
    5151
    5252  locked_print_initialize();
    53   rtems_test_begin_with_plugin(locked_printf_plugin, NULL);
     53  rtems_test_begin();
    5454
    5555  if ( rtems_get_processor_count() == 1 ) {
  • testsuites/smptests/smp07/init.c

    rb1860df5 r24d0ee57  
    1919volatile bool TaskRan = false;
    2020volatile bool TSRFired = false;
    21 rtems_id      Semaphore; 
     21rtems_id      Semaphore;
    2222
    2323rtems_task Init(
     
    3131static void success(void)
    3232{
    33   rtems_test_end_with_plugin(locked_printf_plugin, NULL);
     33  rtems_test_end( );
    3434  rtems_test_exit( 0 );
    3535}
     
    6464  /* Print that the task is up and running. */
    6565  locked_printf(
    66     " CPU %" PRIu32 " running Task %s after semaphore release\n", 
    67     cpu_num, 
     66    " CPU %" PRIu32 " running Task %s after semaphore release\n",
     67    cpu_num,
    6868    name
    6969  );
     
    9999
    100100  locked_print_initialize();
    101   rtems_test_begin_with_plugin(locked_printf_plugin, NULL);
     101  rtems_test_begin();
    102102
    103103  if ( rtems_get_processor_count() == 1 ) {
     
    108108  status = rtems_semaphore_create(
    109109    rtems_build_name ('S', 'E', 'M', '1'),
    110     1,                                             
     110    1,
    111111    RTEMS_LOCAL                   |
    112112    RTEMS_SIMPLE_BINARY_SEMAPHORE |
     
    158158      break;
    159159  };
    160  
     160
    161161  /* Validate the timer fired and that the task ran */
    162162  if ( !TSRFired )
  • testsuites/smptests/smpfatal01/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <rtems.h>
    20 #include <rtems/test.h>
    2123#include <rtems/score/percpu.h>
    2224#include <rtems/score/smpimpl.h>
     
    6365      }
    6466
    65       rtems_test_endk();
     67      TEST_END();
    6668    }
    6769  }
     
    8082  uint32_t cpu;
    8183
    82   rtems_test_begink();
     84  TEST_BEGIN();
    8385
    8486  assert(rtems_configuration_get_maximum_processors() == MAX_CPUS);
     
    108110    per_cpu->state = PER_CPU_STATE_SHUTDOWN;
    109111  } else {
    110     rtems_test_endk();
     112    TEST_END();
    111113    exit(0);
    112114  }
  • testsuites/smptests/smpfatal02/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <rtems.h>
    20 #include <rtems/test.h>
    2123#include <rtems/score/percpu.h>
    2224#include <rtems/score/smpimpl.h>
     
    6870      }
    6971
    70       rtems_test_endk();
     72      TEST_END();
    7173    } else {
    7274      assert(source == RTEMS_FATAL_SOURCE_SMP);
     
    8890  uint32_t cpu;
    8991
    90   rtems_test_begink();
     92  TEST_BEGIN();
    9193
    9294  assert(rtems_configuration_get_maximum_processors() == MAX_CPUS);
     
    113115    rtems_fatal(RTEMS_FATAL_SOURCE_APPLICATION, 0xdeadbeef);
    114116  } else {
    115     rtems_test_endk();
     117    TEST_END();
    116118    exit(0);
    117119  }
  • testsuites/smptests/smpfatal04/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <rtems.h>
    20 #include <rtems/test.h>
    2123#include <rtems/score/smpimpl.h>
    2224
     
    3739)
    3840{
    39   rtems_test_begink();
     41  TEST_BEGIN();
    4042
    4143  if (
     
    4446      && code == SMP_FATAL_BOOT_PROCESSOR_NOT_ASSIGNED_TO_SCHEDULER
    4547  ) {
    46     rtems_test_endk();
     48    TEST_END();
    4749  }
    4850}
  • testsuites/smptests/smpfatal05/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <rtems.h>
    20 #include <rtems/test.h>
    2123#include <rtems/score/smpimpl.h>
    2224
     
    3739)
    3840{
    39   rtems_test_begink();
     41  TEST_BEGIN();
    4042
    4143  if (
     
    4446      && code == SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT
    4547  ) {
    46     rtems_test_endk();
     48    TEST_END();
    4749  }
    4850}
  • testsuites/smptests/smpfatal08/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <rtems.h>
    20 #include <rtems/test.h>
    2123#include <rtems/score/smpimpl.h>
    2224
     
    9496)
    9597{
    96   rtems_test_begink();
     98  TEST_BEGIN();
    9799
    98100  if (
     
    101103      && code == SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED
    102104  ) {
    103     rtems_test_endk();
     105    TEST_END();
    104106  }
    105107}
  • testsuites/sptests/sperror01/init.c

    rb1860df5 r24d0ee57  
    1212#endif
    1313
     14#define TESTS_USE_PRINTK
    1415#include <tmacros.h>
     16
    1517#include "test_support.h"
    1618#include "rtems/error.h"
     
    3335      && error == ENOMEM
    3436  ) {
    35     rtems_test_endk();
     37    TEST_END();
    3638  }
    3739}
  • testsuites/sptests/sperror02/init.c

    rb1860df5 r24d0ee57  
    1212#endif
    1313
     14#define TESTS_USE_PRINTK
    1415#include <tmacros.h>
     16
    1517#include "test_support.h"
    1618#include <errno.h>
     
    3335      && error == 1
    3436  ) {
    35     rtems_test_endk();
     37    TEST_END();
    3638  }
    3739}
     
    4547  errno = ENOMEM;
    4648  rtems_error(
    47     RTEMS_NO_MEMORY | RTEMS_ERROR_ABORT, 
     49    RTEMS_NO_MEMORY | RTEMS_ERROR_ABORT,
    4850    "Dummy: Resources unavailable\n"
    4951  );
  • testsuites/sptests/sperror03/init.c

    rb1860df5 r24d0ee57  
    1212#endif
    1313
    14 #include <tmacros.h>
     14#define TESTS_USE_PRINTK
     15#include "tmacros.h"
    1516#include "test_support.h"
    1617
     
    3132      && error == 0
    3233  ) {
    33     rtems_test_endk();
     34    TEST_END();
    3435  }
    3536}
  • testsuites/sptests/spextensions01/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <assert.h>
    2023#include <limits.h>
    2124#include <stdlib.h>
    22 
    23 #include <rtems/test.h>
    2425
    2526#include <bsp.h>
     
    200201    assert_reverse_order(2);
    201202    assert(counter == 72);
    202     rtems_test_endk();
     203    TEST_END();
    203204  }
    204205}
     
    425426static void Init(rtems_task_argument arg)
    426427{
    427   rtems_test_begink();
     428  TEST_BEGIN();
    428429
    429430  test();
  • testsuites/sptests/spfatal07/testcase.h

    rb1860df5 r24d0ee57  
    5151      "WARNING - Only applicable when CPU_ALLOCATE_INTERRUPT_STACK == TRUE.\n"
    5252    );
    53     rtems_test_endk();
     53    TEST_END();
    5454    rtems_test_exit(0);
    5555  #endif
  • testsuites/sptests/spfatal16/testcase.h

    rb1860df5 r24d0ee57  
    88 */
    99
    10 /* generate fatal errors in termios.c 
     10/* generate fatal errors in termios.c
    1111 *    rtems_semaphore_create( rtems_build_name ('T', 'R', 'r', c),...);
    1212 */
     
    2626{
    2727  /* This fatal error depends on the Termios device configuration */
    28   rtems_test_endk();
     28  TEST_END();
    2929  rtems_test_exit(0);
    3030}
  • testsuites/sptests/spfatal26/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
    1920#include "tmacros.h"
    2021
     
    5253static void Init( rtems_task_argument arg )
    5354{
    54   rtems_test_begink();
     55  TEST_BEGIN();
    5556
    5657  provoke_aligment_or_data_access_exception();
     
    7071  rtems_exception_frame_print( (const rtems_exception_frame *) code );
    7172
    72   rtems_test_endk();
     73  TEST_END();
    7374}
    7475
  • testsuites/sptests/spfatal_support/init.c

    rb1860df5 r24d0ee57  
    2323  if (!done) {
    2424    done = true;
    25     rtems_test_begink();
     25    TEST_BEGIN();
    2626  }
    2727}
     
    108108      && is_expected_error( error )
    109109  ) {
    110     rtems_test_endk();
     110    TEST_END();
    111111  }
    112112}
    113 
  • testsuites/sptests/spfatal_support/system.h

    rb1860df5 r24d0ee57  
    1515 *  Some of the fatal error cases require the ability to peek inside RTEMS
    1616 */
     17
     18#define TESTS_USE_PRINTK
     19#include "tmacros.h"
     20
    1721#include <rtems.h>
    18 #include <rtems/test.h>
    19 #include <tmacros.h>
    2022
    2123/* functions */
  • testsuites/sptests/spinternalerror01/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <bsp.h>
    2023#include <bsp/bootcard.h>
    21 
    22 #include <rtems/test.h>
    2324
    2425const char rtems_test_name[] = "SPINTERNALERROR 1";
     
    4142)
    4243{
    43   rtems_test_begink();
     44  TEST_BEGIN();
    4445
    4546  if (
     
    4849      && error == FATAL_ERROR
    4950  ) {
    50     rtems_test_endk();
     51    TEST_END();
    5152  }
    5253}
  • testsuites/sptests/spprintk/init.c

    rb1860df5 r24d0ee57  
    1414#endif
    1515
     16#define TESTS_USE_PRINTK
    1617#include <tmacros.h>
    17 #include <rtems/bspIo.h>
     18#include <rtems/print.h>
    1819
    1920const char rtems_test_name[] = "SPPRINTK";
     21
     22/*
     23 * Undefined the RTEMS_PRINTF_ATTRIBUTE and make it nothing. The test code
     24 * contained in the file is suppose to be wrong.
     25 */
     26#undef RTEMS_PRINTF_ATTRIBUTE
     27#define RTEMS_PRINTF_ATTRIBUTE(_a, _b)
    2028
    2129/* forward declarations to avoid warnings */
     
    3947
    4048  BSP_poll_char = NULL;
    41  
     49
    4250  putk( "getchark - NULL getchar method - return -1" );
    4351  sc = getchark();
     
    125133)
    126134{
    127   rtems_test_begink();
     135  TEST_BEGIN();
    128136
    129137  do_putk();
     
    135143  do_getchark();
    136144
    137   rtems_test_endk();
     145  TEST_END();
    138146  rtems_test_exit( 0 );
    139147}
     
    152160
    153161#include <rtems/confdefs.h>
    154 
  • testsuites/sptests/spprofiling01/init.c

    rb1860df5 r24d0ee57  
    116116static void test_report_xml(void)
    117117{
     118  rtems_printer printer;
    118119  rtems_status_code sc;
    119120  int rv;
     
    122123  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    123124
    124   rv = rtems_profiling_report_xml("X", rtems_printf_plugin, NULL, 1, "  ");
     125  rtems_print_printer_printf(&printer);
     126  rv = rtems_profiling_report_xml("X", &printer, 1, "  ");
    125127  printf("characters produced by rtems_profiling_report_xml(): %i\n", rv);
    126128}
  • testsuites/sptests/spsysinit01/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <sys/types.h>
    2023#include <sys/stat.h>
     
    3033#include <rtems/libio_.h>
    3134#include <rtems/sysinit.h>
    32 #include <rtems/test.h>
    3335
    3436#include <rtems/extensionimpl.h>
     
    174176FIRST(RTEMS_SYSINIT_BSP_WORK_AREAS)
    175177{
    176   rtems_test_begink();
     178  TEST_BEGIN();
    177179  assert(_Workspace_Area.area_begin == 0);
    178180  next_step(BSP_WORK_AREAS_PRE);
     
    675677#endif /* RTEMS_POSIX_API */
    676678  next_step(INIT_TASK);
    677   rtems_test_endk();
     679  TEST_END();
    678680  exit(0);
    679681}
  • testsuites/sptests/sptimecounter01/init.c

    rb1860df5 r24d0ee57  
    1717#endif
    1818
     19#define TESTS_USE_PRINTK
     20#include "tmacros.h"
     21
    1922#include <assert.h>
    2023
    2124#include <bsp/bootcard.h>
    22 
    23 #include <rtems/test.h>
    2425
    2526#include <rtems/score/timecounterimpl.h>
     
    5556  struct timespec ts;
    5657
    57   rtems_test_begink();
     58  TEST_BEGIN();
    5859
    5960  assert(time(NULL) == TOD_SECONDS_1970_THROUGH_1988);
     
    149150  assert(bt.frac == 18446742522092);
    150151
    151   rtems_test_endk();
     152  TEST_END();
    152153
    153154  _Terminate(RTEMS_FATAL_SOURCE_EXIT, false, 0);
  • testsuites/support/include/buffer_test_io.h

    rb1860df5 r24d0ee57  
    2525#if defined(TESTS_USE_PRINTK)
    2626
    27 #include <rtems/bspIo.h>
     27#include <rtems/print.h>
    2828
    2929  #undef printf
     
    5555    } while (0)
    5656
    57   #define TEST_BEGIN() rtems_test_begink()
    58 
    59   #define TEST_END() rtems_test_endk()
     57  #define TEST_BEGIN() printk(TEST_BEGIN_STRING)
     58
     59  #define TEST_END() printk(TEST_END_STRING)
    6060
    6161/*
     
    157157    } while (0)
    158158
    159   #define TEST_BEGIN() rtems_test_begin()
    160 
    161   #define TEST_END() rtems_test_end()
     159  #define TEST_BEGIN() printf(TEST_BEGIN_STRING)
     160
     161  #define TEST_END() printf(TEST_END_STRING)
    162162
    163163/*
     
    206206    } while (0)
    207207
    208   #define TEST_BEGIN() \
    209     rtems_test_begin_with_plugin((rtems_printk_plugin_t) fiprintf, stderr)
    210 
    211   #define TEST_END() \
    212     rtems_test_end_with_plugin((rtems_printk_plugin_t) fiprintf, stderr)
     208  #define TEST_BEGIN() fiprintf( stderr, TEST_BEGIN_STRING)
     209
     210  #define TEST_END()  fiprintf( stderr, TEST_END_STRING)
    213211
    214212#endif
  • testsuites/support/include/test_support.h

    rb1860df5 r24d0ee57  
    7575int locked_vprintf(const char *fmt, va_list ap);
    7676
    77 int locked_printf_plugin(void *context, const char *fmt, ...);
    78 
    7977void locked_printk(const char *fmt, ...);
    8078
  • testsuites/support/src/locked_print.c

    rb1860df5 r24d0ee57  
    1 /* 
     1/*
    22 *  COPYRIGHT (c) 1989-2011.
    33 *  On-Line Applications Research Corporation (OAR).
     
    1515#include "tmacros.h"
    1616
    17 static rtems_id locked_print_semaphore;      /* synchronisation semaphore */
     17static rtems_id locked_print_semaphore;      /* synchronisation semaphore */
     18
     19rtems_printer rtems_test_printer;
     20
     21static int locked_printf_plugin(void *context, const char *fmt, ...)
     22{
     23  int rv;
     24  va_list ap;
     25
     26  (void) context;
     27
     28  va_start(ap, fmt);
     29  rv = locked_vprintf(fmt, ap);
     30  va_end(ap);
     31
     32  return rv;
     33}
    1834
    1935void locked_print_initialize(void)
     
    3046  sc = rtems_semaphore_create(
    3147    rtems_build_name ('S', 'E', 'M', '1'),
    32     1,                                             
     48    1,
    3349    RTEMS_LOCAL                   |
    3450    RTEMS_BINARY_SEMAPHORE |
     
    3955  );
    4056  directive_failed( sc, "rtems_semaphore_create" );
     57
     58  /*
     59   * Set up the printer to use the locked printf printer.
     60   */
     61  rtems_test_printer.context = NULL;
     62  rtems_test_printer.context = locked_printf_plugin;
    4163}
    4264
     
    5779  /* Release the semaphore  */
    5880  rtems_semaphore_release( locked_print_semaphore );
    59 
    60   return rv;
    61 }
    62 
    63 int locked_printf_plugin(void *context, const char *fmt, ...)
    64 {
    65   int rv;
    66   va_list ap;
    67 
    68   (void) context;
    69 
    70   va_start(ap, fmt);
    71   rv = locked_vprintf(fmt, ap);
    72   va_end(ap);
    7381
    7482  return rv;
Note: See TracChangeset for help on using the changeset viewer.