changed the test name and corresponding file names from icssg_enet to enet_icssg
authorPotluri Krishna <x1082264@ti.com>
Wed, 6 Oct 2021 13:13:31 +0000 (18:43 +0530)
committerAnkur <ankurbaranwal@ti.com>
Sat, 9 Oct 2021 07:38:03 +0000 (02:38 -0500)
packages/ti/board/diag/board_diag_component.mk
packages/ti/board/diag/enet_icssg/build/am65xx/linker_mcu1_0.lds [moved from packages/ti/board/diag/icssg_enet/build/am65xx/linker_mcu1_0.lds with 100% similarity]
packages/ti/board/diag/enet_icssg/build/makefile [moved from packages/ti/board/diag/icssg_enet/build/makefile with 97% similarity]
packages/ti/board/diag/enet_icssg/src/enet_icssg_test.c [moved from packages/ti/board/diag/icssg_enet/src/icssg_enet_test.c with 99% similarity]
packages/ti/board/diag/enet_icssg/src/enet_icssg_test.h [moved from packages/ti/board/diag/icssg_enet/src/icssg_enet_test.h with 99% similarity]
packages/ti/board/diag/icssg_emac/build/am65xx_idk/linker.lds [deleted file]
packages/ti/board/diag/icssg_emac/build/makefile [deleted file]
packages/ti/board/diag/icssg_emac/src/icssg_emac_test.c [deleted file]
packages/ti/board/diag/icssg_emac/src/icssg_emac_test.h [deleted file]

index c17787010b24c731ac6b47f7c70c9034efa81c17..dc2a4845af17276c76380e51cf2218e72da79658 100644 (file)
@@ -585,35 +585,20 @@ export board_diag_hyperbus_$(SOC)_CORELIST
 export board_diag_hyperbus_SBL_APPIMAGEGEN = $(board_diag_APPIMAGEGEN_CTRL)
 board_diag_EXAMPLE_LIST += board_diag_hyperbus
 
-# icssg_emac
-export board_diag_icssgEmac_COMP_LIST = board_diag_icssgEmac
-board_diag_icssgEmac_RELPATH = ti/board/diag/icssg_emac/build
-board_diag_icssgEmac_PATH = $(PDK_BOARD_DIAG_COMP_PATH)/icssg_emac/build
-board_diag_icssgEmac_CUSTOM_BINPATH = $(board_diag_LOCAL_BINPATH)
-export board_diag_icssgEmac_MAKEFILE = -f makefile
-export board_diag_icssgEmac_BOARD_DEPENDENCY = yes
-export board_diag_icssgEmac_CORE_DEPENDENCY = yes
-board_diag_icssgEmac_PKG_LIST = board_diag_icssgEmac
-board_diag_icssgEmac_INCLUDE = $(board_diag_icssgEmac_PATH)
-board_diag_icssgEmac_BOARDLIST = am65xx_evm am65xx_idk
-export board_diag_icssgEmac_$(SOC)_CORELIST = $(board_diag_$(SOC)_CORELIST)
-export board_diag_icssgEmac_SBL_APPIMAGEGEN = $(board_diag_APPIMAGEGEN_CTRL)
-board_diag_EXAMPLE_LIST += board_diag_icssgEmac
-
-# icssg_enet
-export board_diag_icssgEnet_COMP_LIST = board_diag_icssgEnet
-board_diag_icssgEnet_RELPATH = ti/board/diag/icssg_enet/build
-board_diag_icssgEnet_PATH = $(PDK_BOARD_DIAG_COMP_PATH)/icssg_enet/build
-board_diag_icssgEnet_CUSTOM_BINPATH = $(board_diag_LOCAL_BINPATH)
-export board_diag_icssgEnet_MAKEFILE = -f makefile
-export board_diag_icssgEnet_BOARD_DEPENDENCY = yes
-export board_diag_icssgEnet_CORE_DEPENDENCY = yes
-board_diag_icssgEnet_PKG_LIST = board_diag_icssgEnet
-board_diag_icssgEnet_INCLUDE = $(board_diag_icssgEnet_PATH)
-board_diag_icssgEnet_BOARDLIST = am65xx_evm am65xx_idk
-export board_diag_icssgEnet_$(SOC)_CORELIST = $(board_diag_$(SOC)_CORELIST)
-export board_diag_icssgEnet_SBL_APPIMAGEGEN = $(board_diag_APPIMAGEGEN_CTRL)
-board_diag_EXAMPLE_LIST += board_diag_icssgEnet
+# enet_icssg
+export board_diag_enetIcssg_COMP_LIST = board_diag_enetIcssg
+board_diag_enetIcssg_RELPATH = ti/board/diag/enet_icssg/build
+board_diag_enetIcssg_PATH = $(PDK_BOARD_DIAG_COMP_PATH)/enet_icssg/build
+board_diag_enetIcssg_CUSTOM_BINPATH = $(board_diag_LOCAL_BINPATH)
+export board_diag_enetIcssg_MAKEFILE = -f makefile
+export board_diag_enetIcssg_BOARD_DEPENDENCY = yes
+export board_diag_enetIcssg_CORE_DEPENDENCY = yes
+board_diag_enetIcssg_PKG_LIST = board_diag_enetIcssg
+board_diag_enetIcssg_INCLUDE = $(board_diag_enetIcssg_PATH)
+board_diag_enetIcssg_BOARDLIST = am65xx_evm am65xx_idk
+export board_diag_enetIcssg_$(SOC)_CORELIST = $(board_diag_$(SOC)_CORELIST)
+export board_diag_enetIcssg_SBL_APPIMAGEGEN = $(board_diag_APPIMAGEGEN_CTRL)
+board_diag_EXAMPLE_LIST += board_diag_enetIcssg
 
 # icssg_led
 export board_diag_icssgLed_COMP_LIST = board_diag_icssgLed
similarity index 97%
rename from packages/ti/board/diag/icssg_enet/build/makefile
rename to packages/ti/board/diag/enet_icssg/build/makefile
index d737a455bc8624164a6f0ce2ae894e1b02a2d10c..094ce1406ab32790a91e7d27be1c19a56150286e 100644 (file)
@@ -39,7 +39,7 @@
 include $(PDK_INSTALL_PATH)/ti/build/Rules.make
 
 # Board diag parameters which can be controlled outside this makefile
-DIAGNAME ?= icssgEnet
+DIAGNAME ?= enetIcssg
 PROFILE ?= release
 TESTMODE ?= FUNCTIONAL_TEST
 MODENAME ?=
@@ -77,7 +77,7 @@ PACKAGE_SRCS_COMMON += ../../common/$(SOC)
 PACKAGE_SRCS_COMMON += ../../board_diag_component.mk
 PACKAGE_SRCS_COMMON += ../../create_sd.bat ../../create_sd.sh
 
-SRCS_COMMON += icssg_enet_test.c diag_common_cfg.c emac_fw_config_dual_mac.c
+SRCS_COMMON += enet_icssg_test.c diag_common_cfg.c emac_fw_config_dual_mac.c
 
 BOARD_DIAG_CFLAGS += -DENET_ENABLE_ICSSG
 export ENET_ENABLE_ICSSG=yes
similarity index 99%
rename from packages/ti/board/diag/icssg_enet/src/icssg_enet_test.c
rename to packages/ti/board/diag/enet_icssg/src/enet_icssg_test.c
index 1db01399282b8ecc4ebcf0803d6c74cdff5a409e..87df07f1ba086834c97189c898999e8cb9deb0fd 100644 (file)
@@ -31,7 +31,7 @@
  */
 
  /*!
- * \file  icssg_enet_test.c
+ * \file  enet_icssg_test.c
  *
  * \brief This file contains the implementation of the Enet lld with icssg example.
  */
@@ -40,7 +40,7 @@
 /*                             Include Files                                  */
 /* ========================================================================== */
 
-#include "icssg_enet_test.h"
+#include "enet_icssg_test.h"
 
 /* ========================================================================== */
 /*                           Macros & Typedefs                                */
