From 5e7861b3aa00fb41eb8b6b86fc7395e995527ba2 Mon Sep 17 00:00:00 2001
From: tarun <t-puvvada@ti.com>
Date: Thu, 14 Aug 2025 14:20:40 +0530
Subject: [PATCH] Test_spi_DMA

---
 mcal_drv/mcal/Spi/src/Spi_Dma.c               |  2 +-
 .../soc/j721s2/mcu1_0/include/Spi_Cfg.h       | 18 ++++++++----
 .../soc/j721s2/mcu1_0/src/Spi_PBcfg.c         | 28 ++++++++++++++++---
 3 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/mcal_drv/mcal/Spi/src/Spi_Dma.c b/mcal_drv/mcal/Spi/src/Spi_Dma.c
index 27fa6bf..fa0222b 100755
--- a/mcal_drv/mcal/Spi/src/Spi_Dma.c
+++ b/mcal_drv/mcal/Spi/src/Spi_Dma.c
@@ -465,7 +465,7 @@ Std_ReturnType Spi_DmaConfig(Spi_DriverObjType *drvObj,
     {
         status = (Std_ReturnType)E_NOT_OK;
     }
-
+    printf("UDMA Init successful /n");
     return status;
 }
 
diff --git a/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/include/Spi_Cfg.h b/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/include/Spi_Cfg.h
index 399304f..3c18ba2 100644
--- a/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/include/Spi_Cfg.h
+++ b/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/include/Spi_Cfg.h
@@ -138,10 +138,10 @@ extern "C" {
 
 
 /** \brief Enable/disable SPI DMA Support */
-#define SPI_MAX_HW_DMA_UNIT         (0U)
+#define SPI_MAX_HW_DMA_UNIT         (1U)
 
 /** \brief Enable/disable SPI DMA Support */
-#define SPI_DMA_ENABLE              (STD_OFF)
+#define SPI_DMA_ENABLE              (STD_ON)
 
 /*
  * Scalability levels
@@ -212,7 +212,7 @@ extern "C" {
 
 /** \brief Enable/disable SPI MCU MCSPI2 unit ISR */
 
-#define SPI_UNIT_MCU_MCSPI2_ACTIVE      (STD_ON)
+#define SPI_UNIT_MCU_MCSPI2_ACTIVE      (STD_OFF)
 
 /** \brief Enable/disable SPI MCSPI0 unit ISR */
 
@@ -224,16 +224,16 @@ extern "C" {
 
 /** \brief Enable/disable SPI MCSPI2 unit ISR */
 
-#define SPI_UNIT_MCSPI2_ACTIVE      (STD_ON)
+#define SPI_UNIT_MCSPI2_ACTIVE      (STD_OFF)
 
 /** \brief Enable/disable SPI MCSPI3 unit ISR */
 
-#define SPI_UNIT_MCSPI3_ACTIVE      (STD_ON)
+#define SPI_UNIT_MCSPI3_ACTIVE      (STD_OFF)
 
 
 /** \brief Enable/disable SPI MCSPI4 unit ISR */
 
-#define SPI_UNIT_MCSPI4_ACTIVE      (STD_ON)
+#define SPI_UNIT_MCSPI4_ACTIVE      (STD_OFF)
 
 /** \brief Enable/disable SPI MCSPI5 unit ISR */
 
@@ -423,9 +423,15 @@ extern const struct Spi_ConfigType_s SpiDriver;
 /** \brief SPI MCU_MCSPI0 ISR */
 FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi0TxRx(void);
 
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi0DmaTx(void);
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi0DmaRx(void);
+
 /** \brief SPI MCU_MCSPI1 ISR */
 FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi1TxRx(void);
 
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi1DmaTx(void);
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi1DmaRx(void);
+
 /** \brief SPI MCU_MCSPI2 ISR */
 FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi2TxRx(void);
 
diff --git a/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/src/Spi_PBcfg.c b/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/src/Spi_PBcfg.c
index 190f9c5..cd7072e 100644
--- a/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/src/Spi_PBcfg.c
+++ b/mcal_drv/mcal/examples_config/Spi_Demo_Cfg/output/generated/soc/j721s2/mcu1_0/src/Spi_PBcfg.c
@@ -90,9 +90,10 @@
 /*******************************************************************************
  *  VERSION CHECK
  ******************************************************************************/
-#if ((SPI_SW_MAJOR_VERSION != (9U)) || (SPI_SW_MINOR_VERSION != (0U)))
+/*#if ((SPI_SW_MAJOR_VERSION != (9U)) || (SPI_SW_MINOR_VERSION != (0U)))
   #error "Version numbers of Spi_PBcfg.c and Spi.h are inconsistent!"
 #endif
+*/
 /*******************************************************************************
  *  LOCAL CONSTANT MACROS
  ******************************************************************************/
@@ -181,9 +182,9 @@ CONST(struct Spi_ConfigType_s, SPI_CONFIG_DATA) SpiDriver =
             [0] =
             {
                 .hwUnitId = SPI_UNIT_MCU_MCSPI0,
-                .enabledmaMode = (boolean)FALSE,
-                .dmaTxChIntrNum = 0,
-                .dmaRxChIntrNum = 0,
+                .enabledmaMode = (boolean)TRUE,
+                .dmaTxChIntrNum = 81,
+                .dmaRxChIntrNum = 82,
             },
             [1] =
             {
@@ -394,11 +395,30 @@ FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi0TxRx(void)
 {
     Spi_IntISR_McuMcspiTxRx(SPI_UNIT_MCU_MCSPI0);
 }
+
+/** \brief SPI MCU_MCSPI0 ISR */
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi0DmaTx(void)
+{
+    Spi_IntISR_McuMcspiDmaTx(SPI_MAX_HW_DMA_UNIT, SPI_UNIT_MCU_MCSPI0);
+}
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi0DmaRx(void)
+{
+    Spi_IntISR_McuMcspiDmaRx(SPI_MAX_HW_DMA_UNIT, SPI_UNIT_MCU_MCSPI0);
+}
 /** \brief SPI MCU_MCSPI1 ISR */
 FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi1TxRx(void)
 {
     Spi_IntISR_McuMcspiTxRx(SPI_UNIT_MCU_MCSPI1);
 }
+/** \brief SPI MCU_MCSPI0 ISR */
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi1DmaTx(void)
+{
+    Spi_IntISR_McuMcspiDmaTx(SPI_MAX_HW_DMA_UNIT, SPI_UNIT_MCU_MCSPI1);
+}
+FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi1DmaRx(void)
+{
+    Spi_IntISR_McuMcspiDmaRx(SPI_MAX_HW_DMA_UNIT, SPI_UNIT_MCU_MCSPI1);
+}
 /** \brief SPI MCU_MCSPI2 ISR */
 FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcuMcspi2TxRx(void)
 {
-- 
2.34.1

