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 | #include <rtems/score/basedefs.h> |
---|
22 | |
---|
23 | #include <stdarg.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | /** |
---|
30 | * @defgroup BSPIO Kernel Print Support |
---|
31 | * |
---|
32 | * This module contains all methods and support related to providing |
---|
33 | * kernel level print support. |
---|
34 | * |
---|
35 | * The following variables below are declared as extern and |
---|
36 | * MUST be declared and initialized in each BSP. Using this indirect |
---|
37 | * function, the functionality in this group is tailored for the BSP. |
---|
38 | * |
---|
39 | * - BSP_output_char |
---|
40 | * - BSP_poll_char |
---|
41 | */ |
---|
42 | |
---|
43 | /** |
---|
44 | * This type defines the prototype for the BSP provided method to |
---|
45 | * print a single character. It is assumed to be polled. |
---|
46 | */ |
---|
47 | typedef void (*BSP_output_char_function_type) (char c); |
---|
48 | |
---|
49 | /** |
---|
50 | * This type defines the prototype for the BSP provided method to |
---|
51 | * input a single character. It is assumed to be polled. |
---|
52 | */ |
---|
53 | typedef int (*BSP_polling_getchar_function_type) (void); |
---|
54 | |
---|
55 | /** |
---|
56 | * This variable points to the BSP provided method to output a |
---|
57 | * character for the purposes of debug output. |
---|
58 | * |
---|
59 | * It must output only the specific character. It must not perform character |
---|
60 | * translations, e.g. "\n" to "\r\n". |
---|
61 | */ |
---|
62 | extern BSP_output_char_function_type BSP_output_char; |
---|
63 | |
---|
64 | /** |
---|
65 | * This variable points to the BSP provided method to input a |
---|
66 | * character for the purposes of debug input. |
---|
67 | */ |
---|
68 | extern BSP_polling_getchar_function_type BSP_poll_char; |
---|
69 | |
---|
70 | /** |
---|
71 | * @brief Get Character (kernel I/O) |
---|
72 | * |
---|
73 | * This method polls for a key in the simplest possible fashion |
---|
74 | * from whatever the debug console device is. |
---|
75 | * |
---|
76 | * @return If a character is available, it is returned. Otherwise |
---|
77 | * this method returns -1. |
---|
78 | * |
---|
79 | * @note This method uses the BSP_poll_char pointer to a BSP |
---|
80 | * provided method. |
---|
81 | */ |
---|
82 | extern int getchark(void); |
---|
83 | |
---|
84 | /** |
---|
85 | * @brief Variable Argument printk() |
---|
86 | * |
---|
87 | * This method allows the user to access printk() functionality |
---|
88 | * with a va_list style argument. |
---|
89 | * |
---|
90 | * @param[in] fmt is a printf()-style format string |
---|
91 | * @param[in] ap is a va_list pointer to arguments |
---|
92 | * |
---|
93 | * @return The number of characters output. |
---|
94 | */ |
---|
95 | extern int vprintk(const char *fmt, va_list ap); |
---|
96 | |
---|
97 | int rtems_printk_printer( |
---|
98 | void *ignored, |
---|
99 | const char *format, |
---|
100 | va_list ap |
---|
101 | ); |
---|
102 | |
---|
103 | /** |
---|
104 | * @brief Kernel Print |
---|
105 | * |
---|
106 | * This method allows the user to perform a debug printk(). It performs a |
---|
107 | * character translation from "\n" to "\r\n". |
---|
108 | * |
---|
109 | * @param[in] fmt is a printf()-style format string |
---|
110 | * |
---|
111 | * @return The number of characters output. |
---|
112 | */ |
---|
113 | extern int printk(const char *fmt, ...) RTEMS_PRINTFLIKE(1, 2); |
---|
114 | |
---|
115 | /** |
---|
116 | * @brief Kernel Put String |
---|
117 | * |
---|
118 | * This method allows the user to perform a debug puts(). |
---|
119 | * |
---|
120 | * @param[in] s is the string to print |
---|
121 | * |
---|
122 | * @return The number of characters output. |
---|
123 | */ |
---|
124 | extern int putk(const char *s); |
---|
125 | |
---|
126 | /** |
---|
127 | * @brief Kernel Put Character |
---|
128 | * |
---|
129 | * This method allows the user to perform a debug putc(). It performs a |
---|
130 | * character translation from "\n" to "\r\n". |
---|
131 | * |
---|
132 | * @param[in] c is the character to print |
---|
133 | */ |
---|
134 | extern void rtems_putc(char c); |
---|
135 | |
---|
136 | /**@}*/ |
---|
137 | |
---|
138 | #ifdef __cplusplus |
---|
139 | } |
---|
140 | #endif |
---|
141 | |
---|
142 | #endif |
---|