similarity index 99%
rename from packages/ti/board/diag/icssg_enet/src/icssg_enet_test.h
rename to packages/ti/board/diag/enet_icssg/src/enet_icssg_test.h
index 7290197c6920f00cdddfaee7d26f2422f693d6f3..8d75d29bd9b4d848beccbbae83a143c70c8a8821 100644 (file)
@@ -31,7 +31,7 @@
  */
 
  /*!
- * \file  enet_test.h
+ * \file  enet_icssg_test.h
  *
  * \brief This file contains the type definitions and helper macros for ICSSG
  *        TimeSync.
diff --git a/packages/ti/board/diag/icssg_emac/build/am65xx_idk/linker.lds b/packages/ti/board/diag/icssg_emac/build/am65xx_idk/linker.lds
deleted file mode 100644 (file)
index 905a877..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*     File: linker_a53.lds
- *  Semihosting supported gcc Linker script for maxwell A53 for QT
- *     Purpose: single core A53 C app
-*/
-__STACK_SIZE = 0x8000;
-__TI_STACK_SIZE = __STACK_SIZE;
-
-MEMORY
-{
-    /* Reserved for SBL/Available at run time from 0x000041C00000 to 0x000041C3E000 */
-    /* Refer user guide for details */
-       OCMCRAM     : ORIGIN = 0x000041C3E000, LENGTH = 0x00042000                              /* MCUSS-OCMC RAM - 512KB                                       */
-    BOOTVECTOR  : ORIGIN = 0x000070000100, LENGTH = 0x00001000 - 0x100      /* MSMC RAM INIT CODE (4 KB)                               */
-    DIAG_FRAMEWORK  : ORIGIN = 0x000070001000, LENGTH = 0x80000 - 0x1000       /* MSMC resrved for diag framework - Don't use for diag tests */
-    DIAG_COMMON     : ORIGIN = 0x000070080000, LENGTH = 0x68000                                /* MSMC for diag common usage */
-    DIAG_STACK      : ORIGIN = 0x0000700E8000, LENGTH = 0x8000                         /* MSMC for diag stack */
-    DMSC_RSVD       : ORIGIN = 0x0000700F0000, LENGTH = 0x10000                                /* MSMC reserved for DMSC - DO NOT use it */
-    DIAG_DATA       : ORIGIN = 0x000070100000, LENGTH = 0xF0000                                /* MSMC for diag data */
-    DDR_0      (RWX) : ORIGIN =  0x80000000, LENGTH = 0x10000000
-    DDR_1      (RWX) : ORIGIN =  0x90000000, LENGTH = 0x10000000
-    DDR_2      (RWX) : ORIGIN =  0xA0000000, LENGTH = 0x60000000
-}
-
-REGION_ALIAS("REGION_TEXT", DDR_0);
-REGION_ALIAS("REGION_BSS", DDR_0);
-REGION_ALIAS("REGION_USB_RAMDISK", DIAG_DATA);
-REGION_ALIAS("REGION_DIAG_DATA", DIAG_DATA);
-REGION_ALIAS("REGION_DIAG_CODE", DIAG_DATA);
-REGION_ALIAS("REGION_DATA", DDR_0);
-REGION_ALIAS("REGION_STACK", DIAG_STACK);
-REGION_ALIAS("REGION_HEAP", DIAG_DATA);
-REGION_ALIAS("REGION_ARM_EXIDX", DIAG_COMMON);
-REGION_ALIAS("REGION_ARM_EXTAB", DIAG_COMMON);
-REGION_ALIAS("REGION_TEXT_STARTUP", DIAG_COMMON);
-REGION_ALIAS("REGION_DISPLAY_BUFFER", DDR_0);
-REGION_ALIAS("REGION_DATA_BUFFER", DDR_1);
-REGION_ALIAS("REGION_UART_BUFFER", DDR_0);
-
-SECTIONS {
-
-    .vecs : {
-        *(.vecs)
-    } > BOOTVECTOR AT> BOOTVECTOR
-
-    .text.csl_a53_startup : {
-        *(.text.csl_a53_startup)
-               *(.Entry)
-    } > REGION_TEXT_STARTUP AT> REGION_TEXT_STARTUP
-
-    .text : {
-        CREATE_OBJECT_SYMBOLS
-        *(.text)
-        *(.text.*)
-        . = ALIGN(0x8);
-        KEEP (*(.ctors))
-        . = ALIGN(0x4);
-        KEEP (*(.dtors))
-        . = ALIGN(0x8);
-        __init_array_start = .;
-        KEEP (*(.init_array*))
-        __init_array_end = .;
-        *(.init)
-        *(.fini*)
-    } > REGION_TEXT AT> REGION_TEXT
-
-    PROVIDE (__etext = .);
-    PROVIDE (_etext = .);
-    PROVIDE (etext = .);
-
-    .rodata : {
-        *(.rodata)
-        *(.rodata*)
-    } > REGION_TEXT AT> REGION_TEXT
-
-    .data_buffer (NOLOAD) : ALIGN (8) {
-        __data_buffer_load__ = LOADADDR (.data_buffer);
-        __data_buffer_start__ = .;
-        *(.data_buffer)
-        *(.data_buffer*)
-        . = ALIGN (8);
-        __data_buffer_end__ = .;
-    } > REGION_DATA_BUFFER AT> REGION_DATA_BUFFER
-
-    .data : ALIGN (8) {
-        __data_load__ = LOADADDR (.data);
-        __data_start__ = .;
-        *(.data)
-        *(.data*)
-        . = ALIGN (8);
-        __data_end__ = .;
-    } > REGION_DATA AT> REGION_DATA_BUFFER
-
-    .ARM.exidx : {
-        __exidx_start = .;
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-        __exidx_end = .;
-    } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX
-
-    .ARM.extab : {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB
-
-    .bss : {
-        __bss_start__ = .;
-        *(.shbss)
-        *(.bss)
-        *(.bss.*)
-        . = ALIGN (8);
-        __bss_end__ = .;
-        . = ALIGN (8);
-        __bss_common_start__ = .;
-        *(COMMON)
-        __bss_common_end__ = .;
-    } > REGION_BSS AT> REGION_BSS
-
-    .heap : {
-        __heap_start__ = .;
-        end = __heap_start__;
-        _end = end;
-        __end = end;
-        KEEP(*(.heap))
-        __heap_end__ = .;
-        __HeapLimit = __heap_end__;
-    } > REGION_HEAP AT> REGION_HEAP
-
-    .stack (NOLOAD) : ALIGN(16) {
-        _stack = .;
-        __stack = .;
-        KEEP(*(.stack))
-    } > REGION_STACK AT> REGION_STACK
-
-       __TI_STACK_BASE = __stack;
-
-    usbramdisk :
-    {
-        . = ALIGN(8);
-        *(usbramdisk*)
-    } > REGION_USB_RAMDISK
-
-    displaybuffer :
-    {
-        . = ALIGN(8);
-        *(displaybuffer*)
-    } > REGION_DISPLAY_BUFFER AT> REGION_DISPLAY_BUFFER
-
-    uartbuffer (NOLOAD):
-    {
-        . = ALIGN(8);
-        *(uartbuffer*)
-    } > REGION_UART_BUFFER AT> REGION_UART_BUFFER
-
-    diagData :
-    {
-        . = ALIGN(8);
-        *(diagData*)
-    } > REGION_DIAG_DATA AT> REGION_DIAG_DATA
-
-    diagCode : {
-        CREATE_OBJECT_SYMBOLS
-        *(.text)
-        *(.text.*)
-        . = ALIGN(0x8);
-    } > REGION_DIAG_CODE AT> REGION_DIAG_CODE
-
-    /* Stabs debugging sections.  */
-    .stab          0 : { *(.stab) }
-    .stabstr       0 : { *(.stabstr) }
-    .stab.excl     0 : { *(.stab.excl) }
-    .stab.exclstr  0 : { *(.stab.exclstr) }
-    .stab.index    0 : { *(.stab.index) }
-    .stab.indexstr 0 : { *(.stab.indexstr) }
-    .comment       0 : { *(.comment) }
-    /*
-     * DWARF debug sections.
-     * Symbols in the DWARF debugging sections are relative to the beginning
-     * of the section so we begin them at 0.
-     */
-    /* DWARF 1 */
-    .debug         0 : { *(.debug) }
-    .line          0 : { *(.line) }
-    /* GNU DWARF 1 extensions */
-    .debug_srcinfo  0 : { *(.debug_srcinfo) }
-    .debug_sfnames  0 : { *(.debug_sfnames) }
-    /* DWARF 1.1 and DWARF 2 */
-    .debug_aranges  0 : { *(.debug_aranges) }
-    .debug_pubnames 0 : { *(.debug_pubnames) }
-    /* DWARF 2 */
-    .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
-    .debug_abbrev   0 : { *(.debug_abbrev) }
-    .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
-    .debug_frame    0 : { *(.debug_frame) }
-    .debug_str      0 : { *(.debug_str) }
-    .debug_loc      0 : { *(.debug_loc) }
-    .debug_macinfo  0 : { *(.debug_macinfo) }
-    /* SGI/MIPS DWARF 2 extensions */
-    .debug_weaknames 0 : { *(.debug_weaknames) }
-    .debug_funcnames 0 : { *(.debug_funcnames) }
-    .debug_typenames 0 : { *(.debug_typenames) }
-    .debug_varnames  0 : { *(.debug_varnames) }
-    /* DWARF 3 */
-    .debug_pubtypes 0 : { *(.debug_pubtypes) }
-    .debug_ranges   0 : { *(.debug_ranges) }
-    /* DWARF Extension.  */
-    .debug_macro    0 : { *(.debug_macro) }
-    .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
-    /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
-}
diff --git a/packages/ti/board/diag/icssg_emac/build/makefile b/packages/ti/board/diag/icssg_emac/build/makefile
deleted file mode 100755 (executable)
index dee6506..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-# Copyright (C) 2020-2021 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 ?= icssgEmac\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
-SRCDIR = ../src ../../common/$(SOC) ../../../../drv/emac/firmware/icss_dualmac/config\r
-INCDIR = ../../../../board ../src ../../../src/$(BOARD)/include ../../../src/$(BOARD) ../../common/$(SOC) ../../../../drv/emac/firmware/icss_dualmac/config\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 = board csl csl_init osal_nonos uart gpio i2c\r
-ifeq ($(SOC), $(filter $(SOC), am65xx))\r
-COMP_LIST_COMMON += sciclient udma pruss\r
-endif\r
-COMP_LIST_COMMON += enet enetsoc enetphy enet_example_utils_baremetal pm_lib enet_cfgserver\r
-\r
-# Common source files and CFLAGS across all platforms and cores\r
-PACKAGE_SRCS_COMMON = ../src makefile\r
-ifeq ($(SOC), $(filter $(SOC), am65xx))\r
-PACKAGE_SRCS_COMMON += am65xx_idk\r
-endif\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
-SRCS_COMMON += icssg_emac_test.c diag_common_cfg.c emac_fw_config_dual_mac.c\r
-\r
-ifeq ($(CORE),$(filter $(CORE), mcu1_0))\r
-SRCS_ASM_COMMON += diag_entry_r5.asm\r
-endif\r
-\r
-ifeq ($(CORE),$(filter $(CORE), mpu1_0))\r
-SRCS_ASM_COMMON += diag_entry.asm\r
-endif\r
-\r
-EXTERNAL_LNKCMD_FILE_LOCAL = am65xx_idk/linker.lds\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
diff --git a/packages/ti/board/diag/icssg_emac/src/icssg_emac_test.c b/packages/ti/board/diag/icssg_emac/src/icssg_emac_test.c
deleted file mode 100755 (executable)
index 18c9540..0000000
+++ /dev/null
@@ -1,1549 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2021 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   icssg_emac_test.c
- *
- *  \brief  ICSSG ethernet diagnostic test file
- *
- *  Targeted Functionality: Verification of basic functionality of
- *  ICSSG Ethernet interface.
- *
- *  Operation: This is the Loopback test code for the Ethernet Interface.
- *  The test code showcases usage of the ENET Driver exported API for
- *  sending/receiving Ethernet packets.
- *
- *  Supported SoCs: AM65xx
- *
- *  Supported Platforms: am65xx_evm, am65xx_idk.
- *
- */
-
-/* Test application local header file */
-#include "icssg_emac_test.h"
-
-/* Trasnmitt and receive status variables */
-static volatile bool gTxSem = false;
-static volatile bool gRxSem = false;
-
-/* Enet loopback test object */
-static BoardDiag_EnetLpbkObj_t gEnetLpbk;
-
-/**
- * \brief   ENET receive ISR function
- *
- * \param   void *appData   application data
- *
- * \return  NULL
- */
-static void BoardDiag_enetLpbkRxIsrFxn(void *appData)
-{
-    gRxSem = true;
-}
-
-/**
- * \brief   ENET transmit ISR function
- *
- * \param   void *appData   application data
- *
- * \return  NULL
- */
-static void BoardDiag_enetLpbkTxIsrFxn(void *appData)
-{
-    gTxSem = true;
-}
-
-/**
- * \brief   This function is used for close the ENET module.
- *
- * \param   NULL
- *
- * \return  NULL
- */
-static void BoardDiag_enetLpbkCloseEnet(void)
-{
-    Enet_IoctlPrms prms;
-    int32_t status;
-
-    /* Close port link */
-    ENET_IOCTL_SET_IN_ARGS(&prms, &gEnetLpbk.macPort);
-
-    status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                        ENET_PER_IOCTL_CLOSE_PORT_LINK, &prms);
-    if (status != ENET_SOK)
-    {
-        UART_printf("Failed to close port link: %d\n", status);
-    }
-
-#if !(defined(SOC_TPR12) || defined(SOC_AWR294X))
-    /* Detach core */
-    if (status == ENET_SOK)
-    {
-        ENET_IOCTL_SET_IN_ARGS(&prms, &gEnetLpbk.coreKey);
-
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            ENET_PER_IOCTL_DETACH_CORE, &prms);
-        if (status != ENET_SOK)
-        {
-            UART_printf("Failed to detach core key %u: %d\n", gEnetLpbk.coreKey, status);
-        }
-    }
-#endif
-    /* Close Enet driver */
-    Enet_close(gEnetLpbk.hEnet);
-
-    gEnetLpbk.hEnet = NULL;
-}
-
-/**
- * \brief   This function is used for de-initialize the ENET DMA driver.
- *
- * \param   NULL
- *
- * \return  NULL
- */
-static void BoardDiag_enetLpbkCloseDma()
-{
-    EnetDma_PktQ fqPktInfoQ;
-    EnetDma_PktQ cqPktInfoQ;
-
-    EnetQueue_initQ(&fqPktInfoQ);
-    EnetQueue_initQ(&cqPktInfoQ);
-
-    UART_printf("Closing DMA\n");
-    /* There should not be any ready packet */
-    if(EnetQueue_getQCount(&gEnetLpbk.rxReadyQ) != 0)
-    {
-        UART_printf("EnetQueue_getQCount Failed\n");
-        return;
-    }
-
-    /* Close RX Flow */
-    EnetAppUtils_closeRxFlow(gEnetLpbk.enetType,
-                             gEnetLpbk.hEnet,
-                             gEnetLpbk.coreKey,
-                             gEnetLpbk.coreId,
-                             true,
-                             &fqPktInfoQ,
-                             &cqPktInfoQ,
-                             gEnetLpbk.rxStartFlowIdx,
-                             gEnetLpbk.rxFlowIdx,
-                             gEnetLpbk.hostMacAddr,
-                             gEnetLpbk.hRxCh);
-    EnetAppUtils_freePktInfoQ(&fqPktInfoQ);
-    EnetAppUtils_freePktInfoQ(&cqPktInfoQ);
-
-    /* Close TX channel */
-    EnetQueue_initQ(&fqPktInfoQ);
-    EnetQueue_initQ(&cqPktInfoQ);
-
-    EnetAppUtils_closeTxCh(gEnetLpbk.hEnet,
-                           gEnetLpbk.coreKey,
-                           gEnetLpbk.coreId,
-                           &fqPktInfoQ,
-                           &cqPktInfoQ,
-                           gEnetLpbk.hTxCh,
-                           gEnetLpbk.txChNum);
-    EnetAppUtils_freePktInfoQ(&fqPktInfoQ);
-    EnetAppUtils_freePktInfoQ(&cqPktInfoQ);
-
-    EnetAppUtils_freePktInfoQ(&gEnetLpbk.rxFreeQ);
-    EnetAppUtils_freePktInfoQ(&gEnetLpbk.txFreePktInfoQ);
-
-    EnetMem_deInit();
-}
-
-/**
- * \brief   This function is used to Mac port statistics
- *
- * \param   CpswStats_HostPort_2g *st   Cpsw stats
- *
- * \return  NULL
- */
-static void BoardDiag_printMacPortStats2G(CpswStats_MacPort_2g *st)
-{
-    uint32_t i;
-
-    UART_printf("rxGoodFrames            = %d\n", (uint32_t)st->rxGoodFrames);
-    UART_printf("rxBcastFrames           = %d\n", (uint32_t)st->rxBcastFrames);
-    UART_printf("rxOctets                = %d\n", (uint32_t)st->rxOctets);
-    UART_printf("txGoodFrames            = %d\n", (uint32_t)st->txGoodFrames);
-    UART_printf("txBcastFrames           = %d\n", (uint32_t)st->txBcastFrames);
-    UART_printf("txOctets                = %d\n", (uint32_t)st->txOctets);
-    UART_printf("octetsFrames512to1023   = %d\n",
-                (uint32_t)st->octetsFrames512to1023);
-
-    for (i = 0U; i < ENET_ARRAYSIZE((uint32_t)st->txPri); i++)
-    {
-        UART_printf("txPri[%u]                = %d\n", i,
-                    (uint32_t)st->txPri[i]);
-    }
-
-    for (i = 0U; i < ENET_ARRAYSIZE((uint32_t)st->txPriBcnt); i++)
-    {
-        UART_printf("txPriBcnt[%u]            = %d\n", i,
-                    (uint32_t)st->txPriBcnt[i]);
-    }
-}
-
-/**
- * \brief   This function is used to Host port statistics
- *
- * \param   CpswStats_HostPort_2g *st   Cpsw stats
- *
- * \return  NULL
- */
-static void BoardDiag_printHostPortStats2G(CpswStats_HostPort_2g *st)
-{
-    UART_printf("rxGoodFrames            = %d\n", (uint32_t)st->rxGoodFrames);
-    UART_printf("rxBcastFrames           = %u\n", (uint32_t)st->rxBcastFrames);
-    UART_printf("rxOctets                = %d\n", (uint32_t)st->rxOctets);
-    UART_printf("txGoodFrames            = %d\n", (uint32_t)st->txGoodFrames);
-    UART_printf("txBcastFrames           = %d\n", (uint32_t)st->txBcastFrames);
-    UART_printf("txOctets                = %d\n", (uint32_t)st->txOctets);
-    UART_printf("octetsFrames512to1023   = %d\n",
-                (uint32_t)st->octetsFrames512to1023);
-}
-
-/**
- * \brief   This function is used to display Mac and Host port statistics
- *
- * \param   NULL
- *
- * \return  NULL
- *
- */
-static void BoardDiag_enetLpbkShowCpswStats(void)
-{
-    Enet_IoctlPrms prms;
-    CpswStats_PortStats portStats;
-    int32_t status;
-
-    /* Show host port statistics */
-    ENET_IOCTL_SET_OUT_ARGS(&prms, &portStats);
-    status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                        ENET_STATS_IOCTL_GET_HOSTPORT_STATS, &prms);
-    if (status == ENET_SOK)
-    {
-        UART_printf("\n Port 0 Statistics\n");
-        UART_printf("-----------------------------------------\n");
-        BoardDiag_printHostPortStats2G((CpswStats_HostPort_2g *)&portStats);
-        UART_printf("\n");
-    }
-    else
-    {
-        UART_printf("Failed to get host stats: %d\n", status);
-    }
-
-    /* Show MAC port statistics */
-    if (status == ENET_SOK)
-    {
-        ENET_IOCTL_SET_INOUT_ARGS(&prms, &gEnetLpbk.macPort, &portStats);
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            ENET_STATS_IOCTL_GET_MACPORT_STATS, &prms);
-        if (status == ENET_SOK)
-        {
-            UART_printf("\n Port 1 Statistics\n");
-            UART_printf("-----------------------------------------\n");
-            BoardDiag_printMacPortStats2G((CpswStats_MacPort_2g *)&portStats);
-            UART_printf("\n");
-        }
-        else
-        {
-            UART_printf("Failed to get MAC stats: %d\n", status);
-        }
-    }
-}
-
-/**
- * \brief   This function is used to display Mac address
- *
- * \param   uint8_t macAddr[] MAC Address
- *
- * \return   NULL
- *
- */
-static void BoardDiag_printMacAddr(uint8_t macAddr[])
-{
-    UART_printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
-                       macAddr[0] & 0xFF,
-                       macAddr[1] & 0xFF,
-                       macAddr[2] & 0xFF,
-                       macAddr[3] & 0xFF,
-                       macAddr[4] & 0xFF,
-                       macAddr[5] & 0xFF);
-}
-
-/**
- * \brief   This function is used to display Mac address
- *
- * \param   EthFrame EthFrame[] frame to be displayed
- *          uint32_t len        length of the frame
- * \return  NULL
- *
- */
-static void BoardDiag_printFrame(EthFrame *frame,
-                                uint32_t len)
-{
-    uint8_t *payload;
-    uint32_t i;
-
-    UART_printf("Dst addr : ");
-    BoardDiag_printMacAddr(&frame->hdr.dstMac[0]);
-
-    UART_printf("Src addr : ");
-    BoardDiag_printMacAddr(&frame->hdr.srcMac[0]);
-
-    if (frame->hdr.etherType == Enet_htons(ETHERTYPE_VLAN_TAG))
-    {
-        EthVlanFrame *vlanFrame = (EthVlanFrame *)frame;
-
-        UART_printf("TPID     : 0x%04x\n", 
-                    Enet_ntohs(vlanFrame->hdr.tpid) & 0xFFFFU);
-        UART_printf("Priority : %d\n",
-                    (Enet_ntohs(vlanFrame->hdr.tci) & 0xFFFFU) >> 13);
-        UART_printf("VLAN Id  : %d\n",
-                    Enet_ntohs(vlanFrame->hdr.tci) & 0xFFFU);
-        UART_printf("EtherType: 0x%04x\n",
-                    Enet_ntohs(vlanFrame->hdr.etherType) & 0xFFFFU);
-        payload = vlanFrame->payload;
-        len    -= ETH_VLAN_TAG_LEN;
-    }
-    else
-    {
-        UART_printf("EtherType: 0x%04x\n", 
-                    Enet_ntohs(frame->hdr.etherType) & 0xFFFFU);
-        payload = frame->payload;
-    }
-
-    UART_printf("Payload  : ");
-    for (i = 0; i < len; i++)
-    {
-        UART_printf("0x%02x ", payload[i]);
-        if (i && (((i + 1) % OCTETS_PER_ROW) == 0))
-        {
-            UART_printf("\n           ");
-        }
-    }
-
-    if (len && ((len % OCTETS_PER_ROW) != 0))
-    {
-        UART_printf("\n");
-    }
-
-    UART_printf("\n");
-}
-
-/**
- * \brief   This function is used to queue the received packets to rx ready queue
- *
- * \param   NULL
- *
- * \return  uint32_t - Receive ready queue count
- *
- */
-static uint32_t BoardDiag_enetLpbkReceivePkts(void)
-{
-    EnetDma_PktQ rxReadyQ;
-    EnetDma_Pkt *pktInfo;
-    int32_t status;
-    uint32_t rxReadyCnt = 0U;
-
-    EnetQueue_initQ(&rxReadyQ);
-
-    /* Retrieve any CPSW packets which are ready */
-    status = EnetDma_retrieveRxPktQ(gEnetLpbk.hRxCh, &rxReadyQ);
-
-    if (status == ENET_SOK)
-    {
-        rxReadyCnt = EnetQueue_getQCount(&rxReadyQ);
-
-        /* Queue the received packet to rxReadyQ and pass new ones from rxFreeQ
-        **/
-        pktInfo = (EnetDma_Pkt *)EnetQueue_deq(&rxReadyQ);
-        while (pktInfo != NULL)
-        {
-            EnetDma_checkPktState(&pktInfo->pktState,
-                                    ENET_PKTSTATE_MODULE_APP,
-                                    ENET_PKTSTATE_APP_WITH_DRIVER,
-                                    ENET_PKTSTATE_APP_WITH_READYQ);
-
-            EnetQueue_enq(&gEnetLpbk.rxReadyQ, &pktInfo->node);
-            pktInfo = (EnetDma_Pkt *)EnetQueue_deq(&rxReadyQ);
-        }
-    }
-    else
-    {
-        UART_printf("receivePkts() failed to retrieve pkts: %d\n",
-                           status);
-    }
-
-    return rxReadyCnt;
-}
-
-/**
- * \brief   This function is used to retrieve's any CPSW packets that may be free now
- *
- * \param   NULL
- *
- * \return  uint32_t - Transmit free queue count
- *
- */
-static uint32_t BoardDiag_enetLpbkRetrieveFreeTxPkts(void)
-{
-    EnetDma_PktQ txFreeQ;
-    EnetDma_Pkt *pktInfo;
-    int32_t status;
-    uint32_t txFreeQCnt = 0U;
-
-    EnetQueue_initQ(&txFreeQ);
-
-    /* Retrieve any CPSW packets that may be free now */
-    status = EnetDma_retrieveTxPktQ(gEnetLpbk.hTxCh, &txFreeQ);
-    if (status == ENET_SOK)
-    {
-        txFreeQCnt = EnetQueue_getQCount(&txFreeQ);
-
-        pktInfo = (EnetDma_Pkt *)EnetQueue_deq(&txFreeQ);
-        while (NULL != pktInfo)
-        {
-            EnetDma_checkPktState(&pktInfo->pktState,
-                                    ENET_PKTSTATE_MODULE_APP,
-                                    ENET_PKTSTATE_APP_WITH_DRIVER,
-                                    ENET_PKTSTATE_APP_WITH_FREEQ);
-
-            EnetQueue_enq(&gEnetLpbk.txFreePktInfoQ, &pktInfo->node);
-            pktInfo = (EnetDma_Pkt *)EnetQueue_deq(&txFreeQ);
-        }
-    }
-    else
-    {
-        UART_printf("retrieveFreeTxPkts() failed to retrieve pkts: %d\n",
-                           status);
-    }
-
-    return txFreeQCnt;
-}
-
-/**
- * \brief   This function is used for CPSW packet transmission
- *          and reception
- *
- * \param   NULL
- *
- * \return  int32_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int32_t BoardDiag_cpswPktRxTx(void)
-{
-    EnetDma_PktQ txSubmitQ;
-    EnetDma_Pkt *pktInfo;
-    EthFrame *frame;
-    uint32_t txRetrievePktCnt = 0;
-    uint32_t loopTxPktCnt = 0;
-    uint32_t loopRxPktCnt = 0;
-    uint32_t loopCnt = 0, pktCnt = 0;
-    uint32_t rxReadyCnt = 0;
-    int32_t status = ENET_SOK;
-    uint8_t bcastAddr[ENET_MAC_ADDR_LEN] = 
-            {0xffU, 0xffU, 0xffU, 0xffU, 0xffU, 0xffU};
-
-    gEnetLpbk.totalTxCnt = 0U;
-    for (loopCnt = 0U; loopCnt < BOARD_DIAG_ENETLPBK_NUM_ITERATION; loopCnt++)
-    {
-        pktCnt = 0U;
-        while (pktCnt < BOARD_DIAG_ENETLPBK_TEST_PKT_NUM)
-        {
-            loopRxPktCnt = loopTxPktCnt = 0U;
-            /* Transmit a single packet */
-            EnetQueue_initQ(&txSubmitQ);
-
-            /* Dequeue one free TX Eth packet */
-            pktInfo = (EnetDma_Pkt *)EnetQueue_deq(&gEnetLpbk.txFreePktInfoQ);
-
-            while (NULL != pktInfo)
-            {
-                pktCnt++;
-                /* Fill the TX Eth frame with test content */
-                frame = (EthFrame *)pktInfo->bufPtr;
-                memcpy(frame->hdr.dstMac, bcastAddr, ENET_MAC_ADDR_LEN);
-                memcpy(frame->hdr.srcMac, &gEnetLpbk.hostMacAddr[0U],
-                        ENET_MAC_ADDR_LEN);
-                frame->hdr.etherType = Enet_htons(ETHERTYPE_EXPERIMENTAL1);
-                memset(&frame->payload[0U], (uint8_t)(0xA5 + pktCnt),
-                        BOARD_DIAG_ENETLPBK_TEST_PKT_LEN);
-                pktInfo->userBufLen = BOARD_DIAG_ENETLPBK_TEST_PKT_LEN +
-                                      sizeof(EthFrameHeader);
-                pktInfo->appPriv    = &gEnetLpbk;
-                EnetDma_checkPktState(&pktInfo->pktState,
-                                        ENET_PKTSTATE_MODULE_APP,
-                                        ENET_PKTSTATE_APP_WITH_FREEQ,
-                                        ENET_PKTSTATE_APP_WITH_DRIVER);
-
-                /* Enqueue the packet for later transmission */
-                EnetQueue_enq(&txSubmitQ, &pktInfo->node);
-
-                if (pktCnt >= BOARD_DIAG_ENETLPBK_TEST_PKT_NUM)
-                {
-                    break;
-                }
-
-                /* Dequeue one free TX Eth packet */
-                pktInfo =
-                (EnetDma_Pkt *)EnetQueue_deq(&gEnetLpbk.txFreePktInfoQ);
-            }
-            loopTxPktCnt = EnetQueue_getQCount(&txSubmitQ);
-            while (0U != EnetQueue_getQCount(&txSubmitQ))
-            {
-                uint32_t txCnt = EnetQueue_getQCount(&txSubmitQ);
-                status = EnetDma_submitTxPktQ(gEnetLpbk.hTxCh,
-                                                   &txSubmitQ);
-                while (gTxSem != true);
-                gTxSem = false;
-
-                /* Retrieve TX free packets */
-                if (status == ENET_SOK)
-                {
-                    txCnt            = txCnt - EnetQueue_getQCount(&txSubmitQ);
-                    txRetrievePktCnt = 0U;
-                    while (txRetrievePktCnt != txCnt)
-                    {
-                        /* TODO this is not failure as HW is busy sending
-                         * packets, we need to wait and again call retrieve
-                         * packets */
-                        BOARD_delay(1);
-                        txRetrievePktCnt += BoardDiag_enetLpbkRetrieveFreeTxPkts();
-                    }
-                }
-                else
-                {
-                    break;
-                }
-            }
-            
-            /* wait to receive the packet */
-            do
-            {
-                while (gRxSem != true);
-                gRxSem = false;
-
-                /* Get the packets received so far */
-                rxReadyCnt = BoardDiag_enetLpbkReceivePkts();
-                if (rxReadyCnt > 0U)
-                {
-                    /* Consume the received packets and release them */
-                    pktInfo =
-                    (EnetDma_Pkt *)EnetQueue_deq(&gEnetLpbk.rxReadyQ);
-                    while (NULL != pktInfo)
-                    {
-                        EnetDma_checkPktState(&pktInfo->pktState,
-                                                ENET_PKTSTATE_MODULE_APP,
-                                                ENET_PKTSTATE_APP_WITH_READYQ,
-                                                ENET_PKTSTATE_APP_WITH_FREEQ);
-
-                        /* Consume the packet by just printing its content */
-                        if (gEnetLpbk.printFrame)
-                        {
-                            frame = (EthFrame *)pktInfo->bufPtr;
-
-                            BoardDiag_printFrame(frame, pktInfo->userBufLen -
-                                        sizeof(EthFrameHeader));
-                        }
-
-                        /* Release the received packet */
-                        EnetQueue_enq(&gEnetLpbk.rxFreeQ, &pktInfo->node);
-                        pktInfo =
-                        (EnetDma_Pkt *)EnetQueue_deq(&gEnetLpbk.rxReadyQ);
-                    }
-
-                    /*Submit now processed buffers */
-                    if (status == ENET_SOK)
-                    {
-                        EnetAppUtils_validatePacketState(
-                                                &gEnetLpbk.rxFreeQ,
-                                                ENET_PKTSTATE_APP_WITH_FREEQ,
-                                                ENET_PKTSTATE_APP_WITH_DRIVER);
-
-                        EnetDma_submitRxPktQ(gEnetLpbk.hRxCh,
-                                         &gEnetLpbk.rxFreeQ);
-                    }
-                }
-
-                loopRxPktCnt += rxReadyCnt;
-            }
-            while (loopRxPktCnt < loopTxPktCnt);
-
-            gEnetLpbk.totalRxCnt += loopTxPktCnt;
-        }
-
-        gEnetLpbk.totalTxCnt += pktCnt;
-    }
-    
-    if (status == ENET_SOK)
-    {
-        if(gEnetLpbk.totalTxCnt != gEnetLpbk.totalRxCnt)
-        {
-            UART_printf("Packet loss, Test Failed\n");
-            return -1;
-        }
-        UART_printf("\nTransmitted - %d packets\nReceived - %d packets\n",
-                        gEnetLpbk.totalTxCnt, gEnetLpbk.totalRxCnt);
-    }
-    else
-    {
-        UART_printf("Failed to transmit/receive packets: %d,transmitted: %d\n",
-                    BOARD_DIAG_ENETLPBK_TEST_PKT_NUM, gEnetLpbk.totalTxCnt);
-    }
-
-    return status;
-}
-
-/**
- * \brief   CPSW delay function
- *
- * \param   waitTime     [IN]   Wait time
- *
- */
-static void BoardDiag_enetWait(uint32_t waitTime)
-{
-    volatile uint32_t index;
-
-    /* we multiply waitTime by 10000 as 400MHz R5 takes 2.5ns for single cycle
-     * and we assume for loop takes 4 cycles */
-    for (index = 0; index < (waitTime*1000); index++);
-}
-
-/**
- * \brief   This function Waits till phy link is up.
- *
- * \param   NULL
- *
- * \return  int32_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int32_t BoardDiag_enetLpbkWaitForLinkUp(void)
-{
-    Enet_IoctlPrms prms;
-    bool linked = false;
-    int32_t status = ENET_SOK;
-
-    ENET_IOCTL_SET_INOUT_ARGS(&prms, &gEnetLpbk.macPort, &linked);
-
-    while (!linked)
-    {
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            ENET_PER_IOCTL_IS_PORT_LINK_UP, &prms);
-        if (status != ENET_SOK)
-        {
-            UART_printf("Failed to get port %u's link status: %d\n",
-                            ENET_MACPORT_ID(gEnetLpbk.macPort), status);
-            linked = false;
-            break;
-        }
-
-        if (!linked)
-        {
-            Enet_periodicTick(gEnetLpbk.hEnet);
-            BoardDiag_enetWait(1000U);
-        }
-    }
-
-    return status;
-}
-
-/**
- * \brief   This function checks the live status of the phy
- *
- * \param   NULL
- *
- * \return  int32_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int32_t BoardDiag_enetLpbkShowAlivePhys(void)
-{
-    Enet_IoctlPrms prms;
-    bool alive = false;
-    int8_t phyCnt;
-    int32_t status;
-
-    for (phyCnt = 0U; phyCnt < ENET_MDIO_PHY_CNT_MAX; phyCnt++)
-    {
-        ENET_IOCTL_SET_INOUT_ARGS(&prms, &phyCnt, &alive);
-
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            ENET_MDIO_IOCTL_IS_ALIVE, &prms);
-        if (status == ENET_SOK)
-        {
-            if (alive == true)
-            {
-                UART_printf("PHY %u is alive\n", phyCnt);
-            }
-        }
-        else
-        {
-            UART_printf("Failed to get PHY %u alive status: %d\n", phyCnt, status);
-            return -1;
-        }
-    }
-
-    return status;
-}
-
-/**
- * \brief   This function is used to set the ALE port state to forward.
- *
- * \param   NULL
- *
- * \return  int32_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int32_t BoardDiag_enetLpbkSetupCpswAle(void)
-{
-    Enet_IoctlPrms prms;
-    CpswAle_SetPortStateInArgs setPortStateInArgs;
-    CpswAle_SetUcastEntryInArgs setUcastInArgs;
-    uint32_t entryIdx;
-    int32_t status;
-
-    /* ALE entry with "secure" bit cleared is required for loopback */
-    setUcastInArgs.addr.vlanId  = 0U;
-    setUcastInArgs.info.portNum = CPSW_ALE_HOST_PORT_NUM;
-    setUcastInArgs.info.blocked = false;
-    setUcastInArgs.info.secure  = false;
-    setUcastInArgs.info.super   = false;
-    setUcastInArgs.info.ageable = false;
-    setUcastInArgs.info.trunk   = false;
-
-    EnetUtils_copyMacAddr(&setUcastInArgs.addr.addr[0U],
-                          gEnetLpbk.hostMacAddr);
-
-    ENET_IOCTL_SET_INOUT_ARGS(&prms, &setUcastInArgs, &entryIdx);
-
-    status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                        CPSW_ALE_IOCTL_ADD_UCAST, &prms);
-    if (status != ENET_SOK)
-    {
-        UART_printf("Failed to add ucast entry: %d\n", status);
-    }
-
-    /* Set host port to 'forwarding' state */
-    if (status == ENET_SOK)
-    {
-        setPortStateInArgs.portNum   = CPSW_ALE_HOST_PORT_NUM;
-        setPortStateInArgs.portState = CPSW_ALE_PORTSTATE_FORWARD;
-        ENET_IOCTL_SET_IN_ARGS(&prms, &setPortStateInArgs);
-
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            CPSW_ALE_IOCTL_SET_PORT_STATE, &prms);
-        if (status != ENET_SOK)
-        {
-            UART_printf("Failed to set ALE port state: %d\n", status);
-        }
-    }
-
-    return status;
-}
-
-/**
- * \brief   This function is used to initialize the receive ready packet queue
- *
- * \param   NULL
- *
- * \return  int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int8_t BoardDiag_enetLpbkInitRxReadyPktQ(void)
-{
-    EnetDma_PktQ rxReadyQ;
-    EnetDma_Pkt *pPktInfo;
-    int32_t status;
-    uint32_t memUtilsRxPkts;
-
-    EnetQueue_initQ(&gEnetLpbk.rxFreeQ);
-    EnetQueue_initQ(&gEnetLpbk.rxReadyQ);
-    EnetQueue_initQ(&rxReadyQ);
-
-    for (memUtilsRxPkts = 0U; memUtilsRxPkts < ENET_MEM_NUM_RX_PKTS; memUtilsRxPkts++)
-    {
-        pPktInfo =
-        EnetMem_allocEthPkt(&gEnetLpbk,
-                            ENET_MEM_LARGE_POOL_PKT_SIZE,
-                            ENETDMA_CACHELINE_ALIGNMENT);
-        if(pPktInfo == NULL)
-        {
-            UART_printf("EnetMem_allocEthPkt failed\n");
-            return -1;
-        }
-        ENET_UTILS_SET_PKT_APP_STATE(&pPktInfo->pktState,
-                                     ENET_PKTSTATE_APP_WITH_FREEQ);
-        EnetQueue_enq(&gEnetLpbk.rxFreeQ, &pPktInfo->node);
-    }
-
-    /* Retrieve any CPSW packets which are ready */
-    status = EnetDma_retrieveRxPktQ(gEnetLpbk.hRxCh, &rxReadyQ);
-    if(status != ENET_SOK)
-    {
-        UART_printf("EnetDma_retrieveRxPktQ failed\n");
-        return -1;
-    }
-    /* There should not be any packet with DMA during init */
-    if(EnetQueue_getQCount(&rxReadyQ) != 0U)
-    {
-        UART_printf("EnetQueue_getQCount failed\n");
-        return -1;
-    }
-
-    EnetAppUtils_validatePacketState(&gEnetLpbk.rxFreeQ,
-                                     ENET_PKTSTATE_APP_WITH_FREEQ,
-                                     ENET_PKTSTATE_APP_WITH_DRIVER);
-
-    EnetDma_submitRxPktQ(gEnetLpbk.hRxCh,
-                         &gEnetLpbk.rxFreeQ);
-
-    /* Assert here as during init no. of DMA descriptors should be equal to
-     * no. of free Ethernet buffers available with app */
-    if(EnetQueue_getQCount(&gEnetLpbk.rxFreeQ) != 0U)
-    {
-        UART_printf("EnetQueue_getQCount failed\n");
-        return -1;
-    }
-    return 0;
-}
-
-/**
- * \brief   This function is used to initialize the free packet
- *          info queue with the Ethernet packets to be transmitted.
- *
- * \param   NULL
- *
- * \return  int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int8_t BoardDiag_enetLpbkInitTxFreePktQ(void)
-{
-    EnetDma_Pkt *pPktInfo;
-    uint32_t memUtilsTxPkts;
-
-    /* Initialize all queues */
-    EnetQueue_initQ(&gEnetLpbk.txFreePktInfoQ);
-
-    /* Initialize TX EthPkts and queue them to txFreePktInfoQ */
-    for (memUtilsTxPkts = 0U; memUtilsTxPkts < ENET_MEM_NUM_TX_PKTS; memUtilsTxPkts++)
-    {
-        pPktInfo = 
-        EnetMem_allocEthPkt(&gEnetLpbk,
-                                       ENET_MEM_LARGE_POOL_PKT_SIZE,
-                                       ENETDMA_CACHELINE_ALIGNMENT);
-        if(pPktInfo == NULL)
-        {
-            UART_printf("EnetMem_allocEthPkt failed\n");
-            return -1;
-        }
-        ENET_UTILS_SET_PKT_APP_STATE(&pPktInfo->pktState,
-                                     ENET_PKTSTATE_APP_WITH_FREEQ);
-
-        EnetQueue_enq(&gEnetLpbk.txFreePktInfoQ, &pPktInfo->node);
-    }
-
-    UART_printf("initQs() txFreePktInfoQ initialized with %d pkts\n",
-                       EnetQueue_getQCount(&gEnetLpbk.txFreePktInfoQ));
-    return 0;
-}
-
-/**
- * \brief   This function is used to open the CPSW DMA module
- *
- * \param   NULL
- *
- * \return  int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int8_t BoardDiag_enetLpbkOpenDma()
-{
-    int32_t status = ENET_SOK;
-    EnetUdma_OpenRxFlowPrms rxChCfg;
-    EnetUdma_OpenTxChPrms   txChCfg;
-
-    /* Open the CPSW TX channel  */
-    if (status == ENET_SOK)
-    {
-        EnetDma_initTxChParams(&txChCfg);
-
-        txChCfg.cbArg   = &gEnetLpbk;
-        txChCfg.notifyCb = BoardDiag_enetLpbkTxIsrFxn;
-
-        EnetAppUtils_setCommonTxChPrms(&txChCfg);
-
-        EnetAppUtils_openTxCh(gEnetLpbk.hEnet,
-                              gEnetLpbk.coreKey,
-                              gEnetLpbk.coreId,
-                              &gEnetLpbk.txChNum,
-                              &gEnetLpbk.hTxCh,
-                              &txChCfg);
-
-        if(BoardDiag_enetLpbkInitTxFreePktQ() != BOARD_DIAG_SUCCESS)
-        {
-            UART_printf("BoardDiag_enetLpbkInitTxFreePktQ Failed\n");
-            return -1;
-        }
-
-        if (NULL == gEnetLpbk.hTxCh)
-        {
-            /* Free the Ch Num if open Tx Ch failed */
-            EnetAppUtils_freeTxCh(gEnetLpbk.hEnet,
-                                  gEnetLpbk.coreKey,
-                                  gEnetLpbk.coreId,
-                                  gEnetLpbk.txChNum);
-            UART_printf("EnetDma_openTxCh() failed to open: %d\n",
-                               status);
-        }
-    }
-
-    /* Open the CPSW RX Channel  */
-    if (status == ENET_SOK)
-    {
-        EnetDma_initRxChParams(&rxChCfg);
-        rxChCfg.notifyCb = BoardDiag_enetLpbkRxIsrFxn;
-        rxChCfg.cbArg   = &gEnetLpbk;
-
-        EnetAppUtils_setCommonRxFlowPrms(&rxChCfg);
-        EnetAppUtils_openRxFlow(gEnetLpbk.enetType,
-                                gEnetLpbk.hEnet,
-                                gEnetLpbk.coreKey,
-                                gEnetLpbk.coreId,
-                                true,
-                                &gEnetLpbk.rxStartFlowIdx,
-                                &gEnetLpbk.rxFlowIdx,
-                                &gEnetLpbk.hostMacAddr[0U],
-                                &gEnetLpbk.hRxCh,
-                                &rxChCfg);
-        if (NULL == gEnetLpbk.hRxCh)
-        {
-            UART_printf("EnetDma_openRxCh() failed to open: %d\n",
-                               status);
-
-           /* TODO: should we close TxCh here */
-        }
-        else
-        {
-            status = EnetAppUtils_allocMac(gEnetLpbk.hEnet,
-                                           gEnetLpbk.coreKey,
-                                           gEnetLpbk.coreId,
-                                           gEnetLpbk.hostMacAddr);
-            UART_printf("Host MAC address: ");
-            BoardDiag_printMacAddr(gEnetLpbk.hostMacAddr);
-            /* Submit all ready RX buffers to DMA.*/
-            if(BoardDiag_enetLpbkInitRxReadyPktQ() != BOARD_DIAG_SUCCESS)
-            {
-                UART_printf("BoardDiag_enetLpbkInitRxReadyPktQ failed\n");
-                return -1;
-            }
-        }
-    }
-    if(status != ENET_SOK)
-    {
-        return -1;
-    }
-    return 0;
-}
-
-/**
- * \brief   This function is used set MII mode.
- *
- * \param   emac_mode       macMode   mac mode
- *          EnetPhy_Mii     *mii      MII mode
- *
- * \return  int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int8_t BoardDiag_enetLpbkMacMode2PhyMii(emac_mode macMode,
-                                    EnetPhy_Mii *mii)
-{
-    switch (macMode)
-    {
-        case RMII:
-            *mii = ENETPHY_MAC_MII_RMII;
-            break;
-        case RGMII:
-            *mii = ENETPHY_MAC_MII_RGMII;
-            break;
-        default:
-            UART_printf("Invalid MAC mode: %u\n", macMode);
-            return -1;
-    }
-    return 0;
-}
-
-
-/**
- * \brief   This function is used set layerType,sublayerType and variantType.
- *
- * \param   emac_mode                   macMode   mac mode
- *          EnetMacPort_Interface       *mii      MII mode
- *
- * \return  int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int8_t BoardDiag_enetLpbkMacMode2MacMii(emac_mode macMode,
-                                    EnetMacPort_Interface *mii)
-{
-    switch (macMode)
-    {
-        case RMII:
-            mii->layerType    = ENET_MAC_LAYER_MII;
-            mii->sublayerType = ENET_MAC_SUBLAYER_REDUCED;
-            mii->variantType  = ENET_MAC_VARIANT_NONE;
-            break;
-        case RGMII:
-            mii->layerType    = ENET_MAC_LAYER_GMII;
-            mii->sublayerType = ENET_MAC_SUBLAYER_REDUCED;
-            mii->variantType  = ENET_MAC_VARIANT_FORCED;
-            break;
-        default:
-            UART_printf("Invalid MAC mode: %u\n", macMode);
-            return -1;
-    }
-    return 0;
-}
-
-/**
- * \brief   This function is used init cpsw configurations.
- *
- * \param   Cpsw_Cfg *cpswCfg           cpsw configurations
- *
- * \return  NULL
- *
- */
-static void BoardDiag_enetLpbkInitCpswCfg(Cpsw_Cfg *cpswCfg)
-{
-    CpswHostPort_Cfg *hostPortCfg = &cpswCfg->hostPortCfg;
-    CpswAle_Cfg *aleCfg = &cpswCfg->aleCfg;
-    CpswCpts_Cfg *cptsCfg = &cpswCfg->cptsCfg;
-
-    /* Set initial config */
-    Enet_initCfg(gEnetLpbk.enetType, gEnetLpbk.instId, cpswCfg,
-                sizeof(*cpswCfg));
-
-    /* Peripheral config */
-    cpswCfg->vlanCfg.vlanAware = false;
-
-    /* Host port config */
-    hostPortCfg->removeCrc      = true;
-    hostPortCfg->padShortPacket = true;
-    hostPortCfg->passCrcErrors  = true;
-
-    /* ALE config */
-    aleCfg->modeFlags                          = CPSW_ALE_CFG_MODULE_EN;
-    aleCfg->agingCfg.autoAgingEn           = true;
-    aleCfg->agingCfg.agingPeriodInMs           = 1000;
-    aleCfg->nwSecCfg.vid0ModeEn            = true;
-    aleCfg->vlanCfg.aleVlanAwareMode           = false;
-    aleCfg->vlanCfg.cpswVlanAwareMode          = false;
-    aleCfg->vlanCfg.unknownUnregMcastFloodMask = CPSW_ALE_ALL_PORTS_MASK;
-    aleCfg->vlanCfg.unknownRegMcastFloodMask   = CPSW_ALE_ALL_PORTS_MASK;
-    aleCfg->vlanCfg.unknownVlanMemberListMask  = CPSW_ALE_ALL_PORTS_MASK;
-
-    /* CPTS config */
-    /* Note: Timestamping and MAC loopback are not supported together because
-     * of IP limitation, so disabling timestamping for this application */
-    cptsCfg->hostRxTsEn = false;
-
-    EnetAppUtils_initResourceConfig(gEnetLpbk.enetType, gEnetLpbk.coreId,
-                                    &cpswCfg->resCfg);
-}
-
-/**
- * \brief   This function is used to open the ENET driver
- *
- * \param   NULL
- *
- * \return  int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int8_t BoardDiag_enetLpbkOpenEnet(void)
-{
-    Cpsw_Cfg cpswCfg;
-    EnetUdma_Cfg dmaCfg;
-    Enet_IoctlPrms prms;
-    EnetPer_PortLinkCfg portLinkCfg;
-    CpswMacPort_Cfg macCfg;
-    int32_t status = ENET_SOK;
-
-    cpswCfg.dmaCfg = &dmaCfg;
-    /* Initialize peripheral config */
-    BoardDiag_enetLpbkInitCpswCfg(&cpswCfg);
-
-    UART_printf("CPSW_2G Test on MCU NAVSS\n");
-    /* Set Enet global runtime log level */
-    Enet_setTraceLevel(ENET_TRACE_DEBUG);
-
-    /* Open the Enet driver */
-    gEnetLpbk.hEnet = Enet_open(gEnetLpbk.enetType, gEnetLpbk.instId, &cpswCfg,
-                                sizeof(cpswCfg));
-
-    if (gEnetLpbk.hEnet == NULL)
-    {
-        UART_printf("Failed to open Enet driver\n");
-        return -1;
-    }
-
-    /* Setup port link open parameters */
-    if (status == ENET_SOK)
-    {
-        EnetBoard_EthPort ethPort;
-        EnetMacPort_LinkCfg *linkCfg = &portLinkCfg.linkCfg;
-        EnetMacPort_Interface *mii = &portLinkCfg.mii;
-        EnetPhy_Cfg *phyCfg = &portLinkCfg.phyCfg;
-        EnetPhy_Mii phyMii;
-
-        /* Setup board for requested Ethernet port */
-        ethPort.enetType = gEnetLpbk.enetType;
-        ethPort.instId   = gEnetLpbk.instId;
-        ethPort.macPort  = gEnetLpbk.macPort;
-        ethPort.boardId  = gEnetLpbk.boardId;
-        if(BoardDiag_enetLpbkMacMode2MacMii(gEnetLpbk.macMode, &ethPort.mii) != 
-                                            BOARD_DIAG_SUCCESS)
-        {
-            UART_printf("BoardDiag_enetLpbkMacMode2MacMii failed\n");
-            return -1;
-        }
-
-        status = EnetBoard_setupPorts(&ethPort, 1U);
-        if(status != ENET_SOK)
-        {
-            UART_printf("EnetBoard_setupPorts failed\n");
-            return -1;
-        }
-
-        /* Set port link params */
-        portLinkCfg.macPort = gEnetLpbk.macPort;
-        portLinkCfg.macCfg = &macCfg;
-
-        CpswMacPort_initCfg(&macCfg);
-
-        if(BoardDiag_enetLpbkMacMode2MacMii(gEnetLpbk.macMode, mii) 
-                                            != BOARD_DIAG_SUCCESS)
-        {
-            UART_printf("BoardDiag_enetLpbkMacMode2MacMii failed\n");
-            return -1;
-        }
-
-        if (gEnetLpbk.testPhyLoopback)
-        {
-            const EnetBoard_PhyCfg *boardPhyCfg = NULL;
-
-            /* Set PHY configuration params */
-            EnetPhy_initCfg(phyCfg);
-
-            if (BoardDiag_enetLpbkMacMode2PhyMii(gEnetLpbk.macMode, &phyMii) 
-                                                == BOARD_DIAG_SUCCESS)
-            {
-                boardPhyCfg = EnetBoard_getPhyCfg(&ethPort);
-                if (boardPhyCfg != NULL)
-                {
-                    phyCfg->phyAddr     = boardPhyCfg->phyAddr;
-                    phyCfg->isStrapped  = boardPhyCfg->isStrapped;
-                    phyCfg->skipExtendedCfg = boardPhyCfg->skipExtendedCfg;
-                    phyCfg->extendedCfgSize = boardPhyCfg->extendedCfgSize;
-                    memcpy(phyCfg->extendedCfg, boardPhyCfg->extendedCfg,
-                            phyCfg->extendedCfgSize);
-                }
-                else
-                {
-                    UART_printf("PHY info not found\n");
-                    return -1;
-                }
-
-                if ((phyMii == ENETPHY_MAC_MII_MII) ||
-                    (phyMii == ENETPHY_MAC_MII_RMII))
-                {
-                    linkCfg->speed = ENET_SPEED_100MBIT;
-                }
-                else
-                {
-                    /* TODO: TPR12 always 100 Mbits */
-                    linkCfg->speed = ENET_SPEED_100MBIT;
-                }
-
-                linkCfg->duplexity = ENET_DUPLEX_FULL;
-            }
-            else
-            {
-                UART_printf("BoardDiag_enetLpbkMacMode2PhyMii failed\n");
-                return -1;
-            }
-        }
-        else
-        {
-            phyCfg->phyAddr = ENETPHY_INVALID_PHYADDR;
-
-            if (mii->layerType == ENET_MAC_LAYER_MII)
-            {
-                linkCfg->speed = ENET_SPEED_100MBIT;
-            }
-            else
-            {
-                linkCfg->speed = ENET_SPEED_1GBIT;
-            }
-
-            linkCfg->duplexity = ENET_DUPLEX_FULL;
-
-        }
-
-        /* MAC and PHY loopbacks are mutually exclusive */
-        phyCfg->loopbackEn = gEnetLpbk.testPhyLoopback &&
-                                 !gEnetLpbk.testExtLoopback;
-
-        macCfg.loopbackEn = !gEnetLpbk.testPhyLoopback;
-    }
-
-    /* Open port link */
-    if (status == ENET_SOK)
-    {
-        ENET_IOCTL_SET_IN_ARGS(&prms, &portLinkCfg);
-
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            ENET_PER_IOCTL_OPEN_PORT_LINK, &prms);
-        if (status != ENET_SOK)
-        {
-            UART_printf("Failed to open port link: %d\n", status);
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-/**
- * \brief   This function is used to initialiaze the enet
-            parameters(gEnetLpbk) Ethernet external loopback test.
- *
- * \param   NULL
- *
- * \return  NULL
- *
- */
-static void BoardDiag_enetIniParams()
-{
-     /* Initialize loopback test config */
-    memset(&gEnetLpbk, 0, sizeof(gEnetLpbk));
-    
-    gEnetLpbk.enetType        = ENET_CPSW_9G;
-    gEnetLpbk.instId          = 0U;
-    gEnetLpbk.testPhyLoopback = true;
-    gEnetLpbk.testExtLoopback = true;
-    gEnetLpbk.macPort         = ENET_MAC_PORT_1;
-    gEnetLpbk.macMode         = RGMII;
-    gEnetLpbk.enetType        = ENET_CPSW_2G;
-    gEnetLpbk.boardId         = ENETBOARD_CPB_ID;
-
-}
-
-/**
- * \brief   This function is used to perform the CPSW
- *          Ethernet external loopback test
- *
- * \param   NULL
- *
- * \return  int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-static int8_t BoardDiag_cpswLoopbackTest()
-{
-    EnetOsal_Cfg osalCfg;
-    EnetUtils_Cfg utilsCfg;
-    Enet_IoctlPrms prms;
-    int32_t status;
-
-    /* Initialize the phy configurations */
-    EnetBoard_init();
-
-    /* Initialize the enet parameters */
-    BoardDiag_enetIniParams();
-
-    EnetAppUtils_enableClocks(gEnetLpbk.enetType, gEnetLpbk.instId);
-
-    /* Local core id */
-    gEnetLpbk.coreId = EnetSoc_getCoreId();
-
-    /* Initialize Enet driver (use default OSAL and utils) */
-    Enet_initOsalCfg(&osalCfg);
-    Enet_initUtilsCfg(&utilsCfg);
-    utilsCfg.print = EnetAppUtils_print;
-    Enet_init(&osalCfg, &utilsCfg);
-
-    /* Open Enet driver */
-    status = BoardDiag_enetLpbkOpenEnet();
-    if (status != 0)
-    {
-        UART_printf("Failed to open Enet driver: %d\n", status);
-        return -1;
-    }
-#if !(defined(SOC_TPR12) || defined(SOC_AWR294X))
-    if (status == ENET_SOK)
-    {
-        /* Attach the core with RM */
-        uint32_t coreId;
-        EnetPer_AttachCoreOutArgs attachCoreOutArgs;
-        coreId = gEnetLpbk.coreId;
-
-        ENET_IOCTL_SET_INOUT_ARGS(&prms, &coreId, &attachCoreOutArgs);
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            ENET_PER_IOCTL_ATTACH_CORE, &prms);
-        if (status != ENET_SOK)
-        {
-            UART_printf("EnetLpbk_loopbackTest failed"
-                         "ENET_PER_IOCTL_ATTACH_CORE: %d\n", status);
-            return -1;
-        }
-        else
-        {
-            gEnetLpbk.coreKey = attachCoreOutArgs.coreKey;
-        }
-    }
-#endif
-    if (status == ENET_SOK)
-    {
-        /* memutils open should happen after Cpsw is opened as it uses 
-         * CpswUtils_Q functions */
-        status = EnetMem_init();
-        if (status != ENET_SOK)
-        {
-            UART_printf("EnetMem_init failed: "
-                        "%d\n", status);
-            return -1;
-        }
-    }
-
-    /* Open DMA driver */
-    if (status == ENET_SOK)
-    {
-        status = BoardDiag_enetLpbkOpenDma();
-        if (status != ENET_SOK)
-        {
-            UART_printf("Failed to open DMA: %d\n", status);
-            return -1;
-        }
-    }
-
-    /* Enable host port */
-    if (status == ENET_SOK)
-    {
-        if (Enet_isCpswFamily(gEnetLpbk.enetType))
-        {
-            status = BoardDiag_enetLpbkSetupCpswAle();
-            if (status != ENET_SOK)
-            {
-                UART_printf("Failed to setup CPSW ALE: %d\n", status);
-                return -1;
-            }
-        }
-
-        if (status == ENET_SOK)
-        {
-            ENET_IOCTL_SET_NO_ARGS(&prms);
-            status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                                ENET_HOSTPORT_IOCTL_ENABLE, &prms);
-            if (status != ENET_SOK)
-            {
-                UART_printf("Failed to enable host port: %d\n", status);
-                return -1;
-            }
-        }
-    }
-
-    /* Show alive PHYs */
-    if (status == ENET_SOK)
-    {
-        status = BoardDiag_enetLpbkShowAlivePhys();
-    }
-
-    /* Wait for link up */
-    if ((status == ENET_SOK) && gEnetLpbk.testPhyLoopback)
-    {
-        status = BoardDiag_enetLpbkWaitForLinkUp();
-    }
-
-    /* Do packet transmission and reception */
-    if (status == ENET_SOK)
-    {
-       status = BoardDiag_cpswPktRxTx();
-    }
-
-    /* Print network statistics */
-    if (status == ENET_SOK)
-    {
-        if (Enet_isCpswFamily(gEnetLpbk.enetType))
-        {
-            BoardDiag_enetLpbkShowCpswStats();
-        }
-    }
-
-    /* Disable host port */
-    if (status == ENET_SOK)
-    {
-        ENET_IOCTL_SET_NO_ARGS(&prms);
-        status = Enet_ioctl(gEnetLpbk.hEnet, gEnetLpbk.coreId,
-                            ENET_HOSTPORT_IOCTL_DISABLE, &prms);
-        if (status != ENET_SOK)
-        {
-            UART_printf("Failed to disable host port: %d\n", status);
-            return -1;
-        }
-    }
-
-    /* Print DMA statistics */
-    if (status == ENET_SOK)
-    {
-        EnetAppUtils_showRxChStats(gEnetLpbk.hRxCh);
-        EnetAppUtils_showTxChStats(gEnetLpbk.hTxCh);
-    }
-
-    /* Close Enet DMA driver */
-    BoardDiag_enetLpbkCloseDma();
-
-    /* Close Enet driver */
-    BoardDiag_enetLpbkCloseEnet();
-
-    /* Disable peripheral clocks */
-    EnetAppUtils_disableClocks(gEnetLpbk.enetType, gEnetLpbk.instId);
-
-    /* Deinit Enet driver */
-    Enet_deinit();
-    UART_printf("Deinitializing of Enet driver done\n");
-
-    if(status == ENET_SOK)
-    {
-        UART_printf("Test Passed\n");
-    }
-    else
-    {
-        UART_printf("Test Failed\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-/**
- *  \brief    This function runs CPSW ethernet test
- *
- *  \return   int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-int8_t BoardDiag_cpswEthRunTest(void)
-{
-    int8_t ret;
-
-    UART_printf("\n*********************************************\n");
-    UART_printf  ("*            ENET Ethernet Test             *\n");
-    UART_printf  ("*********************************************\n");
-
-    /* Run the loopback test */
-    ret = BoardDiag_cpswLoopbackTest();
-
-    return ret;
-}
-
-/**
- * \brief  CPSW diagnostic test main function
- *
- *  This function performs board initializations and calls cpsw ethernet test
- *
- * \return  int
- *              0  - in case of success
- *             -1  - in case of failure
- *
- */
-#ifndef SPI_BOOT_FRAMEWORK
-int main(void)
-{
-    Board_initCfg boardCfg;
-    Board_STATUS status;
-    int8_t ret = 0;
-
-#ifdef PDK_RAW_BOOT
-    boardCfg = BOARD_INIT_MODULE_CLOCK |
-               BOARD_INIT_PINMUX_CONFIG |
-               BOARD_INIT_UART_STDIO;
-#else
-    boardCfg = BOARD_INIT_UART_STDIO | BOARD_INIT_PINMUX_CONFIG;
-#endif
-
-    status = Board_init(boardCfg);
-    if(status != BOARD_SOK)
-    {
-        return -1;
-    }
-
-    ret = BoardDiag_cpswEthRunTest();
-    if(ret == 0)
-    {
-        UART_printf("CPSW Loopback Test Passed\n\r");
-        UART_printf("All tests have passed\n\r");
-    }
-    else
-    {
-        UART_printf("CPSW Loopback Test failed\n\r");
-    }
-
-    return ret;
-
-}
-#endif
-
diff --git a/packages/ti/board/diag/icssg_emac/src/icssg_emac_test.h b/packages/ti/board/diag/icssg_emac/src/icssg_emac_test.h
deleted file mode 100755 (executable)
index 1623fa0..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2021 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   icssg_emac_test.h
- *
- *  \brief  This file contains all Local definitions for ICSSG Ethernet test
- *          application.
- *
- */
-
-#ifndef __CPSW_ETH_TEST_H__
-#define __CPSW_ETH_TEST_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <string.h>
-#include <assert.h>
-
-#include <ti/drv/uart/UART.h>
-#include <ti/drv/uart/UART_stdio.h>
-
-#include <ti/board/board.h>
-#include "diag_common_cfg.h"
-
-#if defined(am65xx_evm)
-#include <ti/board/src/am65xx_evm/include/board_ethernet_config.h>
-#else
-#include <ti/board/src/am65xx_idk/include/board_ethernet_config.h>
-#endif
-
-#include <ti/drv/enet/enet.h>
-#include <ti/drv/enet/include/core/enet_dma.h>
-#include <ti/drv/enet/include/per/cpsw.h>
-
-#include <ti/drv/enet/examples/utils/include/enet_apputils.h>
-#include <ti/drv/enet/examples/utils/include/enet_appmemutils.h>
-#include <ti/drv/enet/examples/utils/include/enet_appmemutils_cfg.h>
-#include <ti/drv/enet/examples/utils/include/enet_appboardutils.h>
-#include <ti/drv/enet/examples/utils/include/enet_apputils_rtos.h>
-#include <ti/drv/enet/examples/utils/include/enet_board_am65xevm.h>
-
-/* Loopback test iteration count */
-#define BOARD_DIAG_ENETLPBK_NUM_ITERATION          (1U)
-/* Loopback test Number of packets count */
-#define BOARD_DIAG_ENETLPBK_TEST_PKT_NUM           (20U)
-/* Loopback test packet length */
-#define BOARD_DIAG_ENETLPBK_TEST_PKT_LEN           (500U)
-/* Status check */
-#define BOARD_DIAG_SUCCESS                          (0U)
-
-extern void EnetAppUtils_timerInit(void);
-/** 
-  * @brief Enet device object structure 
-  *
-  */
-typedef struct BoardDiag_EnetLpbkObj_s
-{
-    /* Enet handle */
-    Enet_Handle hEnet;
-    /* CPSW instance type */
-    Enet_Type enetType;
-    /* Instant Id */
-    uint32_t instId;
-    /* Core Id */
-    uint32_t coreId;
-    /* Core Key */
-    uint32_t coreKey;
-    /* Board Id */
-    uint32_t boardId;
-    /* MAC port number */
-    Enet_MacPort macPort;
-    /* MAC mode (defined in board library) */
-    emac_mode macMode;
-    /* CPSW driver handle */
-    EnetDma_RxChHandle hRxCh;
-
-    EnetDma_PktQ rxFreeQ;
-    EnetDma_PktQ rxReadyQ;
-    EnetDma_TxChHandle hTxCh;
-    /* TX DMA packet info memory */
-    EnetDma_PktQ txFreePktInfoQ;
-
-    /* UDMA driver handle */
-    Udma_DrvHandle hUdmaDrv;
-    uint32_t rxFlowIdx;
-    uint32_t rxStartFlowIdx;
-    /* Tx channel number */
-    uint32_t txChNum;
-    /* Host mac address */
-    uint8_t hostMacAddr[ENET_MAC_ADDR_LEN];
-
-    /* Test config params */
-    /* external LoopBack enable */
-    bool testExtLoopback;
-    /* PHY loopback */
-    bool testPhyLoopback;
-    /* Print received Ethernet frames */
-    bool printFrame;
-
-    /* Packet transmission */
-    uint32_t totalTxCnt;
-
-    /* Packet reception */
-    uint32_t totalRxCnt;
-
-} BoardDiag_EnetLpbkObj_t;
-
-/**
- *  \brief    This function runs CPSW2G ethernet test
- *
- *  \return   int8_t
- *               0 - in case of success
- *              -1 - in case of failure.
- *
- */
-int8_t BoardDiag_cpswEthRunTest(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __CPSW_ETH_TEST_H__ */