# HG changeset patch # User Edouard Tisserant # Date 1716569250 -7200 # Node ID 9b5cb90297e4f555fba52dddc1b0b1303308ae73 # Parent 8815b44be31e13bc78d33bf279eceac41d4c4763 All Runtimes: Now sizeof(tick)=4 on all platforms (unsigned int). diff -r 8815b44be31e -r 9b5cb90297e4 targets/Linux/plc_Linux_main.c --- a/targets/Linux/plc_Linux_main.c Fri May 24 18:32:23 2024 +0200 +++ b/targets/Linux/plc_Linux_main.c Fri May 24 18:47:30 2024 +0200 @@ -25,7 +25,7 @@ #define _LogError(text,...) _Log(LOG_CRITICAL, text, ##__VA_ARGS__) #define _LogWarning(text,...) _Log(LOG_WARNING, text, ##__VA_ARGS__) -static unsigned long __debug_tick; +static unsigned int __debug_tick; static pthread_t PLC_thread; static pthread_mutex_t python_wait_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -305,9 +305,9 @@ return 0; } -extern unsigned long __tick; - -int WaitDebugData(unsigned long *tick) +extern unsigned int __tick; + +int WaitDebugData(unsigned int *tick) { int res; if (PLC_shutdown) return 1; diff -r 8815b44be31e -r 9b5cb90297e4 targets/OSX/plc_OSX_main.c --- a/targets/OSX/plc_OSX_main.c Fri May 24 18:32:23 2024 +0200 +++ b/targets/OSX/plc_OSX_main.c Fri May 24 18:47:30 2024 +0200 @@ -69,7 +69,7 @@ exit(0); } -static unsigned long __debug_tick; +static unsigned int __debug_tick; pthread_t PLC_thread; static pthread_mutex_t python_wait_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -165,9 +165,9 @@ return 0; } -extern unsigned long __tick; - -int WaitDebugData(unsigned long *tick) +extern unsigned int __tick; + +int WaitDebugData(unsigned int *tick) { int res; if (PLC_shutdown) diff -r 8815b44be31e -r 9b5cb90297e4 targets/Win32/plc_Win32_main.c --- a/targets/Win32/plc_Win32_main.c Fri May 24 18:32:23 2024 +0200 +++ b/targets/Win32/plc_Win32_main.c Fri May 24 18:47:30 2024 +0200 @@ -146,7 +146,7 @@ } return 0; } -static unsigned long __debug_tick; +static unsigned int __debug_tick; int TryEnterDebugSection(void) { @@ -187,7 +187,7 @@ } /* from plc_debugger.c */ -int WaitDebugData(unsigned long *tick) +int WaitDebugData(unsigned int *tick) { DWORD res; res = WaitForSingleObject(debug_wait_sem, INFINITE); diff -r 8815b44be31e -r 9b5cb90297e4 targets/Xenomai/plc_Xenomai_main.c --- a/targets/Xenomai/plc_Xenomai_main.c Fri May 24 18:32:23 2024 +0200 +++ b/targets/Xenomai/plc_Xenomai_main.c Fri May 24 18:47:30 2024 +0200 @@ -336,9 +336,9 @@ } } -extern unsigned long __tick; - -int WaitDebugData(unsigned long *tick) +extern unsigned int __tick; + +int WaitDebugData(unsigned int *tick) { char cmd; int res; diff -r 8815b44be31e -r 9b5cb90297e4 targets/plc_debug.c --- a/targets/plc_debug.c Fri May 24 18:32:23 2024 +0200 +++ b/targets/plc_debug.c Fri May 24 18:47:30 2024 +0200 @@ -170,7 +170,7 @@ extern void InitiateDebugTransfer(void); extern void CleanupRetain(void); -extern unsigned long __tick; +extern unsigned int __tick; void __cleanup_debug(void) { @@ -490,7 +490,7 @@ BUFFER_FULL, BUFFER_EMPTY); } -int WaitDebugData(unsigned long *tick); +int WaitDebugData(unsigned int *tick); /* Wait until debug data ready and return pointer to it */ int GetDebugData(unsigned int *tick, unsigned int *size, void **buffer){ int wait_error = WaitDebugData(tick); diff -r 8815b44be31e -r 9b5cb90297e4 targets/plc_main_head.c --- a/targets/plc_main_head.c Fri May 24 18:32:23 2024 +0200 +++ b/targets/plc_main_head.c Fri May 24 18:47:30 2024 +0200 @@ -7,7 +7,7 @@ /* * Prototypes of functions provided by generated C softPLC **/ -void config_run__(unsigned long tick); +void config_run__(unsigned int tick); void config_init__(void); /* @@ -24,13 +24,13 @@ **/ IEC_TIME __CURRENT_TIME; IEC_BOOL __DEBUG = 0; -unsigned long __tick = 0; +unsigned int __tick = 0; char *PLC_ID = NULL; /* * Variable generated by C softPLC and plugins **/ -extern unsigned long greatest_tick_count__; +extern unsigned int greatest_tick_count__; /* Help to quit cleanly when init fail at a certain level */ static int init_level = 0; diff -r 8815b44be31e -r 9b5cb90297e4 targets/plc_main_tail.c --- a/targets/plc_main_tail.c Fri May 24 18:32:23 2024 +0200 +++ b/targets/plc_main_tail.c Fri May 24 18:47:30 2024 +0200 @@ -45,7 +45,7 @@ typedef struct { uint32_t msgidx; uint32_t msgsize; - unsigned long tick; + unsigned int tick; IEC_TIME time; } mTail; @@ -146,7 +146,7 @@ static long long Tsync = 0; static long long FreqCorr = 0; static int Nticks = 0; -static unsigned long last_tick = 0; +static unsigned int last_tick = 0; /* * Called on each external periodic sync event