libjaylink
0.3.1
Library to access J-Link devices
|
Target related functions. More...
Functions | |
int | jaylink_set_speed (struct jaylink_device_handle *devh, uint16_t speed) |
Set the target interface speed. More... | |
int | jaylink_get_speeds (struct jaylink_device_handle *devh, struct jaylink_speed *speed) |
Retrieve target interface speeds. More... | |
int | jaylink_select_interface (struct jaylink_device_handle *devh, enum jaylink_target_interface iface, enum jaylink_target_interface *prev_iface) |
Select the target interface. More... | |
int | jaylink_get_available_interfaces (struct jaylink_device_handle *devh, uint32_t *ifaces) |
Retrieve the available target interfaces. More... | |
int | jaylink_get_selected_interface (struct jaylink_device_handle *devh, enum jaylink_target_interface *iface) |
Retrieve the selected target interface. More... | |
int | jaylink_clear_reset (struct jaylink_device_handle *devh) |
Clear the target reset signal. More... | |
int | jaylink_set_reset (struct jaylink_device_handle *devh) |
Set the target reset signal. More... | |
int | jaylink_set_target_power (struct jaylink_device_handle *devh, bool enable) |
Set the target power supply. More... | |
Target related functions.
int jaylink_clear_reset | ( | struct jaylink_device_handle * | devh | ) |
Clear the target reset signal.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
int jaylink_get_available_interfaces | ( | struct jaylink_device_handle * | devh, |
uint32_t * | ifaces | ||
) |
Retrieve the available target interfaces.
The target interfaces are stored in a 32-bit bit field where each individual bit represents a target interface. A set bit indicates an available target interface. See jaylink_target_interface for a description of the target interfaces and their bit positions.
[in,out] | devh | Device handle. |
[out] | ifaces | Target interfaces on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
int jaylink_get_selected_interface | ( | struct jaylink_device_handle * | devh, |
enum jaylink_target_interface * | iface | ||
) |
Retrieve the selected target interface.
iface
which is not covered by jaylink_target_interface.[in,out] | devh | Device handle. |
[out] | iface | Selected target interface on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
int jaylink_get_speeds | ( | struct jaylink_device_handle * | devh, |
struct jaylink_speed * | speed | ||
) |
Retrieve target interface speeds.
The speeds are applicable for the currently selected target interface only and calculated as follows:
speeds = freq / n
with n >= div
, where n
is an integerAssuming, for example, a base frequency freq of 4 MHz and a minimum divider div of 4 then the highest possible target interface speed is 4 MHz / 4 = 1 MHz. The next highest speed is 800 kHz for a divider of 5, and so on.
[in,out] | devh | Device handle. |
[out] | speed | Speed information on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
int jaylink_select_interface | ( | struct jaylink_device_handle * | devh, |
enum jaylink_target_interface | iface, | ||
enum jaylink_target_interface * | prev_iface | ||
) |
Select the target interface.
prev_iface
which is not covered by jaylink_target_interface.[in,out] | devh | Device handle. |
[in] | iface | Target interface to select. |
[out] | prev_iface | Previously selected target interface on success, and undefined on failure. Can be NULL. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
int jaylink_set_reset | ( | struct jaylink_device_handle * | devh | ) |
Set the target reset signal.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
int jaylink_set_speed | ( | struct jaylink_device_handle * | devh, |
uint16_t | speed | ||
) |
Set the target interface speed.
[in,out] | devh | Device handle. |
[in] | speed | Speed in kHz or JAYLINK_SPEED_ADAPTIVE_CLOCKING for adaptive clocking. Speed of 0 kHz is not allowed and adaptive clocking must only be used if the device has the JAYLINK_DEV_CAP_ADAPTIVE_CLOCKING capability. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
int jaylink_set_target_power | ( | struct jaylink_device_handle * | devh, |
bool | enable | ||
) |
Set the target power supply.
If enabled, the target is supplied with 5 V from pin 19 of the 20-pin JTAG / SWD connector.
[in,out] | devh | Device handle. |
[in] | enable | Determines whether to enable or disable the target power supply. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |