1/*
2 * Copyright 2014, General Dynamics C4 Systems
3 *
4 * This software may be distributed and modified according to the terms of
5 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
6 * See "LICENSE_GPLv2.txt" for details.
7 *
8 * @TAG(GD_GPL)
9 */
10
11#ifndef __MACHINE_IO_H_
12#define __MACHINE_IO_H_
13
14#include <config.h>
15#include <util.h>
16#include <arch/types.h>
17
18#define FORMAT(archetype, string_index, first_to_check) \
19        __attribute__((format(archetype, string_index, first_to_check)))
20
21#if (defined CONFIG_DEBUG_BUILD) || (defined CONFIG_PRINTING)
22/* most arm platforms just call this for putConsoleChar, so
23 * prototype it here */
24void putDebugChar(unsigned char c);
25#endif
26
27#ifdef CONFIG_DEBUG_BUILD
28/* io for dumping capdl */
29unsigned char getDebugChar(void);
30#endif
31
32#ifdef CONFIG_PRINTING
33/* printf will result in output */
34void putConsoleChar(unsigned char c);
35void putchar(char c);
36#define kernel_putchar(c) putchar(c)
37word_t kprintf(const char *format, ...) VISIBLE FORMAT(printf, 1, 2);
38word_t puts(const char *s) VISIBLE;
39word_t print_unsigned_long(unsigned long x, word_t ui_base) VISIBLE;
40#define printf(args...) kprintf(args)
41#else /* CONFIG_PRINTING */
42/* printf will NOT result in output */
43#define kernel_putchar(c) ((void)(0))
44#define printf(args...) ((void)(0))
45#define puts(s) ((void)(0))
46#endif /* CONFIG_PRINTING */
47
48#endif /* __MACHINE_IO_H_ */
49