This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 140f2c1c7801b32f37e9627c7b4e6e4e629cb77a
Author: Piyush Patle <[email protected]>
AuthorDate: Tue Mar 31 18:39:00 2026 +0530

    docs/rc: document RC/LIRC drivers and remove empty drivers/rmt files
    
    Add documentation for the RC/LIRC character driver subsystem covering
    device registration, the LIRC interface, and usage from user space.
    
    Remove placeholder empty files under drivers/rmt that were left over
    from the rmtchar era and are no longer referenced.
    
    Signed-off-by: Piyush Patle <[email protected]>
---
 Documentation/components/drivers/character/rc.rst  | 136 +++++++++++++++++++++
 arch/risc-v/src/common/espressif/Kconfig           |   1 -
 arch/risc-v/src/common/espressif/esp_lirc.h        |   8 ++
 arch/xtensa/src/common/espressif/Kconfig           |   1 -
 .../esp32/esp32-devkitc/configs/match4/defconfig   |   7 --
 .../esp32/esp32-devkitc/configs/snake/defconfig    |   6 -
 .../esp32s3-devkit/configs/python/defconfig        |   2 -
 drivers/Makefile                                   |   1 -
 drivers/rmt/CMakeLists.txt                         |  23 ----
 drivers/rmt/Kconfig                                |   4 -
 drivers/rmt/Make.defs                              |  21 ----
 11 files changed, 144 insertions(+), 66 deletions(-)

diff --git a/Documentation/components/drivers/character/rc.rst 
b/Documentation/components/drivers/character/rc.rst
index 4cb3d02d5e6..aebedd8c1d0 100644
--- a/Documentation/components/drivers/character/rc.rst
+++ b/Documentation/components/drivers/character/rc.rst
@@ -1,3 +1,139 @@
 ======================
 Remote Control Devices
 ======================
