From 4965d0dc9967847e76795ef625de9a0e49228a80 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 4 Jun 2016 11:29:27 -0600 Subject: [PATCH] KL and LPC11: Perform similar name change as for STM32: xyz_lowputc -> up_putc --- arch/arm/src/kl/Make.defs | 2 +- arch/arm/src/kl/{kl_lowgetc.c => kl_getc.c} | 33 ++++----------- arch/arm/src/kl/{kl_lowgetc.h => kl_getc.h} | 40 ++++--------------- arch/arm/src/kl/kl_serial.c | 19 +-------- arch/arm/src/lpc11xx/Make.defs | 2 +- .../lpc11xx/{lpc11_lowgetc.c => lpc11_getc.c} | 30 +++----------- .../lpc11xx/{lpc11_lowgetc.h => lpc11_getc.h} | 37 +++-------------- arch/arm/src/lpc11xx/lpc11_serial.c | 16 -------- arch/arm/src/stm32/Make.defs | 2 +- arch/arm/src/stm32/stm32.h | 2 +- .../stm32/{stm32_lowgetc.c => stm32_getc.c} | 2 +- .../stm32/{stm32_lowgetc.h => stm32_getc.h} | 8 ++-- 12 files changed, 36 insertions(+), 157 deletions(-) rename arch/arm/src/kl/{kl_lowgetc.c => kl_getc.c} (77%) rename arch/arm/src/kl/{kl_lowgetc.h => kl_getc.h} (69%) rename arch/arm/src/lpc11xx/{lpc11_lowgetc.c => lpc11_getc.c} (79%) rename arch/arm/src/lpc11xx/{lpc11_lowgetc.h => lpc11_getc.h} (70%) rename arch/arm/src/stm32/{stm32_lowgetc.c => stm32_getc.c} (99%) rename arch/arm/src/stm32/{stm32_lowgetc.h => stm32_getc.h} (91%) diff --git a/arch/arm/src/kl/Make.defs b/arch/arm/src/kl/Make.defs index 68c58af802e..39308b6948c 100644 --- a/arch/arm/src/kl/Make.defs +++ b/arch/arm/src/kl/Make.defs @@ -70,7 +70,7 @@ CMN_CSRCS += up_dumpnvic.c endif CHIP_ASRCS = -CHIP_CSRCS = kl_clockconfig.c kl_gpio.c kl_idle.c kl_irq.c kl_lowgetc.c +CHIP_CSRCS = kl_clockconfig.c kl_gpio.c kl_idle.c kl_irq.c kl_getc.c CHIP_CSRCS += kl_lowputc.c kl_serial.c kl_start.c kl_cfmconfig.c ifneq ($(CONFIG_SCHED_TICKLESS),y) diff --git a/arch/arm/src/kl/kl_lowgetc.c b/arch/arm/src/kl/kl_getc.c similarity index 77% rename from arch/arm/src/kl/kl_lowgetc.c rename to arch/arm/src/kl/kl_getc.c index 8033ee732f8..cee3195dd08 100644 --- a/arch/arm/src/kl/kl_lowgetc.c +++ b/arch/arm/src/kl/kl_getc.c @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/arm/src/kl/kl_lowgetc.c + * arch/arm/src/kl/kl_getc.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,40 +41,23 @@ #include -#include -#include - -#include "up_internal.h" #include "up_arch.h" #include "kl_config.h" -#include "kl_lowgetc.h" - -#include "chip/kl_uart.h" +#include "kl_getc.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Select UART parameters for the selected console */ #if defined(CONFIG_UART0_SERIAL_CONSOLE) # define CONSOLE_BASE KL_UART0_BASE -# define CONSOLE_FREQ BOARD_CORECLK_FREQ -# define CONSOLE_BAUD CONFIG_UART0_BAUD -# define CONSOLE_BITS CONFIG_UART0_BITS -# define CONSOLE_PARITY CONFIG_UART0_PARITY #elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define CONSOLE_BASE KL_UART1_BASE -# define CONSOLE_FREQ BOARD_BUSCLK_FREQ -# define CONSOLE_BAUD CONFIG_UART1_BAUD -# define CONSOLE_BITS CONFIG_UART1_BITS -# define CONSOLE_PARITY CONFIG_UART1_PARITY #elif defined(CONFIG_UART2_SERIAL_CONSOLE) # define CONSOLE_BASE KL_UART2_BASE -# define CONSOLE_FREQ BOARD_BUSCLK_FREQ -# define CONSOLE_BAUD CONFIG_UART2_BAUD -# define CONSOLE_BITS CONFIG_UART2_BITS -# define CONSOLE_PARITY CONFIG_UART2_PARITY #endif /**************************************************************************** @@ -82,14 +65,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: kl_lowgetc + * Name: up_getc * * Description: * Input one byte from the serial console * ****************************************************************************/ -int kl_lowgetc(void) +int up_getc(void) { uint8_t ch = 0; @@ -98,11 +81,11 @@ int kl_lowgetc(void) * we have data in the buffer to read. */ - while ((getreg8(CONSOLE_BASE+KL_UART_S1_OFFSET) & UART_S1_RDRF) == 0); + while ((getreg8(CONSOLE_BASE + KL_UART_S1_OFFSET) & UART_S1_RDRF) == 0); /* Then read a character from the UART data register */ - ch = getreg8(CONSOLE_BASE+KL_UART_D_OFFSET); + ch = getreg8(CONSOLE_BASE + KL_UART_D_OFFSET); #endif return (int)ch; diff --git a/arch/arm/src/kl/kl_lowgetc.h b/arch/arm/src/kl/kl_getc.h similarity index 69% rename from arch/arm/src/kl/kl_lowgetc.h rename to arch/arm/src/kl/kl_getc.h index 625f534964e..aff6b2a0b37 100644 --- a/arch/arm/src/kl/kl_lowgetc.h +++ b/arch/arm/src/kl/kl_getc.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/kl/kl_lowgetc.h + * arch/arm/src/kl/kl_getc.h * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,42 +33,16 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_KL_KINETIS_LOWGETC_H -#define __ARCH_ARM_SRC_KL_KINETIS_LOWGETC_H +#ifndef __ARCH_ARM_SRC_KL_KINETIS_GETC_H +#define __ARCH_ARM_SRC_KL_KINETIS_GETC_H /************************************************************************************ * Included Files ************************************************************************************/ #include + #include "kl_config.h" +#include "chip/kl_uart.h" -/************************************************************************************ - * Public Data - ************************************************************************************/ - -#ifndef __ASSEMBLY__ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/************************************************************************************ - * Public Function Prototypes - ************************************************************************************/ - -#ifdef HAVE_SERIAL_CONSOLE -int kl_lowgetc(void); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_KL_KINETIS_LOWGETC_H */ +#endif /* __ARCH_ARM_SRC_KL_KINETIS_GETC_H */ diff --git a/arch/arm/src/kl/kl_serial.c b/arch/arm/src/kl/kl_serial.c index fb135ca7955..fab56a34d5e 100644 --- a/arch/arm/src/kl/kl_serial.c +++ b/arch/arm/src/kl/kl_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/kl/kl_serial.c * - * Copyright (C) 2013-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -59,15 +59,14 @@ #include "kl_config.h" #include "kl_lowputc.h" -#include "kl_lowgetc.h" #include "chip.h" #include "kl_gpio.h" #include "chip/kl_uart.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Some sanity checks *******************************************************/ /* Is there at least one UART enabled and configured as a RS-232 device? */ @@ -958,18 +957,4 @@ int up_putc(int ch) return ch; } -/**************************************************************************** - * Name: up_getc - * - * Description: - * Provide priority, low-level access to support OS debug writes - * - ****************************************************************************/ - -int up_getc(void) -{ - /* Check for LF */ - - return kl_lowgetc(); -} #endif /* USE_SERIALDRIVER */ diff --git a/arch/arm/src/lpc11xx/Make.defs b/arch/arm/src/lpc11xx/Make.defs index a40c1435455..fd0e046964d 100644 --- a/arch/arm/src/lpc11xx/Make.defs +++ b/arch/arm/src/lpc11xx/Make.defs @@ -71,7 +71,7 @@ endif CHIP_ASRCS = CHIP_CSRCS = lpc11_clockconfig.c lpc11_gpio.c lpc11_i2c.c lpc11_idle.c -CHIP_CSRCS += lpc11_irq.c lpc11_lowputc.c lpc11_lowgetc.c lpc11_serial.c +CHIP_CSRCS += lpc11_irq.c lpc11_lowputc.c lpc11_getc.c lpc11_serial.c CHIP_CSRCS += lpc11_spi.c lpc11_ssp.c lpc11_start.c # Configuration-dependent LPC11xx files diff --git a/arch/arm/src/lpc11xx/lpc11_lowgetc.c b/arch/arm/src/lpc11xx/lpc11_getc.c similarity index 79% rename from arch/arm/src/lpc11xx/lpc11_lowgetc.c rename to arch/arm/src/lpc11xx/lpc11_getc.c index a4c0f81c54d..9d733b2e3e7 100644 --- a/arch/arm/src/lpc11xx/lpc11_lowgetc.c +++ b/arch/arm/src/lpc11xx/lpc11_getc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lpc11/lpc11_lowgetc.c + * arch/arm/src/lpc11/lpc11_getc.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -41,42 +41,22 @@ #include -#include -#include - -#include "up_internal.h" #include "up_arch.h" -#include "chip/lpc11_syscon.h" -#include "chip/lpc11_uart.h" - -#include "lpc11_gpio.h" -#include "lpc11_lowgetc.h" -#include "lpc11_serial.h" +#include "lpc11_getc.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Select UART parameters for the selected console */ #if defined(CONFIG_UART0_SERIAL_CONSOLE) # define CONSOLE_BASE LPC11_UART0_BASE -# define CONSOLE_FREQ BOARD_CORECLK_FREQ -# define CONSOLE_BAUD CONFIG_UART0_BAUD -# define CONSOLE_BITS CONFIG_UART0_BITS -# define CONSOLE_PARITY CONFIG_UART0_PARITY #elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define CONSOLE_BASE LPC11_UART1_BASE -# define CONSOLE_FREQ BOARD_BUSCLK_FREQ -# define CONSOLE_BAUD CONFIG_UART1_BAUD -# define CONSOLE_BITS CONFIG_UART1_BITS -# define CONSOLE_PARITY CONFIG_UART1_PARITY #elif defined(CONFIG_UART2_SERIAL_CONSOLE) # define CONSOLE_BASE LPC11_UART2_BASE -# define CONSOLE_FREQ BOARD_BUSCLK_FREQ -# define CONSOLE_BAUD CONFIG_UART2_BAUD -# define CONSOLE_BITS CONFIG_UART2_BITS -# define CONSOLE_PARITY CONFIG_UART2_PARITY #endif /**************************************************************************** @@ -84,14 +64,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: lpc11_lowgetc + * Name: up_getc * * Description: * Input one byte from the serial console * ****************************************************************************/ -int lpc11_lowgetc(void) +int up_getc(void) { uint8_t ch = 0; diff --git a/arch/arm/src/lpc11xx/lpc11_lowgetc.h b/arch/arm/src/lpc11xx/lpc11_getc.h similarity index 70% rename from arch/arm/src/lpc11xx/lpc11_lowgetc.h rename to arch/arm/src/lpc11xx/lpc11_getc.h index 932898f3952..e00864bfc48 100644 --- a/arch/arm/src/lpc11xx/lpc11_lowgetc.h +++ b/arch/arm/src/lpc11xx/lpc11_getc.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lpc11/lpc11_lowgetc.h + * arch/arm/src/lpc11/lpc11_getc.h * * Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LPC11XX_LPC11_LOWGETC_H -#define __ARCH_ARM_SRC_LPC11XX_LPC11_LOWGETC_H +#ifndef __ARCH_ARM_SRC_LPC11XX_LPC11_GETC_H +#define __ARCH_ARM_SRC_LPC11XX_LPC11_GETC_H /************************************************************************************ * Included Files @@ -42,33 +42,6 @@ #include #include "lpc11_serial.h" +#include "chip/lpc11_uart.h" -/************************************************************************************ - * Public Data - ************************************************************************************/ - -#ifndef __ASSEMBLY__ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#ifdef HAVE_SERIAL_CONSOLE -int lpc11_lowgetc(void); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_LOWGETC_H */ +#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_GETC_H */ diff --git a/arch/arm/src/lpc11xx/lpc11_serial.c b/arch/arm/src/lpc11xx/lpc11_serial.c index 6bbd488a3ee..86e3feb11c5 100644 --- a/arch/arm/src/lpc11xx/lpc11_serial.c +++ b/arch/arm/src/lpc11xx/lpc11_serial.c @@ -64,7 +64,6 @@ #include "chip.h" #include "chip/lpc11_uart.h" #include "lpc11_gpio.h" -#include "lpc11_lowgetc.h" #include "lpc11_serial.h" /**************************************************************************** @@ -1041,19 +1040,4 @@ int up_putc(int ch) return ch; } -/**************************************************************************** - * Name: up_getc - * - * Description: - * Provide priority, low-level access to support OS debug writes - * - ****************************************************************************/ - -int up_getc(void) -{ - /* Check for LF */ - - return lpc11_lowgetc(); -} - #endif /* USE_SERIALDRIVER */ diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index 2cc901fb2c7..0b691c270d2 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -110,7 +110,7 @@ CHIP_ASRCS = CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c CHIP_CSRCS += stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c -CHIP_CSRCS += stm32_irq.c stm32_dma.c stm32_lowputc.c stm32_lowgetc.c +CHIP_CSRCS += stm32_irq.c stm32_dma.c stm32_lowputc.c stm32_getc.c CHIP_CSRCS += stm32_serial.c stm32_spi.c stm32_sdio.c stm32_tim.c CHIP_CSRCS += stm32_waste.c stm32_ccm.c stm32_uid.c stm32_capture.c diff --git a/arch/arm/src/stm32/stm32.h b/arch/arm/src/stm32/stm32.h index 8e75e4e9d71..7ae058ee053 100644 --- a/arch/arm/src/stm32/stm32.h +++ b/arch/arm/src/stm32/stm32.h @@ -92,7 +92,7 @@ #include "stm32_usbdev.h" #include "stm32_wdg.h" #include "stm32_lowputc.h" -#include "stm32_lowgetc.h" +#include "stm32_getc.h" #include "stm32_eth.h" #endif /* __ARCH_ARM_SRC_STM32_STM32_H */ diff --git a/arch/arm/src/stm32/stm32_lowgetc.c b/arch/arm/src/stm32/stm32_getc.c similarity index 99% rename from arch/arm/src/stm32/stm32_lowgetc.c rename to arch/arm/src/stm32/stm32_getc.c index 4e080b828ac..e5fbb0fa3dd 100644 --- a/arch/arm/src/stm32/stm32_lowgetc.c +++ b/arch/arm/src/stm32/stm32_getc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32/stm32_lowgetc.c + * arch/arm/src/stm32/stm32_getc.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/arch/arm/src/stm32/stm32_lowgetc.h b/arch/arm/src/stm32/stm32_getc.h similarity index 91% rename from arch/arm/src/stm32/stm32_lowgetc.h rename to arch/arm/src/stm32/stm32_getc.h index 624e6272f42..651165fba5e 100644 --- a/arch/arm/src/stm32/stm32_lowgetc.h +++ b/arch/arm/src/stm32/stm32_getc.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/stm32/stm32_lowgetc.h + * arch/arm/src/stm32/stm32_getc.h * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32_STM32_LOWGETC_H -#define __ARCH_ARM_SRC_STM32_STM32_LOWGETC_H +#ifndef __ARCH_ARM_SRC_STM32_STM32_GETC_H +#define __ARCH_ARM_SRC_STM32_STM32_GETC_H /************************************************************************************ * Included Files @@ -44,4 +44,4 @@ #include "chip.h" -#endif /* __ARCH_ARM_SRC_STM32_STM32_LOWGETC_H */ +#endif /* __ARCH_ARM_SRC_STM32_STM32_GETC_H */