From 725201e3d8ad0a52a136a992e1b71c63c4c90389 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 8 Oct 2010 02:21:43 +0000 Subject: [PATCH] Add beginnings of a serial console git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2977 42af7a65-404d-4744-a932-0658087f49c3 --- arch/avr/src/at91uc3/Make.defs | 2 +- arch/avr/src/at91uc3/at91uc3_internal.h | 18 +++- arch/avr/src/at91uc3/at91uc3_lowconsole.c | 105 ++++++++++++++++++++++ arch/avr/src/at91uc3/at91uc3_lowinit.c | 12 ++- arch/avr/src/at91uc3/at91uc3_serial.c | 18 ---- 5 files changed, 129 insertions(+), 26 deletions(-) create mode 100644 arch/avr/src/at91uc3/at91uc3_lowconsole.c diff --git a/arch/avr/src/at91uc3/Make.defs b/arch/avr/src/at91uc3/Make.defs index fc460ad28f..88083f6fe5 100755 --- a/arch/avr/src/at91uc3/Make.defs +++ b/arch/avr/src/at91uc3/Make.defs @@ -50,7 +50,7 @@ CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ # Required AT91UC3 files CHIP_ASRCS = -CHIP_CSRCS = at91uc3_lowinit.c at91uc3_serial.c +CHIP_CSRCS = at91uc3_lowconsole.c at91uc3_lowinit.c at91uc3_serial.c # Configuration-dependent AT91UC3 files diff --git a/arch/avr/src/at91uc3/at91uc3_internal.h b/arch/avr/src/at91uc3/at91uc3_internal.h index 6013b2f5ba..54c0d2c43c 100755 --- a/arch/avr/src/at91uc3/at91uc3_internal.h +++ b/arch/avr/src/at91uc3/at91uc3_internal.h @@ -59,17 +59,27 @@ ************************************************************************************/ /************************************************************************************ - * Name: at91uc3_clkinit + * Name: up_clkinit * * Description: * Initialiaze clock/PLL settings per the definitions in the board.h file. * ************************************************************************************/ -extern void at91uc3_clkinitialize(void); +extern void up_clkinitialize(void); /************************************************************************************ - * Name: at91uc3_boardinit + * Name: up_consoleinit + * + * Description: + * Initialize a console for debug output. + * + ************************************************************************************/ + +extern void up_consoleinit(void); + +/************************************************************************************ + * Name: up_boardinit * * Description: * This function must be provided by the board-specific logic in the directory @@ -77,7 +87,7 @@ extern void at91uc3_clkinitialize(void); * ************************************************************************************/ -extern void at91uc3_boardinitialize(void); +extern void up_boardinitialize(void); #endif /* __ARCH_AVR_SRC_AVR32_AT91UC3_INTERNAL_H */ diff --git a/arch/avr/src/at91uc3/at91uc3_lowconsole.c b/arch/avr/src/at91uc3/at91uc3_lowconsole.c new file mode 100644 index 0000000000..e12ee4cc75 --- /dev/null +++ b/arch/avr/src/at91uc3/at91uc3_lowconsole.c @@ -0,0 +1,105 @@ +/************************************************************************** + * arch/avr/src/at91uc3/at91uc3_lowconsole.c + * + * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT OWNER 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. + * + **************************************************************************/ + +/************************************************************************** + * Included Files + **************************************************************************/ + +#include + +#include "at91uc3_config.h" +#include "up_internal.h" +#include "at91uc3_internal.h" + +/************************************************************************** + * Private Definitions + **************************************************************************/ + +/************************************************************************** + * Private Types + **************************************************************************/ + +/************************************************************************** + * Private Function Prototypes + **************************************************************************/ + +/************************************************************************** + * Global Variables + **************************************************************************/ + +/************************************************************************** + * Private Variables + **************************************************************************/ + +/************************************************************************** + * Private Functions + **************************************************************************/ + +/************************************************************************** + * Public Functions + **************************************************************************/ + +/************************************************************************************ + * Name: up_consoleinit + * + * Description: + * Initialize a console for debug output. + * + ************************************************************************************/ + +void up_consoleinit(void) +{ +#warning "Not Implemented" +} + +/************************************************************************************ + * Name: up_lowputc + * + * Description: + * Output one byte on the serial console + * + ************************************************************************************/ + +void up_lowputc(char ch) +{ +#ifdef HAVE_SERIAL_CONSOLE + /* Wait until the TX data register is empty */ +#warning "Not Implemented" + + /* Then send the character */ +#warning "Not Implemented" +#endif +} + diff --git a/arch/avr/src/at91uc3/at91uc3_lowinit.c b/arch/avr/src/at91uc3/at91uc3_lowinit.c index fc2f38e32d..38aa67937c 100644 --- a/arch/avr/src/at91uc3/at91uc3_lowinit.c +++ b/arch/avr/src/at91uc3/at91uc3_lowinit.c @@ -85,17 +85,23 @@ void up_lowinit(void) { /* Initialize MCU clocking */ - at91uc3_clkinitialize(); + up_clkinitialize(); + + /* Initialize a console */ + + up_consoleinit(); /* Perform early serial initialization (so that we will have debug output - * available as soon as possible. + * available as soon as possible). */ +#ifdef CONFIG_USE_SERIALDRIVER up_earlyserialinit(); +#endif /* Perform board-level initialization */ - at91uc3_boardinitialize(); + up_boardinitialize(); } diff --git a/arch/avr/src/at91uc3/at91uc3_serial.c b/arch/avr/src/at91uc3/at91uc3_serial.c index f5d80ebf97..8936298d29 100644 --- a/arch/avr/src/at91uc3/at91uc3_serial.c +++ b/arch/avr/src/at91uc3/at91uc3_serial.c @@ -902,21 +902,3 @@ int up_putc(int ch) #endif /* CONFIG_USE_SERIALDRIVER */ -/************************************************************************** - * Name: up_lowputc - * - * Description: - * Output one byte on the serial console - * - **************************************************************************/ - -void up_lowputc(char ch) -{ -#ifdef HAVE_SERIAL_CONSOLE - /* Wait until the TX data register is empty */ -#warning "Not Implemented" - - /* Then send the character */ -#warning "Not Implemented" -#endif -}