summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/bspIo.h
blob: df068a167146c708b754dcb209aeadc6ddc61d49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * @file rtems/bspIo.h
 *
 * @brief Interface to Kernel Print Methods
 *
 * This include file defines the interface to kernel print methods.
 */

/*
 *  COPYRIGHT (c) 1998 valette@crf.canon.fr
 *  COPYRIGHT (c) 2011 On-Line Applications Research Corporation.
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */
#ifndef _RTEMS_BSPIO_H
#define _RTEMS_BSPIO_H

#ifdef __cplusplus
extern "C" {
#endif

/*
 * All the functions declared as extern after this comment
 * MUST be implemented in each BSP. Using this function,
 * this directory contains shared code that export higher level
 * functionnality described after the next command.
 */
typedef void 	(*BSP_output_char_function_type) 	(char c);
typedef int 	(*BSP_polling_getchar_function_type) 	(void);

extern 	BSP_output_char_function_type 		BSP_output_char;
extern 	BSP_polling_getchar_function_type 	BSP_poll_char;

/*
 * All the function declared as extern after this comment
 * are available for each BSP by compiling and linking
 * the files contained in this directory PROVIDED definition
 * and initialisation of the previous variable are done.
 */
#include <stdarg.h>

/**
 *  This method polls for a key in the simplest possible fashion
 *  from whatever the debug console device is.
 *
 *  @return If a character is available, it is returned.  Otherwise
 *          this method returns -1.
 *
 *  @note This method uses the BSP_poll_char pointer to a BSP
 *        provided method.
 */
extern int getchark(void);
extern void vprintk(const char *fmt, va_list ap);
extern void printk(const char *fmt, ...);
extern void putk(const char *s);
extern void rtems_putc(char c);

/*
 *  This routine is passed into RTEMS reporting functions
 *  that may have their output redirected.  In particular,
 *  the cpu usage, period usage, and stack usage reporting
 *  functions use this.  If the user provides their
 *  own "printf plugin", then they may redirect those reports
 *  as they see fit.
 */
extern int printk_plugin(void *context, const char *fmt, ...);

extern int rtems_printf_plugin(void *context, const char *fmt, ...);

/*
 *  Type definition for function which can be plugged in to
 *  certain reporting routines to redirect the output
 */
typedef int (*rtems_printk_plugin_t)(void *, const char *format, ...);

#ifdef __cplusplus
}
#endif

#endif