source: rtems/cpukit/include/rtems/bspIo.h @ 1ce8fc3

5
Last change on this file since 1ce8fc3 was 1ce8fc3, checked in by Sebastian Huber <sebastian.huber@…>, on 06/21/16 at 11:05:18

Make rtems_printf_plugin() static

  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[21242c2]1/**
2 * @file rtems/bspIo.h
[1bce637]3 *
[9ab091e]4 * @brief Interface to Kernel Print Methods
5 *
[21242c2]6 * This include file defines the interface to kernel print methods.
7 */
8
9/*
[1bce637]10 *  COPYRIGHT (c) 1998 valette@crf.canon.fr
[21242c2]11 *  COPYRIGHT (c) 2011 On-Line Applications Research Corporation.
[1bce637]12 *
13 *  The license and distribution terms for this file may be
[dcf3687]14 *  found in the file LICENSE in this distribution or at
[c499856]15 *  http://www.rtems.org/license/LICENSE.
[1bce637]16 */
[a575af8]17
[8ff51798]18#ifndef _RTEMS_BSPIO_H
19#define _RTEMS_BSPIO_H
[1bce637]20
[8eea24b]21#ifdef __cplusplus
22extern "C" {
23#endif
24
[a575af8]25/**
26 * @defgroup BSPIO Kernel Print Support
27 *
28 * This module contains all methods and support related to providing
29 * kernel level print support.
30 *
31 * The following variables below are declared as extern and
32 * MUST be declared and initialized in each BSP. Using this indirect
33 * function, the functionality in this group is tailored for the BSP.
34 *
35 *  - BSP_output_char
36 *  - BSP_poll_char
37 */
38
[24d0ee57]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
47
[a575af8]48/**
49 * This type defines the prototype for the BSP provided method to
50 * print a single character. It is assumed to be polled.
[1bce637]51 */
52typedef void    (*BSP_output_char_function_type)        (char c);
[a575af8]53
54/**
55 * This type defines the prototype for the BSP provided method to
56 * input a single character. It is assumed to be polled.
57 */
[23c3f72e]58typedef int     (*BSP_polling_getchar_function_type)    (void);
[1bce637]59
[a575af8]60/**
61 * This variable points to the BSP provided method to output a
62 * character for the purposes of debug output.
63 */
[1bce637]64extern  BSP_output_char_function_type           BSP_output_char;
[34fd745]65
[a575af8]66/**
67 * This variable points to the BSP provided method to input a
68 * character for the purposes of debug input.
[1bce637]69 */
[a575af8]70extern  BSP_polling_getchar_function_type       BSP_poll_char;
71
[108bab3]72#include <stdarg.h>
[90a5d194]73
[23c3f72e]74/**
[a575af8]75 * @brief Get Character (kernel I/O)
[23c3f72e]76 *
[a575af8]77 * This method polls for a key in the simplest possible fashion
78 * from whatever the debug console device is.
[23c3f72e]79 *
[a575af8]80 * @return If a character is available, it is returned.  Otherwise
81 *         this method returns -1.
82 *
83 * @note This method uses the BSP_poll_char pointer to a BSP
84 *       provided method.
[23c3f72e]85 */
86extern int getchark(void);
[a575af8]87
88/**
89 * @brief Variable Argument printk()
90 *
91 * This method allows the user to access printk() functionality
92 * with a va_list style argument.
93 *
94 * @param[in] fmt is a printf()-style format string
95 * @param[in] ap is a va_list pointer to arguments
[24d0ee57]96 *
97 * @return The number of characters output.
[a575af8]98 */
[24d0ee57]99extern int vprintk(const char *fmt, va_list ap);
[a575af8]100
101/**
102 * @brief Kernel Print
103 *
104 * This method allows the user to perform a debug printk().
105 *
106 * @param[in] fmt is a printf()-style format string
[24d0ee57]107 *
108 * @return The number of characters output.
[a575af8]109 */
[24d0ee57]110extern int printk(const char *fmt, ...) RTEMS_PRINTF_ATTRIBUTE(1, 2);
[a575af8]111
112/**
113 * @brief Kernel Put String
114 *
115 * This method allows the user to perform a debug puts().
116 *
117 * @param[in] s is the string to print
[24d0ee57]118 *
119 * @return The number of characters output.
[a575af8]120 */
[24d0ee57]121extern int putk(const char *s);
[a575af8]122
123/**
124 * @brief Kernel Put Character
125 *
126 * This method allows the user to perform a debug putc().
127 *
128 * @param[in] c is the character to print
129 */
[bd5a1386]130extern void rtems_putc(char c);
[90a5d194]131
[a575af8]132/**
133 * Type definition for function which can be plugged in to
134 * certain reporting routines to redirect the output.
135 *
[24d0ee57]136 * Use the RTEMS Print interface to call these functions. Do not
137 * directly use them.
[a575af8]138 *
139 * If the user provides their own "printf plugin", then they may
140 * redirect those reports as they see fit.
141 */
[24d0ee57]142typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap);
[a575af8]143
[3242614]144/**
145 * @brief Reporting Methods fprintf() Plugin
146 *
147 * This is a standard plug-in to support using fprintf() for output
148 * instead of printk().
149 *
150 * @param[in] context The file stream.
151 * @param[in] fmt is a printf()-style format string
152 *
153 * @return The number of characters printed.
154 */
155extern int rtems_fprintf_plugin(void *context, const char *fmt, va_list ap);
156
[a575af8]157/**@}*/
[1bce637]158
[8eea24b]159#ifdef __cplusplus
160}
161#endif
162
[1bce637]163#endif
Note: See TracBrowser for help on using the repository browser.