1 #ifndef CONSOLE_CONSOLE_H_
2 #define CONSOLE_CONSOLE_H_
5 #include <console/loglevel.h>
7 void console_init(void);
8 void console_tx_byte(unsigned char byte);
9 void console_tx_flush(void);
10 void post_code(uint8_t value);
13 struct console_driver {
15 void (*tx_byte)(unsigned char byte);
16 void (*tx_flush)(void);
19 #define __console __attribute__((unused, __section__ (".rodata.console_drivers")))
21 /* Defined by the linker... */
22 extern struct console_driver console_drivers[];
23 extern struct console_driver econsole_drivers[];
25 extern int console_loglevel;
26 int do_printk(int msg_level, const char *fmt, ...);
28 #define printk_emerg(fmt, arg...) do_printk(BIOS_EMERG ,fmt, ##arg)
29 #define printk_alert(fmt, arg...) do_printk(BIOS_ALERT ,fmt, ##arg)
30 #define printk_crit(fmt, arg...) do_printk(BIOS_CRIT ,fmt, ##arg)
31 #define printk_err(fmt, arg...) do_printk(BIOS_ERR ,fmt, ##arg)
32 #define printk_warning(fmt, arg...) do_printk(BIOS_WARNING ,fmt, ##arg)
33 #define printk_notice(fmt, arg...) do_printk(BIOS_NOTICE ,fmt, ##arg)
34 #define printk_info(fmt, arg...) do_printk(BIOS_INFO ,fmt, ##arg)
35 #define printk_debug(fmt, arg...) do_printk(BIOS_DEBUG ,fmt, ##arg)
36 #define printk_spew(fmt, arg...) do_printk(BIOS_SPEW ,fmt, ##arg)
38 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_EMERG
40 #define printk_emerg(fmt, arg...) do {} while(0)
42 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ALERT
44 #define printk_alart(fmt, arg...) do {} while(0)
46 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_CRIT
48 #define printk_crit(fmt, arg...) do {} while(0)
50 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ERR
52 #define printk_err(fmt, arg...) do {} while(0)
54 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_WARNING
56 #define printk_warning(fmt, arg...) do {} while(0)
58 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_NOTICE
60 #define printk_notice(fmt, arg...) do {} while(0)
62 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_INFO
64 #define printk_info(fmt, arg...) do {} while(0)
66 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_DEBUG
68 #define printk_debug(fmt, arg...) do {} while(0)
70 #if MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_SPEW
72 #define printk_spew(fmt, arg...) do {} while(0)
76 #endif /* CONSOLE_CONSOLE_H_ */