Author: jcrouse Date: 2008-04-11 00:49:02 +0200 (Fri, 11 Apr 2008) New Revision: 3230
Added: trunk/payloads/libpayload/drivers/video/ trunk/payloads/libpayload/drivers/video/vga.c trunk/payloads/libpayload/drivers/video/video.c trunk/payloads/libpayload/include/video_console.h Removed: trunk/payloads/libpayload/drivers/vga.c Modified: trunk/payloads/libpayload/Config.in trunk/payloads/libpayload/curses/local.h trunk/payloads/libpayload/curses/tinycurses.c trunk/payloads/libpayload/drivers/Makefile.inc trunk/payloads/libpayload/include/libpayload.h trunk/payloads/libpayload/libc/console.c Log: libpayload: Add video console framework
Add a framework for multiple video console drivers. This is to prepare for the Geode driver.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/payloads/libpayload/Config.in =================================================================== --- trunk/payloads/libpayload/Config.in 2008-04-10 17:57:42 UTC (rev 3229) +++ trunk/payloads/libpayload/Config.in 2008-04-10 22:49:02 UTC (rev 3230) @@ -59,13 +59,17 @@ depends SERIAL_SET_SPEED default 115200
-config VGA_CONSOLE - bool "See output on a VGA console" +config VIDEO_CONSOLE + bool "See output on a video console" default y
+config VGA_VIDEO_CONSOLE + bool "VGA video console driver" + depends on VIDEO_CONSOLE + default y + config PC_KEYBOARD bool "Allow input from a PC keyboard" - depends VGA_CONSOLE default y
config NVRAM
Modified: trunk/payloads/libpayload/curses/local.h =================================================================== --- trunk/payloads/libpayload/curses/local.h 2008-04-10 17:57:42 UTC (rev 3229) +++ trunk/payloads/libpayload/curses/local.h 2008-04-10 22:49:02 UTC (rev 3230) @@ -69,7 +69,7 @@
/* Flags used to determine what output methods are available */
-#ifdef CONFIG_VGA_CONSOLE +#ifdef CONFIG_VIDEO_CONSOLE #define F_ENABLE_CONSOLE 0x01 #else #define F_ENABLE_CONSOLE 0x00
Modified: trunk/payloads/libpayload/curses/tinycurses.c =================================================================== --- trunk/payloads/libpayload/curses/tinycurses.c 2008-04-10 17:57:42 UTC (rev 3229) +++ trunk/payloads/libpayload/curses/tinycurses.c 2008-04-10 22:49:02 UTC (rev 3230) @@ -219,9 +219,10 @@ // def_prog_mode();
if (curses_flags & F_ENABLE_CONSOLE) { - /* Clear the screen and kill the cursor. */ - vga_clear(); - vga_cursor_enable(0); + /* Clear the screen and kill the cursor */ + + video_console_clear(); + video_console_cursor_enable(0); }
// Speaker init? @@ -586,7 +587,7 @@ * but this will break wide characters! */ c |= (chtype) (win->_line[y].text[x].chars[0] & 0xff); - vga_putc(y, x, c); + video_console_putc(y, x, c); } } }
Modified: trunk/payloads/libpayload/drivers/Makefile.inc =================================================================== --- trunk/payloads/libpayload/drivers/Makefile.inc 2008-04-10 17:57:42 UTC (rev 3229) +++ trunk/payloads/libpayload/drivers/Makefile.inc 2008-04-10 22:49:02 UTC (rev 3230) @@ -29,6 +29,9 @@ ##
TARGETS-$(CONFIG_SERIAL_CONSOLE) += drivers/serial.o -TARGETS-$(CONFIG_VGA_CONSOLE) += drivers/vga.o TARGETS-$(CONFIG_PC_KEYBOARD) += drivers/keyboard.o TARGETS-$(CONFIG_NVRAM) += drivers/nvram.o + +# Video console drivers +TARGETS-$(CONFIG_VIDEO_CONSOLE) += drivers/video/video.o +TARGETS-$(CONFIG_VGA_VIDEO_CONSOLE) += drivers/video/vga.o
Deleted: trunk/payloads/libpayload/drivers/vga.c =================================================================== --- trunk/payloads/libpayload/drivers/vga.c 2008-04-10 17:57:42 UTC (rev 3229) +++ trunk/payloads/libpayload/drivers/vga.c 2008-04-10 22:49:02 UTC (rev 3230) @@ -1,212 +0,0 @@ -/* - * This file is part of the libpayload project. - * - * Copyright (C) 2008 Advanced Micro Devices, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <arch/types.h> -#include <libpayload.h> - -#define WIDTH 80 -#define HEIGHT 25 - -#define VGA_COLOR_WHITE 7 - -#define CRTC_INDEX 0x3d4 -#define CRTC_DATA 0x3d5 - -#define VIDEO(_r, _c) \ - ((uint16_t *) (0xB8000 + ((_r) * (WIDTH * 2)) + ((_c) * 2))) - -static int cursor_enabled; -static int cursorx; -static int cursory; - -static void vga_scroll_up(void); - -static inline uint8_t crtc_read(uint8_t index) -{ - outb(index, CRTC_INDEX); - return inb(CRTC_DATA); -} - -static inline void crtc_write(uint8_t data, uint8_t index) -{ - outb(index, CRTC_INDEX); - outb(data, CRTC_DATA); -} - -static void vga_get_cursor_pos(void) -{ - unsigned int addr; - - addr = ((unsigned int)crtc_read(0x0E)) << 8; - addr += crtc_read(0x0F); - - cursorx = addr % WIDTH; - cursory = addr / WIDTH; -} - -static void vga_fixup_cursor(void) -{ - unsigned int addr; - - if (!cursor_enabled) - return; - - if (cursorx < 0) - cursorx = 0; - - if (cursory < 0) - cursory = 0; - - if (cursorx >= WIDTH) { - cursorx = 0; - cursory++; - } - - while (cursory >= HEIGHT) - vga_scroll_up(); - - addr = cursorx + (WIDTH * cursory); - crtc_write(addr >> 8, 0x0E); - crtc_write(addr, 0x0F); -} - -void vga_cursor_enable(int state) -{ - unsigned char tmp = crtc_read(0x0a); - - if (state == 0) { - tmp |= (1 << 5); - cursor_enabled = 0; - } else { - tmp &= ~(1 << 5); - cursor_enabled = 1; - vga_fixup_cursor(); - } - - crtc_write(tmp, 0x0a); -} - -void vga_clear_line(uint8_t row, uint8_t ch, uint8_t attr) -{ - int col; - uint16_t *ptr = VIDEO(row, 0); - - for (col = 0; col < WIDTH; col++) - ptr[col] = ((attr & 0xFF) << 8) | (ch & 0xFF); -} - -static void vga_scroll_up(void) -{ - uint16_t *src = VIDEO(1, 0); - uint16_t *dst = VIDEO(0, 0); - int i; - - for (i = 0; i < (HEIGHT - 1) * WIDTH; i++) - *dst++ = *src++; - - vga_clear_line(HEIGHT - 1, ' ', VGA_COLOR_WHITE); - cursory--; -} - -void vga_fill(uint8_t ch, uint8_t attr) -{ - uint8_t row; - for (row = 0; row < HEIGHT; row++) - vga_clear_line(row, ch, attr); -} - -void vga_clear(void) -{ - vga_fill(' ', VGA_COLOR_WHITE); - vga_move_cursor(0, 0); -} - -void vga_putc(uint8_t row, uint8_t col, unsigned int c) -{ - uint16_t *ptr = VIDEO(row, col); - *ptr = (uint16_t) (c & 0xFFFF); -} - -void vga_putchar(unsigned int ch) -{ - - uint16_t *ptr; - - switch (ch & 0xFF) { - case '\r': - cursorx = 0; - break; - case '\n': - cursory++; - break; - case '\b': - cursorx--; - ptr = VIDEO(cursory, cursorx); - *ptr = (*ptr & 0xFF00) | ' '; - break; - case '\t': - cursorx = (cursorx + 8) & ~7; - break; - - default: - ptr = VIDEO(cursory, cursorx); - *ptr = (uint16_t) (ch & 0xFFFF); - cursorx++; - break; - } - - vga_fixup_cursor(); -} - -void vga_move_cursor(int x, int y) -{ - cursorx = x; - cursory = y; - - vga_fixup_cursor(); -} - -void vga_init(void) -{ - /* Get the position of the cursor. */ - vga_get_cursor_pos(); - - /* See if it currently enabled or not. */ - cursor_enabled = !(crtc_read(0x0A) & (1 << 5)); - - /* If the cursor is enabled, get us to a sane point. */ - if (cursor_enabled) { - /* Go to the next line. */ - if (cursorx) { - cursorx = 0; - cursory++; - } - vga_fixup_cursor(); - } -}
Added: trunk/payloads/libpayload/drivers/video/vga.c =================================================================== --- trunk/payloads/libpayload/drivers/video/vga.c (rev 0) +++ trunk/payloads/libpayload/drivers/video/vga.c 2008-04-10 22:49:02 UTC (rev 3230) @@ -0,0 +1,140 @@ +/* + * This file is part of the libpayload project. + * + * Copyright (C) 2008 Advanced Micro Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <libpayload.h> +#include <video_console.h> + +#define VGA_COLOR_WHITE 7 + +#define CRTC_INDEX 0x3d4 +#define CRTC_DATA 0x3d5 + +#define VIDEO(_r, _c)\ + ((u16 *) (0xB8000 + ((_r) * (VIDEO_COLS * 2)) + ((_c) * 2))) + +static u8 crtc_read(u8 index) +{ + outb(index, CRTC_INDEX); + return inb(CRTC_DATA); +} + +static void crtc_write(u8 data, u8 index) +{ + outb(index, CRTC_INDEX); + outb(data, CRTC_DATA); +} + +static void vga_get_cursor(unsigned int *x, unsigned int *y, unsigned int *en) +{ + unsigned int addr; + addr = ((unsigned int) crtc_read(0x0E)) << 8; + addr += crtc_read(0x0E); + + *x = addr % VIDEO_COLS; + *y = addr / VIDEO_COLS; + + *en = !(crtc_read(0x0A) & (1 << 5)); +} + +static void vga_set_cursor(unsigned int x, unsigned int y) +{ + unsigned int addr; + + addr = x + (VIDEO_COLS * y); + crtc_write(addr >> 8, 0x0E); + crtc_write(addr, 0x0E); +} + +static void vga_enable_cursor(int state) +{ + unsigned char tmp = crtc_read(0x0a); + + if (state == 0) + tmp |= (1 << 5); + + else + tmp &= ~(1 << 5); + + crtc_write(tmp, 0x0a); +} + +static void vga_clear_line(u8 row, u8 ch, u8 attr) +{ + int col; + u16 *ptr = VIDEO(0, row); + + for(col = 0; col < VIDEO_COLS; col++) + ptr[col] = ((attr & 0xFF) << 8) | (ch & 0xFF); +} + +static void vga_scroll_up(void) +{ + u16 *src = VIDEO(0,1); + u16 *dst = VIDEO(0,0); + int i; + + for(i = 0; i < (VIDEO_ROWS - 1) * VIDEO_COLS; i++) + *dst++ = *src++; + + vga_clear_line(VIDEO_ROWS - 1, ' ', VGA_COLOR_WHITE); +} + +static void vga_fill(u8 ch, u8 attr) +{ + u8 row; + for(row = 0; row < VIDEO_ROWS; row++) + vga_clear_line(row, ch, attr); +} + +static void vga_clear(void) +{ + vga_fill(' ', VGA_COLOR_WHITE); +} + +static void vga_putc(u8 row, u8 col, unsigned int c) +{ + u16 *ptr = VIDEO(row, col); + *ptr = (u16) (c & 0xFFFF); +} + +static int vga_init(void) +{ + return 0; +} + +struct video_console vga_video_console = { + .init = vga_init, + .putc = vga_putc, + .clear = vga_clear, + .scroll_up = vga_scroll_up, + + .get_cursor = vga_get_cursor, + .set_cursor = vga_set_cursor, + .enable_cursor = vga_enable_cursor, +};
Added: trunk/payloads/libpayload/drivers/video/video.c =================================================================== --- trunk/payloads/libpayload/drivers/video/video.c (rev 0) +++ trunk/payloads/libpayload/drivers/video/video.c 2008-04-10 22:49:02 UTC (rev 3230) @@ -0,0 +1,160 @@ +/* + * This file is part of the libpayload project. + * + * Copyright (C) 2008 Advanced Micro Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <libpayload.h> +#include <video_console.h> + +#ifdef CONFIG_VGA_VIDEO_CONSOLE +extern struct video_console vga_video_console; +#endif + +static struct video_console *console_list[] = +{ +#ifdef CONFIG_VGA_VIDEO_CONSOLE + &vga_video_console, +#endif +}; + +static struct video_console *console; + +static unsigned int cursorx; +static unsigned int cursory; +static unsigned int cursor_enabled = 1; + +static void video_console_fixup_cursor(void) +{ + if (!cursor_enabled) + return; + + if (cursorx < 0) + cursorx = 0; + + if (cursory < 0) + cursory = 0; + + if (cursorx > VIDEO_COLS) { + cursorx = 0; + cursory++; + } + + while(cursory >= VIDEO_ROWS) { + console->scroll_up(); + cursory--; + } + + if (console && console->set_cursor) + console->set_cursor(cursorx, cursory); +} + +void video_console_cursor_enable(int state) +{ + if (console && console->enable_cursor) + console->enable_cursor(state); + + cursor_enabled = state; + + if (cursor_enabled) + video_console_fixup_cursor(); +} + +void video_console_clear(void) +{ + if (console) + console->clear(); + + cursorx = 0; + cursory = 0; + + if (console && console->set_cursor) + console->set_cursor(cursorx, cursory); +} + +void video_console_putc(u8 row, u8 col, unsigned int ch) +{ + if (console) + console->putc(row, col, ch); +} + +void video_console_putchar(unsigned int ch) +{ + switch(ch & 0xFF) { + case '\r': + cursorx = 0; + break; + + case '\n': + cursory++; + break; + + case '\b': + cursorx--; + break; + + case '\t': + while(cursorx % 8 && cursorx < VIDEO_COLS) { + if (console) + console->putc(cursorx, cursory, (ch & 0xFF00) | ' '); + + cursorx++; + } + break; + default: + if (console) + console->putc(cursorx++, cursory, ch); + break; + } + + video_console_fixup_cursor(); +} + +int video_console_init(void) +{ + int i; + + for(i = 0; i < ARRAY_SIZE(console_list); i++) { + if (console_list[i]->init()) + continue; + + console = console_list[i]; + + if (console->get_cursor) + console->get_cursor(&cursorx, &cursory, &cursor_enabled); + + if (cursorx) { + cursorx = 0; + cursory++; + } + + video_console_fixup_cursor(); + return 0; + } + + return 0; +} +
Modified: trunk/payloads/libpayload/include/libpayload.h =================================================================== --- trunk/payloads/libpayload/include/libpayload.h 2008-04-10 17:57:42 UTC (rev 3229) +++ trunk/payloads/libpayload/include/libpayload.h 2008-04-10 22:49:02 UTC (rev 3230) @@ -78,15 +78,12 @@ int serial_havechar(void); int serial_getchar(void);
-/* drivers/serial.c */ -void vga_cursor_enable(int state); -void vga_clear_line(uint8_t row, uint8_t ch, uint8_t attr); -void vga_fill(uint8_t ch, uint8_t attr); -void vga_clear(void); -void vga_putc(uint8_t row, uint8_t col, unsigned int c); -void vga_putchar(unsigned int ch); -void vga_move_cursor(int x, int y); -void vga_init(void); +/* video/video.c */ +int video_console_init(void); +void video_console_putchar(unsigned int ch); +void video_console_putc(u8 row, u8 col, unsigned int ch); +void video_console_clear(void); +void video_console_cursor_enable(int state);
/* libc/console.c */ void console_init(void);
Added: trunk/payloads/libpayload/include/video_console.h =================================================================== --- trunk/payloads/libpayload/include/video_console.h (rev 0) +++ trunk/payloads/libpayload/include/video_console.h 2008-04-10 22:49:02 UTC (rev 3230) @@ -0,0 +1,47 @@ +/* + * This file is part of the libpayload project. + * + * Copyright (C) 2008 Advanced Micro Devices, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef VIDEO_CONSOLE_H_ +#define VIDEO_CONSOLE_H_ + +#define VIDEO_ROWS 25 +#define VIDEO_COLS 80 + +struct video_console { + int (*init)(void); + void (*putc)(u8, u8, unsigned int); + void (*clear)(void); + void (*scroll_up)(void); + + void (*get_cursor)(unsigned int *, unsigned int *, unsigned int *); + void (*set_cursor)(unsigned int, unsigned int); + void (*enable_cursor)(int); +}; + +#endif
Modified: trunk/payloads/libpayload/libc/console.c =================================================================== --- trunk/payloads/libpayload/libc/console.c 2008-04-10 17:57:42 UTC (rev 3229) +++ trunk/payloads/libpayload/libc/console.c 2008-04-10 22:49:02 UTC (rev 3230) @@ -31,8 +31,8 @@
void console_init(void) { -#ifdef CONFIG_VGA_CONSOLE - vga_init(); +#ifdef CONFIG_VIDEO_CONSOLE + video_console_init(); #endif #ifdef CONFIG_SERIAL_CONSOLE serial_init(); @@ -41,8 +41,8 @@
static void device_putchar(unsigned char c) { -#ifdef CONFIG_VGA_CONSOLE - vga_putchar(0x700 | c); +#ifdef CONFIG_VIDEO_CONSOLE + video_console_putchar(0x700| c); #endif #ifdef CONFIG_SERIAL_CONSOLE serial_putchar(c);