equal
deleted
inserted
replaced
44 if(comm_status == self.Command): |
44 if(comm_status == self.Command): |
45 return current_plc_status |
45 return current_plc_status |
46 return None |
46 return None |
47 |
47 |
48 def SendData(self, Data): |
48 def SendData(self, Data): |
49 length = len(Data) |
49 return self.pseudofile.write(Data) |
50 # transform length into a byte string |
|
51 # we presuppose endianess of LPC same as PC |
|
52 lengthstr = ctypes.string_at(ctypes.pointer(ctypes.c_int(length)),4) |
|
53 buffer = lengthstr + Data |
|
54 return self.pseudofile.write(buffer) |
|
55 |
50 |
56 def GetData(self): |
51 def GetData(self): |
57 lengthstr = self.pseudofile.read(4) |
52 lengthstr = self.pseudofile.read(4) |
58 # transform a byte string into length |
53 # transform a byte string into length |
59 length = ctypes.cast(ctypes.c_char_p(lengthstr), ctypes.POINTER(ctypes.c_int)).contents.value |
54 length = ctypes.cast( |
|
55 ctypes.c_char_p(lengthstr), |
|
56 ctypes.POINTER(ctypes.c_uint32)).contents.value |
60 return self.pseudofile.read(length) |
57 return self.pseudofile.read(length) |
61 |
58 |
62 def ExchangeData(self): |
59 def ExchangeData(self): |
63 pass |
60 pass |
64 |
61 |
80 LPCAppTransaction.__init__(self, 0x03) |
77 LPCAppTransaction.__init__(self, 0x03) |
81 |
78 |
82 class SET_TRACE_VARIABLETransaction(LPCAppTransaction): |
79 class SET_TRACE_VARIABLETransaction(LPCAppTransaction): |
83 def __init__(self, data): |
80 def __init__(self, data): |
84 LPCAppTransaction.__init__(self, 0x04) |
81 LPCAppTransaction.__init__(self, 0x04) |
85 self.Data = data |
82 length = len(data) |
|
83 # transform length into a byte string |
|
84 # we presuppose endianess of LPC same as PC |
|
85 lengthstr = ctypes.string_at(ctypes.pointer(ctypes.c_uint32(length)),4) |
|
86 self.Data = lengthstr + data |
|
87 |
86 def ExchangeData(self): |
88 def ExchangeData(self): |
87 self.SendData(self.Data) |
89 self.SendData(self.Data) |
88 |
90 |
89 class GET_TRACE_VARIABLETransaction(LPCAppTransaction): |
91 class GET_TRACE_VARIABLETransaction(LPCAppTransaction): |
90 def __init__(self): |
92 def __init__(self): |