Fixed support for logging and simulation
authorLaurent Bessard
Tue, 19 Mar 2013 23:19:43 +0100
changeset 30 9cd6bc93ed89
parent 29 86fb7dc2b54e
child 31 a9c9d1fc97d3
child 32 6942b30d13c4
Fixed support for logging and simulation
LPCManager.py
LPCconnector/LPCAppObject.py
LPCtarget/plc_LPC_main.c
--- a/LPCManager.py	Tue Mar 19 17:22:27 2013 +0900
+++ b/LPCManager.py	Tue Mar 19 23:19:43 2013 +0100
@@ -921,7 +921,8 @@
             status = "Connected"
         else:
             if self._connector is not None:
-                status = self._connector.GetPLCstatus()
+                status, log_count = self._connector.GetPLCstatus()
+                self.UpdatePLCLog(log_count)
             else:
                 status = "Disconnected"
         if self.previous_plcstate != status or self.previous_mode != self.CurrentMode:
@@ -951,6 +952,8 @@
                 self.ShowMethod(*args)
             self.previous_plcstate = status
             self.previous_mode = self.CurrentMode
+            if self.AppFrame is not None:
+                self.AppFrame.RefreshStatusToolBar()
             return True
         return False
 
@@ -1108,7 +1111,7 @@
            # debugger code
            (self.Generate_plc_debugger, "plc_debugger.c", "Debugger"),
            # init/cleanup/retrieve/publish, run and align code
-           (self.Generate_plc_common_main,"plc_common_main.c","Common runtime"),
+           (self.Generate_plc_main,"plc_main.c","Common runtime"),
            # declare located variables for simulate in a black box
            (self.Generate_plc_declare_locations,"plc_declare_locations.c","Declare Locations"),
            # declare located variables for simulate in a black box
--- a/LPCconnector/LPCAppObject.py	Tue Mar 19 17:22:27 2013 +0900
+++ b/LPCconnector/LPCAppObject.py	Tue Mar 19 23:19:43 2013 +0100
@@ -49,7 +49,7 @@
         ccounts = ctypes.cast(
                       ctypes.c_char_p(strcounts),
                       ctypes.POINTER(ctypes.c_uint32))
-        return (self.PLCStatus,)+tuple(int(ccounts[idx]) for idx in range(4))
+        return self.PLCStatus, tuple(int(ccounts[idx]) for idx in range(4))
 
     def MatchMD5(self, MD5):
         data = self.HandleSerialTransaction(GET_PLCIDTransaction())
--- a/LPCtarget/plc_LPC_main.c	Tue Mar 19 17:22:27 2013 +0900
+++ b/LPCtarget/plc_LPC_main.c	Tue Mar 19 23:19:43 2013 +0100
@@ -32,6 +32,18 @@
 	return res;
 }
 
+long AtomicCompareExchange64(long long* atomicvar,long long compared, long long exchange)
+{
+	/* No need for real atomic op on LPC,
+	 * no possible preemption between debug and PLC */
+	long long res = *atomicvar;
+	if(res == compared){
+		*atomicvar = exchange;
+	}
+	return res;
+}
+
+
 void PLC_GetTime(IEC_TIME *CURRENT_TIME)
 {
 	/* Call target GetTime function */