author | Laurent Bessard |
Wed, 27 Feb 2013 11:25:39 +0100 | |
changeset 949 | aa24cf3b7009 |
parent 709 | fe65601bd983 |
child 954 | ab487d32ce9a |
permissions | -rw-r--r-- |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
1 |
/** |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
2 |
* Win32 specific code |
329 | 3 |
**/ |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
4 |
|
205 | 5 |
#include <stdio.h> |
6 |
#include <sys/timeb.h> |
|
7 |
#include <time.h> |
|
8 |
#include <windows.h> |
|
568 | 9 |
#include <locale.h> |
205 | 10 |
|
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
11 |
/* provided by POUS.C */ |
518
8e61b0066859
Fixed confusion about __common_ticktime type, redesigned LPC PLC timer support
edouard
parents:
484
diff
changeset
|
12 |
extern unsigned long long common_ticktime__; |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
13 |
|
244 | 14 |
long AtomicCompareExchange(long* atomicvar, long compared, long exchange) |
205 | 15 |
{ |
16 |
return InterlockedCompareExchange(atomicvar, exchange, compared); |
|
17 |
} |
|
18 |
||
19 |
struct _timeb timetmp; |
|
20 |
void PLC_GetTime(IEC_TIME *CURRENT_TIME) |
|
21 |
{ |
|
22 |
_ftime(&timetmp); |
|
329 | 23 |
|
205 | 24 |
(*CURRENT_TIME).tv_sec = timetmp.time; |
25 |
(*CURRENT_TIME).tv_nsec = timetmp.millitm * 1000000; |
|
26 |
} |
|
27 |
||
28 |
void PLC_timer_notify() |
|
29 |
{ |
|
30 |
PLC_GetTime(&__CURRENT_TIME); |
|
31 |
__run(); |
|
32 |
} |
|
33 |
||
34 |
HANDLE PLC_timer = NULL; |
|
518
8e61b0066859
Fixed confusion about __common_ticktime type, redesigned LPC PLC timer support
edouard
parents:
484
diff
changeset
|
35 |
void PLC_SetTimer(unsigned long long next, unsigned long long period) |
205 | 36 |
{ |
229 | 37 |
LARGE_INTEGER liDueTime; |
205 | 38 |
/* arg 2 of SetWaitableTimer take 100 ns interval*/ |
39 |
liDueTime.QuadPart = next / (-100); |
|
329 | 40 |
|
685 | 41 |
if (!SetWaitableTimer(PLC_timer, &liDueTime, period<1000000?1:period/1000000, NULL, NULL, 0)) |
205 | 42 |
{ |
43 |
printf("SetWaitableTimer failed (%d)\n", GetLastError()); |
|
44 |
} |
|
229 | 45 |
} |
46 |
||
47 |
/* Variable used to stop plcloop thread */ |
|
48 |
void PlcLoop() |
|
49 |
{ |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
50 |
while(WaitForSingleObject(PLC_timer, INFINITE) == WAIT_OBJECT_0) |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
51 |
{ |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
52 |
PLC_timer_notify(); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
53 |
} |
205 | 54 |
} |
55 |
||
229 | 56 |
HANDLE PLC_thread; |
244 | 57 |
HANDLE debug_sem; |
329 | 58 |
HANDLE debug_wait_sem; |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
59 |
HANDLE python_sem; |
329 | 60 |
HANDLE python_wait_sem; |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
61 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
62 |
#define maxval(a,b) ((a>b)?a:b) |
229 | 63 |
int startPLC(int argc,char **argv) |
205 | 64 |
{ |
229 | 65 |
unsigned long thread_id = 0; |
568 | 66 |
setlocale(LC_NUMERIC, "C"); |
397
6a7ff66a811d
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
329
diff
changeset
|
67 |
/* Define Ttick to 1ms if common_ticktime not defined */ |
6a7ff66a811d
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
329
diff
changeset
|
68 |
Ttick = common_ticktime__?common_ticktime__:1000000; |
205 | 69 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
70 |
debug_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
71 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
72 |
1, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
73 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
74 |
NULL); // unnamed semaphore |
329 | 75 |
if (debug_sem == NULL) |
244 | 76 |
{ |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
77 |
printf("startPLC CreateSemaphore debug_sem error: %d\n", GetLastError()); |
244 | 78 |
return; |
79 |
} |
|
329 | 80 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
81 |
debug_wait_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
82 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
83 |
0, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
84 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
85 |
NULL); // unnamed semaphore |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
86 |
|
329 | 87 |
if (debug_wait_sem == NULL) |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
88 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
89 |
printf("startPLC CreateSemaphore debug_wait_sem error: %d\n", GetLastError()); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
90 |
return; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
91 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
92 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
93 |
python_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
94 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
95 |
1, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
96 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
97 |
NULL); // unnamed semaphore |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
98 |
|
329 | 99 |
if (python_sem == NULL) |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
100 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
101 |
printf("startPLC CreateSemaphore python_sem error: %d\n", GetLastError()); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
102 |
return; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
103 |
} |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
104 |
python_wait_sem = CreateSemaphore( |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
105 |
NULL, // default security attributes |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
106 |
0, // initial count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
107 |
1, // maximum count |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
108 |
NULL); // unnamed semaphore |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
109 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
110 |
|
329 | 111 |
if (python_wait_sem == NULL) |
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
112 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
113 |
printf("startPLC CreateSemaphore python_wait_sem error: %d\n", GetLastError()); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
114 |
return; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
115 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
116 |
|
329 | 117 |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
118 |
/* Create a waitable timer */ |
685 | 119 |
timeBeginPeriod(1); |
205 | 120 |
PLC_timer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer"); |
121 |
if(NULL == PLC_timer) |
|
122 |
{ |
|
123 |
printf("CreateWaitableTimer failed (%d)\n", GetLastError()); |
|
124 |
return 1; |
|
125 |
} |
|
126 |
if( __init(argc,argv) == 0 ) |
|
127 |
{ |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
128 |
PLC_SetTimer(Ttick,Ttick); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
129 |
PLC_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PlcLoop, NULL, 0, &thread_id); |
205 | 130 |
} |
229 | 131 |
else{ |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
132 |
return 1; |
229 | 133 |
} |
205 | 134 |
return 0; |
135 |
} |
|
397
6a7ff66a811d
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
329
diff
changeset
|
136 |
static unsigned long __debug_tick; |
244 | 137 |
|
138 |
int TryEnterDebugSection(void) |
|
139 |
{ |
|
140 |
//printf("TryEnterDebugSection\n"); |
|
469 | 141 |
if(WaitForSingleObject(debug_sem, 0) == WAIT_OBJECT_0){ |
142 |
/* Only enter if debug active */ |
|
143 |
if(__DEBUG){ |
|
144 |
return 1; |
|
145 |
} |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
146 |
ReleaseSemaphore(debug_sem, 1, NULL); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
147 |
} |
469 | 148 |
return 0; |
244 | 149 |
} |
150 |
||
151 |
void LeaveDebugSection(void) |
|
152 |
{ |
|
153 |
ReleaseSemaphore(debug_sem, 1, NULL); |
|
154 |
//printf("LeaveDebugSection\n"); |
|
155 |
} |
|
229 | 156 |
|
157 |
int stopPLC() |
|
158 |
{ |
|
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
159 |
CloseHandle(PLC_timer); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
160 |
WaitForSingleObject(PLC_thread, INFINITE); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
161 |
__cleanup(); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
162 |
CloseHandle(debug_wait_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
163 |
CloseHandle(debug_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
164 |
CloseHandle(python_wait_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
165 |
CloseHandle(python_sem); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
166 |
CloseHandle(PLC_thread); |
229 | 167 |
} |
168 |
||
169 |
/* from plc_debugger.c */ |
|
446
1edde533db19
Some cleanup in PLC status - removed that \"Starting\" state ...
ed
parents:
397
diff
changeset
|
170 |
int WaitDebugData(unsigned long *tick) |
229 | 171 |
{ |
709
fe65601bd983
Fixing bug in debugger sending wrong tick with values
laurent
parents:
685
diff
changeset
|
172 |
DWORD res; |
fe65601bd983
Fixing bug in debugger sending wrong tick with values
laurent
parents:
685
diff
changeset
|
173 |
res = WaitForSingleObject(debug_wait_sem, INFINITE); |
446
1edde533db19
Some cleanup in PLC status - removed that \"Starting\" state ...
ed
parents:
397
diff
changeset
|
174 |
*tick = __debug_tick; |
1edde533db19
Some cleanup in PLC status - removed that \"Starting\" state ...
ed
parents:
397
diff
changeset
|
175 |
/* Wait signal from PLC thread */ |
709
fe65601bd983
Fixing bug in debugger sending wrong tick with values
laurent
parents:
685
diff
changeset
|
176 |
return res != WAIT_OBJECT_0; |
229 | 177 |
} |
329 | 178 |
|
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
179 |
/* Called by PLC thread when debug_publish finished |
229 | 180 |
* This is supposed to unlock debugger thread in WaitDebugData*/ |
181 |
void InitiateDebugTransfer() |
|
182 |
{ |
|
244 | 183 |
/* remember tick */ |
184 |
__debug_tick = __tick; |
|
185 |
/* signal debugger thread it can read data */ |
|
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
186 |
ReleaseSemaphore(debug_wait_sem, 1, NULL); |
229 | 187 |
} |
244 | 188 |
|
614 | 189 |
int suspendDebug(int disable) |
469 | 190 |
{ |
244 | 191 |
/* Prevent PLC to enter debug code */ |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
192 |
WaitForSingleObject(debug_sem, INFINITE); |
469 | 193 |
__DEBUG = !disable; |
484 | 194 |
if(disable) |
195 |
ReleaseSemaphore(debug_sem, 1, NULL); |
|
614 | 196 |
return 0; |
244 | 197 |
} |
198 |
||
199 |
void resumeDebug() |
|
200 |
{ |
|
290
3bd617ae7a05
Local Runtime (LOCAL://) now launched "on demand"
etisserant
parents:
280
diff
changeset
|
201 |
__DEBUG = 1; |
244 | 202 |
/* Let PLC enter debug code */ |
203 |
ReleaseSemaphore(debug_sem, 1, NULL); |
|
204 |
} |
|
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
205 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
206 |
/* from plc_python.c */ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
207 |
int WaitPythonCommands(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
208 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
209 |
/* Wait signal from PLC thread */ |
329 | 210 |
return WaitForSingleObject(python_wait_sem, INFINITE); |
211 |
} |
|
212 |
||
280
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
213 |
/* Called by PLC thread on each new python command*/ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
214 |
void UnBlockPythonCommands(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
215 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
216 |
/* signal debugger thread it can read data */ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
217 |
ReleaseSemaphore(python_wait_sem, 1, NULL); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
218 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
219 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
220 |
int TryLockPython(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
221 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
222 |
return WaitForSingleObject(python_sem, 0) == WAIT_OBJECT_0; |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
223 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
224 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
225 |
void UnLockPython(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
226 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
227 |
ReleaseSemaphore(python_sem, 1, NULL); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
228 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
229 |
|
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
230 |
void LockPython(void) |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
231 |
{ |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
232 |
WaitForSingleObject(python_sem, INFINITE); |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
233 |
} |
f2ef79f3dba0
Added native (not a plugin) asynchronous python eval function block - Beta. Code cleanup in C code templates.
etisserant
parents:
276
diff
changeset
|
234 |
|
521
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
235 |
int CheckRetainBuffer(void) |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
236 |
{ |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
237 |
return 1; |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
238 |
} |
02cb9e5fb6f6
LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
edouard
parents:
518
diff
changeset
|
239 |
|
580 | 240 |
void ValidateRetainBuffer(void) |
241 |
{ |
|
242 |
} |
|
243 |
||
244 |
void InValidateRetainBuffer(void) |
|
245 |
{ |
|
246 |
} |
|
247 |
||
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
248 |
void Retain(unsigned int offset, unsigned int count, void * p) |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
249 |
{ |
681
383864958dac
commented out noisy printf in Win32 target
Edouard Tisserant
parents:
614
diff
changeset
|
250 |
/* |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
251 |
unsigned int position; |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
252 |
for(position=0; position<count; position++ ){ |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
253 |
printf("%d : 0x%2.2x\n", offset+position, ((char*)p)[position]); |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
254 |
} |
681
383864958dac
commented out noisy printf in Win32 target
Edouard Tisserant
parents:
614
diff
changeset
|
255 |
*/ |
483
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
256 |
} |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
257 |
|
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
258 |
void Remind(unsigned int offset, unsigned int count, void *p) |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
259 |
{ |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
260 |
} |
bc26c42d2eec
fixed greg's crap in win32, enhanced debug stability, implemented preliminary retain
edouard
parents:
469
diff
changeset
|
261 |