powerlink: fix msleep()

This commit is contained in:
Jiacheng Shi 2022-06-11 19:45:55 +08:00
parent b0e6e4fe49
commit 4e4d6ce223
6 changed files with 10 additions and 37 deletions

View File

@ -29,11 +29,11 @@ $(LIBOPLKCN):
$(call oplk_build,$(LIBOPLK_BUILD_DIR)) $(call oplk_build,$(LIBOPLK_BUILD_DIR))
.PHONY: $(OPLK_DEMO_MN_CONSOLE) .PHONY: $(OPLK_DEMO_MN_CONSOLE)
$(OPLK_DEMO_MN_CONSOLE): $(OPLK_DEMO_MN_CONSOLE): ${LIBOPLKMN}
$(call oplk_build,$(OPLK_DEMO_MN_CONSOLE_BUILD_DIR)) $(call oplk_build,$(OPLK_DEMO_MN_CONSOLE_BUILD_DIR))
.PHONY: $(OPLK_DEMO_CN_CONSOLE) .PHONY: $(OPLK_DEMO_CN_CONSOLE)
$(OPLK_DEMO_CN_CONSOLE): $(OPLK_DEMO_CN_CONSOLE): ${LIBOPLKCN}
$(call oplk_build,$(OPLK_DEMO_CN_CONSOLE_BUILD_DIR)) $(call oplk_build,$(OPLK_DEMO_CN_CONSOLE_BUILD_DIR))
LIBOPLKMN := $(LIBOPLKMN:$(CUR_DIR)/%=%) LIBOPLKMN := $(LIBOPLKMN:$(CUR_DIR)/%=%)

View File

@ -195,37 +195,7 @@ milliseconds has elapsed.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void system_msleep(unsigned int milliSeconds_p) void system_msleep(unsigned int milliSeconds_p)
{ {
struct timeval timeout; MdelayKTask(milliSeconds_p);
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;
}
} }
#if defined(CONFIG_USE_SYNCTHREAD) #if defined(CONFIG_USE_SYNCTHREAD)
@ -387,7 +357,7 @@ static void* firmwareManagerThread(void* arg)
{ {
pInstance->pfnFwmCb(); pInstance->pfnFwmCb();
DelayKTask(pInstance->interval * 1000); MdelayKTask(pInstance->interval * 1000);
} }
return NULL; return NULL;

View File

@ -0,0 +1,3 @@
*
.*
!.gitignore

View File

@ -137,7 +137,7 @@ milliseconds has elapsed.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void target_msleep(UINT32 milliSeconds_p) void target_msleep(UINT32 milliSeconds_p)
{ {
DelayKTask(milliSeconds_p); MdelayKTask(milliSeconds_p);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -177,7 +177,7 @@ tOplkError edrv_init(const tEdrvInitParam* pEdrvInitParam_p)
return kErrorEdrvInit; 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) if (edrvInstance_l.sock < 0)
{ {
DEBUG_LVL_ERROR_TRACE("%s() cannot open socket. Error = %s\n", __func__, strerror(errno)); DEBUG_LVL_ERROR_TRACE("%s() cannot open socket. Error = %s\n", __func__, strerror(errno));

View File

@ -2,7 +2,7 @@
current_path=$(pwd) current_path=$(pwd)
xizi_path=Ubiquitous/XiZi xizi_path=Ubiquitous/XiZi
board=cortex-m4-emulator board=ok1052-c
qemu_machine=netduinoplus2 qemu_machine=netduinoplus2
run_in_docker() { run_in_docker() {