From af2b4914208cad676d64823f5e0bf08871617d80 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 28 Nov 2022 02:18:45 +0800 Subject: [PATCH] driver/segger: Move SYSLOG_RTT config from drivers/syslog to drivers/segger and remove include/nuttx/syslog/syslog_rtt.h Signed-off-by: Xiang Xiao --- drivers/segger/Kconfig | 7 ++++ drivers/segger/syslog_rtt.c | 4 +-- drivers/syslog/Kconfig | 7 ---- drivers/syslog/syslog_channel.c | 2 +- include/nuttx/segger/rtt.h | 7 ++++ include/nuttx/syslog/syslog_rtt.h | 54 ------------------------------- 6 files changed, 16 insertions(+), 65 deletions(-) delete mode 100644 include/nuttx/syslog/syslog_rtt.h diff --git a/drivers/segger/Kconfig b/drivers/segger/Kconfig index 434c3a0907..547728fc0e 100644 --- a/drivers/segger/Kconfig +++ b/drivers/segger/Kconfig @@ -85,6 +85,13 @@ config STREAM_RTT ---help--- Use Segger J-Link RTT as a stream input and output. +config SYSLOG_RTT + bool "Log to Segger J-Link RTT" + select SEGGER_RTT + default n + ---help--- + Use Segger J-Link RTT as a SYSLOG output device. + if SEGGER_SYSVIEW config SEGGER_SYSVIEW_RTT_CHANNEL diff --git a/drivers/segger/syslog_rtt.c b/drivers/segger/syslog_rtt.c index ed68c8893b..e7932e5e85 100644 --- a/drivers/segger/syslog_rtt.c +++ b/drivers/segger/syslog_rtt.c @@ -22,9 +22,7 @@ * Included Files ****************************************************************************/ -#include - -#include +#include #include diff --git a/drivers/syslog/Kconfig b/drivers/syslog/Kconfig index 2e3f9dba96..912ad2c6fb 100644 --- a/drivers/syslog/Kconfig +++ b/drivers/syslog/Kconfig @@ -223,13 +223,6 @@ config SYSLOG_RPMSG ---help--- Use the rpmsg as a SYSLOG output device, send message to remote proc. -config SYSLOG_RTT - bool "Log to Segger J-Link RTT" - select SEGGER_RTT - default n - ---help--- - Use Segger J-Link RTT as a SYSLOG output device. - config SYSLOG_CONSOLE bool "Log to /dev/console" default !ARCH_LOWPUTC && !SYSLOG_CHAR && !RAMLOG_SYSLOG && !SYSLOG_RPMSG && !SYSLOG_RTT diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c index 2c21f12b67..04a3a80057 100644 --- a/drivers/syslog/syslog_channel.c +++ b/drivers/syslog/syslog_channel.c @@ -41,7 +41,7 @@ #endif #ifdef CONFIG_SYSLOG_RTT -# include +# include #endif #ifdef CONFIG_ARCH_LOWPUTC diff --git a/include/nuttx/segger/rtt.h b/include/nuttx/segger/rtt.h index 2ad6f93469..aa4dc41024 100644 --- a/include/nuttx/segger/rtt.h +++ b/include/nuttx/segger/rtt.h @@ -27,6 +27,7 @@ #include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -91,6 +92,12 @@ void lib_rttinstream_open(FAR struct lib_rttinstream_s *stream, void lib_rttinstream_close(FAR struct lib_rttinstream_s *stream); #endif +#ifdef CONFIG_SYSLOG_RTT +int syslog_rtt_putc(FAR struct syslog_channel_s *channel, int ch); +ssize_t syslog_rtt_write(FAR struct syslog_channel_s *channel, + FAR const char *buffer, size_t buflen); +#endif + #ifdef __cplusplus } #endif diff --git a/include/nuttx/syslog/syslog_rtt.h b/include/nuttx/syslog/syslog_rtt.h deleted file mode 100644 index 9e5014bf1f..0000000000 --- a/include/nuttx/syslog/syslog_rtt.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** - * include/nuttx/syslog/syslog_rtt.h - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_SYSLOG_SYSLOG_RTT_H -#define __INCLUDE_NUTTX_SYSLOG_SYSLOG_RTT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -#ifdef CONFIG_SYSLOG_RTT -int syslog_rtt_putc(FAR struct syslog_channel_s *channel, int ch); -ssize_t syslog_rtt_write(FAR struct syslog_channel_s *channel, - FAR const char *buffer, size_t buflen); -#endif - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_SYSLOG_SYSLOG_RTT_H */