id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 51 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
249,900 | square/pylink | pylink/jlink.py | JLink.memory_read64 | def memory_read64(self, addr, num_long_words):
"""Reads memory from the target system in units of 64-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_long_words (int): number of long words to read
Returns:
List ... | python | def memory_read64(self, addr, num_long_words):
buf_size = num_long_words
buf = (ctypes.c_ulonglong * buf_size)()
units_read = self._dll.JLINKARM_ReadMemU64(addr, buf_size, buf, 0)
if units_read < 0:
raise errors.JLinkException(units_read)
return buf[:units_read] | [
"def",
"memory_read64",
"(",
"self",
",",
"addr",
",",
"num_long_words",
")",
":",
"buf_size",
"=",
"num_long_words",
"buf",
"=",
"(",
"ctypes",
".",
"c_ulonglong",
"*",
"buf_size",
")",
"(",
")",
"units_read",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_Read... | Reads memory from the target system in units of 64-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_long_words (int): number of long words to read
Returns:
List of long words read from the target system.
Raises... | [
"Reads",
"memory",
"from",
"the",
"target",
"system",
"in",
"units",
"of",
"64",
"-",
"bits",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2789-L2809 |
249,901 | square/pylink | pylink/jlink.py | JLink.memory_write | def memory_write(self, addr, data, zone=None, nbits=None):
"""Writes memory to a target system or specific memory zone.
The optional ``zone`` specifies a memory zone to access to write to,
e.g. ``IDATA``, ``DDATA``, or ``CODE``.
The given number of bits, if provided, must be either ``8... | python | def memory_write(self, addr, data, zone=None, nbits=None):
buf_size = len(data)
buf = None
access = 0
if nbits is None:
# Pack the given data into an array of 8-bit unsigned integers in
# order to write it successfully
packed_data = map(lambda d: reve... | [
"def",
"memory_write",
"(",
"self",
",",
"addr",
",",
"data",
",",
"zone",
"=",
"None",
",",
"nbits",
"=",
"None",
")",
":",
"buf_size",
"=",
"len",
"(",
"data",
")",
"buf",
"=",
"None",
"access",
"=",
"0",
"if",
"nbits",
"is",
"None",
":",
"# Pa... | Writes memory to a target system or specific memory zone.
The optional ``zone`` specifies a memory zone to access to write to,
e.g. ``IDATA``, ``DDATA``, or ``CODE``.
The given number of bits, if provided, must be either ``8``, ``16``, or
``32``.
Args:
self (JLink): ... | [
"Writes",
"memory",
"to",
"a",
"target",
"system",
"or",
"specific",
"memory",
"zone",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2812-L2876 |
249,902 | square/pylink | pylink/jlink.py | JLink.memory_write8 | def memory_write8(self, addr, data, zone=None):
"""Writes bytes to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of bytes to write
zone (str): optional memory zone to access
... | python | def memory_write8(self, addr, data, zone=None):
return self.memory_write(addr, data, zone, 8) | [
"def",
"memory_write8",
"(",
"self",
",",
"addr",
",",
"data",
",",
"zone",
"=",
"None",
")",
":",
"return",
"self",
".",
"memory_write",
"(",
"addr",
",",
"data",
",",
"zone",
",",
"8",
")"
] | Writes bytes to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of bytes to write
zone (str): optional memory zone to access
Returns:
Number of bytes written to target.
... | [
"Writes",
"bytes",
"to",
"memory",
"of",
"a",
"target",
"system",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2879-L2894 |
249,903 | square/pylink | pylink/jlink.py | JLink.memory_write16 | def memory_write16(self, addr, data, zone=None):
"""Writes half-words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of half-words to write
zone (str): optional memory zone to acces... | python | def memory_write16(self, addr, data, zone=None):
return self.memory_write(addr, data, zone, 16) | [
"def",
"memory_write16",
"(",
"self",
",",
"addr",
",",
"data",
",",
"zone",
"=",
"None",
")",
":",
"return",
"self",
".",
"memory_write",
"(",
"addr",
",",
"data",
",",
"zone",
",",
"16",
")"
] | Writes half-words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of half-words to write
zone (str): optional memory zone to access
Returns:
Number of half-words written t... | [
"Writes",
"half",
"-",
"words",
"to",
"memory",
"of",
"a",
"target",
"system",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2897-L2912 |
249,904 | square/pylink | pylink/jlink.py | JLink.memory_write32 | def memory_write32(self, addr, data, zone=None):
"""Writes words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of words to write
zone (str): optional memory zone to access
... | python | def memory_write32(self, addr, data, zone=None):
return self.memory_write(addr, data, zone, 32) | [
"def",
"memory_write32",
"(",
"self",
",",
"addr",
",",
"data",
",",
"zone",
"=",
"None",
")",
":",
"return",
"self",
".",
"memory_write",
"(",
"addr",
",",
"data",
",",
"zone",
",",
"32",
")"
] | Writes words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of words to write
zone (str): optional memory zone to access
Returns:
Number of words written to target.
... | [
"Writes",
"words",
"to",
"memory",
"of",
"a",
"target",
"system",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2915-L2930 |
249,905 | square/pylink | pylink/jlink.py | JLink.memory_write64 | def memory_write64(self, addr, data, zone=None):
"""Writes long words to memory of a target system.
Note:
This is little-endian.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of long words to write
... | python | def memory_write64(self, addr, data, zone=None):
words = []
bitmask = 0xFFFFFFFF
for long_word in data:
words.append(long_word & bitmask) # Last 32-bits
words.append((long_word >> 32) & bitmask) # First 32-bits
return self.memory_write32(addr, words, zon... | [
"def",
"memory_write64",
"(",
"self",
",",
"addr",
",",
"data",
",",
"zone",
"=",
"None",
")",
":",
"words",
"=",
"[",
"]",
"bitmask",
"=",
"0xFFFFFFFF",
"for",
"long_word",
"in",
"data",
":",
"words",
".",
"append",
"(",
"long_word",
"&",
"bitmask",
... | Writes long words to memory of a target system.
Note:
This is little-endian.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of long words to write
zone (str): optional memory zone to access
R... | [
"Writes",
"long",
"words",
"to",
"memory",
"of",
"a",
"target",
"system",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2933-L2956 |
249,906 | square/pylink | pylink/jlink.py | JLink.register_read_multiple | def register_read_multiple(self, register_indices):
"""Retrieves the values from the registers specified.
Args:
self (JLink): the ``JLink`` instance
register_indices (list): list of registers to read
Returns:
A list of values corresponding one-to-one for each of t... | python | def register_read_multiple(self, register_indices):
num_regs = len(register_indices)
buf = (ctypes.c_uint32 * num_regs)(*register_indices)
data = (ctypes.c_uint32 * num_regs)(0)
# TODO: For some reason, these statuses are wonky, not sure why, might
# be bad documentation, but th... | [
"def",
"register_read_multiple",
"(",
"self",
",",
"register_indices",
")",
":",
"num_regs",
"=",
"len",
"(",
"register_indices",
")",
"buf",
"=",
"(",
"ctypes",
".",
"c_uint32",
"*",
"num_regs",
")",
"(",
"*",
"register_indices",
")",
"data",
"=",
"(",
"c... | Retrieves the values from the registers specified.
Args:
self (JLink): the ``JLink`` instance
register_indices (list): list of registers to read
Returns:
A list of values corresponding one-to-one for each of the given
register indices. The returned list of valu... | [
"Retrieves",
"the",
"values",
"from",
"the",
"registers",
"specified",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L2972-L2999 |
249,907 | square/pylink | pylink/jlink.py | JLink.register_write | def register_write(self, reg_index, value):
"""Writes into an ARM register.
Note:
The data is not immediately written, but is cached before being
transferred to the CPU on CPU start.
Args:
self (JLink): the ``JLink`` instance
reg_index (int): the ARM reg... | python | def register_write(self, reg_index, value):
res = self._dll.JLINKARM_WriteReg(reg_index, value)
if res != 0:
raise errors.JLinkException('Error writing to register %d' % reg_index)
return value | [
"def",
"register_write",
"(",
"self",
",",
"reg_index",
",",
"value",
")",
":",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_WriteReg",
"(",
"reg_index",
",",
"value",
")",
"if",
"res",
"!=",
"0",
":",
"raise",
"errors",
".",
"JLinkException",
"(",
... | Writes into an ARM register.
Note:
The data is not immediately written, but is cached before being
transferred to the CPU on CPU start.
Args:
self (JLink): the ``JLink`` instance
reg_index (int): the ARM register to write to
value (int): the value to w... | [
"Writes",
"into",
"an",
"ARM",
"register",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3002-L3023 |
249,908 | square/pylink | pylink/jlink.py | JLink.register_write_multiple | def register_write_multiple(self, register_indices, values):
"""Writes to multiple CPU registers.
Writes the values to the given registers in order. There must be a
one-to-one correspondence between the values and the registers
specified.
Args:
self (JLink): the ``JL... | python | def register_write_multiple(self, register_indices, values):
if len(register_indices) != len(values):
raise ValueError('Must be an equal number of registers and values')
num_regs = len(register_indices)
buf = (ctypes.c_uint32 * num_regs)(*register_indices)
data = (ctypes.c_u... | [
"def",
"register_write_multiple",
"(",
"self",
",",
"register_indices",
",",
"values",
")",
":",
"if",
"len",
"(",
"register_indices",
")",
"!=",
"len",
"(",
"values",
")",
":",
"raise",
"ValueError",
"(",
"'Must be an equal number of registers and values'",
")",
... | Writes to multiple CPU registers.
Writes the values to the given registers in order. There must be a
one-to-one correspondence between the values and the registers
specified.
Args:
self (JLink): the ``JLink`` instance
register_indices (list): list of registers to w... | [
"Writes",
"to",
"multiple",
"CPU",
"registers",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3026-L3060 |
249,909 | square/pylink | pylink/jlink.py | JLink.ice_register_write | def ice_register_write(self, register_index, value, delay=False):
"""Writes a value to an ARM ICE register.
Args:
self (JLink): the ``JLink`` instance
register_index (int): the ICE register to write to
value (int): the value to write to the ICE register
delay (bo... | python | def ice_register_write(self, register_index, value, delay=False):
self._dll.JLINKARM_WriteICEReg(register_index, int(value), int(delay))
return None | [
"def",
"ice_register_write",
"(",
"self",
",",
"register_index",
",",
"value",
",",
"delay",
"=",
"False",
")",
":",
"self",
".",
"_dll",
".",
"JLINKARM_WriteICEReg",
"(",
"register_index",
",",
"int",
"(",
"value",
")",
",",
"int",
"(",
"delay",
")",
")... | Writes a value to an ARM ICE register.
Args:
self (JLink): the ``JLink`` instance
register_index (int): the ICE register to write to
value (int): the value to write to the ICE register
delay (bool): boolean specifying if the write should be delayed
Returns:
... | [
"Writes",
"a",
"value",
"to",
"an",
"ARM",
"ICE",
"register",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3076-L3089 |
249,910 | square/pylink | pylink/jlink.py | JLink.etm_supported | def etm_supported(self):
"""Returns if the CPU core supports ETM.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``True`` if the CPU has the ETM unit, otherwise ``False``.
"""
res = self._dll.JLINKARM_ETM_IsPresent()
if (res == 1):
... | python | def etm_supported(self):
res = self._dll.JLINKARM_ETM_IsPresent()
if (res == 1):
return True
# JLINKARM_ETM_IsPresent() only works on ARM 7/9 devices. This
# fallback checks if ETM is present by checking the Cortex ROM table
# for debugging information for ETM.
... | [
"def",
"etm_supported",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_ETM_IsPresent",
"(",
")",
"if",
"(",
"res",
"==",
"1",
")",
":",
"return",
"True",
"# JLINKARM_ETM_IsPresent() only works on ARM 7/9 devices. This",
"# fallback checks if... | Returns if the CPU core supports ETM.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``True`` if the CPU has the ETM unit, otherwise ``False``. | [
"Returns",
"if",
"the",
"CPU",
"core",
"supports",
"ETM",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3092-L3114 |
249,911 | square/pylink | pylink/jlink.py | JLink.etm_register_write | def etm_register_write(self, register_index, value, delay=False):
"""Writes a value to an ETM register.
Args:
self (JLink): the ``JLink`` instance.
register_index (int): the register to write to.
value (int): the value to write to the register.
delay (bool): bool... | python | def etm_register_write(self, register_index, value, delay=False):
self._dll.JLINKARM_ETM_WriteReg(int(register_index), int(value), int(delay))
return None | [
"def",
"etm_register_write",
"(",
"self",
",",
"register_index",
",",
"value",
",",
"delay",
"=",
"False",
")",
":",
"self",
".",
"_dll",
".",
"JLINKARM_ETM_WriteReg",
"(",
"int",
"(",
"register_index",
")",
",",
"int",
"(",
"value",
")",
",",
"int",
"("... | Writes a value to an ETM register.
Args:
self (JLink): the ``JLink`` instance.
register_index (int): the register to write to.
value (int): the value to write to the register.
delay (bool): boolean specifying if the write should be buffered.
Returns:
`... | [
"Writes",
"a",
"value",
"to",
"an",
"ETM",
"register",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3130-L3143 |
249,912 | square/pylink | pylink/jlink.py | JLink.set_vector_catch | def set_vector_catch(self, flags):
"""Sets vector catch bits of the processor.
The CPU will jump to a vector if the given vector catch is active, and
will enter a debug state. This has the effect of halting the CPU as
well, meaning the CPU must be explicitly restarted.
Args:
... | python | def set_vector_catch(self, flags):
res = self._dll.JLINKARM_WriteVectorCatch(flags)
if res < 0:
raise errors.JLinkException(res)
return None | [
"def",
"set_vector_catch",
"(",
"self",
",",
"flags",
")",
":",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_WriteVectorCatch",
"(",
"flags",
")",
"if",
"res",
"<",
"0",
":",
"raise",
"errors",
".",
"JLinkException",
"(",
"res",
")",
"return",
"None"
... | Sets vector catch bits of the processor.
The CPU will jump to a vector if the given vector catch is active, and
will enter a debug state. This has the effect of halting the CPU as
well, meaning the CPU must be explicitly restarted.
Args:
self (JLink): the ``JLink`` instance
... | [
"Sets",
"vector",
"catch",
"bits",
"of",
"the",
"processor",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3320-L3339 |
249,913 | square/pylink | pylink/jlink.py | JLink.step | def step(self, thumb=False):
"""Executes a single step.
Steps even if there is a breakpoint.
Args:
self (JLink): the ``JLink`` instance
thumb (bool): boolean indicating if to step in thumb mode
Returns:
``None``
Raises:
JLinkException: ... | python | def step(self, thumb=False):
method = self._dll.JLINKARM_Step
if thumb:
method = self._dll.JLINKARM_StepComposite
res = method()
if res != 0:
raise errors.JLinkException("Failed to step over instruction.")
return None | [
"def",
"step",
"(",
"self",
",",
"thumb",
"=",
"False",
")",
":",
"method",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_Step",
"if",
"thumb",
":",
"method",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_StepComposite",
"res",
"=",
"method",
"(",
")",
"if",
"... | Executes a single step.
Steps even if there is a breakpoint.
Args:
self (JLink): the ``JLink`` instance
thumb (bool): boolean indicating if to step in thumb mode
Returns:
``None``
Raises:
JLinkException: on error | [
"Executes",
"a",
"single",
"step",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3342-L3365 |
249,914 | square/pylink | pylink/jlink.py | JLink.num_available_breakpoints | def num_available_breakpoints(self, arm=False, thumb=False, ram=False, flash=False, hw=False):
"""Returns the number of available breakpoints of the specified type.
If ``arm`` is set, gets the number of available ARM breakpoint units.
If ``thumb`` is set, gets the number of available THUMB brea... | python | def num_available_breakpoints(self, arm=False, thumb=False, ram=False, flash=False, hw=False):
flags = [
enums.JLinkBreakpoint.ARM,
enums.JLinkBreakpoint.THUMB,
enums.JLinkBreakpoint.SW_RAM,
enums.JLinkBreakpoint.SW_FLASH,
enums.JLinkBreakpoint.HW
... | [
"def",
"num_available_breakpoints",
"(",
"self",
",",
"arm",
"=",
"False",
",",
"thumb",
"=",
"False",
",",
"ram",
"=",
"False",
",",
"flash",
"=",
"False",
",",
"hw",
"=",
"False",
")",
":",
"flags",
"=",
"[",
"enums",
".",
"JLinkBreakpoint",
".",
"... | Returns the number of available breakpoints of the specified type.
If ``arm`` is set, gets the number of available ARM breakpoint units.
If ``thumb`` is set, gets the number of available THUMB breakpoint
units. If ``ram`` is set, gets the number of available software RAM
breakpoint uni... | [
"Returns",
"the",
"number",
"of",
"available",
"breakpoints",
"of",
"the",
"specified",
"type",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3411-L3459 |
249,915 | square/pylink | pylink/jlink.py | JLink.breakpoint_info | def breakpoint_info(self, handle=0, index=-1):
"""Returns the information about a set breakpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are pro... | python | def breakpoint_info(self, handle=0, index=-1):
if index < 0 and handle == 0:
raise ValueError('Handle must be provided if index is not set.')
bp = structs.JLinkBreakpointInfo()
bp.Handle = int(handle)
res = self._dll.JLINKARM_GetBPInfoEx(index, ctypes.byref(bp))
if r... | [
"def",
"breakpoint_info",
"(",
"self",
",",
"handle",
"=",
"0",
",",
"index",
"=",
"-",
"1",
")",
":",
"if",
"index",
"<",
"0",
"and",
"handle",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'Handle must be provided if index is not set.'",
")",
"bp",
"=",
... | Returns the information about a set breakpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are provided, the ``index`` overrides
the provided ``ha... | [
"Returns",
"the",
"information",
"about",
"a",
"set",
"breakpoint",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3462-L3493 |
249,916 | square/pylink | pylink/jlink.py | JLink.breakpoint_set | def breakpoint_set(self, addr, thumb=False, arm=False):
"""Sets a breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
normal breakpoint is set.
Args:
... | python | def breakpoint_set(self, addr, thumb=False, arm=False):
flags = enums.JLinkBreakpoint.ANY
if thumb:
flags = flags | enums.JLinkBreakpoint.THUMB
elif arm:
flags = flags | enums.JLinkBreakpoint.ARM
handle = self._dll.JLINKARM_SetBPEx(int(addr), flags)
if h... | [
"def",
"breakpoint_set",
"(",
"self",
",",
"addr",
",",
"thumb",
"=",
"False",
",",
"arm",
"=",
"False",
")",
":",
"flags",
"=",
"enums",
".",
"JLinkBreakpoint",
".",
"ANY",
"if",
"thumb",
":",
"flags",
"=",
"flags",
"|",
"enums",
".",
"JLinkBreakpoint... | Sets a breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
normal breakpoint is set.
Args:
self (JLink): the ``JLink`` instance
addr (int): t... | [
"Sets",
"a",
"breakpoint",
"at",
"the",
"specified",
"address",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3510-L3542 |
249,917 | square/pylink | pylink/jlink.py | JLink.software_breakpoint_set | def software_breakpoint_set(self, addr, thumb=False, arm=False, flash=False, ram=False):
"""Sets a software breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
no... | python | def software_breakpoint_set(self, addr, thumb=False, arm=False, flash=False, ram=False):
if flash and not ram:
flags = enums.JLinkBreakpoint.SW_FLASH
elif not flash and ram:
flags = enums.JLinkBreakpoint.SW_RAM
else:
flags = enums.JLinkBreakpoint.SW
i... | [
"def",
"software_breakpoint_set",
"(",
"self",
",",
"addr",
",",
"thumb",
"=",
"False",
",",
"arm",
"=",
"False",
",",
"flash",
"=",
"False",
",",
"ram",
"=",
"False",
")",
":",
"if",
"flash",
"and",
"not",
"ram",
":",
"flags",
"=",
"enums",
".",
"... | Sets a software breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
normal breakpoint is set.
If ``flash`` is ``True``, the breakpoint is set in flash, otherwise... | [
"Sets",
"a",
"software",
"breakpoint",
"at",
"the",
"specified",
"address",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3545-L3589 |
249,918 | square/pylink | pylink/jlink.py | JLink.watchpoint_info | def watchpoint_info(self, handle=0, index=-1):
"""Returns information about the specified watchpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are... | python | def watchpoint_info(self, handle=0, index=-1):
if index < 0 and handle == 0:
raise ValueError('Handle must be provided if index is not set.')
wp = structs.JLinkWatchpointInfo()
res = self._dll.JLINKARM_GetWPInfoEx(index, ctypes.byref(wp))
if res < 0:
raise errors... | [
"def",
"watchpoint_info",
"(",
"self",
",",
"handle",
"=",
"0",
",",
"index",
"=",
"-",
"1",
")",
":",
"if",
"index",
"<",
"0",
"and",
"handle",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'Handle must be provided if index is not set.'",
")",
"wp",
"=",
... | Returns information about the specified watchpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are provided, the ``index`` overrides
the provided ... | [
"Returns",
"information",
"about",
"the",
"specified",
"watchpoint",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3677-L3714 |
249,919 | square/pylink | pylink/jlink.py | JLink.watchpoint_set | def watchpoint_set(self,
addr,
addr_mask=0x0,
data=0x0,
data_mask=0x0,
access_size=None,
read=False,
write=False,
privileged=False):
... | python | def watchpoint_set(self,
addr,
addr_mask=0x0,
data=0x0,
data_mask=0x0,
access_size=None,
read=False,
write=False,
privileged=False):
... | [
"def",
"watchpoint_set",
"(",
"self",
",",
"addr",
",",
"addr_mask",
"=",
"0x0",
",",
"data",
"=",
"0x0",
",",
"data_mask",
"=",
"0x0",
",",
"access_size",
"=",
"None",
",",
"read",
"=",
"False",
",",
"write",
"=",
"False",
",",
"privileged",
"=",
"F... | Sets a watchpoint at the given address.
This method allows for a watchpoint to be set on an given address or
range of addresses. The watchpoint can then be triggered if the data
at the given address matches the specified ``data`` or range of data as
determined by ``data_mask``, on spec... | [
"Sets",
"a",
"watchpoint",
"at",
"the",
"given",
"address",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3717-L3821 |
249,920 | square/pylink | pylink/jlink.py | JLink.disassemble_instruction | def disassemble_instruction(self, instruction):
"""Disassembles and returns the assembly instruction string.
Args:
self (JLink): the ``JLink`` instance.
instruction (int): the instruction address.
Returns:
A string corresponding to the assembly instruction string ... | python | def disassemble_instruction(self, instruction):
if not util.is_integer(instruction):
raise TypeError('Expected instruction to be an integer.')
buf_size = self.MAX_BUF_SIZE
buf = (ctypes.c_char * buf_size)()
res = self._dll.JLINKARM_DisassembleInst(ctypes.byref(buf), buf_size... | [
"def",
"disassemble_instruction",
"(",
"self",
",",
"instruction",
")",
":",
"if",
"not",
"util",
".",
"is_integer",
"(",
"instruction",
")",
":",
"raise",
"TypeError",
"(",
"'Expected instruction to be an integer.'",
")",
"buf_size",
"=",
"self",
".",
"MAX_BUF_SI... | Disassembles and returns the assembly instruction string.
Args:
self (JLink): the ``JLink`` instance.
instruction (int): the instruction address.
Returns:
A string corresponding to the assembly instruction string at the
given instruction address.
Raises... | [
"Disassembles",
"and",
"returns",
"the",
"assembly",
"instruction",
"string",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3848-L3872 |
249,921 | square/pylink | pylink/jlink.py | JLink.strace_configure | def strace_configure(self, port_width):
"""Configures the trace port width for tracing.
Note that configuration cannot occur while STRACE is running.
Args:
self (JLink): the ``JLink`` instance
port_width (int): the trace port width to use.
Returns:
``None... | python | def strace_configure(self, port_width):
if port_width not in [1, 2, 4]:
raise ValueError('Invalid port width: %s' % str(port_width))
config_string = 'PortWidth=%d' % port_width
res = self._dll.JLINK_STRACE_Config(config_string.encode())
if res < 0:
raise errors.J... | [
"def",
"strace_configure",
"(",
"self",
",",
"port_width",
")",
":",
"if",
"port_width",
"not",
"in",
"[",
"1",
",",
"2",
",",
"4",
"]",
":",
"raise",
"ValueError",
"(",
"'Invalid port width: %s'",
"%",
"str",
"(",
"port_width",
")",
")",
"config_string",
... | Configures the trace port width for tracing.
Note that configuration cannot occur while STRACE is running.
Args:
self (JLink): the ``JLink`` instance
port_width (int): the trace port width to use.
Returns:
``None``
Raises:
ValueError: if ``port... | [
"Configures",
"the",
"trace",
"port",
"width",
"for",
"tracing",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3881-L3905 |
249,922 | square/pylink | pylink/jlink.py | JLink.strace_read | def strace_read(self, num_instructions):
"""Reads and returns a number of instructions captured by STRACE.
The number of instructions must be a non-negative value of at most
``0x10000`` (``65536``).
Args:
self (JLink): the ``JLink`` instance.
num_instructions (int):... | python | def strace_read(self, num_instructions):
if num_instructions < 0 or num_instructions > 0x10000:
raise ValueError('Invalid instruction count.')
buf = (ctypes.c_uint32 * num_instructions)()
buf_size = num_instructions
res = self._dll.JLINK_STRACE_Read(ctypes.byref(buf), buf_si... | [
"def",
"strace_read",
"(",
"self",
",",
"num_instructions",
")",
":",
"if",
"num_instructions",
"<",
"0",
"or",
"num_instructions",
">",
"0x10000",
":",
"raise",
"ValueError",
"(",
"'Invalid instruction count.'",
")",
"buf",
"=",
"(",
"ctypes",
".",
"c_uint32",
... | Reads and returns a number of instructions captured by STRACE.
The number of instructions must be a non-negative value of at most
``0x10000`` (``65536``).
Args:
self (JLink): the ``JLink`` instance.
num_instructions (int): number of instructions to fetch.
Returns:
... | [
"Reads",
"and",
"returns",
"a",
"number",
"of",
"instructions",
"captured",
"by",
"STRACE",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3949-L3980 |
249,923 | square/pylink | pylink/jlink.py | JLink.strace_data_access_event | def strace_data_access_event(self,
operation,
address,
data,
data_mask=None,
access_width=4,
address_range=0):
"""... | python | def strace_data_access_event(self,
operation,
address,
data,
data_mask=None,
access_width=4,
address_range=0):
cmd... | [
"def",
"strace_data_access_event",
"(",
"self",
",",
"operation",
",",
"address",
",",
"data",
",",
"data_mask",
"=",
"None",
",",
"access_width",
"=",
"4",
",",
"address_range",
"=",
"0",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkStraceCommand",
".",
"TRA... | Sets an event to trigger trace logic when data access is made.
Data access corresponds to either a read or write.
Args:
self (JLink): the ``JLink`` instance.
operation (int): one of the operations in ``JLinkStraceOperation``.
address (int): the address of the load/store d... | [
"Sets",
"an",
"event",
"to",
"trigger",
"trace",
"logic",
"when",
"data",
"access",
"is",
"made",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4012-L4053 |
249,924 | square/pylink | pylink/jlink.py | JLink.strace_data_store_event | def strace_data_store_event(self, operation, address, address_range=0):
"""Sets an event to trigger trace logic when data write access is made.
Args:
self (JLink): the ``JLink`` instance.
operation (int): one of the operations in ``JLinkStraceOperation``.
address (int): th... | python | def strace_data_store_event(self, operation, address, address_range=0):
cmd = enums.JLinkStraceCommand.TRACE_EVENT_SET
event_info = structs.JLinkStraceEventInfo()
event_info.Type = enums.JLinkStraceEvent.DATA_STORE
event_info.Op = operation
event_info.Addr = int(address)
... | [
"def",
"strace_data_store_event",
"(",
"self",
",",
"operation",
",",
"address",
",",
"address_range",
"=",
"0",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkStraceCommand",
".",
"TRACE_EVENT_SET",
"event_info",
"=",
"structs",
".",
"JLinkStraceEventInfo",
"(",
")"... | Sets an event to trigger trace logic when data write access is made.
Args:
self (JLink): the ``JLink`` instance.
operation (int): one of the operations in ``JLinkStraceOperation``.
address (int): the address of the store data.
address_range (int): optional range of addre... | [
"Sets",
"an",
"event",
"to",
"trigger",
"trace",
"logic",
"when",
"data",
"write",
"access",
"is",
"made",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4085-L4111 |
249,925 | square/pylink | pylink/jlink.py | JLink.strace_clear | def strace_clear(self, handle):
"""Clears the trace event specified by the given handle.
Args:
self (JLink): the ``JLink`` instance.
handle (int): handle of the trace event.
Returns:
``None``
Raises:
JLinkException: on error.
"""
... | python | def strace_clear(self, handle):
data = ctypes.c_int(handle)
res = self._dll.JLINK_STRACE_Control(enums.JLinkStraceCommand.TRACE_EVENT_CLR, ctypes.byref(data))
if res < 0:
raise errors.JLinkException('Failed to clear STRACE event.')
return None | [
"def",
"strace_clear",
"(",
"self",
",",
"handle",
")",
":",
"data",
"=",
"ctypes",
".",
"c_int",
"(",
"handle",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINK_STRACE_Control",
"(",
"enums",
".",
"JLinkStraceCommand",
".",
"TRACE_EVENT_CLR",
",",
"ctype... | Clears the trace event specified by the given handle.
Args:
self (JLink): the ``JLink`` instance.
handle (int): handle of the trace event.
Returns:
``None``
Raises:
JLinkException: on error. | [
"Clears",
"the",
"trace",
"event",
"specified",
"by",
"the",
"given",
"handle",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4114-L4132 |
249,926 | square/pylink | pylink/jlink.py | JLink.strace_clear_all | def strace_clear_all(self):
"""Clears all STRACE events.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error.
"""
data = 0
res = self._dll.JLINK_STRACE_Control(enums.JLinkStraceCommand.TRA... | python | def strace_clear_all(self):
data = 0
res = self._dll.JLINK_STRACE_Control(enums.JLinkStraceCommand.TRACE_EVENT_CLR_ALL, data)
if res < 0:
raise errors.JLinkException('Failed to clear all STRACE events.')
return None | [
"def",
"strace_clear_all",
"(",
"self",
")",
":",
"data",
"=",
"0",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINK_STRACE_Control",
"(",
"enums",
".",
"JLinkStraceCommand",
".",
"TRACE_EVENT_CLR_ALL",
",",
"data",
")",
"if",
"res",
"<",
"0",
":",
"raise",
... | Clears all STRACE events.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error. | [
"Clears",
"all",
"STRACE",
"events",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4135-L4152 |
249,927 | square/pylink | pylink/jlink.py | JLink.strace_set_buffer_size | def strace_set_buffer_size(self, size):
"""Sets the STRACE buffer size.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error.
"""
size = ctypes.c_uint32(size)
res = self._dll.JLINK_STRACE_C... | python | def strace_set_buffer_size(self, size):
size = ctypes.c_uint32(size)
res = self._dll.JLINK_STRACE_Control(enums.JLinkStraceCommand.SET_BUFFER_SIZE, size)
if res < 0:
raise errors.JLinkException('Failed to set the STRACE buffer size.')
return None | [
"def",
"strace_set_buffer_size",
"(",
"self",
",",
"size",
")",
":",
"size",
"=",
"ctypes",
".",
"c_uint32",
"(",
"size",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINK_STRACE_Control",
"(",
"enums",
".",
"JLinkStraceCommand",
".",
"SET_BUFFER_SIZE",
",",... | Sets the STRACE buffer size.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error. | [
"Sets",
"the",
"STRACE",
"buffer",
"size",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4155-L4172 |
249,928 | square/pylink | pylink/jlink.py | JLink.trace_start | def trace_start(self):
"""Starts collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
"""
cmd = enums.JLinkTraceCommand.START
res = self._dll.JLINKARM_TRACE_Control(cmd, 0)
if (res == 1):
raise erro... | python | def trace_start(self):
cmd = enums.JLinkTraceCommand.START
res = self._dll.JLINKARM_TRACE_Control(cmd, 0)
if (res == 1):
raise errors.JLinkException('Failed to start trace.')
return None | [
"def",
"trace_start",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"START",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cmd",
",",
"0",
")",
"if",
"(",
"res",
"==",
"1",
")",
":",
"raise",
"erro... | Starts collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None`` | [
"Starts",
"collecting",
"trace",
"data",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4181-L4194 |
249,929 | square/pylink | pylink/jlink.py | JLink.trace_stop | def trace_stop(self):
"""Stops collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
"""
cmd = enums.JLinkTraceCommand.STOP
res = self._dll.JLINKARM_TRACE_Control(cmd, 0)
if (res == 1):
raise errors.... | python | def trace_stop(self):
cmd = enums.JLinkTraceCommand.STOP
res = self._dll.JLINKARM_TRACE_Control(cmd, 0)
if (res == 1):
raise errors.JLinkException('Failed to stop trace.')
return None | [
"def",
"trace_stop",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"STOP",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cmd",
",",
"0",
")",
"if",
"(",
"res",
"==",
"1",
")",
":",
"raise",
"errors... | Stops collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None`` | [
"Stops",
"collecting",
"trace",
"data",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4197-L4210 |
249,930 | square/pylink | pylink/jlink.py | JLink.trace_flush | def trace_flush(self):
"""Flushes the trace buffer.
After this method is called, the trace buffer is empty. This method is
best called when the device is reset.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
"""
cmd = enums.J... | python | def trace_flush(self):
cmd = enums.JLinkTraceCommand.FLUSH
res = self._dll.JLINKARM_TRACE_Control(cmd, 0)
if (res == 1):
raise errors.JLinkException('Failed to flush the trace buffer.')
return None | [
"def",
"trace_flush",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"FLUSH",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cmd",
",",
"0",
")",
"if",
"(",
"res",
"==",
"1",
")",
":",
"raise",
"erro... | Flushes the trace buffer.
After this method is called, the trace buffer is empty. This method is
best called when the device is reset.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None`` | [
"Flushes",
"the",
"trace",
"buffer",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4213-L4229 |
249,931 | square/pylink | pylink/jlink.py | JLink.trace_buffer_capacity | def trace_buffer_capacity(self):
"""Retrieves the trace buffer's current capacity.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current capacity of the trace buffer. This is not necessarily
the maximum possible size the buffer could be configured with... | python | def trace_buffer_capacity(self):
cmd = enums.JLinkTraceCommand.GET_CONF_CAPACITY
data = ctypes.c_uint32(0)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(data))
if (res == 1):
raise errors.JLinkException('Failed to get trace buffer size.')
return data.value | [
"def",
"trace_buffer_capacity",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"GET_CONF_CAPACITY",
"data",
"=",
"ctypes",
".",
"c_uint32",
"(",
"0",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cmd",... | Retrieves the trace buffer's current capacity.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current capacity of the trace buffer. This is not necessarily
the maximum possible size the buffer could be configured with. | [
"Retrieves",
"the",
"trace",
"buffer",
"s",
"current",
"capacity",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4249-L4264 |
249,932 | square/pylink | pylink/jlink.py | JLink.trace_set_buffer_capacity | def trace_set_buffer_capacity(self, size):
"""Sets the capacity for the trace buffer.
Args:
self (JLink): the ``JLink`` instance.
size (int): the new capacity for the trace buffer.
Returns:
``None``
"""
cmd = enums.JLinkTraceCommand.SET_CAPACITY
... | python | def trace_set_buffer_capacity(self, size):
cmd = enums.JLinkTraceCommand.SET_CAPACITY
data = ctypes.c_uint32(size)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(data))
if (res == 1):
raise errors.JLinkException('Failed to set trace buffer size.')
return Non... | [
"def",
"trace_set_buffer_capacity",
"(",
"self",
",",
"size",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"SET_CAPACITY",
"data",
"=",
"ctypes",
".",
"c_uint32",
"(",
"size",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Contro... | Sets the capacity for the trace buffer.
Args:
self (JLink): the ``JLink`` instance.
size (int): the new capacity for the trace buffer.
Returns:
``None`` | [
"Sets",
"the",
"capacity",
"for",
"the",
"trace",
"buffer",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4267-L4282 |
249,933 | square/pylink | pylink/jlink.py | JLink.trace_min_buffer_capacity | def trace_min_buffer_capacity(self):
"""Retrieves the minimum capacity the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The minimum configurable capacity for the trace buffer.
"""
cmd = enums.JLinkTraceCommand.GET... | python | def trace_min_buffer_capacity(self):
cmd = enums.JLinkTraceCommand.GET_MIN_CAPACITY
data = ctypes.c_uint32(0)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(data))
if (res == 1):
raise errors.JLinkException('Failed to get min trace buffer size.')
return data... | [
"def",
"trace_min_buffer_capacity",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"GET_MIN_CAPACITY",
"data",
"=",
"ctypes",
".",
"c_uint32",
"(",
"0",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cm... | Retrieves the minimum capacity the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The minimum configurable capacity for the trace buffer. | [
"Retrieves",
"the",
"minimum",
"capacity",
"the",
"trace",
"buffer",
"can",
"be",
"configured",
"with",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4285-L4299 |
249,934 | square/pylink | pylink/jlink.py | JLink.trace_max_buffer_capacity | def trace_max_buffer_capacity(self):
"""Retrieves the maximum size the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The maximum configurable capacity for the trace buffer.
"""
cmd = enums.JLinkTraceCommand.GET_MAX... | python | def trace_max_buffer_capacity(self):
cmd = enums.JLinkTraceCommand.GET_MAX_CAPACITY
data = ctypes.c_uint32(0)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(data))
if (res == 1):
raise errors.JLinkException('Failed to get max trace buffer size.')
return data... | [
"def",
"trace_max_buffer_capacity",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"GET_MAX_CAPACITY",
"data",
"=",
"ctypes",
".",
"c_uint32",
"(",
"0",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cm... | Retrieves the maximum size the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The maximum configurable capacity for the trace buffer. | [
"Retrieves",
"the",
"maximum",
"size",
"the",
"trace",
"buffer",
"can",
"be",
"configured",
"with",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4302-L4316 |
249,935 | square/pylink | pylink/jlink.py | JLink.trace_set_format | def trace_set_format(self, fmt):
"""Sets the format for the trace buffer to use.
Args:
self (JLink): the ``JLink`` instance.
fmt (int): format for the trace buffer; this is one of the attributes
of ``JLinkTraceFormat``.
Returns:
``None``
"""
... | python | def trace_set_format(self, fmt):
cmd = enums.JLinkTraceCommand.SET_FORMAT
data = ctypes.c_uint32(fmt)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(data))
if (res == 1):
raise errors.JLinkException('Failed to set trace format.')
return None | [
"def",
"trace_set_format",
"(",
"self",
",",
"fmt",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"SET_FORMAT",
"data",
"=",
"ctypes",
".",
"c_uint32",
"(",
"fmt",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
... | Sets the format for the trace buffer to use.
Args:
self (JLink): the ``JLink`` instance.
fmt (int): format for the trace buffer; this is one of the attributes
of ``JLinkTraceFormat``.
Returns:
``None`` | [
"Sets",
"the",
"format",
"for",
"the",
"trace",
"buffer",
"to",
"use",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4319-L4335 |
249,936 | square/pylink | pylink/jlink.py | JLink.trace_format | def trace_format(self):
"""Retrieves the current format the trace buffer is using.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current format the trace buffer is using. This is one of the
attributes of ``JLinkTraceFormat``.
"""
cmd = ... | python | def trace_format(self):
cmd = enums.JLinkTraceCommand.GET_FORMAT
data = ctypes.c_uint32(0)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(data))
if (res == 1):
raise errors.JLinkException('Failed to get trace format.')
return data.value | [
"def",
"trace_format",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"GET_FORMAT",
"data",
"=",
"ctypes",
".",
"c_uint32",
"(",
"0",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cmd",
",",
"ctype... | Retrieves the current format the trace buffer is using.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current format the trace buffer is using. This is one of the
attributes of ``JLinkTraceFormat``. | [
"Retrieves",
"the",
"current",
"format",
"the",
"trace",
"buffer",
"is",
"using",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4338-L4353 |
249,937 | square/pylink | pylink/jlink.py | JLink.trace_region_count | def trace_region_count(self):
"""Retrieves a count of the number of available trace regions.
Args:
self (JLink): the ``JLink`` instance.
Returns:
Count of the number of available trace regions.
"""
cmd = enums.JLinkTraceCommand.GET_NUM_REGIONS
data =... | python | def trace_region_count(self):
cmd = enums.JLinkTraceCommand.GET_NUM_REGIONS
data = ctypes.c_uint32(0)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(data))
if (res == 1):
raise errors.JLinkException('Failed to get trace region count.')
return data.value | [
"def",
"trace_region_count",
"(",
"self",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"GET_NUM_REGIONS",
"data",
"=",
"ctypes",
".",
"c_uint32",
"(",
"0",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_TRACE_Control",
"(",
"cmd",
",... | Retrieves a count of the number of available trace regions.
Args:
self (JLink): the ``JLink`` instance.
Returns:
Count of the number of available trace regions. | [
"Retrieves",
"a",
"count",
"of",
"the",
"number",
"of",
"available",
"trace",
"regions",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4356-L4370 |
249,938 | square/pylink | pylink/jlink.py | JLink.trace_region | def trace_region(self, region_index):
"""Retrieves the properties of a trace region.
Args:
self (JLink): the ``JLink`` instance.
region_index (int): the trace region index.
Returns:
An instance of ``JLinkTraceRegion`` describing the specified region.
"""
... | python | def trace_region(self, region_index):
cmd = enums.JLinkTraceCommand.GET_REGION_PROPS_EX
region = structs.JLinkTraceRegion()
region.RegionIndex = int(region_index)
res = self._dll.JLINKARM_TRACE_Control(cmd, ctypes.byref(region))
if (res == 1):
raise errors.JLinkExcept... | [
"def",
"trace_region",
"(",
"self",
",",
"region_index",
")",
":",
"cmd",
"=",
"enums",
".",
"JLinkTraceCommand",
".",
"GET_REGION_PROPS_EX",
"region",
"=",
"structs",
".",
"JLinkTraceRegion",
"(",
")",
"region",
".",
"RegionIndex",
"=",
"int",
"(",
"region_in... | Retrieves the properties of a trace region.
Args:
self (JLink): the ``JLink`` instance.
region_index (int): the trace region index.
Returns:
An instance of ``JLinkTraceRegion`` describing the specified region. | [
"Retrieves",
"the",
"properties",
"of",
"a",
"trace",
"region",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4373-L4389 |
249,939 | square/pylink | pylink/jlink.py | JLink.trace_read | def trace_read(self, offset, num_items):
"""Reads data from the trace buffer and returns it.
Args:
self (JLink): the ``JLink`` instance.
offset (int): the offset from which to start reading from the trace
buffer.
num_items (int): number of items to read from th... | python | def trace_read(self, offset, num_items):
buf_size = ctypes.c_uint32(num_items)
buf = (structs.JLinkTraceData * num_items)()
res = self._dll.JLINKARM_TRACE_Read(buf, int(offset), ctypes.byref(buf_size))
if (res == 1):
raise errors.JLinkException('Failed to read from trace buff... | [
"def",
"trace_read",
"(",
"self",
",",
"offset",
",",
"num_items",
")",
":",
"buf_size",
"=",
"ctypes",
".",
"c_uint32",
"(",
"num_items",
")",
"buf",
"=",
"(",
"structs",
".",
"JLinkTraceData",
"*",
"num_items",
")",
"(",
")",
"res",
"=",
"self",
".",... | Reads data from the trace buffer and returns it.
Args:
self (JLink): the ``JLink`` instance.
offset (int): the offset from which to start reading from the trace
buffer.
num_items (int): number of items to read from the trace buffer.
Returns:
A list o... | [
"Reads",
"data",
"from",
"the",
"trace",
"buffer",
"and",
"returns",
"it",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4392-L4415 |
249,940 | square/pylink | pylink/jlink.py | JLink.swo_start | def swo_start(self, swo_speed=9600):
"""Starts collecting SWO data.
Note:
If SWO is already enabled, it will first stop SWO before enabling it
again.
Args:
self (JLink): the ``JLink`` instance
swo_speed (int): the frequency in Hz used by the target to co... | python | def swo_start(self, swo_speed=9600):
if self.swo_enabled():
self.swo_stop()
info = structs.JLinkSWOStartInfo()
info.Speed = swo_speed
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.START,
ctypes.byref(info))
i... | [
"def",
"swo_start",
"(",
"self",
",",
"swo_speed",
"=",
"9600",
")",
":",
"if",
"self",
".",
"swo_enabled",
"(",
")",
":",
"self",
".",
"swo_stop",
"(",
")",
"info",
"=",
"structs",
".",
"JLinkSWOStartInfo",
"(",
")",
"info",
".",
"Speed",
"=",
"swo_... | Starts collecting SWO data.
Note:
If SWO is already enabled, it will first stop SWO before enabling it
again.
Args:
self (JLink): the ``JLink`` instance
swo_speed (int): the frequency in Hz used by the target to communicate
Returns:
``None``
... | [
"Starts",
"collecting",
"SWO",
"data",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4435-L4464 |
249,941 | square/pylink | pylink/jlink.py | JLink.swo_stop | def swo_stop(self):
"""Stops collecting SWO data.
Args:
self (JLink): the ``JLink`` instance
Returns:
``None``
Raises:
JLinkException: on error
"""
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.STOP, 0)
if res < 0:
... | python | def swo_stop(self):
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.STOP, 0)
if res < 0:
raise errors.JLinkException(res)
return None | [
"def",
"swo_stop",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_SWO_Control",
"(",
"enums",
".",
"JLinkSWOCommands",
".",
"STOP",
",",
"0",
")",
"if",
"res",
"<",
"0",
":",
"raise",
"errors",
".",
"JLinkException",
"(",
"res",... | Stops collecting SWO data.
Args:
self (JLink): the ``JLink`` instance
Returns:
``None``
Raises:
JLinkException: on error | [
"Stops",
"collecting",
"SWO",
"data",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4467-L4483 |
249,942 | square/pylink | pylink/jlink.py | JLink.swo_enable | def swo_enable(self, cpu_speed, swo_speed=9600, port_mask=0x01):
"""Enables SWO output on the target device.
Configures the output protocol, the SWO output speed, and enables any
ITM & stimulus ports.
This is equivalent to calling ``.swo_start()``.
Note:
If SWO is al... | python | def swo_enable(self, cpu_speed, swo_speed=9600, port_mask=0x01):
if self.swo_enabled():
self.swo_stop()
res = self._dll.JLINKARM_SWO_EnableTarget(cpu_speed,
swo_speed,
enums.JLinkSWOInterface... | [
"def",
"swo_enable",
"(",
"self",
",",
"cpu_speed",
",",
"swo_speed",
"=",
"9600",
",",
"port_mask",
"=",
"0x01",
")",
":",
"if",
"self",
".",
"swo_enabled",
"(",
")",
":",
"self",
".",
"swo_stop",
"(",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"J... | Enables SWO output on the target device.
Configures the output protocol, the SWO output speed, and enables any
ITM & stimulus ports.
This is equivalent to calling ``.swo_start()``.
Note:
If SWO is already enabled, it will first stop SWO before enabling it
again.
... | [
"Enables",
"SWO",
"output",
"on",
"the",
"target",
"device",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4486-L4522 |
249,943 | square/pylink | pylink/jlink.py | JLink.swo_disable | def swo_disable(self, port_mask):
"""Disables ITM & Stimulus ports.
Args:
self (JLink): the ``JLink`` instance
port_mask (int): mask specifying which ports to disable
Returns:
``None``
Raises:
JLinkException: on error
"""
res = s... | python | def swo_disable(self, port_mask):
res = self._dll.JLINKARM_SWO_DisableTarget(port_mask)
if res != 0:
raise errors.JLinkException(res)
return None | [
"def",
"swo_disable",
"(",
"self",
",",
"port_mask",
")",
":",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_SWO_DisableTarget",
"(",
"port_mask",
")",
"if",
"res",
"!=",
"0",
":",
"raise",
"errors",
".",
"JLinkException",
"(",
"res",
")",
"return",
"N... | Disables ITM & Stimulus ports.
Args:
self (JLink): the ``JLink`` instance
port_mask (int): mask specifying which ports to disable
Returns:
``None``
Raises:
JLinkException: on error | [
"Disables",
"ITM",
"&",
"Stimulus",
"ports",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4525-L4541 |
249,944 | square/pylink | pylink/jlink.py | JLink.swo_flush | def swo_flush(self, num_bytes=None):
"""Flushes data from the SWO buffer.
After this method is called, the flushed part of the SWO buffer is
empty.
If ``num_bytes`` is not present, flushes all data currently in the SWO
buffer.
Args:
self (JLink): the ``JLink`... | python | def swo_flush(self, num_bytes=None):
if num_bytes is None:
num_bytes = self.swo_num_bytes()
buf = ctypes.c_uint32(num_bytes)
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.FLUSH,
ctypes.byref(buf))
if res < 0:
... | [
"def",
"swo_flush",
"(",
"self",
",",
"num_bytes",
"=",
"None",
")",
":",
"if",
"num_bytes",
"is",
"None",
":",
"num_bytes",
"=",
"self",
".",
"swo_num_bytes",
"(",
")",
"buf",
"=",
"ctypes",
".",
"c_uint32",
"(",
"num_bytes",
")",
"res",
"=",
"self",
... | Flushes data from the SWO buffer.
After this method is called, the flushed part of the SWO buffer is
empty.
If ``num_bytes`` is not present, flushes all data currently in the SWO
buffer.
Args:
self (JLink): the ``JLink`` instance
num_bytes (int): the number... | [
"Flushes",
"data",
"from",
"the",
"SWO",
"buffer",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4544-L4572 |
249,945 | square/pylink | pylink/jlink.py | JLink.swo_speed_info | def swo_speed_info(self):
"""Retrieves information about the supported SWO speeds.
Args:
self (JLink): the ``JLink`` instance
Returns:
A ``JLinkSWOSpeedInfo`` instance describing the target's supported
SWO speeds.
Raises:
JLinkException: on erro... | python | def swo_speed_info(self):
info = structs.JLinkSWOSpeedInfo()
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.GET_SPEED_INFO,
ctypes.byref(info))
if res < 0:
raise errors.JLinkException(res)
return info | [
"def",
"swo_speed_info",
"(",
"self",
")",
":",
"info",
"=",
"structs",
".",
"JLinkSWOSpeedInfo",
"(",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_SWO_Control",
"(",
"enums",
".",
"JLinkSWOCommands",
".",
"GET_SPEED_INFO",
",",
"ctypes",
".",
"byref... | Retrieves information about the supported SWO speeds.
Args:
self (JLink): the ``JLink`` instance
Returns:
A ``JLinkSWOSpeedInfo`` instance describing the target's supported
SWO speeds.
Raises:
JLinkException: on error | [
"Retrieves",
"information",
"about",
"the",
"supported",
"SWO",
"speeds",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4575-L4594 |
249,946 | square/pylink | pylink/jlink.py | JLink.swo_num_bytes | def swo_num_bytes(self):
"""Retrives the number of bytes in the SWO buffer.
Args:
self (JLink): the ``JLink`` instance
Returns:
Number of bytes in the SWO buffer.
Raises:
JLinkException: on error
"""
res = self._dll.JLINKARM_SWO_Control(en... | python | def swo_num_bytes(self):
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.GET_NUM_BYTES,
0)
if res < 0:
raise errors.JLinkException(res)
return res | [
"def",
"swo_num_bytes",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_SWO_Control",
"(",
"enums",
".",
"JLinkSWOCommands",
".",
"GET_NUM_BYTES",
",",
"0",
")",
"if",
"res",
"<",
"0",
":",
"raise",
"errors",
".",
"JLinkException",
... | Retrives the number of bytes in the SWO buffer.
Args:
self (JLink): the ``JLink`` instance
Returns:
Number of bytes in the SWO buffer.
Raises:
JLinkException: on error | [
"Retrives",
"the",
"number",
"of",
"bytes",
"in",
"the",
"SWO",
"buffer",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4597-L4614 |
249,947 | square/pylink | pylink/jlink.py | JLink.swo_set_host_buffer_size | def swo_set_host_buffer_size(self, buf_size):
"""Sets the size of the buffer used by the host to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the host buffer
Returns:
``None``
Raises:
JLinkExceptio... | python | def swo_set_host_buffer_size(self, buf_size):
buf = ctypes.c_uint32(buf_size)
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.SET_BUFFERSIZE_HOST,
ctypes.byref(buf))
if res < 0:
raise errors.JLinkException(res)
return ... | [
"def",
"swo_set_host_buffer_size",
"(",
"self",
",",
"buf_size",
")",
":",
"buf",
"=",
"ctypes",
".",
"c_uint32",
"(",
"buf_size",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_SWO_Control",
"(",
"enums",
".",
"JLinkSWOCommands",
".",
"SET_BUFFERSIZE_HO... | Sets the size of the buffer used by the host to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the host buffer
Returns:
``None``
Raises:
JLinkException: on error | [
"Sets",
"the",
"size",
"of",
"the",
"buffer",
"used",
"by",
"the",
"host",
"to",
"collect",
"SWO",
"data",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4617-L4636 |
249,948 | square/pylink | pylink/jlink.py | JLink.swo_set_emu_buffer_size | def swo_set_emu_buffer_size(self, buf_size):
"""Sets the size of the buffer used by the J-Link to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the emulator buffer
Returns:
``None``
Raises:
JLinkExc... | python | def swo_set_emu_buffer_size(self, buf_size):
buf = ctypes.c_uint32(buf_size)
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.SET_BUFFERSIZE_EMU,
ctypes.byref(buf))
if res < 0:
raise errors.JLinkException(res)
return No... | [
"def",
"swo_set_emu_buffer_size",
"(",
"self",
",",
"buf_size",
")",
":",
"buf",
"=",
"ctypes",
".",
"c_uint32",
"(",
"buf_size",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINKARM_SWO_Control",
"(",
"enums",
".",
"JLinkSWOCommands",
".",
"SET_BUFFERSIZE_EMU... | Sets the size of the buffer used by the J-Link to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the emulator buffer
Returns:
``None``
Raises:
JLinkException: on error | [
"Sets",
"the",
"size",
"of",
"the",
"buffer",
"used",
"by",
"the",
"J",
"-",
"Link",
"to",
"collect",
"SWO",
"data",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4639-L4658 |
249,949 | square/pylink | pylink/jlink.py | JLink.swo_supported_speeds | def swo_supported_speeds(self, cpu_speed, num_speeds=3):
"""Retrives a list of SWO speeds supported by both the target and the
connected J-Link.
The supported speeds are returned in order from highest to lowest.
Args:
self (JLink): the ``JLink`` instance
cpu_speed (... | python | def swo_supported_speeds(self, cpu_speed, num_speeds=3):
buf_size = num_speeds
buf = (ctypes.c_uint32 * buf_size)()
res = self._dll.JLINKARM_SWO_GetCompatibleSpeeds(cpu_speed, 0, buf, buf_size)
if res < 0:
raise errors.JLinkException(res)
return list(buf)[:res] | [
"def",
"swo_supported_speeds",
"(",
"self",
",",
"cpu_speed",
",",
"num_speeds",
"=",
"3",
")",
":",
"buf_size",
"=",
"num_speeds",
"buf",
"=",
"(",
"ctypes",
".",
"c_uint32",
"*",
"buf_size",
")",
"(",
")",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINK... | Retrives a list of SWO speeds supported by both the target and the
connected J-Link.
The supported speeds are returned in order from highest to lowest.
Args:
self (JLink): the ``JLink`` instance
cpu_speed (int): the target's CPU speed in Hz
num_speeds (int): the n... | [
"Retrives",
"a",
"list",
"of",
"SWO",
"speeds",
"supported",
"by",
"both",
"the",
"target",
"and",
"the",
"connected",
"J",
"-",
"Link",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4661-L4681 |
249,950 | square/pylink | pylink/jlink.py | JLink.swo_read | def swo_read(self, offset, num_bytes, remove=False):
"""Reads data from the SWO buffer.
The data read is not automatically removed from the SWO buffer after
reading unless ``remove`` is ``True``. Otherwise the callee must
explicitly remove the data by calling ``.swo_flush()``.
... | python | def swo_read(self, offset, num_bytes, remove=False):
buf_size = ctypes.c_uint32(num_bytes)
buf = (ctypes.c_uint8 * num_bytes)(0)
self._dll.JLINKARM_SWO_Read(buf, offset, ctypes.byref(buf_size))
# After the call, ``buf_size`` has been modified to be the actual
# number of bytes ... | [
"def",
"swo_read",
"(",
"self",
",",
"offset",
",",
"num_bytes",
",",
"remove",
"=",
"False",
")",
":",
"buf_size",
"=",
"ctypes",
".",
"c_uint32",
"(",
"num_bytes",
")",
"buf",
"=",
"(",
"ctypes",
".",
"c_uint8",
"*",
"num_bytes",
")",
"(",
"0",
")"... | Reads data from the SWO buffer.
The data read is not automatically removed from the SWO buffer after
reading unless ``remove`` is ``True``. Otherwise the callee must
explicitly remove the data by calling ``.swo_flush()``.
Args:
self (JLink): the ``JLink`` instance
... | [
"Reads",
"data",
"from",
"the",
"SWO",
"buffer",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4684-L4712 |
249,951 | square/pylink | pylink/jlink.py | JLink.swo_read_stimulus | def swo_read_stimulus(self, port, num_bytes):
"""Reads the printable data via SWO.
This method reads SWO for one stimulus port, which is all printable
data.
Note:
Stimulus port ``0`` is used for ``printf`` debugging.
Args:
self (JLink): the ``JLink`` instan... | python | def swo_read_stimulus(self, port, num_bytes):
if port < 0 or port > 31:
raise ValueError('Invalid port number: %s' % port)
buf_size = num_bytes
buf = (ctypes.c_uint8 * buf_size)()
bytes_read = self._dll.JLINKARM_SWO_ReadStimulus(port, buf, buf_size)
return list(buf)... | [
"def",
"swo_read_stimulus",
"(",
"self",
",",
"port",
",",
"num_bytes",
")",
":",
"if",
"port",
"<",
"0",
"or",
"port",
">",
"31",
":",
"raise",
"ValueError",
"(",
"'Invalid port number: %s'",
"%",
"port",
")",
"buf_size",
"=",
"num_bytes",
"buf",
"=",
"... | Reads the printable data via SWO.
This method reads SWO for one stimulus port, which is all printable
data.
Note:
Stimulus port ``0`` is used for ``printf`` debugging.
Args:
self (JLink): the ``JLink`` instance
port (int): the stimulus port to read from, ... | [
"Reads",
"the",
"printable",
"data",
"via",
"SWO",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4715-L4742 |
249,952 | square/pylink | pylink/jlink.py | JLink.rtt_read | def rtt_read(self, buffer_index, num_bytes):
"""Reads data from the RTT buffer.
This method will read at most num_bytes bytes from the specified
RTT buffer. The data is automatically removed from the RTT buffer.
If there are not num_bytes bytes waiting in the RTT buffer, the
ent... | python | def rtt_read(self, buffer_index, num_bytes):
buf = (ctypes.c_ubyte * num_bytes)()
bytes_read = self._dll.JLINK_RTTERMINAL_Read(buffer_index, buf, num_bytes)
if bytes_read < 0:
raise errors.JLinkRTTException(bytes_read)
return list(buf)[:bytes_read] | [
"def",
"rtt_read",
"(",
"self",
",",
"buffer_index",
",",
"num_bytes",
")",
":",
"buf",
"=",
"(",
"ctypes",
".",
"c_ubyte",
"*",
"num_bytes",
")",
"(",
")",
"bytes_read",
"=",
"self",
".",
"_dll",
".",
"JLINK_RTTERMINAL_Read",
"(",
"buffer_index",
",",
"... | Reads data from the RTT buffer.
This method will read at most num_bytes bytes from the specified
RTT buffer. The data is automatically removed from the RTT buffer.
If there are not num_bytes bytes waiting in the RTT buffer, the
entire contents of the RTT buffer will be read.
Ar... | [
"Reads",
"data",
"from",
"the",
"RTT",
"buffer",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4805-L4830 |
249,953 | square/pylink | pylink/jlink.py | JLink.rtt_write | def rtt_write(self, buffer_index, data):
"""Writes data to the RTT buffer.
This method will write at most len(data) bytes to the specified RTT
buffer.
Args:
self (JLink): the ``JLink`` instance
buffer_index (int): the index of the RTT buffer to write to
da... | python | def rtt_write(self, buffer_index, data):
buf_size = len(data)
buf = (ctypes.c_ubyte * buf_size)(*bytearray(data))
bytes_written = self._dll.JLINK_RTTERMINAL_Write(buffer_index, buf, buf_size)
if bytes_written < 0:
raise errors.JLinkRTTException(bytes_written)
return... | [
"def",
"rtt_write",
"(",
"self",
",",
"buffer_index",
",",
"data",
")",
":",
"buf_size",
"=",
"len",
"(",
"data",
")",
"buf",
"=",
"(",
"ctypes",
".",
"c_ubyte",
"*",
"buf_size",
")",
"(",
"*",
"bytearray",
"(",
"data",
")",
")",
"bytes_written",
"="... | Writes data to the RTT buffer.
This method will write at most len(data) bytes to the specified RTT
buffer.
Args:
self (JLink): the ``JLink`` instance
buffer_index (int): the index of the RTT buffer to write to
data (list): the list of bytes to write to the RTT buf... | [
"Writes",
"data",
"to",
"the",
"RTT",
"buffer",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4833-L4857 |
249,954 | square/pylink | pylink/jlink.py | JLink.rtt_control | def rtt_control(self, command, config):
"""Issues an RTT Control command.
All RTT control is done through a single API call which expects
specifically laid-out configuration structures.
Args:
self (JLink): the ``JLink`` instance
command (int): the command to issue (... | python | def rtt_control(self, command, config):
config_byref = ctypes.byref(config) if config is not None else None
res = self._dll.JLINK_RTTERMINAL_Control(command, config_byref)
if res < 0:
raise errors.JLinkRTTException(res)
return res | [
"def",
"rtt_control",
"(",
"self",
",",
"command",
",",
"config",
")",
":",
"config_byref",
"=",
"ctypes",
".",
"byref",
"(",
"config",
")",
"if",
"config",
"is",
"not",
"None",
"else",
"None",
"res",
"=",
"self",
".",
"_dll",
".",
"JLINK_RTTERMINAL_Cont... | Issues an RTT Control command.
All RTT control is done through a single API call which expects
specifically laid-out configuration structures.
Args:
self (JLink): the ``JLink`` instance
command (int): the command to issue (see enums.JLinkRTTCommand)
config (ctypes... | [
"Issues",
"an",
"RTT",
"Control",
"command",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L4860-L4880 |
249,955 | square/pylink | examples/rtt.py | main | def main(target_device):
"""Creates an interactive terminal to the target via RTT.
The main loop opens a connection to the JLink, and then connects
to the target device. RTT is started, the number of buffers is presented,
and then two worker threads are spawned: one for read, and one for write.
Th... | python | def main(target_device):
jlink = pylink.JLink()
print("connecting to JLink...")
jlink.open()
print("connecting to %s..." % target_device)
jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
jlink.connect(target_device)
print("connected, starting RTT...")
jlink.rtt_start()
while True:
... | [
"def",
"main",
"(",
"target_device",
")",
":",
"jlink",
"=",
"pylink",
".",
"JLink",
"(",
")",
"print",
"(",
"\"connecting to JLink...\"",
")",
"jlink",
".",
"open",
"(",
")",
"print",
"(",
"\"connecting to %s...\"",
"%",
"target_device",
")",
"jlink",
".",
... | Creates an interactive terminal to the target via RTT.
The main loop opens a connection to the JLink, and then connects
to the target device. RTT is started, the number of buffers is presented,
and then two worker threads are spawned: one for read, and one for write.
The main loops sleeps until the JL... | [
"Creates",
"an",
"interactive",
"terminal",
"to",
"the",
"target",
"via",
"RTT",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/examples/rtt.py#L93-L138 |
249,956 | square/pylink | pylink/threads.py | ThreadReturn.run | def run(self):
"""Runs the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
Returns:
``None``
"""
target = getattr(self, '_Thread__target', getattr(self, '_target', None))
args = getattr(self, '_Thread__args', getattr(self, '_args', N... | python | def run(self):
target = getattr(self, '_Thread__target', getattr(self, '_target', None))
args = getattr(self, '_Thread__args', getattr(self, '_args', None))
kwargs = getattr(self, '_Thread__kwargs', getattr(self, '_kwargs', None))
if target is not None:
self._return = target(... | [
"def",
"run",
"(",
"self",
")",
":",
"target",
"=",
"getattr",
"(",
"self",
",",
"'_Thread__target'",
",",
"getattr",
"(",
"self",
",",
"'_target'",
",",
"None",
")",
")",
"args",
"=",
"getattr",
"(",
"self",
",",
"'_Thread__args'",
",",
"getattr",
"("... | Runs the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
Returns:
``None`` | [
"Runs",
"the",
"thread",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/threads.py#L41-L56 |
249,957 | square/pylink | pylink/threads.py | ThreadReturn.join | def join(self, *args, **kwargs):
"""Joins the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
args: optional list of arguments
kwargs: optional key-word arguments
Returns:
The return value of the exited thread.
"""
super(... | python | def join(self, *args, **kwargs):
super(ThreadReturn, self).join(*args, **kwargs)
return self._return | [
"def",
"join",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"ThreadReturn",
",",
"self",
")",
".",
"join",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"_return"
] | Joins the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
args: optional list of arguments
kwargs: optional key-word arguments
Returns:
The return value of the exited thread. | [
"Joins",
"the",
"thread",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/threads.py#L58-L70 |
249,958 | square/pylink | examples/windows_update.py | main | def main():
"""Upgrades the firmware of the J-Links connected to a Windows device.
Returns:
None.
Raises:
OSError: if there are no J-Link software packages.
"""
windows_libraries = list(pylink.Library.find_library_windows())
latest_library = None
for lib in windows_libraries:
... | python | def main():
windows_libraries = list(pylink.Library.find_library_windows())
latest_library = None
for lib in windows_libraries:
if os.path.dirname(lib).endswith('JLinkARM'):
# Always use the one pointed to by the 'JLinkARM' directory.
latest_library = lib
break
... | [
"def",
"main",
"(",
")",
":",
"windows_libraries",
"=",
"list",
"(",
"pylink",
".",
"Library",
".",
"find_library_windows",
"(",
")",
")",
"latest_library",
"=",
"None",
"for",
"lib",
"in",
"windows_libraries",
":",
"if",
"os",
".",
"path",
".",
"dirname",... | Upgrades the firmware of the J-Links connected to a Windows device.
Returns:
None.
Raises:
OSError: if there are no J-Link software packages. | [
"Upgrades",
"the",
"firmware",
"of",
"the",
"J",
"-",
"Links",
"connected",
"to",
"a",
"Windows",
"device",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/examples/windows_update.py#L35-L70 |
249,959 | square/pylink | pylink/decorators.py | async_decorator | def async_decorator(func):
"""Asynchronous function decorator. Interprets the function as being
asynchronous, so returns a function that will handle calling the
Function asynchronously.
Args:
func (function): function to be called asynchronously
Returns:
The wrapped function.
Rai... | python | def async_decorator(func):
@functools.wraps(func)
def async_wrapper(*args, **kwargs):
"""Wraps up the call to ``func``, so that it is called from a separate
thread.
The callback, if given, will be called with two parameters,
``exception`` and ``result`` as ``callback(exception, ... | [
"def",
"async_decorator",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"async_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"Wraps up the call to ``func``, so that it is called from a separate\n thread.\... | Asynchronous function decorator. Interprets the function as being
asynchronous, so returns a function that will handle calling the
Function asynchronously.
Args:
func (function): function to be called asynchronously
Returns:
The wrapped function.
Raises:
AttributeError: if ``fu... | [
"Asynchronous",
"function",
"decorator",
".",
"Interprets",
"the",
"function",
"as",
"being",
"asynchronous",
"so",
"returns",
"a",
"function",
"that",
"will",
"handle",
"calling",
"the",
"Function",
"asynchronously",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/decorators.py#L20-L91 |
249,960 | square/pylink | examples/strace.py | strace | def strace(device, trace_address, breakpoint_address):
"""Implements simple trace using the STrace API.
Args:
device (str): the device to connect to
trace_address (int): address to begin tracing from
breakpoint_address (int): address to breakpoint at
Returns:
``None``
"""
j... | python | def strace(device, trace_address, breakpoint_address):
jlink = pylink.JLink()
jlink.open()
# Do the initial connection sequence.
jlink.power_on()
jlink.set_tif(pylink.JLinkInterfaces.SWD)
jlink.connect(device)
jlink.reset()
# Clear any breakpoints that may exist as of now.
jlink.br... | [
"def",
"strace",
"(",
"device",
",",
"trace_address",
",",
"breakpoint_address",
")",
":",
"jlink",
"=",
"pylink",
".",
"JLink",
"(",
")",
"jlink",
".",
"open",
"(",
")",
"# Do the initial connection sequence.",
"jlink",
".",
"power_on",
"(",
")",
"jlink",
"... | Implements simple trace using the STrace API.
Args:
device (str): the device to connect to
trace_address (int): address to begin tracing from
breakpoint_address (int): address to breakpoint at
Returns:
``None`` | [
"Implements",
"simple",
"trace",
"using",
"the",
"STrace",
"API",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/examples/strace.py#L29-L78 |
249,961 | square/pylink | pylink/__main__.py | create_parser | def create_parser():
"""Builds the command parser.
This needs to be exported in order for Sphinx to document it correctly.
Returns:
An instance of an ``argparse.ArgumentParser`` that parses all the
commands supported by the PyLink CLI.
"""
parser = argparse.ArgumentParser(prog=pylink._... | python | def create_parser():
parser = argparse.ArgumentParser(prog=pylink.__title__,
description=pylink.__description__,
epilog=pylink.__copyright__)
parser.add_argument('--version', action='version',
version='%(prog)s ' +... | [
"def",
"create_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"pylink",
".",
"__title__",
",",
"description",
"=",
"pylink",
".",
"__description__",
",",
"epilog",
"=",
"pylink",
".",
"__copyright__",
")",
"parser... | Builds the command parser.
This needs to be exported in order for Sphinx to document it correctly.
Returns:
An instance of an ``argparse.ArgumentParser`` that parses all the
commands supported by the PyLink CLI. | [
"Builds",
"the",
"command",
"parser",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L535-L567 |
249,962 | square/pylink | pylink/__main__.py | main | def main(args=None):
"""Main command-line interface entrypoint.
Runs the given subcommand or argument that were specified. If not given a
``args`` parameter, assumes the arguments are passed on the command-line.
Args:
args (list): list of command-line arguments
Returns:
Zero on succe... | python | def main(args=None):
if args is None:
args = sys.argv[1:]
parser = create_parser()
args = parser.parse_args(args)
if args.verbose >= 2:
level = logging.DEBUG
elif args.verbose >= 1:
level = logging.INFO
else:
level = logging.WARNING
logging.basicConfig(leve... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"parser",
"=",
"create_parser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
"args",
")",
"if",
... | Main command-line interface entrypoint.
Runs the given subcommand or argument that were specified. If not given a
``args`` parameter, assumes the arguments are passed on the command-line.
Args:
args (list): list of command-line arguments
Returns:
Zero on success, non-zero otherwise. | [
"Main",
"command",
"-",
"line",
"interface",
"entrypoint",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L570-L603 |
249,963 | square/pylink | pylink/__main__.py | Command.create_jlink | def create_jlink(self, args):
"""Creates an instance of a J-Link from the given arguments.
Args:
self (Command): the ``Command`` instance
args (Namespace): arguments to construct the ``JLink`` instance from
Returns:
An instance of a ``JLink``.
"""
... | python | def create_jlink(self, args):
jlink = pylink.JLink()
jlink.open(args.serial_no, args.ip_addr)
if hasattr(args, 'tif') and args.tif is not None:
if args.tif.lower() == 'swd':
jlink.set_tif(pylink.JLinkInterfaces.SWD)
else:
jlink.set_tif(pyl... | [
"def",
"create_jlink",
"(",
"self",
",",
"args",
")",
":",
"jlink",
"=",
"pylink",
".",
"JLink",
"(",
")",
"jlink",
".",
"open",
"(",
"args",
".",
"serial_no",
",",
"args",
".",
"ip_addr",
")",
"if",
"hasattr",
"(",
"args",
",",
"'tif'",
")",
"and"... | Creates an instance of a J-Link from the given arguments.
Args:
self (Command): the ``Command`` instance
args (Namespace): arguments to construct the ``JLink`` instance from
Returns:
An instance of a ``JLink``. | [
"Creates",
"an",
"instance",
"of",
"a",
"J",
"-",
"Link",
"from",
"the",
"given",
"arguments",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L66-L88 |
249,964 | square/pylink | pylink/__main__.py | Command.add_common_arguments | def add_common_arguments(self, parser, has_device=False):
"""Adds common arguments to the given parser.
Common arguments for a J-Link command are the target interface, and
J-Link serial number or IP address.
Args:
self (Command): the ``Command`` instance
parser (arg... | python | def add_common_arguments(self, parser, has_device=False):
if has_device:
parser.add_argument('-t', '--tif', required=True,
type=str.lower, choices=['jtag', 'swd'],
help='target interface (JTAG | SWD)')
parser.add_argument('-... | [
"def",
"add_common_arguments",
"(",
"self",
",",
"parser",
",",
"has_device",
"=",
"False",
")",
":",
"if",
"has_device",
":",
"parser",
".",
"add_argument",
"(",
"'-t'",
",",
"'--tif'",
",",
"required",
"=",
"True",
",",
"type",
"=",
"str",
".",
"lower"... | Adds common arguments to the given parser.
Common arguments for a J-Link command are the target interface, and
J-Link serial number or IP address.
Args:
self (Command): the ``Command`` instance
parser (argparse.ArgumentParser): the parser to add the arguments to
h... | [
"Adds",
"common",
"arguments",
"to",
"the",
"given",
"parser",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L90-L117 |
249,965 | square/pylink | pylink/__main__.py | EraseCommand.run | def run(self, args):
"""Erases the device connected to the J-Link.
Args:
self (EraseCommand): the ``EraseCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None``
"""
jlink = self.create_jlink(args)
era... | python | def run(self, args):
jlink = self.create_jlink(args)
erased = jlink.erase()
print('Bytes Erased: %d' % erased) | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"jlink",
"=",
"self",
".",
"create_jlink",
"(",
"args",
")",
"erased",
"=",
"jlink",
".",
"erase",
"(",
")",
"print",
"(",
"'Bytes Erased: %d'",
"%",
"erased",
")"
] | Erases the device connected to the J-Link.
Args:
self (EraseCommand): the ``EraseCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None`` | [
"Erases",
"the",
"device",
"connected",
"to",
"the",
"J",
"-",
"Link",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L172-L184 |
249,966 | square/pylink | pylink/__main__.py | FlashCommand.run | def run(self, args):
"""Flashes the device connected to the J-Link.
Args:
self (FlashCommand): the ``FlashCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None``
"""
kwargs = {}
kwargs['path'] = args.... | python | def run(self, args):
kwargs = {}
kwargs['path'] = args.file[0]
kwargs['addr'] = args.addr
kwargs['on_progress'] = pylink.util.flash_progress_callback
jlink = self.create_jlink(args)
_ = jlink.flash_file(**kwargs)
print('Flashed device successfully.') | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"kwargs",
"=",
"{",
"}",
"kwargs",
"[",
"'path'",
"]",
"=",
"args",
".",
"file",
"[",
"0",
"]",
"kwargs",
"[",
"'addr'",
"]",
"=",
"args",
".",
"addr",
"kwargs",
"[",
"'on_progress'",
"]",
"=",
... | Flashes the device connected to the J-Link.
Args:
self (FlashCommand): the ``FlashCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None`` | [
"Flashes",
"the",
"device",
"connected",
"to",
"the",
"J",
"-",
"Link",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L208-L225 |
249,967 | square/pylink | pylink/__main__.py | UnlockCommand.add_arguments | def add_arguments(self, parser):
"""Adds the unlock command arguments to the parser.
Args:
self (UnlockCommand): the ``UnlockCommand`` instance
parser (argparse.ArgumentParser): the parser to add the arguments to
Returns:
``None``
"""
parser.add_ar... | python | def add_arguments(self, parser):
parser.add_argument('name', nargs=1, choices=['kinetis'],
help='name of MCU to unlock')
return self.add_common_arguments(parser, True) | [
"def",
"add_arguments",
"(",
"self",
",",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'name'",
",",
"nargs",
"=",
"1",
",",
"choices",
"=",
"[",
"'kinetis'",
"]",
",",
"help",
"=",
"'name of MCU to unlock'",
")",
"return",
"self",
".",
"add_... | Adds the unlock command arguments to the parser.
Args:
self (UnlockCommand): the ``UnlockCommand`` instance
parser (argparse.ArgumentParser): the parser to add the arguments to
Returns:
``None`` | [
"Adds",
"the",
"unlock",
"command",
"arguments",
"to",
"the",
"parser",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L237-L249 |
249,968 | square/pylink | pylink/__main__.py | UnlockCommand.run | def run(self, args):
"""Unlocks the target device.
Args:
self (UnlockCommand): the ``UnlockCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None``
"""
jlink = self.create_jlink(args)
mcu = args.name[0... | python | def run(self, args):
jlink = self.create_jlink(args)
mcu = args.name[0].lower()
if pylink.unlock(jlink, mcu):
print('Successfully unlocked device!')
else:
print('Failed to unlock device!') | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"jlink",
"=",
"self",
".",
"create_jlink",
"(",
"args",
")",
"mcu",
"=",
"args",
".",
"name",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"if",
"pylink",
".",
"unlock",
"(",
"jlink",
",",
"mcu",
")",... | Unlocks the target device.
Args:
self (UnlockCommand): the ``UnlockCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None`` | [
"Unlocks",
"the",
"target",
"device",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L251-L266 |
249,969 | square/pylink | pylink/__main__.py | LicenseCommand.run | def run(self, args):
"""Runs the license command.
Args:
self (LicenseCommand): the ``LicenseCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None``
"""
jlink = self.create_jlink(args)
if args.list:
... | python | def run(self, args):
jlink = self.create_jlink(args)
if args.list:
print('Built-in Licenses: %s' % ', '.join(jlink.licenses.split(',')))
print('Custom Licenses: %s' % ', '.join(jlink.custom_licenses.split(',')))
elif args.add is not None:
if jlink.add_license(... | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"jlink",
"=",
"self",
".",
"create_jlink",
"(",
"args",
")",
"if",
"args",
".",
"list",
":",
"print",
"(",
"'Built-in Licenses: %s'",
"%",
"', '",
".",
"join",
"(",
"jlink",
".",
"licenses",
".",
"spl... | Runs the license command.
Args:
self (LicenseCommand): the ``LicenseCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None`` | [
"Runs",
"the",
"license",
"command",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L294-L317 |
249,970 | square/pylink | pylink/__main__.py | InfoCommand.add_arguments | def add_arguments(self, parser):
"""Adds the information commands to the parser.
Args:
self (InfoCommand): the ``InfoCommand`` instance
parser (argparse.ArgumentParser): the parser to add the arguments to
Returns:
``None``
"""
parser.add_argument('... | python | def add_arguments(self, parser):
parser.add_argument('-p', '--product', action='store_true',
help='print the production information')
parser.add_argument('-j', '--jtag', action='store_true',
help='print the JTAG pin status')
return self.add... | [
"def",
"add_arguments",
"(",
"self",
",",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'-p'",
",",
"'--product'",
",",
"action",
"=",
"'store_true'",
",",
"help",
"=",
"'print the production information'",
")",
"parser",
".",
"add_argument",
"(",
"... | Adds the information commands to the parser.
Args:
self (InfoCommand): the ``InfoCommand`` instance
parser (argparse.ArgumentParser): the parser to add the arguments to
Returns:
``None`` | [
"Adds",
"the",
"information",
"commands",
"to",
"the",
"parser",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L326-L340 |
249,971 | square/pylink | pylink/__main__.py | InfoCommand.run | def run(self, args):
"""Runs the information command.
Args:
self (InfoCommand): the ``InfoCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None``
"""
jlink = self.create_jlink(args)
if args.product:
... | python | def run(self, args):
jlink = self.create_jlink(args)
if args.product:
print('Product: %s' % jlink.product_name)
manufacturer = 'SEGGER' if jlink.oem is None else jlink.oem
print('Manufacturer: %s' % manufacturer)
print('Hardware Version: %s' % jlink.hard... | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"jlink",
"=",
"self",
".",
"create_jlink",
"(",
"args",
")",
"if",
"args",
".",
"product",
":",
"print",
"(",
"'Product: %s'",
"%",
"jlink",
".",
"product_name",
")",
"manufacturer",
"=",
"'SEGGER'",
"i... | Runs the information command.
Args:
self (InfoCommand): the ``InfoCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None`` | [
"Runs",
"the",
"information",
"command",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L342-L370 |
249,972 | square/pylink | pylink/__main__.py | EmulatorCommand.add_arguments | def add_arguments(self, parser):
"""Adds the arguments for the emulator command.
Args:
self (EmulatorCommand): the ``EmulatorCommand`` instance
parser (argparse.ArgumentParser): parser to add the commands to
Returns:
``None``
"""
group = parser.add... | python | def add_arguments(self, parser):
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-l', '--list', nargs='?',
type=str.lower, default='_',
choices=['usb', 'ip'],
help='list all the connected emul... | [
"def",
"add_arguments",
"(",
"self",
",",
"parser",
")",
":",
"group",
"=",
"parser",
".",
"add_mutually_exclusive_group",
"(",
"required",
"=",
"True",
")",
"group",
".",
"add_argument",
"(",
"'-l'",
",",
"'--list'",
",",
"nargs",
"=",
"'?'",
",",
"type",... | Adds the arguments for the emulator command.
Args:
self (EmulatorCommand): the ``EmulatorCommand`` instance
parser (argparse.ArgumentParser): parser to add the commands to
Returns:
``None`` | [
"Adds",
"the",
"arguments",
"for",
"the",
"emulator",
"command",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L379-L398 |
249,973 | square/pylink | pylink/__main__.py | EmulatorCommand.run | def run(self, args):
"""Runs the emulator command.
Args:
self (EmulatorCommand): the ``EmulatorCommand`` instance
args (Namespace): arguments to parse
Returns:
``None``
"""
jlink = pylink.JLink()
if args.test:
if jlink.test():
... | python | def run(self, args):
jlink = pylink.JLink()
if args.test:
if jlink.test():
print('Self-test succeeded.')
else:
print('Self-test failed.')
elif args.list is None or args.list in ['usb', 'ip']:
host = pylink.JLinkHost.USB_OR_IP
... | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"jlink",
"=",
"pylink",
".",
"JLink",
"(",
")",
"if",
"args",
".",
"test",
":",
"if",
"jlink",
".",
"test",
"(",
")",
":",
"print",
"(",
"'Self-test succeeded.'",
")",
"else",
":",
"print",
"(",
"... | Runs the emulator command.
Args:
self (EmulatorCommand): the ``EmulatorCommand`` instance
args (Namespace): arguments to parse
Returns:
``None`` | [
"Runs",
"the",
"emulator",
"command",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L400-L458 |
249,974 | square/pylink | pylink/__main__.py | FirmwareCommand.add_arguments | def add_arguments(self, parser):
"""Adds the arguments for the firmware command.
Args:
self (FirmwareCommand): the ``FirmwareCommand`` instance
parser (argparse.ArgumentParser): parser to add the commands to
Returns:
``None``
"""
group = parser.add... | python | def add_arguments(self, parser):
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-d', '--downgrade', action='store_true',
help='downgrade the J-Link firmware')
group.add_argument('-u', '--upgrade', action='store_true',
... | [
"def",
"add_arguments",
"(",
"self",
",",
"parser",
")",
":",
"group",
"=",
"parser",
".",
"add_mutually_exclusive_group",
"(",
"required",
"=",
"True",
")",
"group",
".",
"add_argument",
"(",
"'-d'",
",",
"'--downgrade'",
",",
"action",
"=",
"'store_true'",
... | Adds the arguments for the firmware command.
Args:
self (FirmwareCommand): the ``FirmwareCommand`` instance
parser (argparse.ArgumentParser): parser to add the commands to
Returns:
``None`` | [
"Adds",
"the",
"arguments",
"for",
"the",
"firmware",
"command",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L467-L482 |
249,975 | square/pylink | pylink/__main__.py | FirmwareCommand.run | def run(self, args):
"""Runs the firmware command.
Args:
self (FirmwareCommand): the ``FirmwareCommand`` instance
args (Namespace): arguments to parse
Returns:
``None``
"""
jlink = self.create_jlink(args)
if args.downgrade:
if n... | python | def run(self, args):
jlink = self.create_jlink(args)
if args.downgrade:
if not jlink.firmware_newer():
print('DLL firmware is not older than J-Link firmware.')
else:
jlink.invalidate_firmware()
try:
# Change to ... | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"jlink",
"=",
"self",
".",
"create_jlink",
"(",
"args",
")",
"if",
"args",
".",
"downgrade",
":",
"if",
"not",
"jlink",
".",
"firmware_newer",
"(",
")",
":",
"print",
"(",
"'DLL firmware is not older than... | Runs the firmware command.
Args:
self (FirmwareCommand): the ``FirmwareCommand`` instance
args (Namespace): arguments to parse
Returns:
``None`` | [
"Runs",
"the",
"firmware",
"command",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L484-L523 |
249,976 | square/pylink | pylink/structs.py | JLinkDeviceInfo.name | def name(self):
"""Returns the name of the device.
Args:
self (JLinkDeviceInfo): the ``JLinkDeviceInfo`` instance
Returns:
Device name.
"""
return ctypes.cast(self.sName, ctypes.c_char_p).value.decode() | python | def name(self):
return ctypes.cast(self.sName, ctypes.c_char_p).value.decode() | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"ctypes",
".",
"cast",
"(",
"self",
".",
"sName",
",",
"ctypes",
".",
"c_char_p",
")",
".",
"value",
".",
"decode",
"(",
")"
] | Returns the name of the device.
Args:
self (JLinkDeviceInfo): the ``JLinkDeviceInfo`` instance
Returns:
Device name. | [
"Returns",
"the",
"name",
"of",
"the",
"device",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/structs.py#L207-L216 |
249,977 | square/pylink | pylink/structs.py | JLinkDeviceInfo.manufacturer | def manufacturer(self):
"""Returns the name of the manufacturer of the device.
Args:
self (JLinkDeviceInfo): the ``JLinkDeviceInfo`` instance
Returns:
Manufacturer name.
"""
buf = ctypes.cast(self.sManu, ctypes.c_char_p).value
return buf.decode() if ... | python | def manufacturer(self):
buf = ctypes.cast(self.sManu, ctypes.c_char_p).value
return buf.decode() if buf else None | [
"def",
"manufacturer",
"(",
"self",
")",
":",
"buf",
"=",
"ctypes",
".",
"cast",
"(",
"self",
".",
"sManu",
",",
"ctypes",
".",
"c_char_p",
")",
".",
"value",
"return",
"buf",
".",
"decode",
"(",
")",
"if",
"buf",
"else",
"None"
] | Returns the name of the manufacturer of the device.
Args:
self (JLinkDeviceInfo): the ``JLinkDeviceInfo`` instance
Returns:
Manufacturer name. | [
"Returns",
"the",
"name",
"of",
"the",
"manufacturer",
"of",
"the",
"device",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/structs.py#L219-L229 |
249,978 | square/pylink | pylink/structs.py | JLinkBreakpointInfo.software_breakpoint | def software_breakpoint(self):
"""Returns whether this is a software breakpoint.
Args:
self (JLinkBreakpointInfo): the ``JLinkBreakpointInfo`` instance
Returns:
``True`` if the breakpoint is a software breakpoint, otherwise
``False``.
"""
software_... | python | def software_breakpoint(self):
software_types = [
enums.JLinkBreakpoint.SW_RAM,
enums.JLinkBreakpoint.SW_FLASH,
enums.JLinkBreakpoint.SW
]
return any(self.Type & stype for stype in software_types) | [
"def",
"software_breakpoint",
"(",
"self",
")",
":",
"software_types",
"=",
"[",
"enums",
".",
"JLinkBreakpoint",
".",
"SW_RAM",
",",
"enums",
".",
"JLinkBreakpoint",
".",
"SW_FLASH",
",",
"enums",
".",
"JLinkBreakpoint",
".",
"SW",
"]",
"return",
"any",
"("... | Returns whether this is a software breakpoint.
Args:
self (JLinkBreakpointInfo): the ``JLinkBreakpointInfo`` instance
Returns:
``True`` if the breakpoint is a software breakpoint, otherwise
``False``. | [
"Returns",
"whether",
"this",
"is",
"a",
"software",
"breakpoint",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/structs.py#L687-L702 |
249,979 | square/pylink | pylink/library.py | Library.find_library_windows | def find_library_windows(cls):
"""Loads the SEGGER DLL from the windows installation directory.
On Windows, these are found either under:
- ``C:\\Program Files\\SEGGER\\JLink``
- ``C:\\Program Files (x86)\\SEGGER\\JLink``.
Args:
cls (Library): the ``Library`` clas... | python | def find_library_windows(cls):
dll = cls.get_appropriate_windows_sdk_name() + '.dll'
root = 'C:\\'
for d in os.listdir(root):
dir_path = os.path.join(root, d)
# Have to account for the different Program Files directories.
if d.startswith('Program Files') and ... | [
"def",
"find_library_windows",
"(",
"cls",
")",
":",
"dll",
"=",
"cls",
".",
"get_appropriate_windows_sdk_name",
"(",
")",
"+",
"'.dll'",
"root",
"=",
"'C:\\\\'",
"for",
"d",
"in",
"os",
".",
"listdir",
"(",
"root",
")",
":",
"dir_path",
"=",
"os",
".",
... | Loads the SEGGER DLL from the windows installation directory.
On Windows, these are found either under:
- ``C:\\Program Files\\SEGGER\\JLink``
- ``C:\\Program Files (x86)\\SEGGER\\JLink``.
Args:
cls (Library): the ``Library`` class
Returns:
The paths to... | [
"Loads",
"the",
"SEGGER",
"DLL",
"from",
"the",
"windows",
"installation",
"directory",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/library.py#L112-L144 |
249,980 | square/pylink | pylink/library.py | Library.find_library_linux | def find_library_linux(cls):
"""Loads the SEGGER DLL from the root directory.
On Linux, the SEGGER tools are installed under the ``/opt/SEGGER``
directory with versioned directories having the suffix ``_VERSION``.
Args:
cls (Library): the ``Library`` class
Returns:
... | python | def find_library_linux(cls):
dll = Library.JLINK_SDK_NAME
root = os.path.join('/', 'opt', 'SEGGER')
for (directory_name, subdirs, files) in os.walk(root):
fnames = []
x86_found = False
for f in files:
path = os.path.join(directory_name, f)
... | [
"def",
"find_library_linux",
"(",
"cls",
")",
":",
"dll",
"=",
"Library",
".",
"JLINK_SDK_NAME",
"root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'/'",
",",
"'opt'",
",",
"'SEGGER'",
")",
"for",
"(",
"directory_name",
",",
"subdirs",
",",
"files",
")... | Loads the SEGGER DLL from the root directory.
On Linux, the SEGGER tools are installed under the ``/opt/SEGGER``
directory with versioned directories having the suffix ``_VERSION``.
Args:
cls (Library): the ``Library`` class
Returns:
The paths to the J-Link library... | [
"Loads",
"the",
"SEGGER",
"DLL",
"from",
"the",
"root",
"directory",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/library.py#L147-L182 |
249,981 | square/pylink | pylink/library.py | Library.find_library_darwin | def find_library_darwin(cls):
"""Loads the SEGGER DLL from the installed applications.
This method accounts for the all the different ways in which the DLL
may be installed depending on the version of the DLL. Always uses
the first directory found.
SEGGER's DLL is installed in... | python | def find_library_darwin(cls):
dll = Library.JLINK_SDK_NAME
root = os.path.join('/', 'Applications', 'SEGGER')
if not os.path.isdir(root):
return
for d in os.listdir(root):
dir_path = os.path.join(root, d)
# Navigate through each JLink directory.
... | [
"def",
"find_library_darwin",
"(",
"cls",
")",
":",
"dll",
"=",
"Library",
".",
"JLINK_SDK_NAME",
"root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'/'",
",",
"'Applications'",
",",
"'SEGGER'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
... | Loads the SEGGER DLL from the installed applications.
This method accounts for the all the different ways in which the DLL
may be installed depending on the version of the DLL. Always uses
the first directory found.
SEGGER's DLL is installed in one of three ways dependent on which
... | [
"Loads",
"the",
"SEGGER",
"DLL",
"from",
"the",
"installed",
"applications",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/library.py#L185-L231 |
249,982 | square/pylink | pylink/library.py | Library.load_default | def load_default(self):
"""Loads the default J-Link SDK DLL.
The default J-Link SDK is determined by first checking if ``ctypes``
can find the DLL, then by searching the platform-specific paths.
Args:
self (Library): the ``Library`` instance
Returns:
``True... | python | def load_default(self):
path = ctypes_util.find_library(self._sdk)
if path is None:
# Couldn't find it the standard way. Fallback to the non-standard
# way of finding the J-Link library. These methods are operating
# system specific.
if self._windows or ... | [
"def",
"load_default",
"(",
"self",
")",
":",
"path",
"=",
"ctypes_util",
".",
"find_library",
"(",
"self",
".",
"_sdk",
")",
"if",
"path",
"is",
"None",
":",
"# Couldn't find it the standard way. Fallback to the non-standard",
"# way of finding the J-Link library. Thes... | Loads the default J-Link SDK DLL.
The default J-Link SDK is determined by first checking if ``ctypes``
can find the DLL, then by searching the platform-specific paths.
Args:
self (Library): the ``Library`` instance
Returns:
``True`` if the DLL was loaded, otherwise... | [
"Loads",
"the",
"default",
"J",
"-",
"Link",
"SDK",
"DLL",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/library.py#L274-L301 |
249,983 | square/pylink | pylink/library.py | Library.load | def load(self, path=None):
"""Loads the specified DLL, if any, otherwise re-loads the current DLL.
If ``path`` is specified, loads the DLL at the given ``path``,
otherwise re-loads the DLL currently specified by this library.
Note:
This creates a temporary DLL file to use for... | python | def load(self, path=None):
self.unload()
self._path = path or self._path
# Windows requires a proper suffix in order to load the library file,
# so it must be set here.
if self._windows or self._cygwin:
suffix = '.dll'
elif sys.platform.startswith('darwin'):... | [
"def",
"load",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"self",
".",
"unload",
"(",
")",
"self",
".",
"_path",
"=",
"path",
"or",
"self",
".",
"_path",
"# Windows requires a proper suffix in order to load the library file,",
"# so it must be set here.",
"i... | Loads the specified DLL, if any, otherwise re-loads the current DLL.
If ``path`` is specified, loads the DLL at the given ``path``,
otherwise re-loads the DLL currently specified by this library.
Note:
This creates a temporary DLL file to use for the instance. This is
nece... | [
"Loads",
"the",
"specified",
"DLL",
"if",
"any",
"otherwise",
"re",
"-",
"loads",
"the",
"current",
"DLL",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/library.py#L303-L368 |
249,984 | square/pylink | pylink/library.py | Library.unload | def unload(self):
"""Unloads the library's DLL if it has been loaded.
This additionally cleans up the temporary DLL file that was created
when the library was loaded.
Args:
self (Library): the ``Library`` instance
Returns:
``True`` if the DLL was unloaded, ... | python | def unload(self):
unloaded = False
if self._lib is not None:
if self._winlib is not None:
# ctypes passes integers as 32-bit C integer types, which will
# truncate the value of a 64-bit pointer in 64-bit python, so
# we have to change the Free... | [
"def",
"unload",
"(",
"self",
")",
":",
"unloaded",
"=",
"False",
"if",
"self",
".",
"_lib",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_winlib",
"is",
"not",
"None",
":",
"# ctypes passes integers as 32-bit C integer types, which will",
"# truncate the value o... | Unloads the library's DLL if it has been loaded.
This additionally cleans up the temporary DLL file that was created
when the library was loaded.
Args:
self (Library): the ``Library`` instance
Returns:
``True`` if the DLL was unloaded, otherwise ``False``. | [
"Unloads",
"the",
"library",
"s",
"DLL",
"if",
"it",
"has",
"been",
"loaded",
"."
] | 81dda0a191d923a8b2627c52cb778aba24d279d7 | https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/library.py#L370-L414 |
249,985 | bndr/pipreqs | pipreqs/pipreqs.py | _open | def _open(filename=None, mode='r'):
"""Open a file or ``sys.stdout`` depending on the provided filename.
Args:
filename (str): The path to the file that should be opened. If
``None`` or ``'-'``, ``sys.stdout`` or ``sys.stdin`` is
returned depending on the desired mode. Defaults ... | python | def _open(filename=None, mode='r'):
if not filename or filename == '-':
if not mode or 'r' in mode:
file = sys.stdin
elif 'w' in mode:
file = sys.stdout
else:
raise ValueError('Invalid mode for file: {}'.format(mode))
else:
file = open(filename... | [
"def",
"_open",
"(",
"filename",
"=",
"None",
",",
"mode",
"=",
"'r'",
")",
":",
"if",
"not",
"filename",
"or",
"filename",
"==",
"'-'",
":",
"if",
"not",
"mode",
"or",
"'r'",
"in",
"mode",
":",
"file",
"=",
"sys",
".",
"stdin",
"elif",
"'w'",
"i... | Open a file or ``sys.stdout`` depending on the provided filename.
Args:
filename (str): The path to the file that should be opened. If
``None`` or ``'-'``, ``sys.stdout`` or ``sys.stdin`` is
returned depending on the desired mode. Defaults to ``None``.
mode (str): The mode t... | [
"Open",
"a",
"file",
"or",
"sys",
".",
"stdout",
"depending",
"on",
"the",
"provided",
"filename",
"."
] | 15208540da03fdacf48fcb0a8b88b26da76b64f3 | https://github.com/bndr/pipreqs/blob/15208540da03fdacf48fcb0a8b88b26da76b64f3/pipreqs/pipreqs.py#L66-L93 |
249,986 | bndr/pipreqs | pipreqs/pipreqs.py | get_pkg_names | def get_pkg_names(pkgs):
"""Get PyPI package names from a list of imports.
Args:
pkgs (List[str]): List of import names.
Returns:
List[str]: The corresponding PyPI package names.
"""
result = set()
with open(join("mapping"), "r") as f:
data = dict(x.strip().split(":") ... | python | def get_pkg_names(pkgs):
result = set()
with open(join("mapping"), "r") as f:
data = dict(x.strip().split(":") for x in f)
for pkg in pkgs:
# Look up the mapped requirement. If a mapping isn't found,
# simply use the package name.
result.add(data.get(pkg, pkg))
# Return a... | [
"def",
"get_pkg_names",
"(",
"pkgs",
")",
":",
"result",
"=",
"set",
"(",
")",
"with",
"open",
"(",
"join",
"(",
"\"mapping\"",
")",
",",
"\"r\"",
")",
"as",
"f",
":",
"data",
"=",
"dict",
"(",
"x",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\... | Get PyPI package names from a list of imports.
Args:
pkgs (List[str]): List of import names.
Returns:
List[str]: The corresponding PyPI package names. | [
"Get",
"PyPI",
"package",
"names",
"from",
"a",
"list",
"of",
"imports",
"."
] | 15208540da03fdacf48fcb0a8b88b26da76b64f3 | https://github.com/bndr/pipreqs/blob/15208540da03fdacf48fcb0a8b88b26da76b64f3/pipreqs/pipreqs.py#L252-L270 |
249,987 | spyder-ide/qtawesome | qtawesome/__init__.py | charmap | def charmap(prefixed_name):
"""
Return the character map used for a given font.
Returns
-------
return_value: dict
The dictionary mapping the icon names to the corresponding unicode character.
"""
prefix, name = prefixed_name.split('.')
return _instance().charmap[prefix][name] | python | def charmap(prefixed_name):
prefix, name = prefixed_name.split('.')
return _instance().charmap[prefix][name] | [
"def",
"charmap",
"(",
"prefixed_name",
")",
":",
"prefix",
",",
"name",
"=",
"prefixed_name",
".",
"split",
"(",
"'.'",
")",
"return",
"_instance",
"(",
")",
".",
"charmap",
"[",
"prefix",
"]",
"[",
"name",
"]"
] | Return the character map used for a given font.
Returns
-------
return_value: dict
The dictionary mapping the icon names to the corresponding unicode character. | [
"Return",
"the",
"character",
"map",
"used",
"for",
"a",
"given",
"font",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/__init__.py#L176-L187 |
249,988 | spyder-ide/qtawesome | qtawesome/iconic_font.py | set_global_defaults | def set_global_defaults(**kwargs):
"""Set global defaults for the options passed to the icon painter."""
valid_options = [
'active', 'selected', 'disabled', 'on', 'off',
'on_active', 'on_selected', 'on_disabled',
'off_active', 'off_selected', 'off_disabled',
'color', 'color_on',... | python | def set_global_defaults(**kwargs):
valid_options = [
'active', 'selected', 'disabled', 'on', 'off',
'on_active', 'on_selected', 'on_disabled',
'off_active', 'off_selected', 'off_disabled',
'color', 'color_on', 'color_off',
'color_active', 'color_selected', 'color_disabled',
... | [
"def",
"set_global_defaults",
"(",
"*",
"*",
"kwargs",
")",
":",
"valid_options",
"=",
"[",
"'active'",
",",
"'selected'",
",",
"'disabled'",
",",
"'on'",
",",
"'off'",
",",
"'on_active'",
",",
"'on_selected'",
",",
"'on_disabled'",
",",
"'off_active'",
",",
... | Set global defaults for the options passed to the icon painter. | [
"Set",
"global",
"defaults",
"for",
"the",
"options",
"passed",
"to",
"the",
"icon",
"painter",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/iconic_font.py#L53-L72 |
249,989 | spyder-ide/qtawesome | qtawesome/iconic_font.py | CharIconPainter.paint | def paint(self, iconic, painter, rect, mode, state, options):
"""Main paint method."""
for opt in options:
self._paint_icon(iconic, painter, rect, mode, state, opt) | python | def paint(self, iconic, painter, rect, mode, state, options):
for opt in options:
self._paint_icon(iconic, painter, rect, mode, state, opt) | [
"def",
"paint",
"(",
"self",
",",
"iconic",
",",
"painter",
",",
"rect",
",",
"mode",
",",
"state",
",",
"options",
")",
":",
"for",
"opt",
"in",
"options",
":",
"self",
".",
"_paint_icon",
"(",
"iconic",
",",
"painter",
",",
"rect",
",",
"mode",
"... | Main paint method. | [
"Main",
"paint",
"method",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/iconic_font.py#L79-L82 |
249,990 | spyder-ide/qtawesome | qtawesome/iconic_font.py | CharIconPainter._paint_icon | def _paint_icon(self, iconic, painter, rect, mode, state, options):
"""Paint a single icon."""
painter.save()
color = options['color']
char = options['char']
color_options = {
QIcon.On: {
QIcon.Normal: (options['color_on'], options['on']),
... | python | def _paint_icon(self, iconic, painter, rect, mode, state, options):
painter.save()
color = options['color']
char = options['char']
color_options = {
QIcon.On: {
QIcon.Normal: (options['color_on'], options['on']),
QIcon.Disabled: (options['colo... | [
"def",
"_paint_icon",
"(",
"self",
",",
"iconic",
",",
"painter",
",",
"rect",
",",
"mode",
",",
"state",
",",
"options",
")",
":",
"painter",
".",
"save",
"(",
")",
"color",
"=",
"options",
"[",
"'color'",
"]",
"char",
"=",
"options",
"[",
"'char'",... | Paint a single icon. | [
"Paint",
"a",
"single",
"icon",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/iconic_font.py#L84-L138 |
249,991 | spyder-ide/qtawesome | qtawesome/iconic_font.py | IconicFont.icon | def icon(self, *names, **kwargs):
"""Return a QIcon object corresponding to the provided icon name."""
cache_key = '{}{}'.format(names,kwargs)
if cache_key not in self.icon_cache:
options_list = kwargs.pop('options', [{}] * len(names))
general_options = kwargs
... | python | def icon(self, *names, **kwargs):
cache_key = '{}{}'.format(names,kwargs)
if cache_key not in self.icon_cache:
options_list = kwargs.pop('options', [{}] * len(names))
general_options = kwargs
if len(options_list) != len(names):
error = '"options" must... | [
"def",
"icon",
"(",
"self",
",",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"cache_key",
"=",
"'{}{}'",
".",
"format",
"(",
"names",
",",
"kwargs",
")",
"if",
"cache_key",
"not",
"in",
"self",
".",
"icon_cache",
":",
"options_list",
"=",
"kwarg... | Return a QIcon object corresponding to the provided icon name. | [
"Return",
"a",
"QIcon",
"object",
"corresponding",
"to",
"the",
"provided",
"icon",
"name",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/iconic_font.py#L252-L279 |
249,992 | spyder-ide/qtawesome | qtawesome/iconic_font.py | IconicFont.font | def font(self, prefix, size):
"""Return a QFont corresponding to the given prefix and size."""
font = QFont(self.fontname[prefix])
font.setPixelSize(size)
if prefix[-1] == 's': # solid style
font.setStyleName('Solid')
return font | python | def font(self, prefix, size):
font = QFont(self.fontname[prefix])
font.setPixelSize(size)
if prefix[-1] == 's': # solid style
font.setStyleName('Solid')
return font | [
"def",
"font",
"(",
"self",
",",
"prefix",
",",
"size",
")",
":",
"font",
"=",
"QFont",
"(",
"self",
".",
"fontname",
"[",
"prefix",
"]",
")",
"font",
".",
"setPixelSize",
"(",
"size",
")",
"if",
"prefix",
"[",
"-",
"1",
"]",
"==",
"'s'",
":",
... | Return a QFont corresponding to the given prefix and size. | [
"Return",
"a",
"QFont",
"corresponding",
"to",
"the",
"given",
"prefix",
"and",
"size",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/iconic_font.py#L357-L363 |
249,993 | spyder-ide/qtawesome | qtawesome/iconic_font.py | IconicFont._custom_icon | def _custom_icon(self, name, **kwargs):
"""Return the custom icon corresponding to the given name."""
options = dict(_default_options, **kwargs)
if name in self.painters:
painter = self.painters[name]
return self._icon_by_painter(painter, options)
else:
... | python | def _custom_icon(self, name, **kwargs):
options = dict(_default_options, **kwargs)
if name in self.painters:
painter = self.painters[name]
return self._icon_by_painter(painter, options)
else:
return QIcon() | [
"def",
"_custom_icon",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"options",
"=",
"dict",
"(",
"_default_options",
",",
"*",
"*",
"kwargs",
")",
"if",
"name",
"in",
"self",
".",
"painters",
":",
"painter",
"=",
"self",
".",
"painter... | Return the custom icon corresponding to the given name. | [
"Return",
"the",
"custom",
"icon",
"corresponding",
"to",
"the",
"given",
"name",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/iconic_font.py#L381-L388 |
249,994 | spyder-ide/qtawesome | qtawesome/iconic_font.py | IconicFont._icon_by_painter | def _icon_by_painter(self, painter, options):
"""Return the icon corresponding to the given painter."""
engine = CharIconEngine(self, painter, options)
return QIcon(engine) | python | def _icon_by_painter(self, painter, options):
engine = CharIconEngine(self, painter, options)
return QIcon(engine) | [
"def",
"_icon_by_painter",
"(",
"self",
",",
"painter",
",",
"options",
")",
":",
"engine",
"=",
"CharIconEngine",
"(",
"self",
",",
"painter",
",",
"options",
")",
"return",
"QIcon",
"(",
"engine",
")"
] | Return the icon corresponding to the given painter. | [
"Return",
"the",
"icon",
"corresponding",
"to",
"the",
"given",
"painter",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/qtawesome/iconic_font.py#L390-L393 |
249,995 | spyder-ide/qtawesome | setupbase.py | UpdateFA5Command.finalize_options | def finalize_options(self):
"""Validate the command options."""
assert bool(self.fa_version), 'FA version is mandatory for this command.'
if self.zip_path:
assert os.path.exists(self.zip_path), (
'Local zipfile does not exist: %s' % self.zip_path) | python | def finalize_options(self):
assert bool(self.fa_version), 'FA version is mandatory for this command.'
if self.zip_path:
assert os.path.exists(self.zip_path), (
'Local zipfile does not exist: %s' % self.zip_path) | [
"def",
"finalize_options",
"(",
"self",
")",
":",
"assert",
"bool",
"(",
"self",
".",
"fa_version",
")",
",",
"'FA version is mandatory for this command.'",
"if",
"self",
".",
"zip_path",
":",
"assert",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"zi... | Validate the command options. | [
"Validate",
"the",
"command",
"options",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/setupbase.py#L98-L103 |
249,996 | spyder-ide/qtawesome | setupbase.py | UpdateFA5Command.__print | def __print(self, msg):
"""Shortcut for printing with the distutils logger."""
self.announce(msg, level=distutils.log.INFO) | python | def __print(self, msg):
self.announce(msg, level=distutils.log.INFO) | [
"def",
"__print",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"announce",
"(",
"msg",
",",
"level",
"=",
"distutils",
".",
"log",
".",
"INFO",
")"
] | Shortcut for printing with the distutils logger. | [
"Shortcut",
"for",
"printing",
"with",
"the",
"distutils",
"logger",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/setupbase.py#L105-L107 |
249,997 | spyder-ide/qtawesome | setupbase.py | UpdateFA5Command.__zip_file | def __zip_file(self):
"""Get a file object of the FA zip file."""
if self.zip_path:
# If using a local file, just open it:
self.__print('Opening local zipfile: %s' % self.zip_path)
return open(self.zip_path, 'rb')
# Otherwise, download it and make a file obje... | python | def __zip_file(self):
if self.zip_path:
# If using a local file, just open it:
self.__print('Opening local zipfile: %s' % self.zip_path)
return open(self.zip_path, 'rb')
# Otherwise, download it and make a file object in-memory:
url = self.__release_url
... | [
"def",
"__zip_file",
"(",
"self",
")",
":",
"if",
"self",
".",
"zip_path",
":",
"# If using a local file, just open it:",
"self",
".",
"__print",
"(",
"'Opening local zipfile: %s'",
"%",
"self",
".",
"zip_path",
")",
"return",
"open",
"(",
"self",
".",
"zip_path... | Get a file object of the FA zip file. | [
"Get",
"a",
"file",
"object",
"of",
"the",
"FA",
"zip",
"file",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/setupbase.py#L123-L134 |
249,998 | spyder-ide/qtawesome | setupbase.py | UpdateFA5Command.__zipped_files_data | def __zipped_files_data(self):
"""Get a dict of all files of interest from the FA release zipfile."""
files = {}
with zipfile.ZipFile(self.__zip_file) as thezip:
for zipinfo in thezip.infolist():
if zipinfo.filename.endswith('metadata/icons.json'):
... | python | def __zipped_files_data(self):
files = {}
with zipfile.ZipFile(self.__zip_file) as thezip:
for zipinfo in thezip.infolist():
if zipinfo.filename.endswith('metadata/icons.json'):
with thezip.open(zipinfo) as compressed_file:
files['i... | [
"def",
"__zipped_files_data",
"(",
"self",
")",
":",
"files",
"=",
"{",
"}",
"with",
"zipfile",
".",
"ZipFile",
"(",
"self",
".",
"__zip_file",
")",
"as",
"thezip",
":",
"for",
"zipinfo",
"in",
"thezip",
".",
"infolist",
"(",
")",
":",
"if",
"zipinfo",... | Get a dict of all files of interest from the FA release zipfile. | [
"Get",
"a",
"dict",
"of",
"all",
"files",
"of",
"interest",
"from",
"the",
"FA",
"release",
"zipfile",
"."
] | c88122aac5b7000eab9d2ae98d27fb3ade88d0f3 | https://github.com/spyder-ide/qtawesome/blob/c88122aac5b7000eab9d2ae98d27fb3ade88d0f3/setupbase.py#L137-L162 |
249,999 | trailofbits/protofuzz | protofuzz/pbimport.py | from_string | def from_string(proto_str):
'''
Produce a Protobuf module from a string description.
Return the module if successfully compiled, otherwise raise a BadProtobuf
exception.
'''
_, proto_file = tempfile.mkstemp(suffix='.proto')
with open(proto_file, 'w+') as proto_f:
proto_f.... | python | def from_string(proto_str):
'''
Produce a Protobuf module from a string description.
Return the module if successfully compiled, otherwise raise a BadProtobuf
exception.
'''
_, proto_file = tempfile.mkstemp(suffix='.proto')
with open(proto_file, 'w+') as proto_f:
proto_f.... | [
"def",
"from_string",
"(",
"proto_str",
")",
":",
"_",
",",
"proto_file",
"=",
"tempfile",
".",
"mkstemp",
"(",
"suffix",
"=",
"'.proto'",
")",
"with",
"open",
"(",
"proto_file",
",",
"'w+'",
")",
"as",
"proto_f",
":",
"proto_f",
".",
"write",
"(",
"pr... | Produce a Protobuf module from a string description.
Return the module if successfully compiled, otherwise raise a BadProtobuf
exception. | [
"Produce",
"a",
"Protobuf",
"module",
"from",
"a",
"string",
"description",
".",
"Return",
"the",
"module",
"if",
"successfully",
"compiled",
"otherwise",
"raise",
"a",
"BadProtobuf",
"exception",
"."
] | 589492d34de9a0da6cc5554094e2588b893b2fd8 | https://github.com/trailofbits/protofuzz/blob/589492d34de9a0da6cc5554094e2588b893b2fd8/protofuzz/pbimport.py#L48-L60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.