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

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

commit 7ee57f42bb6fec1eff2ccccdf73c32c18a85852d
Author: Maarten Zanders <[email protected]>
AuthorDate: Tue Feb 24 10:30:22 2026 +0100

    arch/arm/imx9: rptun/rsctable: move addresses and MU instance to headers.
    
    Extract chip-specific constants from imx9_rptun.c and imx9_rsctable.c
    into new dispatch headers:
    
    - hardware/imx9_rsctable.h: VDEV0_VRING_BASE and RESOURCE_TABLE_BASE,
      selected per ARCH_CHIP define
    - hardware/imx9_rptun.h: MU_INSTANCE, selected per ARCH_CHIP define
    
    Rename the misnamed VRING_SHMEM constant in imx9_rptun.c to
    RESOURCE_TABLE_BASE, which correctly reflects that this address points
    to the resource table, not the vring shared memory region.
    
    No functional change for i.MX95-M7 builds.
    
    Signed-off-by: Maarten Zanders <[email protected]>
---
 arch/arm/src/imx9/hardware/imx9_rptun.h    | 32 +++++++++++++++++++++++++++++
 arch/arm/src/imx9/hardware/imx9_rsctable.h | 33 ++++++++++++++++++++++++++++++
 arch/arm/src/imx9/imx9_rptun.c             |  7 +++----
 arch/arm/src/imx9/imx9_rsctable.c          |  3 +--
 4 files changed, 69 insertions(+), 6 deletions(-)

diff --git a/arch/arm/src/imx9/hardware/imx9_rptun.h 
b/arch/arm/src/imx9/hardware/imx9_rptun.h
new file mode 100644
index 00000000000..bef157b5c90
--- /dev/null
+++ b/arch/arm/src/imx9/hardware/imx9_rptun.h
@@ -0,0 +1,32 @@
+/****************************************************************************
+ * arch/arm/src/imx9/hardware/imx9_rptun.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * SPDX-FileCopyrightText: 2024 NXP
+ *
+ * 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 __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RPTUN_H
+#define __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RPTUN_H
+
+#if defined(CONFIG_ARCH_CHIP_IMX95_M7)
+#  define MU_INSTANCE      7
+#else
+#  error Unrecognized i.MX9 architecture
+#endif
+
+#endif /* __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RPTUN_H */
diff --git a/arch/arm/src/imx9/hardware/imx9_rsctable.h 
b/arch/arm/src/imx9/hardware/imx9_rsctable.h
new file mode 100644
index 00000000000..626d8617077
--- /dev/null
+++ b/arch/arm/src/imx9/hardware/imx9_rsctable.h
@@ -0,0 +1,33 @@
+/****************************************************************************
+ * arch/arm/src/imx9/hardware/imx9_rsctable.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * SPDX-FileCopyrightText: 2024 NXP
+ *
+ * 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 __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RSCTALBE_H
+#define __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RSCTALBE_H
+
+#if defined(CONFIG_ARCH_CHIP_IMX95_M7)
+#  define VDEV0_VRING_BASE        0x88000000
+#  define RESOURCE_TABLE_BASE     0x88220000
+#else
+#  error Unrecognized i.MX9 architecture
+#endif
+
+#endif /* __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RSCTALBE_H */
diff --git a/arch/arm/src/imx9/imx9_rptun.c b/arch/arm/src/imx9/imx9_rptun.c
index c221c82a5a7..9261ed6f4b0 100644
--- a/arch/arm/src/imx9/imx9_rptun.c
+++ b/arch/arm/src/imx9/imx9_rptun.c
@@ -29,6 +29,8 @@
 #include "arm_internal.h"
 #include "imx9_mu.h"
 #include "imx9_rsctable.h"
+#include "hardware/imx9_rptun.h"
+#include "hardware/imx9_rsctable.h"
 #include <debug.h>
 #include <nuttx/config.h>
 #include <nuttx/kthread.h>
@@ -41,10 +43,7 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define VRING_SHMEM 0x88220000 /* Vring shared memory start */
-
 #define RPMSG_MU_CHANNEL 1
-#define MU_INSTANCE      7
 
 #define MU_MSG_VQID_BITOFFSET 16
 
@@ -161,7 +160,7 @@ imx9_rptun_get_resource(struct rptun_dev_s *dev)
       return &priv->shmem->rsc.rsc_tbl_hdr;
     }
 
-  priv->shmem = (struct imx9_rptun_shmem_s *)VRING_SHMEM;
+  priv->shmem = (struct imx9_rptun_shmem_s *)RESOURCE_TABLE_BASE;
   if (priv->shmem->rsc.rsc_tbl_hdr.offset
       != g_imx9_rsc_table.rsc_tbl_hdr.offset)
     {
diff --git a/arch/arm/src/imx9/imx9_rsctable.c 
b/arch/arm/src/imx9/imx9_rsctable.c
index 937f6ff7e08..8c8b0c1048c 100644
--- a/arch/arm/src/imx9/imx9_rsctable.c
+++ b/arch/arm/src/imx9/imx9_rsctable.c
@@ -26,6 +26,7 @@
  ****************************************************************************/
 
 #include "imx9_rsctable.h"
+#include "hardware/imx9_rsctable.h"
 #include <string.h>
 #include <nuttx/rptun/rptun.h>
 
@@ -37,8 +38,6 @@
 #define RL_BUFFER_COUNT         0x100
 #define VRING_ALIGN             0x1000
 #define VRING_SIZE              0x8000
-#define VDEV0_VRING_BASE        0x88000000
-#define RESOURCE_TABLE_BASE     0x88220000
 
 #define NO_RESOURCE_ENTRIES     (1)
 #define RSC_VDEV_FEATURE        (1 << VIRTIO_RPMSG_F_NS | \

Reply via email to