diag_csirx/tpr12: support for csirx diag on c66x and ti_rtos config
authorBadri S <badri@ti.com>
Sun, 1 Nov 2020 17:15:45 +0000 (22:45 +0530)
committerSivaraj R <sivaraj@ti.com>
Mon, 2 Nov 2020 07:49:57 +0000 (01:49 -0600)
added frontend cfg for AWR2243 and added support for c66x build
and sysbios config. CSIRX on c66x works only in sysbios config
and not in baremetal config presently due to PDK-8403

Signed-off-by: Badri S <badri@ti.com>
packages/ti/board/diag/board_diag_component.mk [changed mode: 0755->0644]
packages/ti/board/diag/common/tpr12/linker_c66xdsp_1.cmd [changed mode: 0755->0644]
packages/ti/board/diag/common/tpr12/linker_mcu1_0.lds [changed mode: 0755->0644]
packages/ti/board/diag/common/tpr12/linker_mcu1_0_sysbios.lds [new file with mode: 0644]
packages/ti/board/diag/common/tpr12/osal_log_config.xs [new file with mode: 0644]
packages/ti/board/diag/csirx/build/makefile [changed mode: 0755->0644]
packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_dss.xe66 [new file with mode: 0755]
packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_mss.xer5f [new file with mode: 0755]
packages/ti/board/diag/csirx/src/csirx_test_tpr12.c [changed mode: 0755->0644]
packages/ti/board/diag/csirx/src/csirx_test_tpr12.h

old mode 100755 (executable)
new mode 100644 (file)
index 9fbab9c..f387981
@@ -261,27 +261,50 @@ board_diag_csirx_COMP_LIST = board_diag_csirx
 board_diag_csirx_RELPATH = ti/board/diag/csirx/build
 board_diag_csirx_PATH = $(PDK_BOARD_DIAG_COMP_PATH)/csirx/build
 board_diag_csirx_CUSTOM_BINPATH = $(board_diag_LOCAL_BINPATH)
-board_diag_csirx_MAKEFILE = -f makefile
+board_diag_csirx_MAKEFILE = -f makefile IS_BAREMETAL=yes
 board_diag_csirx_BOARD_DEPENDENCY = yes
 board_diag_csirx_CORE_DEPENDENCY = yes
+board_diag_csirx_XDC_CONFIGURO = no
 export board_diag_csirx_COMP_LIST
 export board_diag_csirx_BOARD_DEPENDENCY
 export board_diag_csirx_CORE_DEPENDENCY
 export board_diag_csirx_MAKEFILE
+export board_diag_csirx_XDC_CONFIGURO
 board_diag_csirx_PKG_LIST = board_diag_csirx
 board_diag_csirx_INCLUDE = $(board_diag_csirx_PATH)
 board_diag_csirx_BOARDLIST = j721e_evm tpr12_evm
 ifeq ($(SOC),$(filter $(SOC), tpr12))
-board_diag_csirx_$(SOC)_CORELIST = mcu1_0
+board_diag_csirx_$(SOC)_CORELIST = mcu1_0 c66xdsp_1
 else
 board_diag_csirx_$(SOC)_CORELIST = mcu2_0
 endif
 export board_diag_csirx_$(SOC)_CORELIST
 export board_diag_csirx_SBL_APPIMAGEGEN = $(board_diag_APPIMAGEGEN_CTRL)
 
+# csirx
+board_diag_csirx_tirtos_COMP_LIST = board_diag_csirx_tirtos
+board_diag_csirx_tirtos_RELPATH = ti/board/diag/csirx/build
+board_diag_csirx_tirtos_PATH = $(PDK_BOARD_DIAG_COMP_PATH)/csirx/build
+board_diag_csirx_tirtos_CUSTOM_BINPATH = $(board_diag_LOCAL_BINPATH)
+board_diag_csirx_tirtos_MAKEFILE = -f makefile IS_BAREMETAL=no
+board_diag_csirx_tirtos_BOARD_DEPENDENCY = yes
+board_diag_csirx_tirtos_CORE_DEPENDENCY = yes
+board_diag_csirx_tirtos_XDC_CONFIGURO = yes
+export board_diag_csirx_tirtos_COMP_LIST
+export board_diag_csirx_tirtos_BOARD_DEPENDENCY
+export board_diag_csirx_tirtos_CORE_DEPENDENCY
+export board_diag_csirx_tirtos_MAKEFILE
+export board_diag_csirx_tirtos_XDC_CONFIGURO
+board_diag_csirx_tirtos_PKG_LIST = board_diag_csirx_tirtos
+board_diag_csirx_tirtos_INCLUDE = $(board_diag_csirx_tirtos_PATH)
+board_diag_csirx_tirtos_BOARDLIST = tpr12_evm
+board_diag_csirx_tirtos_$(SOC)_CORELIST = mcu1_0 c66xdsp_1
+export board_diag_csirx_tirtos_$(SOC)_CORELIST
+export board_diag_csirx_tirtos_SBL_APPIMAGEGEN = $(board_diag_APPIMAGEGEN_CTRL)
+
 # Add CSIRX diagnostic test only if the CSIRX component path exists
 ifneq ($(wildcard $(PDK_CSIRX_COMP_PATH)),)
-board_diag_EXAMPLE_LIST += board_diag_csirx
+board_diag_EXAMPLE_LIST += board_diag_csirx board_diag_csirx_tirtos
 endif
 
 
old mode 100755 (executable)
new mode 100644 (file)
index 233be82..3e404e9
@@ -79,6 +79,9 @@ SECTIONS
     .cio:      {} > L2SRAM
     .data:     {} > L2SRAM
     .sysmem:   {} > L2SRAM
