1 | /** |
---|
2 | * @file rtems/bspIo.h |
---|
3 | * |
---|
4 | * @brief Interface to Kernel Print Methods |
---|
5 | * |
---|
6 | * This include file defines the interface to kernel print methods. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1998 valette@crf.canon.fr |
---|
11 | * COPYRIGHT (c) 2011 On-Line Applications Research Corporation. |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_BSPIO_H |
---|
19 | #define _RTEMS_BSPIO_H |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" { |
---|
23 | #endif |
---|
24 | |
---|
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 | |
---|
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 | |
---|
48 | /** |
---|
49 | * This type defines the prototype for the BSP provided method to |
---|
50 | * print a single character. It is assumed to be polled. |
---|
51 | */ |
---|
52 | typedef void (*BSP_output_char_function_type) (char c); |
---|
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 | */ |
---|
58 | typedef int (*BSP_polling_getchar_function_type) (void); |
---|
59 | |
---|
60 | /** |
---|
61 | * This variable points to the BSP provided method to output a |
---|
62 | * character for the purposes of debug output. |
---|
63 | */ |
---|
64 | extern BSP_output_char_function_type BSP_output_char; |
---|
65 | |
---|
66 | /** |
---|
67 | * This variable points to the BSP provided method to input a |
---|
68 | * character for the purposes of debug input. |
---|
69 | */ |
---|
70 | extern BSP_polling_getchar_function_type BSP_poll_char; |
---|
71 | |
---|
72 | #include <stdarg.h> |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief Get Character (kernel I/O) |
---|
76 | * |
---|
77 | * This method polls for a key in the simplest possible fashion |
---|
78 | * from whatever the debug console device is. |
---|
79 | * |
---|
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. |
---|
85 | */ |
---|
86 | extern int getchark(void); |
---|
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 |
---|
96 | * |
---|
97 | * @return The number of characters output. |
---|
98 | */ |
---|
99 | extern int vprintk(const char *fmt, va_list ap); |
---|
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 |
---|
107 | * |
---|
108 | * @return The number of characters output. |
---|
109 | */ |
---|
110 | extern int printk(const char *fmt, ...) RTEMS_PRINTF_ATTRIBUTE(1, 2); |
---|
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 |
---|
118 | * |
---|
119 | * @return The number of characters output. |
---|
120 | */ |
---|
121 | extern int putk(const char *s); |
---|
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 | */ |
---|
130 | extern void rtems_putc(char c); |
---|
131 | |
---|
132 | /** |
---|
133 | * Type definition for function which can be plugged in to |
---|
134 | * certain reporting routines to redirect the output. |
---|
135 | * |
---|
136 | * Use the RTEMS Print interface to call these functions. Do not |
---|
137 | * directly use them. |
---|
138 | * |
---|
139 | * If the user provides their own "printf plugin", then they may |
---|
140 | * redirect those reports as they see fit. |
---|
141 | */ |
---|
142 | typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap); |
---|
143 | |
---|
144 | /**@}*/ |
---|
145 | |
---|
146 | #ifdef __cplusplus |
---|
147 | } |
---|
148 | #endif |
---|
149 | |
---|
150 | #endif |
---|