Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _convert_exception(exc):
if isinstance(exc, DAPAccess.TransferFaultError):
return exceptions.TransferFaultError(*exc.args)
elif isinstance(exc, DAPAccess.TransferTimeoutError):
return exceptions.TransferTimeoutError(*exc.args)
elif isinstance(exc, DAPAccess.TransferError):
return exceptions.TransferError(*exc.args)
elif isinstance(exc, (DAPAccess.DeviceError, DAPAccess.CommandError)):
return exceptions.ProbeError(*exc.args)
elif isinstance(exc, DAPAccess.Error):
return exceptions.Error(*exc.args)
else:
return exc
addr += thisTransferSize
size -= thisTransferSize
# Check status of this read.
response = self._device.transfer([Commands.JTAG_COMMAND, Commands.JTAG_GETLASTRWSTATUS2], readSize=12)
status, _, faultAddr = struct.unpack('
def _handle_error(self, error, num):
if LOG_DAP:
self.logger.info("error:%06d %s", num, error)
# Clear sticky error for Fault errors only
if isinstance(error, exceptions.TransferFaultError):
self.clear_sticky_err()