summaryrefslogtreecommitdiff
path: root/payloads/libpayload/curses
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2015-06-29 15:47:34 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-06-30 18:55:15 +0200
commit1b4d39428eac80bc76713b1f21a2c85e8900c1b8 (patch)
treee2b9dfea6be47c785fa55964950c691643d0a232 /payloads/libpayload/curses
parentde60c8899680f362a908d68efe9e4154ab3380be (diff)
downloadcoreboot-1b4d39428eac80bc76713b1f21a2c85e8900c1b8.tar.xz
libpayload: Make Kconfig bools use IS_ENABLED()
This will make the code work with the different styles of Kconfig (emit unset bools vs don't emit unset bools) Roughly, the patch does this, and a little bit of fixing up: perl -pi -e 's,ifdef (CONFIG_LP_.+?)\b,if IS_ENABLED\($1\),g' `find . -name *.[ch]` perl -pi -e 's,ifndef (CONFIG_LP_.+?)\b,if !IS_ENABLED\($1\),g' `find . -name *.[ch]` Change-Id: Ib8a839b056a1f806a8597052e1b571ea3d18a79f Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: http://review.coreboot.org/10711 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'payloads/libpayload/curses')
-rw-r--r--payloads/libpayload/curses/keyboard.c15
-rw-r--r--payloads/libpayload/curses/local.h4
-rw-r--r--payloads/libpayload/curses/pdcurses-backend/pdcdisp.c16
-rw-r--r--payloads/libpayload/curses/pdcurses-backend/pdckbd.c14
-rw-r--r--payloads/libpayload/curses/pdcurses-backend/pdcscrn.c2
-rw-r--r--payloads/libpayload/curses/pdcurses-backend/pdcsetsc.c4
-rw-r--r--payloads/libpayload/curses/pdcurses-backend/pdcutil.c2
-rw-r--r--payloads/libpayload/curses/tinycurses.c30
8 files changed, 44 insertions, 43 deletions
diff --git a/payloads/libpayload/curses/keyboard.c b/payloads/libpayload/curses/keyboard.c
index 315653b784..f571d564ff 100644
--- a/payloads/libpayload/curses/keyboard.c
+++ b/payloads/libpayload/curses/keyboard.c
@@ -45,7 +45,7 @@ static int _halfdelay = 0;
/* ============== Serial ==================== */
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
/* We treat serial like a vt100 terminal. For now we
do the cooking in here, but we should probably eventually
pass it to dedicated vt100 code */
@@ -146,12 +146,13 @@ static int cook_serial(unsigned char ch)
static int curses_getchar(int _delay)
{
-#if defined(CONFIG_LP_USB_HID) || defined(CONFIG_LP_PC_KEYBOARD) || defined(CONFIG_LP_SERIAL_CONSOLE)
+#if IS_ENABLED(CONFIG_LP_USB_HID) || IS_ENABLED(CONFIG_LP_PC_KEYBOARD) || \
+ IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
unsigned short c;
#endif
do {
-#ifdef CONFIG_LP_USB_HID
+#if IS_ENABLED(CONFIG_LP_USB_HID)
usb_poll();
if ((curses_flags & F_ENABLE_CONSOLE) &&
usbhid_havechar()) {
@@ -159,7 +160,7 @@ static int curses_getchar(int _delay)
if (c != 0) return c;
}
#endif
-#ifdef CONFIG_LP_PC_KEYBOARD
+#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD)
if ((curses_flags & F_ENABLE_CONSOLE) &&
keyboard_havechar()) {
c = keyboard_getchar();
@@ -167,7 +168,7 @@ static int curses_getchar(int _delay)
}
#endif
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if ((curses_flags & F_ENABLE_SERIAL) &&
serial_havechar()) {
c = serial_getchar();
@@ -225,7 +226,7 @@ int nocbreak(void)
return 0;
}
-#ifdef CONFIG_LP_VGA_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VGA_VIDEO_CONSOLE)
void curses_enable_vga(int state)
{
if (state)
@@ -243,7 +244,7 @@ void curses_enable_vga(int state) { }
int curses_vga_enabled(void) { return 0; }
#endif
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
void curses_enable_serial(int state)
{
if (state)
diff --git a/payloads/libpayload/curses/local.h b/payloads/libpayload/curses/local.h
index 73fb005c5a..660f5db581 100644
--- a/payloads/libpayload/curses/local.h
+++ b/payloads/libpayload/curses/local.h
@@ -70,13 +70,13 @@
/* Flags used to determine what output methods are available */
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
#define F_ENABLE_CONSOLE 0x01
#else
#define F_ENABLE_CONSOLE 0x00
#endif
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
#define F_ENABLE_SERIAL 0x02
#else
#define F_ENABLE_SERIAL 0x00
diff --git a/payloads/libpayload/curses/pdcurses-backend/pdcdisp.c b/payloads/libpayload/curses/pdcurses-backend/pdcdisp.c
index 6b13b27b3b..af1b50a3eb 100644
--- a/payloads/libpayload/curses/pdcurses-backend/pdcdisp.c
+++ b/payloads/libpayload/curses/pdcurses-backend/pdcdisp.c
@@ -66,8 +66,8 @@ chtype fallback_acs_map[128] =
'|', '<', '>', '*', '!', 'f', 'o', ' ',
};
-#ifdef CONFIG_LP_SERIAL_CONSOLE
-#ifdef CONFIG_LP_SERIAL_ACS_FALLBACK
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
+#if IS_ENABLED(CONFIG_LP_SERIAL_ACS_FALLBACK)
chtype serial_acs_map[128];
#else
/* See acsc of vt100. */
@@ -93,7 +93,7 @@ chtype serial_acs_map[128] =
#endif
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
/* See acsc of linux. */
chtype console_acs_map[128] =
{
@@ -122,10 +122,10 @@ void PDC_gotoyx(int row, int col)
{
PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
serial_set_cursor(col, row);
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
video_console_set_cursor(col, row);
#endif
}
@@ -139,7 +139,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
PDC_LOG(("PDC_transform_line() - called: line %d, len %d, curses_flags %d\n", lineno, len, curses_flags));
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
int serial_is_bold = 0;
int serial_is_reverse = 0;
int serial_is_altcharset = 0;
@@ -157,7 +157,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
{
ch = srcp[j];
attr = ch;
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if (curses_flags & F_ENABLE_SERIAL) {
if (attr & A_BOLD) {
if (!serial_is_bold) {
@@ -222,7 +222,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
}
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
unsigned char c = pdc_atrtab[srcp[j] >> PDC_ATTR_SHIFT];
if (curses_flags & F_ENABLE_CONSOLE) {
diff --git a/payloads/libpayload/curses/pdcurses-backend/pdckbd.c b/payloads/libpayload/curses/pdcurses-backend/pdckbd.c
index d1061b2499..c872262fd3 100644
--- a/payloads/libpayload/curses/pdcurses-backend/pdckbd.c
+++ b/payloads/libpayload/curses/pdcurses-backend/pdckbd.c
@@ -5,7 +5,7 @@
unsigned long pdc_key_modifiers = 0L;
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
/* We treat serial like a vt100 terminal. For now we
do the cooking in here, but we should probably eventually
pass it to dedicated vt100 code */
@@ -108,7 +108,7 @@ void PDC_set_keyboard_binary(bool on)
bool PDC_check_key(void)
{
-#ifdef CONFIG_LP_USB_HID
+#if IS_ENABLED(CONFIG_LP_USB_HID)
usb_poll();
if ((curses_flags & F_ENABLE_CONSOLE) &&
usbhid_havechar()) {
@@ -116,14 +116,14 @@ bool PDC_check_key(void)
}
#endif
-#ifdef CONFIG_LP_PC_KEYBOARD
+#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD)
if ((curses_flags & F_ENABLE_CONSOLE) &&
keyboard_havechar()) {
return TRUE;
}
#endif
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if ((curses_flags & F_ENABLE_SERIAL) &&
serial_havechar()) {
return TRUE;
@@ -139,7 +139,7 @@ int PDC_get_key(void)
{
int c = 0;
-#ifdef CONFIG_LP_USB_HID
+#if IS_ENABLED(CONFIG_LP_USB_HID)
usb_poll();
if ((curses_flags & F_ENABLE_CONSOLE) &&
usbhid_havechar()) {
@@ -147,14 +147,14 @@ int PDC_get_key(void)
}
#endif
-#ifdef CONFIG_LP_PC_KEYBOARD
+#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD)
if ((curses_flags & F_ENABLE_CONSOLE) &&
keyboard_havechar() && (c==0)) {
c = keyboard_getchar();
}
#endif
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if ((curses_flags & F_ENABLE_SERIAL) &&
serial_havechar() && (c==0)) {
c = cook_serial(serial_getchar());
diff --git a/payloads/libpayload/curses/pdcurses-backend/pdcscrn.c b/payloads/libpayload/curses/pdcurses-backend/pdcscrn.c
index c4922ec409..e33edc2167 100644
--- a/payloads/libpayload/curses/pdcurses-backend/pdcscrn.c
+++ b/payloads/libpayload/curses/pdcurses-backend/pdcscrn.c
@@ -72,7 +72,7 @@ int PDC_scr_open(int argc, char **argv)
SP->lines = PDC_get_rows();
SP->cols = PDC_get_columns();
-#ifdef CONFIG_LP_SPEAKER
+#if IS_ENABLED(CONFIG_LP_SPEAKER)
SP->audible = TRUE;
#endif
diff --git a/payloads/libpayload/curses/pdcurses-backend/pdcsetsc.c b/payloads/libpayload/curses/pdcurses-backend/pdcsetsc.c
index b2997a16f9..ba230c654b 100644
--- a/payloads/libpayload/curses/pdcurses-backend/pdcsetsc.c
+++ b/payloads/libpayload/curses/pdcurses-backend/pdcsetsc.c
@@ -13,12 +13,12 @@ int PDC_curs_set(int visibility)
ret_vis = SP->visibility;
SP->visibility = visibility;
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if (curses_flags & F_ENABLE_SERIAL) {
serial_cursor_enable(visibility);
}
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
if (curses_flags & F_ENABLE_CONSOLE) {
video_console_cursor_enable(visibility);
}
diff --git a/payloads/libpayload/curses/pdcurses-backend/pdcutil.c b/payloads/libpayload/curses/pdcurses-backend/pdcutil.c
index 70853dc169..d423f0cf29 100644
--- a/payloads/libpayload/curses/pdcurses-backend/pdcutil.c
+++ b/payloads/libpayload/curses/pdcurses-backend/pdcutil.c
@@ -11,7 +11,7 @@ void PDC_beep(void)
{
PDC_LOG(("PDC_beep() - called\n"));
-#ifdef CONFIG_LP_SPEAKER
+#if IS_ENABLED(CONFIG_LP_SPEAKER)
speaker_tone(1760, 500); /* 1760 == note A6 */
#endif
}
diff --git a/payloads/libpayload/curses/tinycurses.c b/payloads/libpayload/curses/tinycurses.c
index d5bf23f1af..6f3f8b8d82 100644
--- a/payloads/libpayload/curses/tinycurses.c
+++ b/payloads/libpayload/curses/tinycurses.c
@@ -111,8 +111,8 @@ chtype fallback_acs_map[128] =
'|', '<', '>', '*', '!', 'f', 'o', ' ',
};
-#ifdef CONFIG_LP_SERIAL_CONSOLE
-#ifdef CONFIG_LP_SERIAL_ACS_FALLBACK
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
+#if IS_ENABLED(CONFIG_LP_SERIAL_ACS_FALLBACK)
chtype serial_acs_map[128];
#else
/* See acsc of vt100. */
@@ -138,7 +138,7 @@ chtype serial_acs_map[128] =
#endif
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
/* See acsc of linux. */
chtype console_acs_map[128] =
{
@@ -191,7 +191,7 @@ NCURSES_CH_T _nc_render(WINDOW *win, NCURSES_CH_T ch)
int beep(void)
{
/* TODO: Flash the screen if beeping fails? */
-#ifdef CONFIG_LP_SPEAKER
+#if IS_ENABLED(CONFIG_LP_SPEAKER)
speaker_tone(1760, 500); /* 1760 == note A6 */
#endif
return OK;
@@ -202,12 +202,12 @@ int cbreak(void) { /* TODO */ return 0; }
// int color_content(short color, short *r, short *g, short *b) {}
int curs_set(int on)
{
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if (curses_flags & F_ENABLE_SERIAL) {
serial_cursor_enable(on);
}
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
if (curses_flags & F_ENABLE_CONSOLE) {
video_console_cursor_enable(on);
}
@@ -315,12 +315,12 @@ WINDOW *initscr(void)
for (i = 0; i < 128; i++)
acs_map[i] = (chtype) i | A_ALTCHARSET;
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if (curses_flags & F_ENABLE_SERIAL) {
serial_clear();
}
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
if (curses_flags & F_ENABLE_CONSOLE) {
/* Clear the screen and kill the cursor */
@@ -719,7 +719,7 @@ int whline(WINDOW *win, chtype ch, int n)
(((c) & 0x4400) >> 2) | ((c) & 0xAA00) | (((c) & 0x1100) << 2)
int wnoutrefresh(WINDOW *win)
{
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
// FIXME.
int serial_is_bold = 0;
int serial_is_reverse = 0;
@@ -732,7 +732,7 @@ int wnoutrefresh(WINDOW *win)
int x, y;
chtype ch;
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
serial_end_bold();
serial_end_altcharset();
#endif
@@ -744,7 +744,7 @@ int wnoutrefresh(WINDOW *win)
/* Position the serial cursor */
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if (curses_flags & F_ENABLE_SERIAL)
serial_set_cursor(win->_begy + y, win->_begx +
win->_line[y].firstchar);
@@ -753,7 +753,7 @@ int wnoutrefresh(WINDOW *win)
for (x = win->_line[y].firstchar; x <= win->_line[y].lastchar; x++) {
attr_t attr = win->_line[y].text[x].attr;
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if (curses_flags & F_ENABLE_SERIAL) {
ch = win->_line[y].text[x].chars[0];
@@ -819,7 +819,7 @@ int wnoutrefresh(WINDOW *win)
}
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
unsigned int c =
((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
@@ -860,12 +860,12 @@ int wnoutrefresh(WINDOW *win)
win->_line[y].lastchar = _NOCHANGE;
}
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
if (curses_flags & F_ENABLE_SERIAL)
serial_set_cursor(win->_begy + win->_cury, win->_begx + win->_curx);
#endif
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
if (curses_flags & F_ENABLE_CONSOLE)
video_console_set_cursor(win->_begx + win->_curx, win->_begy + win->_cury);
#endif