+
+NuttX provides a Remote Control (RC) framework for infrared style input and
+output devices. The userspace interface follows the LIRC model and exposes
+each device as a character node such as ``/dev/lirc0``.
+
+Like many NuttX drivers, the RC subsystem is split into two parts:
+
+#. a generic upper half in ``drivers/rc/lirc_dev.c``, and
+#. a lower half supplied by platform or device specific code.
+
+The upper half handles the character driver registration, per-open buffering,
+``poll()`` support, and the common ``ioctl()`` interface. The lower half is
+responsible for the hardware specific work such as receiving pulse timings,
+transmitting IR data, or reporting decoded scancodes.
+
+Files related to the RC framework are located in:
+
+- ``include/nuttx/lirc.h``
+- ``include/nuttx/rc/lirc_dev.h``
+- ``drivers/rc/lirc_dev.c``
+
+Application Programming Interface
+=================================
+
+Applications should include the following header files:
+
+.. code-block:: c
+
+  #include <nuttx/lirc.h>
+  #include <sys/ioctl.h>
+
+Each RC device is registered as a POSIX character device in ``/dev``.
+Applications open the device with the standard ``open()`` call and then use
+``read()``, ``write()``, ``poll()``, and ``ioctl()`` just like other character
+drivers.
+
+The RC framework supports three kinds of lower-half devices:
+
+- ``LIRC_DRIVER_SCANCODE`` for devices that report decoded scancodes
+- ``LIRC_DRIVER_IR_RAW`` for devices that report raw pulse/space timings
+- ``LIRC_DRIVER_IR_RAW_TX`` for transmit-only raw devices
+
+Raw Pulse/Space Format
+======================
+
+Raw IR timing is transferred in the LIRC ``mode2`` format. Each sample is a
+32-bit ``unsigned int`` value. The upper 8 bits describe the sample type and
+the lower 24 bits carry the payload, usually a duration in microseconds.
+
+The helpers in ``include/nuttx/lirc.h`` are intended to build and inspect
+these values:
+
+- ``LIRC_PULSE(usec)``
+- ``LIRC_SPACE(usec)``
+- ``LIRC_FREQUENCY(value)``
+- ``LIRC_TIMEOUT(usec)``
+- ``LIRC_IS_PULSE(sample)``
+- ``LIRC_IS_SPACE(sample)``
+- ``LIRC_VALUE(sample)``
+
+Typical raw transmit data looks like this:
+
+.. code-block:: c
+
+  unsigned int txbuf[] =
+  {
+    LIRC_PULSE(9000),
+    LIRC_SPACE(4500),
+    LIRC_PULSE(560),
+    LIRC_SPACE(560),
+    LIRC_PULSE(560),
+  };
+
+For raw transmit, ``write()`` expects an odd number of ``unsigned int``
+samples. The upper half forwards the pulse/space sequence to the lower-half
+``tx_ir()`` callback.
+
+IOCTL Commands
+==============
+
+The RC upper half supports the standard LIRC ``ioctl()`` commands defined in
+``include/nuttx/lirc.h``. Commonly used commands include:
+
+- ``LIRC_GET_FEATURES``
+- ``LIRC_GET_SEND_MODE``
+- ``LIRC_GET_REC_MODE``
+- ``LIRC_SET_SEND_MODE``
+- ``LIRC_SET_REC_MODE``
+- ``LIRC_GET_REC_RESOLUTION``
+- ``LIRC_SET_SEND_CARRIER``
+- ``LIRC_SET_SEND_DUTY_CYCLE``
+- ``LIRC_SET_REC_TIMEOUT``
+
+Support for a specific command depends on the lower-half capabilities. In
+practice, applications usually start by querying ``LIRC_GET_FEATURES`` and
+then only use the operations that the device advertises.
+
+Lower-Half Registration
+=======================
+
+Platform code registers an RC lower half by filling ``struct lirc_lowerhalf_s``
+and calling ``lirc_register()``.
+
+.. code-block:: c
+
+  int ret = lirc_register(lower, devno);
+
+The lower half provides a ``struct lirc_ops_s`` callback table. Depending on
+the hardware, it may implement open/close callbacks, raw transmit via
+``tx_ir()``, scancode transmit via ``tx_scancode()``, carrier and duty-cycle
+configuration, or receive timeout handling.
+
+Testing
+-------
+
+The ``irtest`` application in ``nuttx-apps/system/irtest`` can be used to
+exercise RC devices from NSH. A typical validation sequence is:
+
+#. open ``/dev/lircN``
+#. query ``LIRC_GET_FEATURES``
+#. query or set send / receive mode
+#. write raw mode2 samples on transmit-capable devices
+#. read back mode2 samples from receive-capable devices
+
+Espressif RMT LIRC Adapter
+==========================
+
+Espressif targets may provide an arch-local LIRC adapter built on top of the
+RMT peripheral:
+
+- ``arch/xtensa/src/common/espressif/esp_lirc.c``
+- ``arch/risc-v/src/common/espressif/esp_lirc.c``
+
+These adapters expose the RMT peripheral through the RC framework as
+``/dev/lircN`` devices while keeping the hardware specific RMT implementation
+in the Espressif lower-half driver.
diff --git a/arch/risc-v/src/common/espressif/Kconfig 
b/arch/risc-v/src/common/espressif/Kconfig
index b09c4674268..4d9d6320a5a 100644
--- a/arch/risc-v/src/common/espressif/Kconfig
+++ b/arch/risc-v/src/common/espressif/Kconfig
@@ -1288,7 +1288,6 @@ config ESPRESSIF_BROWNOUT_DET
 config ESP_RMT
        bool "Remote Control Module (RMT)"
        default n
-       select DRIVERS_RC
        ---help---
                The RMT (Remote Control Transceiver) peripheral was designed to 
act as
                an infrared transceiver. However, due to the flexibility of its 
data
diff --git a/arch/risc-v/src/common/espressif/esp_lirc.h 
b/arch/risc-v/src/common/espressif/esp_lirc.h
index 2289f587c80..b86705d30fa 100644
--- a/arch/risc-v/src/common/espressif/esp_lirc.h
+++ b/arch/risc-v/src/common/espressif/esp_lirc.h
@@ -23,10 +23,18 @@
 #ifndef __ARCH_RISC_V_SRC_COMMON_ESPRESSIF_ESP_LIRC_H
 #define __ARCH_RISC_V_SRC_COMMON_ESPRESSIF_ESP_LIRC_H
 
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
 #include <nuttx/config.h>
 
 #include "esp_rmt.h"
 
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
 #ifndef __ASSEMBLY__
 #ifdef __cplusplus
 extern "C"
diff --git a/arch/xtensa/src/common/espressif/Kconfig 
b/arch/xtensa/src/common/espressif/Kconfig
index 4200e515de3..3a9b16cd316 100644
--- a/arch/xtensa/src/common/espressif/Kconfig
+++ b/arch/xtensa/src/common/espressif/Kconfig
@@ -71,7 +71,6 @@ endmenu # Interrupt Configuration
 config ESP_RMT
        bool "Remote Control Module (RMT)"
        default n
-       select DRIVERS_RC
        ---help---
                The RMT (Remote Control Transceiver) peripheral was designed to 
act as
                an infrared transceiver. However, due to the flexibility of its 
