xiaoxiang781216 commented on code in PR #7554:
URL: https://github.com/apache/nuttx/pull/7554#discussion_r1033458751


##########
drivers/segger/serial_rtt.c:
##########
@@ -0,0 +1,368 @@
+/****************************************************************************
+ * drivers/segger/serial_rtt.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <assert.h>
+#include <debug.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <nuttx/kmalloc.h>
+#include <nuttx/kthread.h>
+#include <nuttx/list.h>
+#include <nuttx/serial/serial.h>
+
+#include <SEGGER_RTT.h>
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct rtt_dev_s

Review Comment:
   ```suggestion
   struct serial_rtt_dev_s
   ```



##########
drivers/segger/Kconfig:
##########
@@ -94,6 +94,47 @@ config SYSLOG_RTT
        ---help---
                Use Segger J-Link RTT as a SYSLOG output device.
 
+config SERIAL_RTT
+       bool "Segger RTT serial"
+       select SEGGER_RTT
+       select SERIAL_RXDMA
+       select SERIAL_TXDMA
+       default n
+       ---help---
+               This option is used to enable RTT serial device
+               In Segger RTT serial driver, RTT channel buffer and serial DMA 
buffer are shared,
+               So you cannot use RTT stream to operate it
+
+config SERIAL_RTT_POLLING_INTERVAL
+       int "Segger RTT serial pilling interval (us)"
+       default 10000
+       ---help---
+               This option is used to configure the RTT serial serial polling 
interval

Review Comment:
   ```suggestion
                This option is used to configure the RTT serial polling interval
   ```



##########
drivers/segger/serial_rtt.c:
##########
@@ -0,0 +1,368 @@
+/****************************************************************************
+ * drivers/segger/serial_rtt.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <assert.h>
+#include <debug.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <nuttx/kmalloc.h>
+#include <nuttx/kthread.h>
+#include <nuttx/list.h>
+#include <nuttx/serial/serial.h>
+
+#include <SEGGER_RTT.h>
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct rtt_dev_s
+{
+  int channel;
+  FAR char *txbuf;
+  FAR char *rxbuf;
+  struct list_node node;
+  struct uart_dev_s uart;
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int serial_rtt_setup(FAR struct uart_dev_s *dev);
+static void serial_rtt_shutdown(FAR struct uart_dev_s *dev);
+static int serial_rtt_attach(FAR struct uart_dev_s *dev);
+static void serial_rtt_detach(FAR struct uart_dev_s *dev);
+static int serial_rtt_ioctl(FAR struct file *filep, int cmd,
+                            unsigned long arg);
+static int serial_rtt_receive(FAR struct uart_dev_s *dev,
+                              unsigned int *status);
+static void serial_rtt_rxint(FAR struct uart_dev_s *dev, bool enable);
+static bool serial_rtt_rxavailable(FAR struct uart_dev_s *dev);
+static void serial_rtt_send(FAR struct uart_dev_s *dev, int ch);
+static void serial_rtt_txint(FAR struct uart_dev_s *dev, bool enable);
+static bool serial_rtt_txready(FAR struct uart_dev_s *dev);
+static bool serial_rtt_txempty(FAR struct uart_dev_s *dev);
+static void serial_rtt_dmasend(FAR struct uart_dev_s *dev);
+static void serial_rtt_dmareceive(FAR struct uart_dev_s *dev);
+static void serial_rtt_dmarxfree(FAR struct uart_dev_s *dev);
+static void serial_rtt_dmatxavail(FAR struct uart_dev_s *dev);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+struct list_node g_rtt_dev_list = LIST_INITIAL_VALUE(g_rtt_dev_list);

Review Comment:
   g_rtt_dev_list  to g_serial_rtt_list 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to