This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 71e277027b2 sent: add sent framework for nuttx
71e277027b2 is described below
commit 71e277027b226037657beb0d0dd02eb93202be2e
Author: chenzihan1 <[email protected]>
AuthorDate: Wed Sep 24 14:32:27 2025 +0800
sent: add sent framework for nuttx
Add an upper-half character driver for SENT (Single Edge Nibble
Transmission, SAE J2716) protocol devices. The framework provides
open/close/read/ioctl/poll operations backed by a circular buffer,
and defines a lower-half ops interface (activate, trigger_spc,
control) for hardware-specific implementations.
Signed-off-by: chenzihan1 <[email protected]>
---
drivers/CMakeLists.txt | 3 +-
drivers/Kconfig | 1 +
drivers/Makefile | 1 +
drivers/{ => sent}/CMakeLists.txt | 14 +-
drivers/sent/Kconfig | 20 +++
drivers/sent/Make.defs | 29 +++
drivers/sent/sent.c | 361 ++++++++++++++++++++++++++++++++++++++
include/nuttx/fs/ioctl.h | 6 +
include/nuttx/sent/sent.h | 237 +++++++++++++++++++++++++
9 files changed, 662 insertions(+), 10 deletions(-)
diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt
index cd0335ac476..be748762576 100644
--- a/drivers/CMakeLists.txt
+++ b/drivers/CMakeLists.txt
@@ -26,6 +26,7 @@ nuttx_add_kernel_library(drivers)
# included automatically.
nuttx_add_subdirectory()
-# The TEE driver is discovered through its own CMakeLists.txt.
+# The TEE driver is discovered through its own CMakeLists.txt. The SENT driver
+# is discovered through its own CMakeLists.txt.
target_sources(drivers PRIVATE drivers_initialize.c)
target_include_directories(drivers PRIVATE ${CMAKE_CURRENT_LIST_DIR})
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 7a10e943a7e..64013e33c31 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -89,3 +89,4 @@ source "drivers/pci/Kconfig"
source "drivers/coresight/Kconfig"
source "drivers/aie/Kconfig"
source "drivers/tee/Kconfig"
+source "drivers/sent/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 7b709b747aa..fef955b4358 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -64,6 +64,7 @@ include regmap/Make.defs
include rpmsg/Make.defs
include rptun/Make.defs
include sensors/Make.defs
+include sent/Make.defs
include serial/Make.defs
include spi/Make.defs
include syslog/Make.defs
diff --git a/drivers/CMakeLists.txt b/drivers/sent/CMakeLists.txt
similarity index 72%
copy from drivers/CMakeLists.txt
copy to drivers/sent/CMakeLists.txt
index cd0335ac476..a4e05ee8f97 100644
--- a/drivers/CMakeLists.txt
+++ b/drivers/sent/CMakeLists.txt
@@ -1,5 +1,5 @@
#
##############################################################################
-# drivers/CMakeLists.txt
+# drivers/sent/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -20,12 +20,8 @@
#
#
##############################################################################
-nuttx_add_kernel_library(drivers)
+if(CONFIG_SENT)
+ set(SRCS sent.c)
-# Subdirectories that provide their own CMakeLists.txt (for example dma-buf)
are
-# included automatically.
-nuttx_add_subdirectory()
-
-# The TEE driver is discovered through its own CMakeLists.txt.
-target_sources(drivers PRIVATE drivers_initialize.c)
-target_include_directories(drivers PRIVATE ${CMAKE_CURRENT_LIST_DIR})
+ target_sources(drivers PRIVATE ${SRCS})
+endif()
diff --git a/drivers/sent/Kconfig b/drivers/sent/Kconfig
new file mode 100644
index 00000000000..2cc60dcde77
--- /dev/null
+++ b/drivers/sent/Kconfig
@@ -0,0 +1,20 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config SENT
+ bool "Enable SENT driver"
+ default n
+ ---help---
+ Enable support for SENT (Single Edge Nibble Transmission)
protocol
+ devices. SENT is a digital communication protocol standardized
by
+ SAE J2716, primarily used in automotive applications for sensor
+ data transmission.
+
+config SENT_RING_BUFFER_SIZE
+ int "The size of sent ring buffer"
+ depends on SENT
+ default 16
+ ---help---
+ The number of frames can be accommodated in the ring buffer of
the sent driver
diff --git a/drivers/sent/Make.defs b/drivers/sent/Make.defs
new file mode 100644
index 00000000000..e3b0fec9f22
--- /dev/null
+++ b/drivers/sent/Make.defs
@@ -0,0 +1,29 @@
+############################################################################
+# drivers/sent/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.
+#
+############################################################################
+
+ifeq ($(CONFIG_SENT),y)
+ CSRCS += sent.c
+
+ DEPPATH += --dep-path sent
+ VPATH += :sent
+ CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)drivers$(DELIM)sent
+endif
diff --git a/drivers/sent/sent.c b/drivers/sent/sent.c
new file mode 100644
index 00000000000..e8b57c6bdbd
--- /dev/null
+++ b/drivers/sent/sent.c
@@ -0,0 +1,361 @@
+/****************************************************************************
+ * drivers/sent/sent.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <assert.h>
+#include <debug.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <nuttx/poll.h>
+#include <stdio.h>
+
+#include <nuttx/kmalloc.h>
+#include <nuttx/nuttx.h>
+#include <nuttx/semaphore.h>
+#include <nuttx/sent/sent.h>
+#include <nuttx/spinlock.h>
+#include <nuttx/circbuf.h>
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* This structure describes the state of the upper half driver */
+
+struct sent_upperhalf_s
+{
+ FAR struct sent_lowerhalf_s *lower; /* The handle of lower half
driver */
+ uint8_t crefs; /* The number of times the
device has been opened */
+ spinlock_t spinlock; /* Manages exclusive access to
file operations */
+ struct circbuf_s buffer; /* The circular buffer of sent
fast data */
+ sem_t buffersem; /* Semaphore to signal data
availability */
+ FAR struct pollfd_s *pollfd; /* Polling file descriptors */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int sent_open(FAR struct file *filep);
+static int sent_close(FAR struct file *filep);
+static ssize_t sent_read(FAR struct file *filep, FAR char *buffer,
+ size_t buflen);
+static int sent_ioctl(FAR struct file *filep, int cmd,
+ unsigned long arg);
+static int sent_poll(FAR struct file *filep, FAR struct pollfd_s *fds,
+ bool setup);
+static void sent_push_frame(FAR void *priv,
+ FAR const struct sent_frame_s *frame);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct file_operations g_sent_fops =
+{
+ sent_open, /* open */
+ sent_close, /* close */
+ sent_read, /* read */
+ NULL, /* write */
+ NULL, /* seek */
+ sent_ioctl, /* ioctl */
+ NULL, /* mmap */
+ NULL, /* truncate */
+ sent_poll, /* poll */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static int sent_open(FAR struct file *filep)
+{
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct sent_upperhalf_s *upper = inode->i_private;
+ FAR struct sent_lowerhalf_s *lower = upper->lower;
+ irqstate_t flags;
+ int ret = OK;
+
+ flags = spin_lock_irqsave(&upper->spinlock);
+
+ /* Increment the reference count */
+
+ if (upper->crefs == 0)
+ {
+ if (lower->ops->activate)
+ {
+ ret = lower->ops->activate(lower, sent_push_frame, upper);
+ if (ret < 0)
+ {
+ spin_unlock_irqrestore(&upper->spinlock, flags);
+ return ret;
+ }
+ }
+ }
+
+ upper->crefs++;
+
+ spin_unlock_irqrestore(&upper->spinlock, flags);
+ return ret;
+}
+
+static int sent_close(FAR struct file *filep)
+{
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct sent_upperhalf_s *upper = inode->i_private;
+ FAR struct sent_lowerhalf_s *lower = upper->lower;
+ irqstate_t flags;
+ int ret = OK;
+
+ flags = spin_lock_irqsave(&upper->spinlock);
+
+ /* Decrement the reference count */
+
+ DEBUGASSERT(upper->crefs > 0);
+ upper->crefs--;
+ if (upper->crefs == 0)
+ {
+ if (lower->ops->activate)
+ {
+ ret = lower->ops->activate(lower, NULL, NULL);
+ }
+ }
+
+ spin_unlock_irqrestore(&upper->spinlock, flags);
+ return ret;
+}
+
+static void sent_push_frame(FAR void *priv,
+ FAR const struct sent_frame_s *frame)
+{
+ FAR struct sent_upperhalf_s *upper = priv;
+ ssize_t ret;
+ int semcount;
+ irqstate_t flags;
+
+ flags = spin_lock_irqsave_nopreempt(&upper->spinlock);
+ ret = circbuf_overwrite(&upper->buffer, frame, sizeof(*frame));
+ if (ret < 0)
+ {
+ spin_unlock_irqrestore_nopreempt(&upper->spinlock, flags);
+ return;
+ }
+
+ if (upper->pollfd && (upper->pollfd->events & POLLIN))
+ {
+ poll_notify(&upper->pollfd, 1, POLLIN);
+ }
+
+ nxsem_get_value(&upper->buffersem, &semcount);
+ if (semcount < 1)
+ {
+ nxsem_post(&upper->buffersem);
+ }
+
+ spin_unlock_irqrestore_nopreempt(&upper->spinlock, flags);
+}
+
+static ssize_t sent_read(FAR struct file *filep, FAR char *buffer,
+ size_t buflen)
+{
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct sent_upperhalf_s *upper = inode->i_private;
+ irqstate_t flags;
+ ssize_t ret;
+
+ if (buffer == NULL || buflen == 0)
+ {
+ return -EINVAL;
+ }
+
+ /* Read integral count of sent_frame_s entries */
+
+ buflen /= sizeof(struct sent_frame_s);
+ if (buflen == 0)
+ {
+ return -EINVAL;
+ }
+
+ flags = spin_lock_irqsave(&upper->spinlock);
+ while (circbuf_is_empty(&upper->buffer))
+ {
+ if (filep->f_oflags & O_NONBLOCK)
+ {
+ spin_unlock_irqrestore(&upper->spinlock, flags);
+ return -ENODATA;
+ }
+
+ spin_unlock_irqrestore(&upper->spinlock, flags);
+ nxsem_wait_uninterruptible(&upper->buffersem);
+ flags = spin_lock_irqsave(&upper->spinlock);
+ }
+
+ ret = circbuf_read(&upper->buffer, buffer,
+ buflen * sizeof(struct sent_frame_s));
+
+ spin_unlock_irqrestore(&upper->spinlock, flags);
+ return ret;
+}
+
+static int sent_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+{
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct sent_upperhalf_s *upper = inode->i_private;
+ FAR struct sent_lowerhalf_s *lower = upper->lower;
+ int ret = -ENOTTY;
+
+ switch (cmd)
+ {
+ case SENTIOC_TRIGGER_SPC:
+ if (lower->ops->trigger_spc)
+ {
+ ret = lower->ops->trigger_spc(lower);
+ }
+
+ break;
+
+ default:
+ if (lower->ops->control)
+ {
+ ret = lower->ops->control(lower, cmd, arg);
+ }
+
+ break;
+ }
+
+ return ret;
+}
+
+static int sent_poll(FAR struct file *filep, FAR struct pollfd_s *fds,
+ bool setup)
+{
+ FAR struct inode *inode = filep->f_inode;
+ FAR struct sent_upperhalf_s *upper = inode->i_private;
+ irqstate_t flags;
+ int ret = 0;
+
+ flags = spin_lock_irqsave_nopreempt(&upper->spinlock);
+
+ if (setup)
+ {
+ if (upper->pollfd != NULL)
+ {
+ ret = -EBUSY;
+ goto errout;
+ }
+
+ upper->pollfd = fds;
+ fds->revents = 0;
+ if (!circbuf_is_empty(&upper->buffer))
+ {
+ if (fds->events & POLLIN)
+ {
+ poll_notify(&upper->pollfd, 1, POLLIN);
+ }
+ }
+ }
+ else
+ {
+ if (upper->pollfd == fds)
+ {
+ upper->pollfd = NULL;
+ }
+ }
+
+errout:
+ spin_unlock_irqrestore_nopreempt(&upper->spinlock, flags);
+ return ret;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: sent_register
+ *
+ * Description:
+ * This function is used to register a SENT device driver instance.
+ * It creates and initializes the upper-half driver structure,
+ * links it with the provided lower-half driver, and registers the
+ * device node under the /dev directory (e.g., /dev/sent0_channel0).
+ *
+ * The function allocates and initializes the necessary resources,
+ * including spin locks and a circular buffer for data reception.
+ * If registration succeeds, the SENT device can then be accessed
+ * via standard file operations defined in g_sent_fops.
+ *
+ * Input Parameters:
+ * path - The device path to register (e.g., "/dev/sent0_channel0").
+ * lower - Pointer to the lower-half driver structure that provides the
+ * hardware-specific implementations and callbacks for the SENT
+ * peripheral.
+ *
+ * Returned Value:
+ * OK if the driver was successfully registered; A negated errno value is
+ * returned on any failure.
+ *
+ ****************************************************************************/
+
+int sent_register(const char *path, FAR struct sent_lowerhalf_s *lower)
+{
+ FAR struct sent_upperhalf_s *upper;
+ int ret;
+
+ DEBUGASSERT(lower != NULL);
+
+ upper = kmm_zalloc(sizeof(struct sent_upperhalf_s));
+ if (!upper)
+ {
+ return -ENOMEM;
+ }
+
+ ret = circbuf_init(&upper->buffer, NULL, CONFIG_SENT_RING_BUFFER_SIZE *
+ sizeof(struct sent_frame_s));
+ if (ret < 0)
+ {
+ goto errout;
+ }
+
+ spin_lock_init(&upper->spinlock);
+ nxsem_init(&upper->buffersem, 0, 0);
+ upper->lower = lower;
+ ret = register_driver(path, &g_sent_fops, 0666, upper);
+ if (ret < 0)
+ {
+ nxsem_destroy(&upper->buffersem);
+ circbuf_uninit(&upper->buffer);
+ goto errout;
+ }
+
+ return OK;
+
+errout:
+ kmm_free(upper);
+ return ret;
+}
+
diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h
index 9be52345a39..f94bf529374 100644
--- a/include/nuttx/fs/ioctl.h
+++ b/include/nuttx/fs/ioctl.h
@@ -117,6 +117,7 @@
#define _PULSECOUNTBASE (0x4900) /* Pulse count driver ioctl commands */
#define _NPZEROIOCBASE (0x4a00) /* nPZero power-saving IC ioctl commands */
#define _OCUIOCBASE (0x4b00) /* OCU (Output Compare Unit) ioctl commands */
+#define _SENTIOCBASE (0x4c00) /* SENT modules ioctl commands */
#define _RPTUNBASE (0x5000) /* Remote processor tunneling ioctl commands
*/
#define _VIRTIOBASE (0x5100) /* VirtIO ioctl commands */
#define _WLIOCBASE (0x8b00) /* Wireless modules ioctl network commands */
@@ -437,6 +438,11 @@
#define _SNIOCVALID(c) (_IOC_TYPE(c)==_SNIOCBASE)
#define _SNIOC(nr) _IOC(_SNIOCBASE,nr)
+/* NuttX SENT ioctl definitions (see nuttx/sent/sent.h) *********************/
+
+#define _SENTIOCVALID(c) (_IOC_TYPE(c)==_SENTIOCBASE)
+#define _SENTIOC(nr) _IOC(_SENTIOCBASE,nr)
+
/* NuttX Analog (DAC/ADC) ioctl commands (see nuttx/analog/ioctl.h **********/
#define _ANIOCVALID(c) (_IOC_TYPE(c)==_ANIOCBASE)
diff --git a/include/nuttx/sent/sent.h b/include/nuttx/sent/sent.h
new file mode 100644
index 00000000000..266e27790b2
--- /dev/null
+++ b/include/nuttx/sent/sent.h
@@ -0,0 +1,237 @@
+/****************************************************************************
+ * include/nuttx/sent/sent.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_SENT_SENT_H
+#define __INCLUDE_NUTTX_SENT_SENT_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/fs/ioctl.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define SENTIOC_TRIGGER_SPC _SENTIOC(0x0001)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* The sent frame data structure */
+
+enum sent_frame_type_e
+{
+ SENT_FRAME_SHORT,
+ SENT_FRAME_ENH4,
+ SENT_FRAME_ENH8,
+ SENT_FRAME_FAST,
+};
+
+struct sent_frame_shrt_s
+{
+ uint16_t id : 4;
+ uint16_t data : 8;
+ uint16_t crc : 4;
+};
+
+struct sent_frame_enh4_s
+{
+ uint32_t id : 4;
+ uint32_t data : 16;
+ uint32_t crc : 6;
+};
+
+struct sent_frame_enh8_s
+{
+ uint32_t id : 8;
+ uint32_t data : 12;
+ uint32_t crc : 6;
+};
+
+struct sent_frame_fast_s
+{
+ uint32_t status : 4;
+ uint32_t data : 24;
+ uint32_t crc : 4;
+};
+
+struct sent_frame_s
+{
+ enum sent_frame_type_e type;
+ union
+ {
+ struct sent_frame_shrt_s shrt;
+ struct sent_frame_enh4_s enh4;
+ struct sent_frame_enh8_s enh8;
+ struct sent_frame_fast_s fast;
+ };
+
+ uint64_t timestamp;
+};
+
+/* This structure is the generic form of state structure used by lower half
+ * Sent driver.
+ */
+
+typedef CODE void
+(*sent_push_frame_t)(FAR void *priv,
+ FAR const struct sent_frame_s *frame);
+
+/* The sent lower half driver interface */
+
+struct sent_lowerhalf_s;
+struct sent_ops_s
+{
+/****************************************************************************
+ * Name: activate
+ *
+ * Description:
+ * Enable or disable the SENT device. This function allows the upper-half
+ * driver to control the operational state of the SENT peripheral at
+ * runtime.
+ *
+ * When 'push_frame' is provided (non-NULL), the SENT device should be
+ * powered on, initialized, and configured to receive SENT frames. The
+ * lower-half driver will invoke this callback whenever a valid SENT frame
+ * is received.
+ *
+ * When 'push_frame' is NULL, the SENT device should be powered down and
+ * disabled to save energy and release hardware resources.
+ *
+ * The exact behavior depends on the hardware implementation. If the
+ * requested operation is not supported or fails, an appropriate error
+ * code must be returned.
+ *
+ * Input Parameters:
+ * lower - Pointer to the instance of the SENT lower-half driver
+ * push_frame - Callback function to push received SENT frames to the
+ * upper-half driver. Pass NULL to disable reception and
+ * power down the device.
+ * priv - Opaque pointer to the upper-half driver private context.
+ * This will be passed to the push_frame callback.
+ *
+ * Returned Value:
+ * Zero (OK) is returned on success.
+ * A negated errno value is returned on any failure.
+ *
+ ****************************************************************************/
+
+ CODE int (*activate)(FAR struct sent_lowerhalf_s *lower,
+ sent_push_frame_t push_frame,
+ FAR void *priv);
+
+/****************************************************************************
+ * Name: trigger_spc
+ *
+ * Description:
+ * Trigger a SENT SPC (Serial Peripheral Communication) transaction on the
+ * specified SENT channel. This function is typically used by the
+ * upper-half driver or application to initiate a command or data request
+ * to the sensor via the SPC back channel defined in the SENT
+ * protocol (SAE J2716).
+ *
+ * In SENT with SPC mode, the ECU communicates with the sensor by pulling
+ * the SENT line low for a specific duration after a valid SENT frame. This
+ * function initiates that timing sequence at the hardware level to send an
+ * SPC command or request, allowing bidirectional communication with the
+ * sensor.
+ *
+ * Input Parameters:
+ * lower - Pointer to the instance of the SENT lower-half driver that
+ * provides access to the hardware-specific implementation of
+ * the SPC mechanism.
+ *
+ * Returned Value:
+ * Zero (OK) or positive on success; a negated errno value on failure.
+ *
+ ***************************************************************************/
+
+ CODE int (*trigger_spc)(FAR struct sent_lowerhalf_s *lower);
+
+ /**************************************************************************
+ * Name: control
+ *
+ * With this method, the user can set some special config for the sent,
+ * which are all parsed and implemented by lower half driver.
+ *
+ * Input Parameters:
+ * lower - The instance of lower half sent driver.
+ * cmd - The special cmd for sent.
+ * arg - The parameters associated with cmd.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ * -ENOTTY - The cmd don't support.
+ *
+ **************************************************************************/
+
+ CODE int (*control)(FAR struct sent_lowerhalf_s *lower,
+ int cmd, unsigned long arg);
+};
+
+struct sent_lowerhalf_s
+{
+ /* The lower half sent driver operations */
+
+ FAR const struct sent_ops_s *ops;
+};
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: sent_register
+ *
+ * Description:
+ * This function is used to register a SENT device driver instance.
+ * It creates and initializes the upper-half driver structure,
+ * links it with the provided lower-half driver, and registers the
+ * device node under the /dev directory (e.g., /dev/sent0_channel0).
+ *
+ * The function allocates and initializes the necessary resources,
+ * including spin locks and a circular buffer for data reception.
+ * If registration succeeds, the SENT device can then be accessed
+ * via standard file operations defined in g_sent_fops.
+ *
+ * Input Parameters:
+ * path - The device path to register (e.g., "/dev/sent0_channel0").
+ * lower - Pointer to the lower-half driver structure that provides the
+ * hardware-specific implementations and callbacks for the SENT
+ * peripheral.
+ *
+ * Returned Value:
+ * OK if the driver was successfully registered; A negated errno value is
+ * returned on any failure.
+ *
+ ****************************************************************************/
+
+int sent_register(FAR const char *path, FAR struct sent_lowerhalf_s *lower);
+
+#endif