data
diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/match4/defconfig 
b/boards/xtensa/esp32/esp32-devkitc/configs/match4/defconfig
index 4d7d8567714..3de79d233ca 100644
--- a/boards/xtensa/esp32/esp32-devkitc/configs/match4/defconfig
+++ b/boards/xtensa/esp32/esp32-devkitc/configs/match4/defconfig
@@ -26,11 +26,7 @@ CONFIG_BUILTIN=y
 CONFIG_DEV_GPIO=y
 CONFIG_ESP32_UART0=y
 CONFIG_ESPRESSIF_GPIO_IRQ=y
-CONFIG_ESP_RMT=y
 CONFIG_EXAMPLES_GPIO=y
-CONFIG_EXAMPLES_RMTCHAR=y
-CONFIG_EXAMPLES_RMTCHAR_RX=y
-CONFIG_EXAMPLES_RMTCHAR_TX=y
 CONFIG_EXAMPLES_WS2812=y
 CONFIG_FS_PROCFS=y
 CONFIG_GAMES_MATCH4=y
@@ -50,9 +46,6 @@ CONFIG_NSH_READLINE=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=114688
 CONFIG_RAM_START=0x20000000
-CONFIG_RMT=y
-CONFIG_RMTCHAR=y
-CONFIG_RMT_DEFAULT_RX_BUFFER_SIZE=256
 CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/snake/defconfig 
b/boards/xtensa/esp32/esp32-devkitc/configs/snake/defconfig
index 59ee3080301..2811e201e7a 100644
--- a/boards/xtensa/esp32/esp32-devkitc/configs/snake/defconfig
+++ b/boards/xtensa/esp32/esp32-devkitc/configs/snake/defconfig
@@ -28,9 +28,6 @@ CONFIG_ESP32_UART0=y
 CONFIG_ESPRESSIF_GPIO_IRQ=y
 CONFIG_ESP_RMT=y
 CONFIG_EXAMPLES_GPIO=y
-CONFIG_EXAMPLES_RMTCHAR=y
-CONFIG_EXAMPLES_RMTCHAR_RX=y
-CONFIG_EXAMPLES_RMTCHAR_TX=y
 CONFIG_EXAMPLES_WS2812=y
 CONFIG_FS_PROCFS=y
 CONFIG_GAMES_SNAKE=y
@@ -50,9 +47,6 @@ CONFIG_NSH_READLINE=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=114688
 CONFIG_RAM_START=0x20000000
-CONFIG_RMT=y
-CONFIG_RMTCHAR=y
-CONFIG_RMT_DEFAULT_RX_BUFFER_SIZE=256
 CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig 
b/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig
index 5889128709b..2b5342cb3c0 100644
--- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/python/defconfig
@@ -91,8 +91,6 @@ CONFIG_PSEUDOFS_SOFTLINKS=y
 CONFIG_PTHREAD_MUTEX_TYPES=y
 CONFIG_RAM_SIZE=114688
 CONFIG_RAM_START=0x20000000
-CONFIG_RMT=y
-CONFIG_RMTCHAR=y
 CONFIG_RR_INTERVAL=200
 CONFIG_RTC=y
 CONFIG_RTC_DRIVER=y
diff --git a/drivers/Makefile b/drivers/Makefile
index 72f4a0c4367..adeb7a25f02 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -59,7 +59,6 @@ include pinctrl/Make.defs
 include pipes/Make.defs
 include power/Make.defs
 include regmap/Make.defs
-include rmt/Make.defs
 include rpmsg/Make.defs
 include rptun/Make.defs
 include sensors/Make.defs
diff --git a/drivers/rmt/CMakeLists.txt b/drivers/rmt/CMakeLists.txt
deleted file mode 100644
index 41f66775498..00000000000
--- a/drivers/rmt/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# 
##############################################################################
-# drivers/rmt/CMakeLists.txt
-#
-# 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.
-#
-# 
##############################################################################
-
-# RMT character driver removed; RMT upper-half is now arch/espressif/esp_lirc.c
diff --git a/drivers/rmt/Kconfig b/drivers/rmt/Kconfig
deleted file mode 100644
index f72f3c094ce..00000000000
--- a/drivers/rmt/Kconfig
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
diff --git a/drivers/rmt/Make.defs b/drivers/rmt/Make.defs
deleted file mode 100644
index 5f6b700ac29..00000000000
--- a/drivers/rmt/Make.defs
+++ /dev/null
@@ -1,21 +0,0 @@
-############################################################################
-# drivers/rmt/Make.defs
-#
-# 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.
-#
-############################################################################

Reply via email to