| Line 256... |
Line 256... |
| 256 |
def cread(self, bitmask=0x1):
|
256 |
def cread(self, bitmask=0x1):
|
| 257 |
""" Reads one packet with the maximal cin size from the device consoles
|
257 |
""" Reads one packet with the maximal cin size from the device consoles
|
| 258 |
identified with the specified bitmask
|
258 |
identified with the specified bitmask
|
| 259 |
"""
|
259 |
"""
|
| 260 |
cin_maxsize = self.lib.dev.packetsizelimit["cin"] - self.lib.headersize
|
260 |
cin_maxsize = self.lib.dev.packetsizelimit["cin"] - self.lib.headersize
|
| 261 |
resp = self.lib.monitorcommand(struct.pack("IIII", 13, cin_maxsize, 0, 0), "III%ds" % cin_maxsize, ("size", None, None))
|
261 |
resp = self.lib.monitorcommand(struct.pack("IIII", 13, bitmask, cin_maxsize, 0), "III%ds" % cin_maxsize, ("size", None, None))
|
| 262 |
resp.data = resp.data[size:]
|
262 |
resp.data = resp.data[size:]
|
| 263 |
resp.maxsize = cin_maxsize
|
263 |
resp.maxsize = cin_maxsize
|
| 264 |
return resp
|
264 |
return resp
|
| 265 |
|
265 |
|
| 266 |
def cwrite(self, data, bitmask=0x1):
|
266 |
def cwrite(self, data, bitmask=0x1):
|
| Line 269... |
Line 269... |
| 269 |
"""
|
269 |
"""
|
| 270 |
cin_maxsize = self.lib.dev.packetsizelimit["cin"] - self.lib.headersize
|
270 |
cin_maxsize = self.lib.dev.packetsizelimit["cin"] - self.lib.headersize
|
| 271 |
size = len(data)
|
271 |
size = len(data)
|
| 272 |
while len(data) > 0:
|
272 |
while len(data) > 0:
|
| 273 |
writesize = min(cin_maxsize, len(data))
|
273 |
writesize = min(cin_maxsize, len(data))
|
| 274 |
resp = self.lib.monitorcommand(struct.pack("IIII%ds" % writesize, 12, writesize, 0, 0, data[:writesize]), "III", (None, None, None))
|
274 |
resp = self.lib.monitorcommand(struct.pack("IIII%ds" % writesize, 12, bitmask, writesize, 0, data[:writesize]), "III", (None, None, None))
|
| 275 |
data = data[writesize:]
|
275 |
data = data[writesize:]
|
| 276 |
return size
|
276 |
return size
|
| 277 |
|
277 |
|
| 278 |
def cflush(self, bitmask):
|
278 |
def cflush(self, bitmask):
|
| 279 |
""" Flushes the consoles specified with 'bitmask' """
|
279 |
""" Flushes the consoles specified with 'bitmask' """
|