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


##########
include/nuttx/pcnt/pcnt.h:
##########
@@ -0,0 +1,96 @@
+/****************************************************************************
+ * include/nuttx/pcnt/pcnt.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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_PCNT_PCNT_H
+#define __INCLUDE_NUTTX_PCNT_PCNT_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <nuttx/fs/ioctl.h>
+
+#ifdef CONFIG_PCNT
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct pcnt_dev_s;
+
+/* The pcnt peripheral vtable */
+
+struct pcnt_ops_s
+{
+  CODE int      (*open)(FAR struct pcnt_dev_s *dev);
+  CODE int      (*close)(FAR struct pcnt_dev_s *dev);
+  CODE ssize_t  (*read)(FAR struct pcnt_dev_s *dev,
+                        FAR char *buffer,
+                        size_t buflen);
+  CODE int      (*ioctl)(FAR struct pcnt_dev_s *dev,
+                         int cmd, unsigned long arg);

Review Comment:
   should we define some standard ioctl



##########
include/nuttx/pcnt/pcntchar.h:
##########
@@ -1,5 +1,7 @@
 /****************************************************************************
- * boards/risc-v/esp32c6/common/src/esp_board_qencoder.c
+ * include/nuttx/pcnt/pcntchar.h
+ *
+ * SPDX-License-Identifier: Apache-2.0

Review Comment:
   dup License



##########
include/nuttx/pcnt/pcnt.h:
##########
@@ -0,0 +1,96 @@
+/****************************************************************************
+ * include/nuttx/pcnt/pcnt.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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_PCNT_PCNT_H
+#define __INCLUDE_NUTTX_PCNT_PCNT_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <nuttx/fs/ioctl.h>
+
+#ifdef CONFIG_PCNT
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct pcnt_dev_s;
+
+/* The pcnt peripheral vtable */
+
+struct pcnt_ops_s
+{
+  CODE int      (*open)(FAR struct pcnt_dev_s *dev);
+  CODE int      (*close)(FAR struct pcnt_dev_s *dev);
+  CODE ssize_t  (*read)(FAR struct pcnt_dev_s *dev,

Review Comment:
   should define the buffer layout



##########
include/nuttx/pcnt/pcnt.h:
##########
@@ -0,0 +1,96 @@
+/****************************************************************************
+ * include/nuttx/pcnt/pcnt.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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_PCNT_PCNT_H
+#define __INCLUDE_NUTTX_PCNT_PCNT_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <nuttx/fs/ioctl.h>
+
+#ifdef CONFIG_PCNT
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct pcnt_dev_s;
+
+/* The pcnt peripheral vtable */
+
+struct pcnt_ops_s
+{
+  CODE int      (*open)(FAR struct pcnt_dev_s *dev);
+  CODE int      (*close)(FAR struct pcnt_dev_s *dev);
+  CODE ssize_t  (*read)(FAR struct pcnt_dev_s *dev,
+                        FAR char *buffer,
+                        size_t buflen);
+  CODE int      (*ioctl)(FAR struct pcnt_dev_s *dev,
+                         int cmd, unsigned long arg);
+};
+
+/* pcnt private data.  This structure only defines the initial fields of the
+ * structure visible to the pcnt client.  The specific implementation may
+ * add additional, device-specific fields.
+ */
+
+struct pcnt_dev_s
+{
+  FAR const struct pcnt_ops_s *ops;
+  int                         minor;

Review Comment:
   why not pass minor to pcntchar_register



##########
drivers/pcnt/Kconfig:
##########
@@ -0,0 +1,19 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+menuconfig PCNT
+       bool "PCNT (Pulse Counter) Driver Support"
+       default n
+       ---help---
+               This option selects common PCNT (Pulse Counter) options and 
should be
+               enabled by the platforms that implement a Pulse Counter 
Peripheral.
+
+if PCNT
+
+config PCNTCHAR

Review Comment:
   why not use pwm capture interface?



-- 
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