From 4e4d6ce223702befcee6834537bf49a8aa1db597 Mon Sep 17 00:00:00 2001 From: Jiacheng Shi Date: Sat, 11 Jun 2022 19:45:55 +0800 Subject: [PATCH] powerlink: fix msleep() --- .../connection/industrial_ethernet/Makefile | 4 +-- .../apps/common/src/system/system-xiuos.c | 34 ++----------------- .../openPOWERLINK/stack/lib/.gitignore | 3 ++ .../stack/src/arch/xiuos/target-xiuos.c | 2 +- .../stack/src/kernel/edrv/edrv-xiuos.c | 2 +- devtools.sh | 2 +- 6 files changed, 10 insertions(+), 37 deletions(-) create mode 100644 APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/lib/.gitignore diff --git a/APP_Framework/Framework/connection/industrial_ethernet/Makefile b/APP_Framework/Framework/connection/industrial_ethernet/Makefile index 85d8055c2..1db5452ee 100644 --- a/APP_Framework/Framework/connection/industrial_ethernet/Makefile +++ b/APP_Framework/Framework/connection/industrial_ethernet/Makefile @@ -29,11 +29,11 @@ $(LIBOPLKCN): $(call oplk_build,$(LIBOPLK_BUILD_DIR)) .PHONY: $(OPLK_DEMO_MN_CONSOLE) -$(OPLK_DEMO_MN_CONSOLE): +$(OPLK_DEMO_MN_CONSOLE): ${LIBOPLKMN} $(call oplk_build,$(OPLK_DEMO_MN_CONSOLE_BUILD_DIR)) .PHONY: $(OPLK_DEMO_CN_CONSOLE) -$(OPLK_DEMO_CN_CONSOLE): +$(OPLK_DEMO_CN_CONSOLE): ${LIBOPLKCN} $(call oplk_build,$(OPLK_DEMO_CN_CONSOLE_BUILD_DIR)) LIBOPLKMN := $(LIBOPLKMN:$(CUR_DIR)/%=%) diff --git a/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/apps/common/src/system/system-xiuos.c b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/apps/common/src/system/system-xiuos.c index 9ca2e2cfe..f1c40686f 100644 --- a/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/apps/common/src/system/system-xiuos.c +++ b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/apps/common/src/system/system-xiuos.c @@ -195,37 +195,7 @@ milliseconds has elapsed. //------------------------------------------------------------------------------ void system_msleep(unsigned int milliSeconds_p) { - struct timeval timeout; - fd_set readFds; - int maxFd; - int selectRetVal; - unsigned int seconds; - unsigned int microSeconds; - - // initialize file descriptor set - maxFd = 0 + 1; - FD_ZERO(&readFds); - - // Calculate timeout values - seconds = milliSeconds_p / 1000; - microSeconds = (milliSeconds_p - (seconds * 1000)) * 1000; - - // initialize timeout value - timeout.tv_sec = seconds; - timeout.tv_usec = microSeconds; - - selectRetVal = select(maxFd, &readFds, NULL, NULL, &timeout); - switch (selectRetVal) - { - case 0: // select timeout occurred, no packet received - break; - - case -1: // select error occurred - break; - - default: // packet available for receive - break; - } + MdelayKTask(milliSeconds_p); } #if defined(CONFIG_USE_SYNCTHREAD) @@ -387,7 +357,7 @@ static void* firmwareManagerThread(void* arg) { pInstance->pfnFwmCb(); - DelayKTask(pInstance->interval * 1000); + MdelayKTask(pInstance->interval * 1000); } return NULL; diff --git a/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/lib/.gitignore b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/lib/.gitignore new file mode 100644 index 000000000..7d0e838f5 --- /dev/null +++ b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/lib/.gitignore @@ -0,0 +1,3 @@ +* +.* +!.gitignore \ No newline at end of file diff --git a/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/arch/xiuos/target-xiuos.c b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/arch/xiuos/target-xiuos.c index 985f9b491..92933d298 100644 --- a/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/arch/xiuos/target-xiuos.c +++ b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/arch/xiuos/target-xiuos.c @@ -137,7 +137,7 @@ milliseconds has elapsed. //------------------------------------------------------------------------------ void target_msleep(UINT32 milliSeconds_p) { - DelayKTask(milliSeconds_p); + MdelayKTask(milliSeconds_p); } //------------------------------------------------------------------------------ diff --git a/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/kernel/edrv/edrv-xiuos.c b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/kernel/edrv/edrv-xiuos.c index c3cd25a3e..19ef2d6eb 100644 --- a/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/kernel/edrv/edrv-xiuos.c +++ b/APP_Framework/Framework/connection/industrial_ethernet/openPOWERLINK/stack/src/kernel/edrv/edrv-xiuos.c @@ -177,7 +177,7 @@ tOplkError edrv_init(const tEdrvInitParam* pEdrvInitParam_p) return kErrorEdrvInit; } - edrvInstance_l.sock = open(ETHERNET_UART_NAME, O_RDWR); + edrvInstance_l.sock = open("/dev/uart2_dev2", O_RDWR); if (edrvInstance_l.sock < 0) { DEBUG_LVL_ERROR_TRACE("%s() cannot open socket. Error = %s\n", __func__, strerror(errno)); diff --git a/devtools.sh b/devtools.sh index 529914def..12a4844cb 100755 --- a/devtools.sh +++ b/devtools.sh @@ -2,7 +2,7 @@ current_path=$(pwd) xizi_path=Ubiquitous/XiZi -board=cortex-m4-emulator +board=ok1052-c qemu_machine=netduinoplus2 run_in_docker() {