OpenOCD
|
Serial Wire Output (SWO) functions. More...
Go to the source code of this file.
Functions | |
JAYLINK_API int | jaylink_swo_get_speeds (struct jaylink_device_handle *devh, enum jaylink_swo_mode mode, struct jaylink_swo_speed *speed) |
Retrieve SWO speeds. More... | |
JAYLINK_API int | jaylink_swo_read (struct jaylink_device_handle *devh, uint8_t *buffer, uint32_t *length) |
Read SWO trace data. More... | |
JAYLINK_API int | jaylink_swo_start (struct jaylink_device_handle *devh, enum jaylink_swo_mode mode, uint32_t baudrate, uint32_t size) |
Start SWO capture. More... | |
JAYLINK_API int | jaylink_swo_stop (struct jaylink_device_handle *devh) |
Stop SWO capture. More... | |
Serial Wire Output (SWO) functions.
Definition in file swo.c.
JAYLINK_API int jaylink_swo_get_speeds | ( | struct jaylink_device_handle * | devh, |
enum jaylink_swo_mode | mode, | ||
struct jaylink_swo_speed * | speed | ||
) |
Retrieve SWO speeds.
The speeds are calculated as follows:
speeds = freq / n
with n >= min_div
and n <= max_div
, where n
is an integerAssuming, for example, a base frequency freq of 4500 kHz, a minimum divider min_div of 1 and a maximum divider max_div of 8 then the highest possible SWO speed is 4500 kHz / 1 = 4500 kHz. The next highest speed is 2250 kHz for a divider of 2, and so on. Accordingly, the lowest possible speed is 4500 kHz / 8 = 562.5 kHz.
[in,out] | devh | Device handle. |
[in] | mode | Capture mode to retrieve speeds for. |
[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_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
Definition at line 345 of file swo.c.
References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, jaylink_swo_speed::freq, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_PROTO, JAYLINK_OK, jaylink_strerror(), JAYLINK_SWO_MODE_UART, length, log_err(), jaylink_swo_speed::max_div, jaylink_swo_speed::max_prescaler, jaylink_swo_speed::min_div, jaylink_swo_speed::min_prescaler, transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().
Referenced by config_trace().
JAYLINK_API int jaylink_swo_read | ( | struct jaylink_device_handle * | devh, |
uint8_t * | buffer, | ||
uint32_t * | length | ||
) |
Read SWO trace data.
[in,out] | devh | Device handle. |
[out] | buffer | Buffer to store trace data on success. Its content is undefined on failure. |
[in,out] | length | Maximum number of bytes to read. On success, the value gets updated with the actual number of bytes read. The value is 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_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
Definition at line 230 of file swo.c.
References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_PROTO, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().
Referenced by poll_trace().
JAYLINK_API int jaylink_swo_start | ( | struct jaylink_device_handle * | devh, |
enum jaylink_swo_mode | mode, | ||
uint32_t | baudrate, | ||
uint32_t | size | ||
) |
Start SWO capture.
[in,out] | devh | Device handle. |
[in] | mode | Mode to capture data with. |
[in] | baudrate | Baudrate to capture data in bit per second. |
[in] | size | Device internal buffer size in bytes to use for capturing. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
Definition at line 71 of file swo.c.
References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_OK, jaylink_strerror(), JAYLINK_SWO_MODE_UART, log_err(), transport_read(), transport_start_write_read(), and transport_write().
Referenced by config_trace().
JAYLINK_API int jaylink_swo_stop | ( | struct jaylink_device_handle * | devh | ) |
Stop SWO capture.
[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_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
Definition at line 156 of file swo.c.
References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().
Referenced by config_trace(), and jlink_quit().