targets/Win32/plc_Win32_main.c
changeset 518 8e61b0066859
parent 484 3d0c06e2648c
child 521 02cb9e5fb6f6
equal deleted inserted replaced
517:6da1617a7645 518:8e61b0066859
     6 #include <sys/timeb.h>
     6 #include <sys/timeb.h>
     7 #include <time.h>
     7 #include <time.h>
     8 #include <windows.h>
     8 #include <windows.h>
     9 
     9 
    10 /* provided by POUS.C */
    10 /* provided by POUS.C */
    11 extern unsigned long common_ticktime__;
    11 extern unsigned long long common_ticktime__;
    12 
    12 
    13 long AtomicCompareExchange(long* atomicvar, long compared, long exchange)
    13 long AtomicCompareExchange(long* atomicvar, long compared, long exchange)
    14 {
    14 {
    15     return InterlockedCompareExchange(atomicvar, exchange, compared);
    15     return InterlockedCompareExchange(atomicvar, exchange, compared);
    16 }
    16 }
    29     PLC_GetTime(&__CURRENT_TIME);
    29     PLC_GetTime(&__CURRENT_TIME);
    30     __run();
    30     __run();
    31 }
    31 }
    32 
    32 
    33 HANDLE PLC_timer = NULL;
    33 HANDLE PLC_timer = NULL;
    34 void PLC_SetTimer(long long next, long long period)
    34 void PLC_SetTimer(unsigned long long next, unsigned long long period)
    35 {
    35 {
    36 	LARGE_INTEGER liDueTime;
    36 	LARGE_INTEGER liDueTime;
    37 	/* arg 2 of SetWaitableTimer take 100 ns interval*/
    37 	/* arg 2 of SetWaitableTimer take 100 ns interval*/
    38 	liDueTime.QuadPart =  next / (-100);
    38 	liDueTime.QuadPart =  next / (-100);
    39 
    39