summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f30ce71)
raw | patch | inline | side by side (parent: f30ce71)
author | Tinku Mannan <tmannan@ti.com> | |
Wed, 14 Aug 2019 21:38:30 +0000 (17:38 -0400) | ||
committer | Tinku Mannan <tmannan@ti.com> | |
Wed, 14 Aug 2019 21:38:30 +0000 (17:38 -0400) |
for verification of link status for 1G and 100 MBPS links
for verification of emac poll API duration
Signed-off-by: Tinku Mannan <tmannan@ti.com>
for verification of emac poll API duration
Signed-off-by: Tinku Mannan <tmannan@ti.com>
emac_component.mk | patch | blob | history | |
test/EmacLoopbackTest/am65xx/icssg/makefile_switch_link_status | [new file with mode: 0644] | patch | blob |
test/EmacLoopbackTest/main_am65xx.c | patch | blob | history | |
test/EmacLoopbackTest/test_utils_switch_k3.c | [changed mode: 0644->0755] | patch | blob | history |
test/Module.xs | patch | blob | history |
diff --git a/emac_component.mk b/emac_component.mk
index f66c6123b709525efd3baf64056773581c99423f..73ddbd0bb07a0ec1ce6f8b86249914ff99a77e1d 100644 (file)
--- a/emac_component.mk
+++ b/emac_component.mk
# All the tests mentioned in list are built when test target is called
# List below all test apps for allowed values
############################
-emac_EXAMPLE_LIST = Emac_Icssg_Switch_TestApp Emac_Icssg_TestApp Emac_Cpsw_TestApp Emac_Cpsw_Smp_TestApp Emac_Icssg_WithoutDDR_TestApp Emac_Icssg_Switch_Benchmark_TestApp
+emac_EXAMPLE_LIST = Emac_Icssg_Switch_TestApp Emac_Icssg_TestApp Emac_Cpsw_TestApp Emac_Cpsw_Smp_TestApp Emac_Icssg_WithoutDDR_TestApp Emac_Icssg_Switch_Benchmark_TestApp Emac_Icssg_Switch_LinkStatus_TestApp
drvemac_EXAMPLE_LIST = $(emac_EXAMPLE_LIST)
#
Emac_Icssg_Switch_Benchmark_TestApp_$(SOC)_CORELIST = $(drvemac_$(SOC)_CORELIST)
export Emac_Icssg_Switch_Benchmark_TestApp_$(SOC)_CORELIST
+# EMAC SWITCH Link status check unit test app ICSSG
+Emac_Icssg_Switch_LinkStatus_TestApp_COMP_LIST = Emac_Icssg_Switch_LinkStatus_TestApp
+Emac_Icssg_Switch_LinkStatus_TestApp_RELPATH = ti/drv/emac/test/EmacLoopbackTest
+Emac_Icssg_Switch_LinkStatus_TestApp_PATH = $(PDK_EMAC_COMP_PATH)/test/EmacLoopbackTest
+Emac_Icssg_Switch_LinkStatus_TestApp_BOARD_DEPENDENCY = yes
+Emac_Icssg_Switch_LinkStatus_TestApp_CORE_DEPENDENCY = no
+Emac_Icssg_Switch_LinkStatus_TestApp_XDC_CONFIGURO = yes
+Emac_Icssg_Switch_LinkStatus_TestApp_MAKEFILE = -f am65xx/icssg/makefile_switch_link_status
+export Emac_Icssg_Switch_LinkStatus_TestApp_MAKEFILE
+export Emac_Icssg_Switch_LinkStatus_TestApp_board_dependency
+export Emac_Icssg_Switch_LinkStatus_TestApp_core_dependency
+export Emac_Icssg_Switch_LinkStatus_TestApp_xdc_configuro
+Emac_Icssg_Switch_LinkStatus_TestApp_PKG_LIST = Emac_Icssg_Switch_LinkStatus_TestApp
+Emac_Icssg_Switch_LinkStatus_TestApp_INCLUDE = $(Emac_Icssg_Switch_LinkStatus_TestApp_PATH)
+Emac_Icssg_Switch_LinkStatus_TestApp_BOARDLIST = am65xx_idk
+export Emac_Icssg_Switch_LinkStatus_TestApp_BOARDLIST
+Emac_Icssg_Switch_LinkStatus_TestApp_$(SOC)_CORELIST = $(drvemac_$(SOC)_CORELIST)
+export Emac_Icssg_Switch_LinkStatus_TestApp_$(SOC)_CORELIST
+
+Emac_Icssg_Switch_LinkStatus_TestApp_SBL_APPIMAGEGEN = yes
+export Emac_Icssg_Switch_LinkStatus_TestApp_SBL_APPIMAGEGEN
export drvemac_LIB_LIST
export emac_LIB_LIST
export emac_EXAMPLE_LIST
diff --git a/test/EmacLoopbackTest/am65xx/icssg/makefile_switch_link_status b/test/EmacLoopbackTest/am65xx/icssg/makefile_switch_link_status
--- /dev/null
@@ -0,0 +1,49 @@
+# Makefile for EMAC sample app
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+
+#Name of the directory created under packages/ti/binary/
+APP_NAME = Emac_Icssg_Switch_LinkStatus_TestApp
+
+# Name of the binary if different from the default (APP_NAME)_$(BOARD_$(CORE)_<build_profile>
+LOCAL_APP_NAME = EMAC_Icssg_$(BOARD)_$(CORE)Switch_LinkStatus_TestApp
+
+SRCDIR += $(PDK_EMAC_COMP_PATH)/firmware/icss_switch/config
+INCDIR += $(PDK_EMAC_COMP_PATH)/firmware/icss_switch/config
+
+ifeq ($(SOC),$(filter $(SOC), am65xx))
+SRCS_COMMON += main_am65xx.c test_utils_switch_k3.c emac_fw_config_switch.c
+endif
+# List all the external components/interfaces, whose interface header files
+# need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = bios xdc pdk
+
+# List all the components required by the application
+COMP_LIST_COMMON = emac uart uart_console osal_tirtos csl pruss board udma sciclient
+
+ifeq ($(CORE),$(filter $(CORE), mpu1_0))
+# Enable XDC build for application by providing XDC CFG File per core
+XDC_CFG_FILE_$(CORE) = ./am65xx/emacUnitTest_a53.cfg
+EXTERNAL_LNKCMD_FILE_LOCAL = $(pdk_PATH)/ti/drv/emac/test/EmacLoopbackTest/am65xx/emac_linker_a53.lds
+endif
+
+ifeq ($(CORE),$(filter $(CORE), mcu1_0))
+# Enable XDC build for application by providing XDC CFG File per core
+XDC_CFG_FILE_$(CORE) = ./am65xx/emacUnitTest_r5.cfg
+EXTERNAL_LNKCMD_FILE_LOCAL = $(pdk_PATH)/ti/drv/emac/test/EmacLoopbackTest/am65xx/emac_linker_r5.lds
+endif
+
+PACKAGE_SRCS_COMMON = .
+CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) -DEMAC_TEST_APP_ICSSG -DEMAC_TEST_APP_ICSSG_SWITCH -DEMAC_CHECK_LINK_STATUS
+
+# 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
index f46ad917d76ca3a7c318877059a8c77c1ed0f826..f5df9252d19f03f48b7940c233d4e1e4ca7eac85 100644 (file)
Task_create( app_test_task_benchmark, &taskParams, NULL);
#endif
+#ifndef EMAC_CHECK_LINK_STATUS
/* Create the task to poll driver to rx pkts.*/
/* set the priority to 10 for both polling tasks */
taskParams.priority = 10;
taskParams.arg0 = EMAC_SWITCH_PORT2;
taskParams.instance->name = rxTaskName[2];
Task_create(app_test_task_poll_ctrl, &taskParams, NULL);
+#endif
#else
#ifndef EMAC_BENCHMARK
/* Create the task start the unit test.*/
diff --git a/test/EmacLoopbackTest/test_utils_switch_k3.c b/test/EmacLoopbackTest/test_utils_switch_k3.c
#include <ti/drv/pruss/pruicss.h>
#include <ti/drv/pruss/soc/pruicss_v1.h>
+#include <ti/csl/arch/csl_arch.h>
extern uint32_t portNum;
extern uint32_t endPort;
extern int port_en[];
UART_printf("Link for port %d is now UP, change: %d, link status: %d\n", portNum, linkInfo.link_status_change, linkInfo.link_status);
}
+#if defined (EMAC_CHECK_LINK_STATUS) && defined (__aarch64__)
+#define APP_TEST_PMU_SAMPLE_COUNT 100
+#define APP_TEST_LINK_DOWN 0
+#define APP_TEST_LINK_100HD 1
+#define APP_TEST_LINK_1G 2
+#define APP_TEST_LINK_POLL_TOO_LONG 3
+#define APP_TEST_MAX_STRING_SIZE 64
+#define APP_TEST_PMU_CYLE_POLL_DURATION_CRITERIA 350000 /* 350000 cycles @800 MHz */
+
+uint64_t cyclesPmu[APP_TEST_PMU_SAMPLE_COUNT];
+char app_test_link_results_array[][APP_TEST_MAX_STRING_SIZE] =
+{
+ "LINK IS DOWN",
+ "100 mbps FD LINK ESTABLISED",
+ "1000 FD LINK ESTABLISHED",
+ "POLL period took too long"
+};
+
+void app_test_print_results(uint32_t portNum, uint32_t linkSpeed, uint64_t cyclesPmu)
+{
+ UART_printf("link status for port: %d: %s, PMU CYLES: 0x%x%08x\n",
+ portNum,
+ app_test_link_results_array[linkSpeed],
+ (unsigned int)(cyclesPmu >> 32),
+ (unsigned int)(cyclesPmu & 0xFFFFFFFF));
+}
+
+/* Verification of link speed/duplexity and emac poll period duration*/
+void app_test_get_link_status(uint32_t portNum)
+{
+ EMAC_LINK_INFO_T linkInfo;
+ uint64_t overHeadPmu =0;
+ overHeadPmu = CSL_getPmuCycleCountOverhead();
+ uint32_t countPmu = 0;
+ char input;
+ linkInfo.link_status = 0;
+ linkInfo.link_status_change = 0;
+ uint32_t connectCable = 0;
+ while(1)
+ {
+ UART_printf ("Please enter E to exit LINK STATUS CHECK, or any other character to continue\n");
+ input = (char) UART_getc();
+
+ if ((int8_t) 'E' == (int8_t)(input))
+ {
+ UART_printf ("Exiting link status check\n");
+ break;
+ }
+ else
+ {
+ /* at this point, link should be active */
+ if (connectCable == 0)
+ UART_printf ("unplug the ethernet cable for SWITCH PORT 1\n");
+ else
+ UART_printf ("plug the ethernet cable for SWITCH PORT 1 with either GIGABIT port or 100 MBPS full duplex port\n");
+ do
+ {
+ memset(&linkInfo, 0, sizeof(EMAC_LINK_INFO_T));
+ CSL_startPmuCycleCounter();
+ emac_poll(portNum, &linkInfo);
+ CSL_stopPmuCycleCounter();
+ if (linkInfo.link_status_change == 1)
+ {
+ cyclesPmu[countPmu] = CSL_getPmuCycleCount() - overHeadPmu;
+ CSL_clearPmuCycleCounter();
+ if (cyclesPmu[countPmu] > APP_TEST_PMU_CYLE_POLL_DURATION_CRITERIA)
+ {
+ app_test_print_results(portNum, APP_TEST_LINK_POLL_TOO_LONG,cyclesPmu[countPmu]);
+ gTestFailCount++;
+ }
+ switch(linkInfo.link_status)
+ {
+ case 0:
+ connectCable = 1;
+ app_test_print_results(portNum, APP_TEST_LINK_DOWN,cyclesPmu[countPmu]);
+ break;
+ case 4:
+ connectCable = 0;
+ app_test_print_results(portNum, APP_TEST_LINK_100HD,cyclesPmu[countPmu]);
+ break;
+ case 5:
+ connectCable = 0;
+ app_test_print_results(portNum, APP_TEST_LINK_1G,cyclesPmu[countPmu]);
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ CSL_clearPmuCycleCounter();
+ } while(linkInfo.link_status == EMAC_LINKSTATUS_NOLINK);
+ if (++countPmu == APP_TEST_PMU_SAMPLE_COUNT)
+ countPmu = 0;
+ Osal_delay(100);
+ }
+ }
+}
+#endif
+
void app_test_port_set_state(uint32_t portNum, uint8_t state)
{
EMAC_IOCTL_PARAMS params;
{
UART_printf("app_test_emac_open failed\n");
}
- initComplete = 1;
+ initComplete = 1;
+
app_test_check_port_link_switch(EMAC_SWITCH_PORT1);
- app_test_check_port_link_switch(EMAC_SWITCH_PORT2);
+#if defined (EMAC_CHECK_LINK_STATUS) && defined (__aarch64__)
+ app_test_get_link_status(EMAC_SWITCH_PORT1);
+ if (gTestFailCount == 0)
+ UART_printf("All tests have passed\n");
+ else
+ UART_printf("Some tests have passed\n");
+#else
+ app_test_check_port_link_switch(EMAC_SWITCH_PORT2);
/*Set up default setting for test app */
app_test_setup_default_settings();
{
Task_sleep(1000);
}
+#endif
}
#endif
-
/*
* ======== app_test_task_init_pruicss========
*/
diff --git a/test/Module.xs b/test/Module.xs
index 08db6e9890b89079b965f6df52bf50fcb1273cce..a3c0f173c21b90afd8646726c69b08864ddbd261 100644 (file)
--- a/test/Module.xs
+++ b/test/Module.xs
*
* EMAC Driver Documents Module Specification File.
*
- * Copyright (C) 2010-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010-2019 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k];
}
+ var documentFiles = libUtility.listAllFiles ("makefile_switch_link_status", "./test");
+ for (var k = 0 ; k < documentFiles.length; k++) {
+ Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k];
+ }
+
var documentFiles = libUtility.listAllFiles (".cdtbuild", "./test");
for (var k = 0 ; k < documentFiles.length; k++) {
Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k];