+    .l2ram   : {} > L2SRAM
+    .l3ram   : {} > L3SRAM
+       .hwaram  : {} > HWA_RAM
 
     GROUP
     {
old mode 100755 (executable)
new mode 100644 (file)
index 316796e..edbf56d
@@ -67,8 +67,6 @@ SECTIONS{
     */
     .l2ram   : {} > L2_RAM
     .l3ram   : {} > L3_RAM
-    .pingl3ram   : {} > L3_RAM_Ping
-    .pongl3ram   : {} > L3_RAM_Pong
        .hwaram  : {} > HWA_RAM
     .text    : {} >> TCMA_RAM | L2_RAM
 
diff --git a/packages/ti/board/diag/common/tpr12/linker_mcu1_0_sysbios.lds b/packages/ti/board/diag/common/tpr12/linker_mcu1_0_sysbios.lds
new file mode 100644 (file)
index 0000000..92a2711
--- /dev/null
@@ -0,0 +1,66 @@
+/*----------------------------------------------------------------------------*/
+/* r4f_linker.cmd                                                                 */
+/*                                                                            */
+/* (c) Texas Instruments 2016, All rights reserved.                           */
+/*                                                                            */
+
+/* USER CODE BEGIN (0) */
+/* USER CODE END */
+
+
+/*----------------------------------------------------------------------------*/
+/* Linker Settings                                                            */
+--retain="*(.intvecs)"
+
+/*----------------------------------------------------------------------------*/
+/* Memory Map                                                                 */
+MEMORY{
+PAGE 0:
+    VECTORS  (X)  : origin=0x00000000 length=0x00000100
+    TCMA_RAM (RX) : origin=0x00000100 length=0x00007F00
+    TCMB_RAM (RW) : origin=0x00080000 length=0x00008000
+    SBL_RESERVED_L2_RAM (RW)   : origin=0x10200000 length=0x00060000
+    L2_RAM (RW)   : origin=0x10260000 length=0x00090000
+    L3_RAM (RW)   : origin=0x88000000 length=0x00390000
+    HWA_RAM (RW)  : origin=0x82000000 length=0x00020000
+
+PAGE 1:
+    L3_RAM (RW)   : origin=0x88000000 length=0x00390000
+}
+
+/*----------------------------------------------------------------------------*/
+/* Section Configuration                                                      */
+SECTIONS{
+    .intvecs : {} > VECTORS
+    
+    /* The linker notation "X >> Y | Z" indicates section X is first allocated in Y
+       and allowed to overflow into Z and can be split from Y to Z.
+       The linker notation "X > Y | Z" indicates section X is first allocated in Y
+       and allowed to overflow into Z and cannot be split from Y to Z. Some sections
+       like bss are not allowed to be split so > notation is used for them 
+    */
+    .text    : {} >> TCMA_RAM | L2_RAM
+    
+    .const   : {} > L2_RAM
+    .switch  : {} > L2_RAM
+    .cio:    : {} > SBL_RESERVED_L2_RAM | L2_RAM
+    .data:   : {} > SBL_RESERVED_L2_RAM | L2_RAM
+    
+    .cinit   : {} > L2_RAM
+    .pinit   : {} > L2_RAM
+    .bss     : {} > SBL_RESERVED_L2_RAM | L2_RAM
+    .stack   : {} > TCMB_RAM | SBL_RESERVED_L2_RAM | L2_RAM
+       .hwaram  : {} > HWA_RAM
+
+    .boot:{
+       *.*(*ti_sysbios_family_arm_MPU*)
+       boot.aer5f*(*.text)
+       *.*(*startup*)
+       *.*(*Startup*)
+       *.*(*Cache*)
+     } > TCMA_RAM | TCMB_RAM
+    .l3ram   : {} > L3_RAM
+    .l2ram   : {} > SBL_RESERVED_L2_RAM | L2_RAM
+}
+/*----------------------------------------------------------------------------*/
+
diff --git a/packages/ti/board/diag/common/tpr12/osal_log_config.xs b/packages/ti/board/diag/common/tpr12/osal_log_config.xs
new file mode 100644 (file)
index 0000000..560f5ed
--- /dev/null
@@ -0,0 +1,26 @@
+/* Enable Log */
+var Main = xdc.useModule('xdc.runtime.Main');
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+var Log = xdc.useModule('xdc.runtime.Log');
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+LoggerBuf.TimestampProxy = xdc.useModule('xdc.runtime.Timestamp');
+
+/* Trace log */
+var loggerBufParams = new LoggerBuf.Params();
+loggerBufParams.bufType = LoggerBuf.BufType_CIRCULAR; //or BufType_FIXED
+loggerBufParams.exitFlush = false;
+loggerBufParams.instance.name = "_logInfo";
+loggerBufParams.numEntries = 128;
+var logger0 = LoggerBuf.create(loggerBufParams);
+Main.common$.logger = logger0;
+
+/* Turn on USER1_logs in Main module (all non-module functions) */
+Main.common$.diags_USER1 = Diags.RUNTIME_ON;
+
+/* Turn on USER1 logs in Task module */
+Task.common$.diags_USER1 = Diags.RUNTIME_ON;
+
+
+
+
old mode 100755 (executable)
new mode 100644 (file)
index 105741e..13a0782
-# Copyright (C) 2019-2020 Texas Instruments Incorporated - http://www.ti.com/\r
-#\r
-#\r
-#  Redistribution and use in source and binary forms, with or without\r
-#  modification, are permitted provided that the following conditions\r
-#  are met:\r
-#\r
-#    Redistributions of source code must retain the above copyright\r
-#    notice, this list of conditions and the following disclaimer.\r
-#\r
-#    Redistributions in binary form must reproduce the above copyright\r
-#    notice, this list of conditions and the following disclaimer in the\r
-#    documentation and/or other materials provided with the\r
-#    distribution.\r
-#\r
-#    Neither the name of Texas Instruments Incorporated nor the names of\r
-#    its contributors may be used to endorse or promote products derived\r
-#    from this software without specific prior written permission.\r
-#\r
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
-#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
-#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
-#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
-#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
-#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
-#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-#\r
-# Macro definitions referenced below\r
-#\r
-\r
-#\r
-# This file is the makefile for building CSL uart app.\r
-#\r
-include $(PDK_INSTALL_PATH)/ti/build/Rules.make\r
-\r
-# Board diag parameters which can be controlled outside this makefile\r
-DIAGNAME ?= csirx\r
-PROFILE ?= release\r
-TESTMODE ?= FUNCTIONAL_TEST\r
-MODENAME ?=\r
-BOARD_DIAG_CFLAGS ?=\r
-APP_NAME ?= board_diag_$(DIAGNAME)\r
-\r
-BUILD_PROFILE_$(CORE) = $(PROFILE)\r
-\r
-BUILD_OS_TYPE = baremetal\r
-LNKFLAGS_LOCAL_mpu1_0  += --entry Entry\r
-EXTERNAL_INTERFACES =\r
-XDC_CFG_FILE_mpu1_0 =\r
-XDC_CFG_FILE_mcu1_0 =\r
-\r
-ifeq ($(MODENAME), )\r
-ifeq ($(TESTMODE), STRESS_TEST)\r
-MODENAME = Stress\r
-endif\r
-endif\r
-\r
-SRCDIR = ../src  ../../common/$(SOC) ./$(BOARD)\r
-INCDIR = ../../../../board ../src ../../../src/$(BOARD)/include ../../../src/devices ../../common/$(SOC) ../../../../csl\r
-\r
-# List all the external components/interfaces, whose interface header files\r
-# need to be included for this component\r
-INCLUDE_EXTERNAL_INTERFACES = pdk\r
-\r
-# List all the components required by the application\r
-COMP_LIST_COMMON = $(PDK_COMMON_BAREMETAL_COMP)\r
-\r
-ifeq ($(SOC), $(filter $(SOC), tpr12))\r
-COMP_LIST_COMMON += csirx\r
-else\r
-COMP_LIST_COMMON += fvid2 csirx dss\r
-endif\r
-\r
-# Common source files and CFLAGS across all platforms and cores\r
-PACKAGE_SRCS_COMMON = makefile\r
-PACKAGE_SRCS_COMMON += ../../common/$(SOC)\r
-PACKAGE_SRCS_COMMON += ../../board_diag_component.mk\r
-PACKAGE_SRCS_COMMON += ../../create_sd.bat ../../create_sd.sh\r
-\r
-ifeq ($(SOC), $(filter $(SOC), tpr12))\r
-PACKAGE_SRCS_COMMON += ../src/csirx_test_tpr12.c ../src/csirx_test_tpr12.h\r
-SRCS_COMMON += csirx_test_tpr12.c\r
-else\r
-PACKAGE_SRCS_COMMON += ../src/csirx_display.c ../src/csirx_display.h ../src/csirx_test.c ../src/csirx_test.h\r
-SRCS_COMMON += csirx_test.c csirx_display.c\r
-endif\r
-\r
-SRCS_COMMON += diag_common_cfg.c\r
-\r
-ifeq ($(SOC), $(filter $(SOC), tpr12))\r
-ifeq ($(CORE),$(filter $(CORE), mcu1_0))\r
-SRCS_ASM_COMMON += diag_entry_r5.asm\r
-EXTERNAL_LNKCMD_FILE_LOCAL = ../../common/$(SOC)/linker_$(CORE).lds\r
-endif\r
-endif\r
-\r
-CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) -DDIAG_$(TESTMODE) $(BOARD_DIAG_CFLAGS)\r
-\r
-# Include common make files\r
-ifeq ($(MAKERULEDIR), )\r
-#Makerule path not defined, define this and assume relative path from ROOTDIR\r
-  MAKERULEDIR := $(ROOTDIR)/ti/build/makerules\r
-  export MAKERULEDIR\r
-endif\r
-include $(MAKERULEDIR)/common.mk\r
-\r
-# OBJs and libraries are built by using rule defined in rules_<target>.mk\r
-#     and need not be explicitly specified here\r
-\r
-# Nothing beyond this point\r
+# Copyright (C) 2019-2020 Texas Instruments Incorporated - http://www.ti.com/
+#
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#    Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+#
+#    Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the
+#    distribution.
+#
+#    Neither the name of Texas Instruments Incorporated nor the names of
+#    its contributors may be used to endorse or promote products derived
+#    from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#
+# Macro definitions referenced below
+#
+
+#
+# This file is the makefile for building CSL uart app.
+#
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+
+# Board diag parameters which can be controlled outside this makefile
+ifeq ($(IS_BAREMETAL),yes)
+DIAGNAME ?= csirx
+else
+DIAGNAME ?= csirx_tirtos
+endif
+PROFILE ?= release
+TESTMODE ?= FUNCTIONAL_TEST
+MODENAME ?=
+BOARD_DIAG_CFLAGS ?=
+APP_NAME ?= board_diag_$(DIAGNAME)
+
+BUILD_PROFILE_$(CORE) = $(PROFILE)
+
+ifeq ($(IS_BAREMETAL),yes)
+BUILD_OS_TYPE = baremetal
+CFLAGS_OS_DEFINES =
+LNKFLAGS_LOCAL_mpu1_0  += --entry Entry
+COMP_LIST_COMMON = $(PDK_COMMON_BAREMETAL_COMP)
+EXTERNAL_INTERFACES =
+XDC_CFG_FILE_mpu1_0 =
+XDC_CFG_FILE_mcu1_0 =
+else
+BUILD_OS_TYPE = tirtos
+CFLAGS_OS_DEFINES = -DUSE_BIOS
+EXTERNAL_INTERFACES = bios xdc
+COMP_LIST_COMMON    = $(PDK_COMMON_TIRTOS_COMP) 
+
+
+ifeq ($(SOC),$(filter $(SOC), tpr12))
+# Enable XDC build for application by providing XDC CFG File per core
+XDC_CFG_FILE_mcu1_0 = $(PDK_INSTALL_PATH)/ti/build/$(SOC)/sysbios_r5f.cfg
+XDC_CFG_FILE_c66xdsp_1 = $(PDK_INSTALL_PATH)/ti/build/$(SOC)/sysbios_c66.cfg
+XDC_CFG_UPDATE_$(CORE) = ../../common/$(SOC)/osal_log_config.xs
+endif
+
+endif
+
+ifeq ($(MODENAME), )
+ifeq ($(TESTMODE), STRESS_TEST)
+MODENAME = Stress
+endif
+endif
+
+ifeq ($(BUILD_OS_TYPE), tirtos)
+CSIRX_OS_TESTPREFIX=
+else
+CSIRX_OS_TESTPREFIX=_Baremetal
+endif
+
+# Name of the binary if different from the default (APP_NAME)_$(BOARD_$(CORE)_<build_profile>
+LOCAL_APP_NAME =  $(DIAGNAME)$(CSIRX_OS_TESTPREFIX)$(MODENAME)_DiagExample_$(BOARD)_$(CORE)
+
+SRCDIR = ../src  ../../common/$(SOC) ./$(BOARD)
+INCDIR = ../../../../board ../src ../../../src/$(BOARD)/include ../../../src/devices ../../common/$(SOC) ../../../../csl
+
+# List all the external components/interfaces, whose interface header files
+# need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = pdk $(EXTERNAL_INTERFACES)
+
+
+ifeq ($(SOC), $(filter $(SOC), tpr12))
+COMP_LIST_COMMON += csirx
+else
+COMP_LIST_COMMON += fvid2 csirx dss
+endif
+
+# Common source files and CFLAGS across all platforms and cores
+PACKAGE_SRCS_COMMON = makefile
+PACKAGE_SRCS_COMMON += ../../common/$(SOC)
+PACKAGE_SRCS_COMMON += ../../board_diag_component.mk
+PACKAGE_SRCS_COMMON += ../../create_sd.bat ../../create_sd.sh
+
+ifeq ($(SOC), $(filter $(SOC), tpr12))
+PACKAGE_SRCS_COMMON += ../src/csirx_test_tpr12.c ../src/csirx_test_tpr12.h
+SRCS_COMMON += csirx_test_tpr12.c
+else
+PACKAGE_SRCS_COMMON += ../src/csirx_display.c ../src/csirx_display.h ../src/csirx_test.c ../src/csirx_test.h
+SRCS_COMMON += csirx_test.c csirx_display.c
+endif
+
+SRCS_COMMON += diag_common_cfg.c
+
+ifeq ($(IS_BAREMETAL),yes)
+    ifeq ($(SOC), $(filter $(SOC), tpr12))
+        ifeq ($(CORE),$(filter $(CORE), mcu1_0))
+            SRCS_ASM_COMMON += diag_entry_r5.asm
+            EXTERNAL_LNKCMD_FILE_LOCAL = ../../common/$(SOC)/linker_$(CORE).lds
+        else
+            EXTERNAL_LNKCMD_FILE_LOCAL = ../../common/$(SOC)/linker_$(CORE).cmd
+        endif
+    endif
+else
+#sysbios case
+    ifeq ($(SOC), $(filter $(SOC), tpr12))
+        ifeq ($(CORE),$(filter $(CORE), c66xdsp_1))
+            EXTERNAL_LNKCMD_FILE_LOCAL = ../../common/$(SOC)/linker_$(CORE).cmd
+        endif
+        ifeq ($(CORE),$(filter $(CORE), mcu1_0))
+            EXTERNAL_LNKCMD_FILE_LOCAL = ../../common/$(SOC)/linker_mcu1_0_sysbios.lds
+        endif
+    endif
+endif
+
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) -DDIAG_$(TESTMODE) $(BOARD_DIAG_CFLAGS) $(CFLAGS_OS_DEFINES)
+
+# Include common make files
+ifeq ($(MAKERULEDIR), )
+#Makerule path not defined, define this and assume relative path from ROOTDIR
+  MAKERULEDIR := $(ROOTDIR)/ti/build/makerules
+  export MAKERULEDIR
+endif
+include $(MAKERULEDIR)/common.mk
+
+# OBJs and libraries are built by using rule defined in rules_<target>.mk
+#     and need not be explicitly specified here
+
+# Nothing beyond this point
diff --git a/packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_dss.xe66 b/packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_dss.xe66
new file mode 100755 (executable)
index 0000000..6bf3fdd
Binary files /dev/null and b/packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_dss.xe66 differ
diff --git a/packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_mss.xer5f b/packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_mss.xer5f
new file mode 100755 (executable)
index 0000000..3225f38
Binary files /dev/null and b/packages/ti/board/diag/csirx/frontendcfg/tpr12_mmwave_full_mss.xer5f differ
old mode 100755 (executable)
new mode 100644 (file)
index 9f09ad9..5ef108b
-/******************************************************************************\r
-* Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com\r
-*\r
-* Redistribution and use in source and binary forms, with or without\r
-* modification, are permitted provided that the following conditions\r
-* are met:\r
-*\r
-* Redistributions of source code must retain the above copyright\r
-* notice, this list of conditions and the following disclaimer.\r
-*\r
-* Redistributions in binary form must reproduce the above copyright\r
-* notice, this list of conditions and the following disclaimer in the\r
-* documentation and/or other materials provided with the\r
-* distribution.\r
-*\r
-* Neither the name of Texas Instruments Incorporated nor the names of\r
-* its contributors may be used to endorse or promote products derived\r
-* from this software without specific prior written permission.\r
-*\r
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*\r
-*****************************************************************************/\r
-\r
-\r
-/**\r
- *  \file   csirx_test_tpr12.c\r
- *\r
- *  \brief  csirx diagnostic test file.\r
- *\r
- *  Targeted Functionality: Verification of csirx interface by receiving fixed\r
- *                          pattern data from Radar sensor.\r
- *\r
- *  Operation: This test verifies CSIRX interface by receiving the userDefinedMapping\r
- *          user defined from IWR143 radar sensor.\r
- *\r
- *  Supported SoCs: TPR12.\r
- *\r
- *  Supported Platforms: tp12_evm.\r
- */\r
-\r
-\r
-\r
-#include <csirx_test_tpr12.h>\r
-\r
-BoardDaig_State gTestState = {0};\r
-volatile bool gFrameReceived = 0;\r
-uint32_t gErrorCode = 0;\r
-uint32_t gFrameCounter = 0;\r
-\r
-#define BOARD_DIAG_CSIRX_A_TEST             (1U)\r
-#define BOARD_DIAG_TEST_BUF_INIT_PATTERN    (0xBE)\r
-#define BOARD_DIAG_TEST_PAYLOAD_PATTERN_NUM_BYTES_PER_FRAME (128U)\r
-#define BOARD_DIAG_INIT_PATTERN_SIZE        (BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED + 32U)\r
-/* Ping */\r
-#pragma DATA_SECTION(testPingBufL3, ".l3ram");\r
-uint8_t testPingBufL3[BOARD_DIAG_INIT_PATTERN_SIZE]       \\r
-        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));\r
-\r
-#pragma DATA_SECTION(testPingBufHWA, ".hwaram");\r
-uint8_t testPingBufHWA[BOARD_DIAG_INIT_PATTERN_SIZE]       \\r
-        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));\r
-\r
-#pragma DATA_SECTION(testPingBufL2, ".l2ram");\r
-uint8_t testPingBufL2[BOARD_DIAG_INIT_PATTERN_SIZE]       \\r
-        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));\r
-\r
-/* Pong */\r
-#pragma DATA_SECTION(testPongBufL3, ".l3ram");\r
-uint8_t testPongBufL3[BOARD_DIAG_INIT_PATTERN_SIZE]       \\r
-        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));\r
-\r
-#pragma DATA_SECTION(testPongBufHWA, ".hwaram");\r
-uint8_t testPongBufHWA[BOARD_DIAG_INIT_PATTERN_SIZE]       \\r
-        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));\r
-\r
-#pragma DATA_SECTION(testPongBufL2, ".l2ram");\r
-uint8_t testPongBufL2[BOARD_DIAG_INIT_PATTERN_SIZE]       \\r
-        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));\r
-\r
-/**\r
- *  \brief    Used to read the payload data from the ping-pong buffers\r
- *            This function comapres the data received from the buffers\r
- *            to expected value.\r
- *\r
- *  \param    handle              [IN]     CSIRX Handler\r
- *\r
- *  \return   NULL\r
- *\r
- */\r
-void BoardDiag_CheckPayloadReceived(CSIRX_Handle handle)\r
-{\r
-    uint32_t numBytes = 0;\r
-    uint32_t buffer, bufIndx = 0;\r
-    uint8_t *buf;\r
-\r
-    gErrorCode = CSIRX_getContextReceivedBuffer(handle, BOARD_DIAG_TEST_CONTEXT, &buffer);\r
-    DebugP_assert(gErrorCode == CSIRX_NO_ERROR);\r
-    buffer = CSL_globToLocAddr(buffer);\r
-    buf = (uint8_t *)buffer;\r
-    CacheP_Inv(buf,BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED);\r
-#if defined(PAYLOAD_PATTERN_CHECK)\r
-    for(numBytes = 0; numBytes < BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED; numBytes++)\r
-    {\r
-        if(buf[bufIndx++] != BOARD_DIAG_TEST_PATTERN)\r
-        {\r
-            gTestState.isReceivedPayloadCorrect = false;\r
-            DebugP_log1("Frame - %d is invalid\n",\r
-            gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect);\r
-            break;\r
-        }\r
-    }\r
-#else\r
-    numBytes = BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED;\r
-    bufIndx = BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED;\r
-#endif\r
-    if (numBytes == BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED)\r
-    {\r
-        for (; numBytes < (BOARD_DIAG_INIT_PATTERN_SIZE);numBytes++)\r
-        {\r
-            if(buf[bufIndx++] != BOARD_DIAG_TEST_BUF_INIT_PATTERN)\r
-            {\r
-                gTestState.isReceivedPayloadCorrect = false;\r
-                UART_printf("Buffer corruption - %d is invalid\n",\r
-                gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect);\r
-                break;\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-/**\r
- *  \brief    Callback function for common.irq interrupt, generated when\r
- *            end of frame code and line code detected.\r
- *\r
- *  \param    handle              [IN]     CSIRX Handler\r
- *            arg                 [IN]     CALLBACK function argument\r
- *            IRQ                 [OUT]    CSIRX common irq\r
- *\r
- */\r
-void BoardDiag_commonCallback(CSIRX_Handle handle, uint32_t arg,\r
-                              CSIRX_CommonIRQ_t *IRQ)\r
-{\r
-    uint8_t i;\r
-    uint32_t frameCounter =\r
-    gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect + 1;\r
-\r
-    DebugP_assert(handle != NULL);\r
-    DebugP_assert(arg == BOARD_DIAG_TEST_COMMON_CB_ARG);\r
-    gTestState.callbackCount.common++;\r
-\r
-    gTestState.IRQ.common = *IRQ;\r
-\r
-    /* Counts book-keeping */\r
-    if(IRQ->isOCPerror == true)\r
-    {\r
-        gTestState.commonIRQcount.isOCPerror++;\r
-    }\r
-    if(IRQ->isComplexIOerror == true)\r
-    {\r
-        gTestState.commonIRQcount.isComplexIOerror++;\r
-    }\r
-    if(IRQ->isFIFOoverflow == true)\r
-    {\r
-        gTestState.commonIRQcount.isFIFOoverflow++;\r
-    }\r
-\r
-    if(IRQ->isComplexIOerror)\r
-    {\r
-        gErrorCode = CSIRX_getComplexIOlanesIRQ(handle,\r
-                                               &gTestState.IRQ.complexIOlanes);\r
-        if(gErrorCode != CSIRX_NO_ERROR)\r
-        {\r
-            DebugP_log1("Error occured while recieving the frame-%d\n", frameCounter);\r
-        }\r
-        DebugP_assert(gErrorCode == CSIRX_NO_ERROR);\r
-\r
-        gErrorCode = CSIRX_clearAllcomplexIOlanesIRQ(handle);\r
-        DebugP_assert(gErrorCode == CSIRX_NO_ERROR);\r
-    }\r
-\r
-    for(i = 0; i < CSIRX_NUM_CONTEXTS; i++)\r
-    {\r
-        if(IRQ->isContext[i] == true)\r
-        {\r
-            gErrorCode = CSIRX_getContextIRQ(handle, i,\r
-                                            &gTestState.IRQ.context[i]);\r
-            DebugP_assert(gErrorCode == CSIRX_NO_ERROR);\r
-\r
-            if(gTestState.IRQ.context[i].isFrameEndCodeDetect == true)\r
-            {\r
-                gTestState.contextIRQcounts[i].frameEndCodeDetect++;\r
-                  /* Single frame is received */\r
-                gFrameReceived = true;\r
-\r
-            }\r
-\r
-            if(gTestState.IRQ.context[i].isLineEndCodeDetect == true)\r
-            {\r
-                gTestState.contextIRQcounts[i].lineEndCodeDetect++;\r
-            }\r
-\r
-            gErrorCode = CSIRX_clearAllcontextIRQ(handle, i);\r
-            DebugP_assert(gErrorCode == CSIRX_NO_ERROR);\r
-        }\r
-    }\r
-}\r
-\r
-void BoardDiag_CheckStateError(bool *isTestPass)\r
-{\r
-    if(gTestState.commonIRQcount.isOCPerror != 0)\r
-    {\r
-        DebugP_log1("OCP error has occured %d number of times \n", gTestState.commonIRQcount.isOCPerror);\r
-        *isTestPass = false;\r
-    }\r
-    if(gTestState.commonIRQcount.isComplexIOerror != 0)\r
-    {\r
-        DebugP_log1("Complex IO error has occured %d number of times \n", gTestState.commonIRQcount.isComplexIOerror);\r
-        *isTestPass = false;\r
-    }\r
-    if(gTestState.commonIRQcount.isFIFOoverflow != 0)\r
-    {\r
-        DebugP_log1("FIFO Overflow error has occured %d number of times \n",gTestState.commonIRQcount.isFIFOoverflow);\r
-        *isTestPass = false;\r
-    }\r
-}\r
-\r
-void BoardDiag_combinedEOFcallback(CSIRX_Handle handle, uint32_t arg)\r
-{\r
-    DebugP_assert(handle != NULL);\r
-    DebugP_assert(arg == BOARD_DIAG_TEST_COMBINED_EOF_CB_ARG);\r
-    gTestState.callbackCount.combinedEOF++;\r
-}\r
-\r
-Board_DiagConfig testConfig =\r
-{\r
-    /* DDR clock set to 300 MHz */\r
-    .DPHYcfg.ddrClockInHz = 300000000U,\r
-    .DPHYcfg.isClockMissingDetectionEnabled = true,\r
-    .DPHYcfg.triggerEscapeCode[0] = 0x0,\r
-    .DPHYcfg.triggerEscapeCode[1] = 0x0,\r
-    .DPHYcfg.triggerEscapeCode[2] = 0x0,\r
-    .DPHYcfg.triggerEscapeCode[3] = 0x0,\r
-\r
-    .complexIOcfg.lanesConfig.dataLane[0].polarity = 0,\r
-    .complexIOcfg.lanesConfig.dataLane[0].position = CSIRX_LANE_POSITION_1,\r
-    .complexIOcfg.lanesConfig.dataLane[1].polarity = 0,\r
-    .complexIOcfg.lanesConfig.dataLane[1].position = CSIRX_LANE_POSITION_2,\r
-    .complexIOcfg.lanesConfig.dataLane[2].polarity = 0,\r
-    .complexIOcfg.lanesConfig.dataLane[2].position = CSIRX_LANE_POSITION_4,\r
-    .complexIOcfg.lanesConfig.dataLane[3].polarity = 0,\r
-    .complexIOcfg.lanesConfig.dataLane[3].position = CSIRX_LANE_POSITION_5,\r
-    .complexIOcfg.lanesConfig.clockLane.polarity = 0,\r
-    .complexIOcfg.lanesConfig.clockLane.position = CSIRX_LANE_POSITION_3,\r
-    .complexIOcfg.lanesIRQ.isAllLanesULPMenter = true,\r
-    .complexIOcfg.lanesIRQ.isAllLanesULPMexit = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[0].isStateTransitionToULPM = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[0].isControlError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[0].isEscapeEntryError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[0].isStartOfTransmisionSyncError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[0].isStartOfTransmisionError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[1].isStateTransitionToULPM = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[1].isControlError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[1].isEscapeEntryError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[1].isStartOfTransmisionSyncError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[1].isStartOfTransmisionError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[2].isStateTransitionToULPM = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[2].isControlError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[2].isEscapeEntryError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[2].isStartOfTransmisionSyncError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[2].isStartOfTransmisionError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[3].isStateTransitionToULPM = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[3].isControlError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[3].isEscapeEntryError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[3].isStartOfTransmisionSyncError = true,\r
-    .complexIOcfg.lanesIRQ.dataLane[3].isStartOfTransmisionError = true,\r
-    .complexIOcfg.lanesIRQ.clockLane.isStateTransitionToULPM = true,\r
-    .complexIOcfg.lanesIRQ.clockLane.isControlError = true,\r
-    .complexIOcfg.lanesIRQ.clockLane.isEscapeEntryError = true,\r
-    .complexIOcfg.lanesIRQ.clockLane.isStartOfTransmisionSyncError = true,\r
-    .complexIOcfg.lanesIRQ.clockLane.isStartOfTransmisionError = true,\r
-\r
-    .commonCfg.isSoftStoppingOnInterfaceDisable = true,\r
-    .commonCfg.isECCenabled = false,\r
-    .commonCfg.isEXP16SignExtensionEnabled = false,\r
-    .commonCfg.isBurstSizeExpand = false,\r
-    .commonCfg.isNonPostedWrites = true,\r
-    .commonCfg.isOCPautoIdle = true,\r
-    .commonCfg.stopStateFSMtimeoutInNanoSecs = 200000U,\r
-    .commonCfg.burstSize = 8,\r
-    .commonCfg.endianness = CSIRX_ALL_LITTLE_ENDIAN,\r
-    .commonCfg.startOfFrameIRQ0contextId = BOARD_DIAG_TEST_CONTEXT,\r
-    .commonCfg.startOfFrameIRQ1contextId = 0,\r
-    .commonCfg.endOfFrameIRQ0contextId = BOARD_DIAG_TEST_CONTEXT,\r
-    .commonCfg.endOfFrameIRQ1contextId = 0,\r
-    .commonCfg.IRQ.isOCPerror = true,\r
-    .commonCfg.IRQ.isGenericShortPacketReceive = false,\r
-    .commonCfg.IRQ.isECConeBitShortPacketErrorCorrect = false,\r
-    .commonCfg.IRQ.isECCmoreThanOneBitCannotCorrect = false,\r
-    .commonCfg.IRQ.isComplexIOerror = true,\r
-    .commonCfg.IRQ.isFIFOoverflow = true,\r
-    .commonCfg.IRQ.isContext[0] = false,\r
-    .commonCfg.IRQ.isContext[1] = false,\r
-    .commonCfg.IRQ.isContext[2] = false,\r
-    .commonCfg.IRQ.isContext[3] = false,\r
-    .commonCfg.IRQ.isContext[4] = false,\r
-    .commonCfg.IRQ.isContext[5] = false,\r
-    .commonCfg.IRQ.isContext[6] = false,\r
-    .commonCfg.IRQ.isContext[7] = false,\r
-    .commonCfg.IRQcallbacks.common.fxn = BoardDiag_commonCallback,\r
-    .commonCfg.IRQcallbacks.common.arg = BOARD_DIAG_TEST_COMMON_CB_ARG,\r
-    .commonCfg.IRQcallbacks.combinedEndOfLine.fxn = NULL,\r
-    .commonCfg.IRQcallbacks.combinedEndOfLine.arg = 0,\r
-#ifdef BUILD_DSP_1\r
-    .commonCfg.IRQcallbacks.combinedEndOfFrame.fxn = NULL,\r
-    .commonCfg.IRQcallbacks.combinedEndOfFrame.arg = 0,\r
-#else\r
-    .commonCfg.IRQcallbacks.combinedEndOfFrame.fxn =\r
-        BoardDiag_combinedEOFcallback,\r
-    .commonCfg.IRQcallbacks.combinedEndOfFrame.arg =\r
-        BOARD_DIAG_TEST_COMBINED_EOF_CB_ARG,\r
-#endif\r
-    .commonCfg.IRQcallbacks.startOfFrameIRQ0.fxn = NULL,\r
-    .commonCfg.IRQcallbacks.startOfFrameIRQ0.arg = 0,\r
-    .commonCfg.IRQcallbacks.startOfFrameIRQ1.fxn = NULL,\r
-    .commonCfg.IRQcallbacks.startOfFrameIRQ1.arg = 0,\r
-    .commonCfg.IRQcallbacks.endOfFrameIRQ0.fxn = NULL,\r
-    .commonCfg.IRQcallbacks.endOfFrameIRQ0.arg = 0,\r
-    .commonCfg.IRQcallbacks.endOfFrameIRQ1.fxn = NULL,\r
-    .commonCfg.IRQcallbacks.endOfFrameIRQ1.arg = 0,\r
-\r
-    .contextCfg.virtualChannelId = BOARD_DIAG_TEST_VC,\r
-    .contextCfg.format = BOARD_DIAG_TEST_FORMAT,\r
-    .contextCfg.userDefinedMapping = BOARD_DIAG_TEST_USER_DEFINED_MAPPING,\r
-    .contextCfg.isByteSwapEnabled = false,\r
-    .contextCfg.isGenericEnabled = false,\r
-    .contextCfg.isTranscodingEnabled = false,\r
-    .contextCfg.transcodeConfig.transcodeFormat =\r
-                                CSIRX_TRANSCODE_FORMAT_NO_TRANSCODE,\r
-    .contextCfg.transcodeConfig.isHorizontalDownscalingBy2Enabled = false,\r
-    .contextCfg.transcodeConfig.crop.horizontalCount = 0,\r
-    .contextCfg.transcodeConfig.crop.horizontalSkip = 0,\r
-    .contextCfg.transcodeConfig.crop.verticalCount = 0,\r
-    .contextCfg.transcodeConfig.crop.verticalSkip = 0,\r
-    .contextCfg.alpha = 0,\r
-    .contextCfg.pingPongConfig.pingPongSwitchMode = CSIRX_PING_PONG_FRAME_SWITCHING,\r
-    .contextCfg.pingPongConfig.numFramesForFrameBasedPingPongSwitching = 1,\r
-    .contextCfg.pingPongConfig.lineOffset =\r
-                            CSIRX_LINEOFFSET_CONTIGUOUS_STORAGE,\r
-    .contextCfg.pingPongConfig.pingAddress = NULL,\r
-    .contextCfg.pingPongConfig.pongAddress = NULL,\r
-    .contextCfg.numFramesToAcquire = CSIRX_NUM_FRAMES_TO_ACQUIRE_INFINITE,\r
-    .contextCfg.IRQ.isNumLines = false,\r
-    .contextCfg.isNumLinesForIRQmoduloWithinFrame = false,\r
-    .contextCfg.numLinesForIRQ = 0,\r
-    .contextCfg.IRQ.isFramesToAcquire = false,\r
-    .contextCfg.IRQ.isPayloadChecksumMismatch = false,\r
-    .contextCfg.IRQ.isFrameStartCodeDetect = true,\r
-    .contextCfg.IRQ.isFrameEndCodeDetect = true,\r
-    .contextCfg.IRQ.isLineStartCodeDetect = false,\r
-    .contextCfg.IRQ.isLineEndCodeDetect = true,\r
-    .contextCfg.IRQ.isECConeBitLongPacketCorrect = false,\r
-    .contextCfg.endOfLineIRQcallback.fxn = NULL,\r
-    .contextCfg.endOfLineIRQcallback.arg = NULL,\r
-    .contextCfg.isEndOfFramePulseEnabled = true,\r
-    .contextCfg.isEndOfLinePulseEnabled = false,\r
-    .contextCfg.isChecksumEnabled = true\r
-};\r
-\r
-/**\r
- *  \brief    Initialize the ping pong buffers to reset values\r
- *  \param    pingBuf   [OUT]    Ping buffer\r
- *            pongBuf   [OUT]    Pong buffer\r
- *            sizeBuf   [OUT]    Size of the buffer\r
- *\r
- * \retval\r
- *      none\r
- */\r
-void BoardDiag_InitBuf(uint32_t pingBuf, uint32_t pongBuf, uint32_t sizeBuf)\r
-{\r
-    /* initialize ping/pong bufs to known failing pattern */\r
-    memset((void *)pingBuf, BOARD_DIAG_TEST_BUF_INIT_PATTERN, sizeBuf);\r
-    CacheP_wbInv((void *)pingBuf, sizeBuf);\r
-    memset((void *)pongBuf, BOARD_DIAG_TEST_BUF_INIT_PATTERN, sizeBuf);\r
-    CacheP_wbInv((void *)pongBuf, sizeBuf);\r
-}\r
-\r
-/**\r
- *  \brief    This function initializes test state variable.\r
- */\r
-void BoardDiag_TestInit(void)\r
-{\r
-    memset(&gTestState, 0, sizeof(gTestState));\r
-\r
-    gTestState.isReceivedPayloadCorrect = true;\r
-\r
-}\r
-\r
-/**\r
- *  \brief    Gets test buffer address from a bunch of input parameters\r
- *  \param    BoardDiag_RAMtype   [IN]    Type of buffer RAM\r
- *            buf                 [OUT]   Pointer to where the buffer address is returned\r
- *            isPing              [IN]    true if ping buffer else pong buffer\r
- *\r
- *\r
- *  \retval\r
- *      none\r
- */\r
-void BoardDiag_getBuf(BoardDiag_RAMtype bufRAMtype, uint32_t *buf, bool isPing)\r
-{\r
-    if(isPing == true)\r
-    {\r
-        switch(bufRAMtype)\r
-        {\r
-        case BOARD_DIAG_L3RAM:\r
-            *buf = (uint32_t) &testPingBufL3;\r
-            break;\r
-        case BOARD_DIAG_HWARAM:\r
-            *buf = (uint32_t) &testPingBufHWA;\r
-            break;\r
-        case BOARD_DIAG_L2RAM:\r
-            *buf = (uint32_t) &testPingBufL2;\r
-            break;\r
-        }\r
-    }\r
-    else\r
-    {\r
-        switch(bufRAMtype)\r
-        {\r
-        case BOARD_DIAG_L3RAM:\r
-            *buf = (uint32_t) &testPongBufL3;\r
-            break;\r
-        case BOARD_DIAG_HWARAM:\r
-            *buf = (uint32_t) &testPongBufHWA;\r
-            break;\r
-        case BOARD_DIAG_L2RAM:\r
-            *buf = (uint32_t) &testPongBufL2;\r
-            break;\r
-        }\r
-    }\r
-}\r
-\r
-/**\r
- *  \brief    The function performs the CSI-Rx Diagnostic\r
- *            test.\r
- *\r
- *  \return   int8_t\r
- *               0 - in case of success\r
- *              -1 - in case of failure.\r
- *\r
- */\r
-bool BoardDiag_CsirxTestRun(uint8_t instanceId)\r
-{\r
-    CSIRX_Handle         handle;\r
-    int32_t errorCode;\r
-    uint32_t pingBuf, pongBuf;\r
-    CSIRX_InstanceInfo_t instanceInfo;\r
-    bool isTestPass = true;\r
-    CSL_rcss_rcmRegs *rcss_rcm = (CSL_rcss_rcmRegs *)CSL_RCSS_RCM_U_BASE;\r
-    volatile bool isComplexIOresetDone, isForceRxModeDeasserted;\r
-    volatile uint32_t numComplexIOresetDonePolls, numComplexIOPowerStatusPolls,\r
-             numForceRxModeDeassertedPolls;\r
-    volatile uint8_t isComplexIOpowerStatus;\r
-    volatile bool isForceRxModeOnComplexIOdeasserted;\r
-\r
-    /* get ping-pong buffer addresses based on the RAM type and context */\r
-    BoardDiag_getBuf(BOARD_DIAG_HWARAM, &pingBuf, true);\r
-    BoardDiag_getBuf(BOARD_DIAG_HWARAM, &pongBuf, false);\r
-\r
-    BoardDiag_InitBuf(pingBuf, pongBuf, BOARD_DIAG_INIT_PATTERN_SIZE);\r
-    /* initialize the ping-pong buffers */\r
-    BoardDiag_TestInit();\r
-\r
-    CSL_FINS(rcss_rcm->RCSS_CSI2A_RST_CTRL, RCSS_RCM_RCSS_CSI2A_RST_CTRL_RCSS_CSI2A_RST_CTRL_ASSERT, 0x7);\r
-\r
-    CSL_FINS(rcss_rcm->RCSS_CSI2A_RST_CTRL, RCSS_RCM_RCSS_CSI2A_RST_CTRL_RCSS_CSI2A_RST_CTRL_ASSERT, 0U);\r
-\r
-\r
-    /* Initialize CSIRX */\r
-    errorCode = CSIRX_init();\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_init failed with errorCode = %d\n", errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* Open the CSI Instance */\r
-    handle = CSIRX_open(instanceId, NULL, &errorCode, &instanceInfo);\r
-    if(handle == NULL)\r
-    {\r
-        if(errorCode == CSIRX_E_INVALID__INSTANCE_ID)\r
-        {\r
-            printf("Csirx Instance not supported\n");\r
-        }\r
-        else\r
-        {\r
-            printf("Unable to open the csirx Instance, erorCode = %d\n", errorCode);\r
-        }\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-    DebugP_log3("Instance opened, Revision = %d.%d, Number of "\r
-            "Contexts = %d\n", instanceInfo.majorRevisionId,\r
-            instanceInfo.minorRevisionId,\r
-            instanceInfo.numContexts);\r
-\r
-    /* reset csi */\r
-    errorCode = CSIRX_reset(handle);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_reset failed, errorCode = %d\n", errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-    /* config complex IO - lanes and IRQ */\r
-    errorCode = CSIRX_configComplexIO(handle, &testConfig.complexIOcfg);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_configComplexIO failed, errorCode = %d\n",\r
-                    errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* deassert complex IO reset */\r
-    errorCode = CSIRX_deassertComplexIOreset(handle);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_deassertComplexIOreset failed, errorCode = %d\n",\r
-                    errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* config DPHY */\r
-    errorCode = CSIRX_configDPHY(handle, &testConfig.DPHYcfg);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_configDPHY failed, errorCode = %d\n", errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    errorCode = CSIRX_setComplexIOpowerCommand(handle, 1);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_setComplexIOpowerCommand failed, errorCode = %d\n",\r
-                    errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    numComplexIOPowerStatusPolls = 0;\r
-    do\r
-    {\r
-        errorCode = CSIRX_getComplexIOpowerStatus(handle,\r
-                                            (uint8_t*)&isComplexIOpowerStatus);\r
-        if(errorCode != CSIRX_NO_ERROR)\r
-        {\r
-            DebugP_log1("CSIRX_getComplexIOpowerStatus failed, errorCode = "\r
-            " %d\n", errorCode);\r
-            isTestPass = false;\r
-        return isTestPass;\r
-        }\r
-        if (isComplexIOpowerStatus == 0)\r
-        {\r
-            Osal_delay(1);\r
-        }\r
-        numComplexIOPowerStatusPolls++;\r
-    } while((isComplexIOpowerStatus == 0));\r
-    \r
-    /* config common */\r
-    testConfig.commonCfg.IRQ.isContext[BOARD_DIAG_TEST_CONTEXT] = true,\r
-    errorCode = CSIRX_configCommon(handle, &testConfig.commonCfg);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_configCommon failed, errorCode = %d\n", errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* config contexts */\r
-    /* assign ping pong address */\r
-    testConfig.contextCfg.pingPongConfig.pingAddress =\r
-            (uint32_t) CSL_locToGlobAddr(pingBuf);\r
-    testConfig.contextCfg.pingPongConfig.pongAddress =\r
-            (uint32_t) CSL_locToGlobAddr(pongBuf);\r
-\r
-    errorCode = CSIRX_configContext(handle, BOARD_DIAG_TEST_CONTEXT,\r
-                                &testConfig.contextCfg);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_configContext failed, errorCode = %d\n", errorCode);\r
-        \r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* enable context */\r
-    errorCode = CSIRX_enableContext(handle, BOARD_DIAG_TEST_CONTEXT);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_enableContext failed, errorCode = %d\n", errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* enable interface */\r
-    errorCode = CSIRX_enableInterface(handle);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_enableInterface failed, errorCode = %d\n",\r
-                    errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* Wait until complex IO reset complete */\r
-    numComplexIOresetDonePolls = 0;\r
-    do\r
-    {\r
-        errorCode = CSIRX_isComplexIOresetDone(handle,\r
-                                            (bool *)&isComplexIOresetDone);\r
-        if(errorCode != CSIRX_NO_ERROR)\r
-        {\r
-            DebugP_log1("CSIRX_isComplexIOresetDone failed, errorCode = "\r
-            " %d\n", errorCode);\r
-            isTestPass = false;\r
-            return isTestPass;\r
-        }\r
-        if (isComplexIOresetDone == false)\r
-        {\r
-            /* NOTE: This delay should be much smaller than frame time, default BIOS tick = 1 ms */\r
-            Osal_delay(1);\r
-        }\r
-        numComplexIOresetDonePolls++;\r
-    }while((isComplexIOresetDone == false));\r
-\r
-    if(isComplexIOresetDone == false)\r
-    {\r
-        DebugP_log0("CSIRX_isComplexIOresetDone attempts exceeded\n");\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /*Wait csirx receive the data */\r
-    while(gFrameCounter !=\r
-          BOARD_DIAG_TEST_NUM_FRAMES)\r
-    {\r
-        if(gFrameReceived)\r
-        {\r
-            /* TODO: Added global variable counter to check the while loop is not optimized */\r
-            gFrameCounter++;\r
-            BoardDiag_CheckPayloadReceived(handle);\r
-            DebugP_log1("Frame - %d received\n" ,\r
-            gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect);\r
-            gFrameReceived = false;\r
-\r
-            /* Test is considered as failed even if any one of the frame\r
-               received is invalid */\r
-            if(isTestPass != false)\r
-            {\r
-                isTestPass = isTestPass & gTestState.isReceivedPayloadCorrect;\r
-            }\r
-        }\r
-        Osal_delay(1);\r
-    }\r
-\r
-    if(gFrameCounter != BOARD_DIAG_TEST_NUM_FRAMES)\r
-    {\r
-        DebugP_log0("Number of frames recieved does not match\n");\r
-        isTestPass = false;\r
-    }\r
-\r
-    BoardDiag_CheckStateError(&isTestPass);\r
-\r
-    /* disable context */\r
-    errorCode = CSIRX_disableContext(handle, BOARD_DIAG_TEST_CONTEXT);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_disableContext failed,errorCode = %d\n", errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* disable interface */\r
-    errorCode = CSIRX_disableInterface(handle);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_disableInterface failed, errorCode = %d\n",\r
-                    errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    /* close instance */\r
-    errorCode = CSIRX_close(handle);\r
-    if(errorCode != CSIRX_NO_ERROR)\r
-    {\r
-        DebugP_log1("CSIRX_close failed, errorCode = %d\n", errorCode);\r
-        isTestPass = false;\r
-        return isTestPass;\r
-    }\r
-\r
-    return(isTestPass);\r
-}\r
-\r
-/**\r
- *  \brief    The function performs the CSIRX Diagnostic\r
- *            test.\r
- *\r
- *  \return   int8_t\r
- *               0 - in case of success\r
- *              -1 - in case of failure.\r
- *\r
- */\r
-int8_t BoardDiag_CsirxTest()\r
-{\r
-    uint8_t result;\r
-    /* TPR12_TODO: Update this to menu based after initial testing */\r
-#if defined (BOARD_DIAG_CSIRX_A_TEST)\r
-    uint8_t instanceId = CSIRX_INST_ID_FIRST;\r
-#else\r
-    uint8_t instanceId = CSIRX_INST_ID_LAST;\r
-#endif\r
-    char instName[25];\r
-\r
-    UART_printf("\n**********************************************\n");\r
-    UART_printf  ("*                CSI-Rx Test                 *\n");\r
-    UART_printf  ("**********************************************\n");\r
-\r
-    CSIRX_getInstanceName(instanceId, &instName[0], sizeof(instName));\r
-\r
-    UART_printf("Receiving data from CSIRX instance #%d: %s\n", instanceId,\r
-                 instName);\r
-\r
-    result = BoardDiag_CsirxTestRun(instanceId);\r
-    if(result != true)\r
-    {\r
-        UART_printf("Failed to receive data from CSIRX instance #%d\n",\r
-                    instanceId);\r
-        return -1;\r
-    }\r
-    else\r
-    {\r
-        UART_printf("CSIRX diag test passed\n");\r
-    }\r
-    UART_printf("csirx test finished\n");\r
-\r
-    return 0;\r
-\r
-}\r
-\r
-/**\r
- *  \brief   CSIRX Diagnostic test main function\r
- *\r
- *  \return  int - CSIRX Diagnostic test status.\r
- *             0 - in case of success\r
- *            -1 - in case of failure.\r
- *\r
- */\r
-int main (void)\r
-{\r
-    Board_STATUS status;\r
-    Board_initCfg boardCfg;\r
-    int8_t ret;\r
-\r
-#ifdef PDK_RAW_BOOT\r
-    boardCfg = BOARD_INIT_MODULE_CLOCK |\r
-               BOARD_INIT_PINMUX_CONFIG |\r
-               BOARD_INIT_UART_STDIO;\r
-#else\r
-    boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_UART_STDIO | BOARD_INIT_MODULE_CLOCK;\r
-#endif\r
-\r
-    status = Board_init(boardCfg);\r
-    if(status != BOARD_SOK)\r
-    {\r
-        return -1;\r
-    }\r
-\r
-    ret = BoardDiag_CsirxTest();\r
-    if(ret != 0)\r
-    {\r
-        UART_printf("\nCSIRX Test Failed\n");\r
-        return -1;\r
-    }\r
-    else\r
-    {\r
-        UART_printf("\nCSIRX Test Passed\n");\r
-    }\r
-\r
-    return 0;\r
-}\r
+/******************************************************************************
+* Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*****************************************************************************/
+
+
+/**
+ *  \file   csirx_test_tpr12.c
+ *
+ *  \brief  csirx diagnostic test file.
+ *
+ *  Targeted Functionality: Verification of csirx interface by receiving fixed
+ *                          pattern data from Radar sensor.
+ *
+ *  Operation: This test verifies CSIRX interface by receiving the userDefinedMapping
+ *          user defined from IWR143 radar sensor.
+ *
+ *  Supported SoCs: TPR12.
+ *
+ *  Supported Platforms: tp12_evm.
+ */
+
+#ifdef USE_BIOS
+/* XDCtools Header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/System.h>
+#include <stdio.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* BIOS Header files */
+#include <ti/sysbios/BIOS.h>
+#include <xdc/runtime/Error.h>
+#endif /* #ifdef USE_BIOS */
+
+
+#include <csirx_test_tpr12.h>
+
+BoardDaig_State gTestState = {0};
+volatile bool gFrameReceived = 0;
+uint32_t gErrorCode = 0;
+uint32_t gFrameCounter = 0;
+
+#define BOARD_DIAG_CSIRX_A_TEST             (1U)
+#define BOARD_DIAG_TEST_BUF_INIT_PATTERN    (0xBE)
+#define BOARD_DIAG_TEST_PAYLOAD_PATTERN_NUM_BYTES_PER_FRAME (128U)
+#define BOARD_DIAG_INIT_PATTERN_SIZE        (BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED + 32U)
+/* Ping */
+#pragma DATA_SECTION(testPingBufL3, ".l3ram");
+uint8_t testPingBufL3[BOARD_DIAG_INIT_PATTERN_SIZE]       \
+        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));
+
+#pragma DATA_SECTION(testPingBufHWA, ".hwaram");
+uint8_t testPingBufHWA[BOARD_DIAG_INIT_PATTERN_SIZE]       \
+        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));
+
+#pragma DATA_SECTION(testPingBufL2, ".l2ram");
+uint8_t testPingBufL2[BOARD_DIAG_INIT_PATTERN_SIZE]       \
+        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));
+
+/* Pong */
+#pragma DATA_SECTION(testPongBufL3, ".l3ram");
+uint8_t testPongBufL3[BOARD_DIAG_INIT_PATTERN_SIZE]       \
+        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));
+
+#pragma DATA_SECTION(testPongBufHWA, ".hwaram");
+uint8_t testPongBufHWA[BOARD_DIAG_INIT_PATTERN_SIZE]       \
+        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));
+
+#pragma DATA_SECTION(testPongBufL2, ".l2ram");
+uint8_t testPongBufL2[BOARD_DIAG_INIT_PATTERN_SIZE]       \
+        __attribute__ ((aligned(BOARD_DIAG_PING_PONG_ALIGNMENT)));
+
+/**
+ *  \brief    Used to read the payload data from the ping-pong buffers
+ *            This function comapres the data received from the buffers
+ *            to expected value.
+ *
+ *  \param    handle              [IN]     CSIRX Handler
+ *
+ *  \return   NULL
+ *
+ */
+void BoardDiag_CheckPayloadReceived(CSIRX_Handle handle)
+{
+    uint32_t numBytes = 0;
+    uint32_t buffer, bufIndx = 0;
+    uint8_t *buf;
+
+    gErrorCode = CSIRX_getContextReceivedBuffer(handle, BOARD_DIAG_TEST_CONTEXT, &buffer);
+    DebugP_assert(gErrorCode == CSIRX_NO_ERROR);
+    buffer = CSL_globToLocAddr(buffer);
+    buf = (uint8_t *)buffer;
+    CacheP_Inv(buf,BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED);
+#if defined(PAYLOAD_PATTERN_CHECK)
+    for(numBytes = 0; numBytes < BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED; numBytes++)
+    {
+        if(buf[bufIndx++] != BOARD_DIAG_TEST_PATTERN)
+        {
+            gTestState.isReceivedPayloadCorrect = false;
+            printf("Frame - %d is invalid\n",
+            gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect);
+            break;
+        }
+    }
+#else
+    numBytes = BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED;
+    bufIndx = BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED;
+#endif
+    if (numBytes == BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED)
+    {
+        for (; numBytes < (BOARD_DIAG_INIT_PATTERN_SIZE);numBytes++)
+        {
+            if(buf[bufIndx++] != BOARD_DIAG_TEST_BUF_INIT_PATTERN)
+            {
+                gTestState.isReceivedPayloadCorrect = false;
+                printf("Buffer corruption - %d is invalid\n",
+                gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect);
+                break;
+            }
+        }
+    }
+}
+
+/**
+ *  \brief    Callback function for common.irq interrupt, generated when
+ *            end of frame code and line code detected.
+ *
+ *  \param    handle              [IN]     CSIRX Handler
+ *            arg                 [IN]     CALLBACK function argument
+ *            IRQ                 [OUT]    CSIRX common irq
+ *
+ */
+void BoardDiag_commonCallback(CSIRX_Handle handle, uint32_t arg,
+                              CSIRX_CommonIRQ_t *IRQ)
+{
+    uint8_t i;
+    uint32_t frameCounter =
+    gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect + 1;
+
+    DebugP_assert(handle != NULL);
+    DebugP_assert(arg == BOARD_DIAG_TEST_COMMON_CB_ARG);
+    gTestState.callbackCount.common++;
+
+    gTestState.IRQ.common = *IRQ;
+
+    /* Counts book-keeping */
+    if(IRQ->isOCPerror == true)
+    {
+        gTestState.commonIRQcount.isOCPerror++;
+    }
+    if(IRQ->isComplexIOerror == true)
+    {
+        gTestState.commonIRQcount.isComplexIOerror++;
+    }
+    if(IRQ->isFIFOoverflow == true)
+    {
+        gTestState.commonIRQcount.isFIFOoverflow++;
+    }
+
+    if(IRQ->isComplexIOerror)
+    {
+        gErrorCode = CSIRX_getComplexIOlanesIRQ(handle,
+                                               &gTestState.IRQ.complexIOlanes);
+        if(gErrorCode != CSIRX_NO_ERROR)
+        {
+            DebugP_log1("Error occured while recieving the frame-%d\n", frameCounter);
+        }
+        DebugP_assert(gErrorCode == CSIRX_NO_ERROR);
+
+        gErrorCode = CSIRX_clearAllcomplexIOlanesIRQ(handle);
+        DebugP_assert(gErrorCode == CSIRX_NO_ERROR);
+    }
+
+    for(i = 0; i < CSIRX_NUM_CONTEXTS; i++)
+    {
+        if(IRQ->isContext[i] == true)
+        {
+            gErrorCode = CSIRX_getContextIRQ(handle, i,
+                                            &gTestState.IRQ.context[i]);
+            DebugP_assert(gErrorCode == CSIRX_NO_ERROR);
+
+            if(gTestState.IRQ.context[i].isFrameEndCodeDetect == true)
+            {
+                gTestState.contextIRQcounts[i].frameEndCodeDetect++;
+                  /* Single frame is received */
+                gFrameReceived = true;
+
+            }
+
+            if(gTestState.IRQ.context[i].isLineEndCodeDetect == true)
+            {
+                gTestState.contextIRQcounts[i].lineEndCodeDetect++;
+            }
+
+            gErrorCode = CSIRX_clearAllcontextIRQ(handle, i);
+            DebugP_assert(gErrorCode == CSIRX_NO_ERROR);
+        }
+    }
+}
+
+void BoardDiag_CheckStateError(bool *isTestPass)
+{
+    if(gTestState.commonIRQcount.isOCPerror != 0)
+    {
+        printf("OCP error has occured %d number of times \n", gTestState.commonIRQcount.isOCPerror);
+        *isTestPass = false;
+    }
+    if(gTestState.commonIRQcount.isComplexIOerror != 0)
+    {
+        printf("Complex IO error has occured %d number of times \n", gTestState.commonIRQcount.isComplexIOerror);
+        *isTestPass = false;
+    }
+    if(gTestState.commonIRQcount.isFIFOoverflow != 0)
+    {
+        printf("FIFO Overflow error has occured %d number of times \n",gTestState.commonIRQcount.isFIFOoverflow);
+        *isTestPass = false;
+    }
+}
+
+void BoardDiag_combinedEOFcallback(CSIRX_Handle handle, uint32_t arg)
+{
+    DebugP_assert(handle != NULL);
+    DebugP_assert(arg == BOARD_DIAG_TEST_COMBINED_EOF_CB_ARG);
+    gTestState.callbackCount.combinedEOF++;
+}
+
+Board_DiagConfig testConfig =
+{
+    /* DDR clock set to 300 MHz */
+    .DPHYcfg.ddrClockInHz = 300000000U,
+    .DPHYcfg.isClockMissingDetectionEnabled = true,
+    .DPHYcfg.triggerEscapeCode[0] = 0x0,
+    .DPHYcfg.triggerEscapeCode[1] = 0x0,
+    .DPHYcfg.triggerEscapeCode[2] = 0x0,
+    .DPHYcfg.triggerEscapeCode[3] = 0x0,
+
+    .complexIOcfg.lanesConfig.dataLane[0].polarity = 0,
+    .complexIOcfg.lanesConfig.dataLane[0].position = CSIRX_LANE_POSITION_1,
+    .complexIOcfg.lanesConfig.dataLane[1].polarity = 0,
+    .complexIOcfg.lanesConfig.dataLane[1].position = CSIRX_LANE_POSITION_2,
+    .complexIOcfg.lanesConfig.dataLane[2].polarity = 0,
+    .complexIOcfg.lanesConfig.dataLane[2].position = CSIRX_LANE_POSITION_4,
+    .complexIOcfg.lanesConfig.dataLane[3].polarity = 0,
+    .complexIOcfg.lanesConfig.dataLane[3].position = CSIRX_LANE_POSITION_5,
+    .complexIOcfg.lanesConfig.clockLane.polarity = 0,
+    .complexIOcfg.lanesConfig.clockLane.position = CSIRX_LANE_POSITION_3,
+    .complexIOcfg.lanesIRQ.isAllLanesULPMenter = true,
+    .complexIOcfg.lanesIRQ.isAllLanesULPMexit = true,
+    .complexIOcfg.lanesIRQ.dataLane[0].isStateTransitionToULPM = true,
+    .complexIOcfg.lanesIRQ.dataLane[0].isControlError = true,
+    .complexIOcfg.lanesIRQ.dataLane[0].isEscapeEntryError = true,
+    .complexIOcfg.lanesIRQ.dataLane[0].isStartOfTransmisionSyncError = true,
+    .complexIOcfg.lanesIRQ.dataLane[0].isStartOfTransmisionError = true,
+    .complexIOcfg.lanesIRQ.dataLane[1].isStateTransitionToULPM = true,
+    .complexIOcfg.lanesIRQ.dataLane[1].isControlError = true,
+    .complexIOcfg.lanesIRQ.dataLane[1].isEscapeEntryError = true,
+    .complexIOcfg.lanesIRQ.dataLane[1].isStartOfTransmisionSyncError = true,
+    .complexIOcfg.lanesIRQ.dataLane[1].isStartOfTransmisionError = true,
+    .complexIOcfg.lanesIRQ.dataLane[2].isStateTransitionToULPM = true,
+    .complexIOcfg.lanesIRQ.dataLane[2].isControlError = true,
+    .complexIOcfg.lanesIRQ.dataLane[2].isEscapeEntryError = true,
+    .complexIOcfg.lanesIRQ.dataLane[2].isStartOfTransmisionSyncError = true,
+    .complexIOcfg.lanesIRQ.dataLane[2].isStartOfTransmisionError = true,
+    .complexIOcfg.lanesIRQ.dataLane[3].isStateTransitionToULPM = true,
+    .complexIOcfg.lanesIRQ.dataLane[3].isControlError = true,
+    .complexIOcfg.lanesIRQ.dataLane[3].isEscapeEntryError = true,
+    .complexIOcfg.lanesIRQ.dataLane[3].isStartOfTransmisionSyncError = true,
+    .complexIOcfg.lanesIRQ.dataLane[3].isStartOfTransmisionError = true,
+    .complexIOcfg.lanesIRQ.clockLane.isStateTransitionToULPM = true,
+    .complexIOcfg.lanesIRQ.clockLane.isControlError = true,
+    .complexIOcfg.lanesIRQ.clockLane.isEscapeEntryError = true,
+    .complexIOcfg.lanesIRQ.clockLane.isStartOfTransmisionSyncError = true,
+    .complexIOcfg.lanesIRQ.clockLane.isStartOfTransmisionError = true,
+
+    .commonCfg.isSoftStoppingOnInterfaceDisable = true,
+    .commonCfg.isECCenabled = false,
+    .commonCfg.isEXP16SignExtensionEnabled = false,
+    .commonCfg.isBurstSizeExpand = false,
+    .commonCfg.isNonPostedWrites = true,
+    .commonCfg.isOCPautoIdle = true,
+    .commonCfg.stopStateFSMtimeoutInNanoSecs = 200000U,
+    .commonCfg.burstSize = 8,
+    .commonCfg.endianness = CSIRX_ALL_LITTLE_ENDIAN,
+    .commonCfg.startOfFrameIRQ0contextId = BOARD_DIAG_TEST_CONTEXT,
+    .commonCfg.startOfFrameIRQ1contextId = 0,
+    .commonCfg.endOfFrameIRQ0contextId = BOARD_DIAG_TEST_CONTEXT,
+    .commonCfg.endOfFrameIRQ1contextId = 0,
+    .commonCfg.IRQ.isOCPerror = true,
+    .commonCfg.IRQ.isGenericShortPacketReceive = false,
+    .commonCfg.IRQ.isECConeBitShortPacketErrorCorrect = false,
+    .commonCfg.IRQ.isECCmoreThanOneBitCannotCorrect = false,
+    .commonCfg.IRQ.isComplexIOerror = true,
+    .commonCfg.IRQ.isFIFOoverflow = true,
+    .commonCfg.IRQ.isContext[0] = false,
+    .commonCfg.IRQ.isContext[1] = false,
+    .commonCfg.IRQ.isContext[2] = false,
+    .commonCfg.IRQ.isContext[3] = false,
+    .commonCfg.IRQ.isContext[4] = false,
+    .commonCfg.IRQ.isContext[5] = false,
+    .commonCfg.IRQ.isContext[6] = false,
+    .commonCfg.IRQ.isContext[7] = false,
+    .commonCfg.IRQcallbacks.common.fxn = BoardDiag_commonCallback,
+    .commonCfg.IRQcallbacks.common.arg = BOARD_DIAG_TEST_COMMON_CB_ARG,
+    .commonCfg.IRQcallbacks.combinedEndOfLine.fxn = NULL,
+    .commonCfg.IRQcallbacks.combinedEndOfLine.arg = 0,
+#ifdef BUILD_DSP_1
+    .commonCfg.IRQcallbacks.combinedEndOfFrame.fxn = NULL,
+    .commonCfg.IRQcallbacks.combinedEndOfFrame.arg = 0,
+#else
+    .commonCfg.IRQcallbacks.combinedEndOfFrame.fxn =
+        BoardDiag_combinedEOFcallback,
+    .commonCfg.IRQcallbacks.combinedEndOfFrame.arg =
+        BOARD_DIAG_TEST_COMBINED_EOF_CB_ARG,
+#endif
+    .commonCfg.IRQcallbacks.startOfFrameIRQ0.fxn = NULL,
+    .commonCfg.IRQcallbacks.startOfFrameIRQ0.arg = 0,
+    .commonCfg.IRQcallbacks.startOfFrameIRQ1.fxn = NULL,
+    .commonCfg.IRQcallbacks.startOfFrameIRQ1.arg = 0,
+    .commonCfg.IRQcallbacks.endOfFrameIRQ0.fxn = NULL,
+    .commonCfg.IRQcallbacks.endOfFrameIRQ0.arg = 0,
+    .commonCfg.IRQcallbacks.endOfFrameIRQ1.fxn = NULL,
+    .commonCfg.IRQcallbacks.endOfFrameIRQ1.arg = 0,
+
+    .contextCfg.virtualChannelId = BOARD_DIAG_TEST_VC,
+    .contextCfg.format = BOARD_DIAG_TEST_FORMAT,
+    .contextCfg.userDefinedMapping = BOARD_DIAG_TEST_USER_DEFINED_MAPPING,
+    .contextCfg.isByteSwapEnabled = false,
+    .contextCfg.isGenericEnabled = false,
+    .contextCfg.isTranscodingEnabled = false,
+    .contextCfg.transcodeConfig.transcodeFormat =
+                                CSIRX_TRANSCODE_FORMAT_NO_TRANSCODE,
+    .contextCfg.transcodeConfig.isHorizontalDownscalingBy2Enabled = false,
+    .contextCfg.transcodeConfig.crop.horizontalCount = 0,
+    .contextCfg.transcodeConfig.crop.horizontalSkip = 0,
+    .contextCfg.transcodeConfig.crop.verticalCount = 0,
+    .contextCfg.transcodeConfig.crop.verticalSkip = 0,
+    .contextCfg.alpha = 0,
+    .contextCfg.pingPongConfig.pingPongSwitchMode = CSIRX_PING_PONG_FRAME_SWITCHING,
+    .contextCfg.pingPongConfig.numFramesForFrameBasedPingPongSwitching = 1,
+    .contextCfg.pingPongConfig.lineOffset =
+                            CSIRX_LINEOFFSET_CONTIGUOUS_STORAGE,
+    .contextCfg.pingPongConfig.pingAddress = NULL,
+    .contextCfg.pingPongConfig.pongAddress = NULL,
+    .contextCfg.numFramesToAcquire = CSIRX_NUM_FRAMES_TO_ACQUIRE_INFINITE,
+    .contextCfg.IRQ.isNumLines = false,
+    .contextCfg.isNumLinesForIRQmoduloWithinFrame = false,
+    .contextCfg.numLinesForIRQ = 0,
+    .contextCfg.IRQ.isFramesToAcquire = false,
+    .contextCfg.IRQ.isPayloadChecksumMismatch = false,
+    .contextCfg.IRQ.isFrameStartCodeDetect = true,
+    .contextCfg.IRQ.isFrameEndCodeDetect = true,
+    .contextCfg.IRQ.isLineStartCodeDetect = false,
+    .contextCfg.IRQ.isLineEndCodeDetect = true,
+    .contextCfg.IRQ.isECConeBitLongPacketCorrect = false,
+    .contextCfg.endOfLineIRQcallback.fxn = NULL,
+    .contextCfg.endOfLineIRQcallback.arg = NULL,
+    .contextCfg.isEndOfFramePulseEnabled = true,
+    .contextCfg.isEndOfLinePulseEnabled = false,
+    .contextCfg.isChecksumEnabled = true
+};
+
+/**
+ *  \brief    Initialize the ping pong buffers to reset values
+ *  \param    pingBuf   [OUT]    Ping buffer
+ *            pongBuf   [OUT]    Pong buffer
+ *            sizeBuf   [OUT]    Size of the buffer
+ *
+ * \retval
+ *      none
+ */
+void BoardDiag_InitBuf(uint32_t pingBuf, uint32_t pongBuf, uint32_t sizeBuf)
+{
+    /* initialize ping/pong bufs to known failing pattern */
+    memset((void *)pingBuf, BOARD_DIAG_TEST_BUF_INIT_PATTERN, sizeBuf);
+    CacheP_wbInv((void *)pingBuf, sizeBuf);
+    memset((void *)pongBuf, BOARD_DIAG_TEST_BUF_INIT_PATTERN, sizeBuf);
+    CacheP_wbInv((void *)pongBuf, sizeBuf);
+}
+
+/**
+ *  \brief    This function initializes test state variable.
+ */
+void BoardDiag_TestInit(void)
+{
+    memset(&gTestState, 0, sizeof(gTestState));
+
+    gTestState.isReceivedPayloadCorrect = true;
+
+}
+
+/**
+ *  \brief    Gets test buffer address from a bunch of input parameters
+ *  \param    BoardDiag_RAMtype   [IN]    Type of buffer RAM
+ *            buf                 [OUT]   Pointer to where the buffer address is returned
+ *            isPing              [IN]    true if ping buffer else pong buffer
+ *
+ *
+ *  \retval
+ *      none
+ */
+void BoardDiag_getBuf(BoardDiag_RAMtype bufRAMtype, uint32_t *buf, bool isPing)
+{
+    if(isPing == true)
+    {
+        switch(bufRAMtype)
+        {
+        case BOARD_DIAG_L3RAM:
+            *buf = (uint32_t) &testPingBufL3;
+            break;
+        case BOARD_DIAG_HWARAM:
+            *buf = (uint32_t) &testPingBufHWA;
+            break;
+        case BOARD_DIAG_L2RAM:
+            *buf = (uint32_t) &testPingBufL2;
+            break;
+        }
+    }
+    else
+    {
+        switch(bufRAMtype)
+        {
+        case BOARD_DIAG_L3RAM:
+            *buf = (uint32_t) &testPongBufL3;
+            break;
+        case BOARD_DIAG_HWARAM:
+            *buf = (uint32_t) &testPongBufHWA;
+            break;
+        case BOARD_DIAG_L2RAM:
+            *buf = (uint32_t) &testPongBufL2;
+            break;
+        }
+    }
+}
+
+/**
+ *  \brief    The function performs the CSI-Rx Diagnostic
+ *            test.
+ *
+ *  \return   int8_t
+ *               0 - in case of success
+ *              -1 - in case of failure.
+ *
+ */
+bool BoardDiag_CsirxTestRun(uint8_t instanceId)
+{
+    CSIRX_Handle         handle;
+    int32_t errorCode;
+    uint32_t pingBuf, pongBuf;
+    CSIRX_InstanceInfo_t instanceInfo;
+    bool isTestPass = true;
+    CSL_rcss_rcmRegs *rcss_rcm = (CSL_rcss_rcmRegs *)CSL_RCSS_RCM_U_BASE;
+    volatile bool isComplexIOresetDone, isForceRxModeDeasserted;
+    volatile uint32_t numComplexIOresetDonePolls, numComplexIOPowerStatusPolls,
+             numForceRxModeDeassertedPolls;
+    volatile uint8_t isComplexIOpowerStatus;
+    volatile bool isForceRxModeOnComplexIOdeasserted;
+
+    /* get ping-pong buffer addresses based on the RAM type and context */
+    BoardDiag_getBuf(BOARD_DIAG_HWARAM, &pingBuf, true);
+    BoardDiag_getBuf(BOARD_DIAG_HWARAM, &pongBuf, false);
+
+    BoardDiag_InitBuf(pingBuf, pongBuf, BOARD_DIAG_INIT_PATTERN_SIZE);
+    /* initialize the ping-pong buffers */
+    BoardDiag_TestInit();
+
+    CSL_FINS(rcss_rcm->RCSS_CSI2A_RST_CTRL, RCSS_RCM_RCSS_CSI2A_RST_CTRL_RCSS_CSI2A_RST_CTRL_ASSERT, 0x7);
+
+    CSL_FINS(rcss_rcm->RCSS_CSI2A_RST_CTRL, RCSS_RCM_RCSS_CSI2A_RST_CTRL_RCSS_CSI2A_RST_CTRL_ASSERT, 0U);
+
+
+    /* Initialize CSIRX */
+    errorCode = CSIRX_init();
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_init failed with errorCode = %d\n", errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* Open the CSI Instance */
+    handle = CSIRX_open(instanceId, NULL, &errorCode, &instanceInfo);
+    if(handle == NULL)
+    {
+        if(errorCode == CSIRX_E_INVALID__INSTANCE_ID)
+        {
+            printf("Csirx Instance not supported\n");
+        }
+        else
+        {
+            printf("Unable to open the csirx Instance, erorCode = %d\n", errorCode);
+        }
+        isTestPass = false;
+        return isTestPass;
+    }
+    DebugP_log3("Instance opened, Revision = %d.%d, Number of "
+            "Contexts = %d\n", instanceInfo.majorRevisionId,
+            instanceInfo.minorRevisionId,
+            instanceInfo.numContexts);
+
+    /* reset csi */
+    errorCode = CSIRX_reset(handle);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_reset failed, errorCode = %d\n", errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+    /* config complex IO - lanes and IRQ */
+    errorCode = CSIRX_configComplexIO(handle, &testConfig.complexIOcfg);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_configComplexIO failed, errorCode = %d\n",
+                    errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* deassert complex IO reset */
+    errorCode = CSIRX_deassertComplexIOreset(handle);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_deassertComplexIOreset failed, errorCode = %d\n",
+                    errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* config DPHY */
+    errorCode = CSIRX_configDPHY(handle, &testConfig.DPHYcfg);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_configDPHY failed, errorCode = %d\n", errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    errorCode = CSIRX_setComplexIOpowerCommand(handle, 1);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_setComplexIOpowerCommand failed, errorCode = %d\n",
+                    errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    numComplexIOPowerStatusPolls = 0;
+    do
+    {
+        errorCode = CSIRX_getComplexIOpowerStatus(handle,
+                                            (uint8_t*)&isComplexIOpowerStatus);
+        if(errorCode != CSIRX_NO_ERROR)
+        {
+            printf("CSIRX_getComplexIOpowerStatus failed, errorCode = "
+            " %d\n", errorCode);
+            isTestPass = false;
+        return isTestPass;
+        }
+        if (isComplexIOpowerStatus == 0)
+        {
+            Osal_delay(1);
+        }
+        numComplexIOPowerStatusPolls++;
+    } while((isComplexIOpowerStatus == 0));
+    printf("Complex IO Powered up.Run AWR FE binrary config now\n");
+    /* config common */
+    testConfig.commonCfg.IRQ.isContext[BOARD_DIAG_TEST_CONTEXT] = true,
+    errorCode = CSIRX_configCommon(handle, &testConfig.commonCfg);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_configCommon failed, errorCode = %d\n", errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* config contexts */
+    /* assign ping pong address */
+    testConfig.contextCfg.pingPongConfig.pingAddress =
+            (uint32_t) CSL_locToGlobAddr(pingBuf);
+    testConfig.contextCfg.pingPongConfig.pongAddress =
+            (uint32_t) CSL_locToGlobAddr(pongBuf);
+
+    errorCode = CSIRX_configContext(handle, BOARD_DIAG_TEST_CONTEXT,
+                                &testConfig.contextCfg);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_configContext failed, errorCode = %d\n", errorCode);
+        
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* enable context */
+    errorCode = CSIRX_enableContext(handle, BOARD_DIAG_TEST_CONTEXT);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_enableContext failed, errorCode = %d\n", errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* enable interface */
+    errorCode = CSIRX_enableInterface(handle);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_enableInterface failed, errorCode = %d\n",
+                    errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* Wait until complex IO reset complete */
+    numComplexIOresetDonePolls = 0;
+    do
+    {
+        errorCode = CSIRX_isComplexIOresetDone(handle,
+                                            (bool *)&isComplexIOresetDone);
+        if(errorCode != CSIRX_NO_ERROR)
+        {
+            printf("CSIRX_isComplexIOresetDone failed, errorCode = "
+            " %d\n", errorCode);
+            isTestPass = false;
+            return isTestPass;
+        }
+        if (isComplexIOresetDone == false)
+        {
+            /* NOTE: This delay should be much smaller than frame time, default BIOS tick = 1 ms */
+            Osal_delay(1);
+        }
+        numComplexIOresetDonePolls++;
+    }while((isComplexIOresetDone == false));
+
+    if(isComplexIOresetDone == false)
+    {
+        printf("CSIRX_isComplexIOresetDone attempts exceeded\n");
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /*Wait csirx receive the data */
+    while(gFrameCounter !=
+          BOARD_DIAG_TEST_NUM_FRAMES)
+    {
+        if(gFrameReceived)
+        {
+            /* TODO: Added global variable counter to check the while loop is not optimized */
+            gFrameCounter++;
+            BoardDiag_CheckPayloadReceived(handle);
+            DebugP_log1("Frame - %d received\n" ,
+            gTestState.contextIRQcounts[BOARD_DIAG_TEST_CONTEXT].frameEndCodeDetect);
+            gFrameReceived = false;
+
+            /* Test is considered as failed even if any one of the frame
+               received is invalid */
+            if(isTestPass != false)
+            {
+                isTestPass = isTestPass & gTestState.isReceivedPayloadCorrect;
+            }
+        }
+        Osal_delay(1);
+    }
+
+    if(gFrameCounter != BOARD_DIAG_TEST_NUM_FRAMES)
+    {
+        printf("Number of frames recieved does not match\n");
+        isTestPass = false;
+    }
+
+    BoardDiag_CheckStateError(&isTestPass);
+
+    /* disable context */
+    errorCode = CSIRX_disableContext(handle, BOARD_DIAG_TEST_CONTEXT);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_disableContext failed,errorCode = %d\n", errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* disable interface */
+    errorCode = CSIRX_disableInterface(handle);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_disableInterface failed, errorCode = %d\n",
+                    errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    /* close instance */
+    errorCode = CSIRX_close(handle);
+    if(errorCode != CSIRX_NO_ERROR)
+    {
+        printf("CSIRX_close failed, errorCode = %d\n", errorCode);
+        isTestPass = false;
+        return isTestPass;
+    }
+
+    return(isTestPass);
+}
+
+/**
+ *  \brief    The function performs the CSIRX Diagnostic
+ *            test.
+ *
+ *  \return   int8_t
+ *               0 - in case of success
+ *              -1 - in case of failure.
+ *
+ */
+#ifdef USE_BIOS
+int8_t BoardDiag_CsirxTest(UArg arg0, UArg arg1)
+#else
+int8_t BoardDiag_CsirxTest(void)
+#endif
+{
+    uint8_t result;
+    /* TPR12_TODO: Update this to menu based after initial testing */
+#if defined (BOARD_DIAG_CSIRX_A_TEST)
+    uint8_t instanceId = CSIRX_INST_ID_FIRST;
+#else
+    uint8_t instanceId = CSIRX_INST_ID_LAST;
+#endif
+    char instName[25];
+
+    printf("\n**********************************************\n");
+    printf  ("*                CSI-Rx Test                 *\n");
+    printf  ("**********************************************\n");
+
+    CSIRX_getInstanceName(instanceId, &instName[0], sizeof(instName));
+
+    printf("Receiving data from CSIRX instance #%d: %s\n", instanceId,
+                 instName);
+
+    result = BoardDiag_CsirxTestRun(instanceId);
+    if(result != true)
+    {
+        printf("Failed to receive data from CSIRX instance #%d\n",
+                    instanceId);
+        return -1;
+    }
+    else
+    {
+        printf("CSIRX diag test passed\n");
+    }
+    printf("csirx test finished\n");
+
+    return 0;
+
+}
+
+/**
+ *  \brief   CSIRX Diagnostic test main function
+ *
+ *  \return  int - CSIRX Diagnostic test status.
+ *             0 - in case of success
+ *            -1 - in case of failure.
+ *
+ */
+int main (void)
+{
+    Board_STATUS status;
+    Board_initCfg boardCfg;
+
+#ifdef USE_BIOS
+    Task_Handle task;
+    Error_Block eb;
+
+    Error_init(&eb);
+    task = Task_create((Task_FuncPtr)BoardDiag_CsirxTest, NULL, &eb);
+    if (task == NULL) {
+        System_printf("Task_create() failed!\n");
+        BIOS_exit(0);
+    }
+#else
+    int8_t ret;
+#endif
+
+#ifdef PDK_RAW_BOOT
+    boardCfg = BOARD_INIT_MODULE_CLOCK |
+               BOARD_INIT_PINMUX_CONFIG |
+               BOARD_INIT_UART_STDIO;
+#else
+    boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_UART_STDIO | BOARD_INIT_MODULE_CLOCK;
+#endif
+
+    status = Board_init(boardCfg);
+    if(status != BOARD_SOK)
+    {
+        return -1;
+    }
+
+#ifdef USE_BIOS
+    /* Start BIOS */
+    BIOS_start();
+#else
+    ret = BoardDiag_CsirxTest();
+    if(ret != 0)
+    {
+        printf("\nCSIRX Test Failed\n");
+        return -1;
+    }
+    else
+    {
+        printf("\nCSIRX Test Passed\n");
+    }
+#endif
+
+    return 0;
+}
index 8fd03b695ff439a8723fc8dce9248aaf50737ee1..383f21f6d17c3a884701315628df7553fc432be7 100644 (file)
-/******************************************************************************\r
-* Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com\r
-*\r
-* Redistribution and use in source and binary forms, with or without\r
-* modification, are permitted provided that the following conditions\r
-* are met:\r
-*\r
-* Redistributions of source code must retain the above copyright\r
-* notice, this list of conditions and the following disclaimer.\r
-*\r
-* Redistributions in binary form must reproduce the above copyright\r
-* notice, this list of conditions and the following disclaimer in the\r
-* documentation and/or other materials provided with the\r
-* distribution.\r
-*\r
-* Neither the name of Texas Instruments Incorporated nor the names of\r
-* its contributors may be used to endorse or promote products derived\r
-* from this software without specific prior written permission.\r
-*\r
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*\r
-*****************************************************************************/\r
-\r
-/**\r
- *\r
- * \file   csirx_test_tpr12.h\r
- *\r
- * \brief  This is the header file for CSI-Rx diagnostic test.\r
- *\r
- */\r
-\r
-#ifndef _CSIRX_TEST_TPR12_H_\r
-#define _CSIRX_TEST_TPR12_H_\r
-\r
-/* Standard Include Files. */\r
-#include <stdint.h>\r
-#include <stdlib.h>\r
-#include <stddef.h>\r
-#include <string.h>\r
-#include <stdio.h>\r
-#include <time.h>\r
-\r
-#include <ti/drv/csirx/soc/csirx_soc_priv.h>\r
-#include <ti/drv/csirx/csirx.h>\r
-#include <ti/csl/cslr_csirx.h>\r
-#include <ti/osal/CacheP.h>\r
-\r
-#include <assert.h>\r
-#include <ti/drv/csirx/csirx.h>\r
-\r
-#include <ti/csl/soc.h>\r
-#include <ti/osal/osal.h>\r
-#include <ti/osal/DebugP.h>\r
-#include <ti/osal/CycleprofilerP.h>\r
-#include <ti/board/board.h>\r
-\r
-#include <ti/drv/uart/UART.h>\r
-#include <ti/drv/uart/UART_stdio.h>\r
-\r
-/* ======================================================================== */\r
-/*                           Macros & Typedefs                              */\r
-/* ======================================================================== */\r
-\r
-/* should match with CSI TX, assumes complex sample */\r
-//#define PAYLOAD_PATTERN_CHECK             (1)\r
-\r
-#define BOARD_DIAG_TEST_NUM_ADC_SAMPLES_PER_CHIRP (256U)\r
-#define BOARD_DIAG_TEST_BYTES_PER_ADC_SAMPLE      (4U) //complex\r
-#define BOARD_DIAG_TEST_NUM_CHIRPS                (1U)\r
-#define BOARD_DIAG_TEST_NUM_FRAMES                (10U)\r
-#define BOARD_DIAG_TEST_NUM_RX                    (4U)\r
-\r
-#define BOARD_DIAG_TEST_PATTERN                                  (0xFFU)\r
-#define BOARD_DIAG_TEST_CONTEXT               (2U)\r
-#define BOARD_DIAG_TEST_FORMAT                (CSIRX_FORMAT_RAW8)\r
-#define BOARD_DIAG_TEST_VC                    (0U)\r
-#define BOARD_DIAG_TEST_USER_DEFINED_MAPPING  (CSIRX_USER_DEFINED_FORMAT_RAW8)\r
-#define BOARD_DIAG_NUM_INSTANCES                         (2U)\r
-\r
-#define BOARD_DIAG_TEST_NUM_BYTES_PER_FRAME \\r
-    ((BOARD_DIAG_TEST_NUM_ADC_SAMPLES_PER_CHIRP * BOARD_DIAG_TEST_BYTES_PER_ADC_SAMPLE * \\r
-        BOARD_DIAG_TEST_NUM_CHIRPS * BOARD_DIAG_TEST_NUM_RX))\r
-\r
-#define BOARD_DIAG_TEST_COMMON_CB_ARG       (0x11112222U)\r
-#define BOARD_DIAG_TEST_COMBINED_EOF_CB_ARG (0x33334444U)\r
-\r
-#define BOARD_DIAG_PING_PONG_ALIGNMENT CSL_MAX(CSIRX_PING_PONG_ADDRESS_LINEOFFSET_ALIGNMENT_IN_BYTES, \\r
-                                         CSL_CACHE_L1D_LINESIZE)\r
-\r
-#define BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED CSL_NEXT_MULTIPLE_OF(BOARD_DIAG_TEST_NUM_BYTES_PER_FRAME, \\r
-                                                                BOARD_DIAG_PING_PONG_ALIGNMENT)\r
-\r
-\r
-/*! Defines RAM types for choosing ping-pong buffers */\r
-typedef enum BoardDiag_RAMtype_e\r
-{\r
-    BOARD_DIAG_L3RAM,\r
-    BOARD_DIAG_HWARAM,\r
-    BOARD_DIAG_L2RAM\r
-} BoardDiag_RAMtype;\r
-\r
-typedef struct Board_DiagConfig_s\r
-{\r
-    CSIRX_DphyConfig_t DPHYcfg;\r
-    CSIRX_ComplexIoConfig_t complexIOcfg;\r
-    CSIRX_CommonConfig_t commonCfg;\r
-    CSIRX_ContextConfig_t contextCfg;\r
-} Board_DiagConfig;\r
-\r
-typedef struct BoardDiag_ContextIRQcount_s\r
-{\r
-    volatile uint32_t frameEndCodeDetect;\r
-    uint32_t lineEndCodeDetect;\r
-} BoardDiag_ContextIRQcount;\r
-\r
-/*! holds common IRQ counts */\r
-typedef struct BoardDiag_CommonIRQcount_s\r
-{\r
-    uint32_t isOCPerror;\r
-    uint32_t isGenericShortPacketReceive;\r
-    uint32_t isECConeBitShortPacketErrorCorrect;\r
-    uint32_t isECCmoreThanOneBitCannotCorrect;\r
-    uint32_t isComplexIOerror;\r
-    uint32_t isFIFOoverflow;\r
-} BoardDiag_CommonIRQcount;\r
-\r
-typedef struct BoardDiag_IRQs_s\r
-{\r
-    CSIRX_ContextIRQ_t context[CSIRX_NUM_CONTEXTS];\r
-    CSIRX_CommonIRQ_t common;\r
-    CSIRX_LanesIRQ_t  complexIOlanes;\r
-} BoardDiag_IRQs;\r
-\r
-typedef struct BoardDiag_CallBackCounts_s\r
-{\r
-    uint32_t common;\r
-    uint32_t combinedEOL;\r
-    uint32_t combinedEOF;\r
-    uint32_t EOF0;\r
-    uint32_t EOF1;\r
-    uint32_t SOF0;\r
-    uint32_t SOF1;\r
-    uint32_t contextEOL[CSIRX_NUM_CONTEXTS];\r
-} BoardDaig_CallBackCounts;\r
-\r
-typedef struct BoardDaig_State_s\r
-{\r
-       BoardDiag_CommonIRQcount commonIRQcount;\r
-    BoardDiag_IRQs IRQ;\r
-    BoardDaig_CallBackCounts callbackCount;\r
-    bool isReceivedPayloadCorrect;\r
-       BoardDiag_ContextIRQcount contextIRQcounts[CSIRX_NUM_CONTEXTS];\r
-    uint32_t frameId;\r
-    uint32_t lineId;\r
-       uint32_t receivedBuffer;\r
-} BoardDaig_State;\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/**\r
- * \brief   This function executes CSI-Rx diagnostic test\r
- *\r
- * \return  int8_t\r
- *             0   - in case of success\r
- *            -1   - in case of failure\r
- *\r
- */\r
-int8_t BoardDiag_CsirxTest(void);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif /* __cplusplus */\r
-\r
-#endif /* _CSIRX_TEST_TPR12_H_ */\r
+/******************************************************************************
+* Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*****************************************************************************/
+
+/**
+ *
+ * \file   csirx_test_tpr12.h
+ *
+ * \brief  This is the header file for CSI-Rx diagnostic test.
+ *
+ */
+
+#ifndef _CSIRX_TEST_TPR12_H_
+#define _CSIRX_TEST_TPR12_H_
+
+/* Standard Include Files. */
+#include <stdint.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+
+#include <ti/drv/csirx/soc/csirx_soc_priv.h>
+#include <ti/drv/csirx/csirx.h>
+#include <ti/csl/cslr_csirx.h>
+#include <ti/osal/CacheP.h>
+
+#include <assert.h>
+#include <ti/drv/csirx/csirx.h>
+
+#include <ti/csl/soc.h>
+#include <ti/osal/osal.h>
+#include <ti/osal/DebugP.h>
+#include <ti/osal/CycleprofilerP.h>
+#include <ti/board/board.h>
+
+#include <ti/drv/uart/UART.h>
+#include <ti/drv/uart/UART_stdio.h>
+
+/* ======================================================================== */
+/*                           Macros & Typedefs                              */
+/* ======================================================================== */
+
+/* should match with CSI TX, assumes complex sample */
+//#define PAYLOAD_PATTERN_CHECK             (1)
+
+#define BOARD_DIAG_TEST_NUM_ADC_SAMPLES_PER_CHIRP (256U)
+#define BOARD_DIAG_TEST_BYTES_PER_ADC_SAMPLE      (4U) //complex
+#define BOARD_DIAG_TEST_NUM_CHIRPS                (1U)
+#define BOARD_DIAG_TEST_NUM_FRAMES                (10U)
+#define BOARD_DIAG_TEST_NUM_RX                    (4U)
+
+#define BOARD_DIAG_TEST_PATTERN                                  (0xFFU)
+#define BOARD_DIAG_TEST_CONTEXT               (2U)
+#define BOARD_DIAG_TEST_FORMAT                (CSIRX_FORMAT_RAW8)
+#define BOARD_DIAG_TEST_VC                    (0U)
+#define BOARD_DIAG_TEST_USER_DEFINED_MAPPING  (CSIRX_USER_DEFINED_FORMAT_RAW8)
+#define BOARD_DIAG_NUM_INSTANCES                         (2U)
+
+#define BOARD_DIAG_TEST_NUM_BYTES_PER_FRAME \
+    ((BOARD_DIAG_TEST_NUM_ADC_SAMPLES_PER_CHIRP * BOARD_DIAG_TEST_BYTES_PER_ADC_SAMPLE * \
+        BOARD_DIAG_TEST_NUM_CHIRPS * BOARD_DIAG_TEST_NUM_RX))
+
+#define BOARD_DIAG_TEST_COMMON_CB_ARG       (0x11112222U)
+#define BOARD_DIAG_TEST_COMBINED_EOF_CB_ARG (0x33334444U)
+
+#define BOARD_DIAG_PING_PONG_ALIGNMENT CSL_MAX(CSIRX_PING_PONG_ADDRESS_LINEOFFSET_ALIGNMENT_IN_BYTES, \
+                                         CSL_CACHE_L1D_LINESIZE)
+
+#define BOARD_DIAG_PING_OR_PONG_BUF_SIZE_ALIGNED CSL_NEXT_MULTIPLE_OF(BOARD_DIAG_TEST_NUM_BYTES_PER_FRAME, \
+                                                                BOARD_DIAG_PING_PONG_ALIGNMENT)
+
+
+/*! Defines RAM types for choosing ping-pong buffers */
+typedef enum BoardDiag_RAMtype_e
+{
+    BOARD_DIAG_L3RAM,
+    BOARD_DIAG_HWARAM,
+    BOARD_DIAG_L2RAM
+} BoardDiag_RAMtype;
+
+typedef struct Board_DiagConfig_s
+{
+    CSIRX_DphyConfig_t DPHYcfg;
+    CSIRX_ComplexIoConfig_t complexIOcfg;
+    CSIRX_CommonConfig_t commonCfg;
+    CSIRX_ContextConfig_t contextCfg;
+} Board_DiagConfig;
+
+typedef struct BoardDiag_ContextIRQcount_s
+{
+    volatile uint32_t frameEndCodeDetect;
+    uint32_t lineEndCodeDetect;
+} BoardDiag_ContextIRQcount;
+
+/*! holds common IRQ counts */
+typedef struct BoardDiag_CommonIRQcount_s
+{
+    uint32_t isOCPerror;
+    uint32_t isGenericShortPacketReceive;
+    uint32_t isECConeBitShortPacketErrorCorrect;
+    uint32_t isECCmoreThanOneBitCannotCorrect;
+    uint32_t isComplexIOerror;
+    uint32_t isFIFOoverflow;
+} BoardDiag_CommonIRQcount;
+
+typedef struct BoardDiag_IRQs_s
+{
+    CSIRX_ContextIRQ_t context[CSIRX_NUM_CONTEXTS];
+    CSIRX_CommonIRQ_t common;
+    CSIRX_LanesIRQ_t  complexIOlanes;
+} BoardDiag_IRQs;
+
+typedef struct BoardDiag_CallBackCounts_s
+{
+    uint32_t common;
+    uint32_t combinedEOL;
+    uint32_t combinedEOF;
+    uint32_t EOF0;
+    uint32_t EOF1;
+    uint32_t SOF0;
+    uint32_t SOF1;
+    uint32_t contextEOL[CSIRX_NUM_CONTEXTS];
+} BoardDaig_CallBackCounts;
+
+typedef struct BoardDaig_State_s
+{
+       BoardDiag_CommonIRQcount commonIRQcount;
+    BoardDiag_IRQs IRQ;
+    BoardDaig_CallBackCounts callbackCount;
+    bool isReceivedPayloadCorrect;
+       BoardDiag_ContextIRQcount contextIRQcounts[CSIRX_NUM_CONTEXTS];
+    uint32_t frameId;
+    uint32_t lineId;
+       uint32_t receivedBuffer;
+} BoardDaig_State;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _CSIRX_TEST_TPR12_H_ */