/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2009 by Bob Cousins * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ /* Include Standard files */ #include #include #include #include "inttypes.h" #include "string.h" #include "cpu.h" #include "system.h" #include "kernel.h" #include "thread.h" #include "system-target.h" #include "uart-s3c2440.h" #define MAX_PRINTF_BUF 1024 /**************************************************************************** * serial driver API ****************************************************************************/ void serial_setup (void) { uart_init(); uart_init_device(DEBUG_UART_PORT); } int tx_rdy(void) { if (uart_tx_ready (DEBUG_UART_PORT)) return 1; else return 0; } void tx_writec(unsigned char c) { uart_send_byte (DEBUG_UART_PORT, c); } /**************************************************************************** * General purpose debug function ****************************************************************************/ void uart_printf (const char *format, ...) { static bool debug_uart_init = false; static char tx_buf [MAX_PRINTF_BUF]; int len; unsigned char *ptr; int j; va_list ap; va_start(ap, format); ptr = tx_buf; len = vsnprintf(ptr, sizeof(tx_buf), format, ap); va_end(ap); if (!debug_uart_init) { uart_init_device(DEBUG_UART_PORT); debug_uart_init = true; } for (j=0; j