aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/interface.h
diff options
context:
space:
mode:
authorMarc Schink <openocd-dev@marcschink.de>2016-12-02 15:39:23 +0100
committerPaul Fertser <fercerpav@gmail.com>2019-12-21 19:25:32 +0000
commit2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c (patch)
treef52d7ef4e56c734d25f1bf12bed0fe01110c53cb /src/jtag/interface.h
parent90bd7d148225efa587d8e62017625709a1ac002d (diff)
downloadriscv-openocd-2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c.zip
riscv-openocd-2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c.tar.gz
riscv-openocd-2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c.tar.bz2
target/armv7m_trace: Improve SWO frequency auto-detection
The SWO frequency auto-detection with J-Link adapters does not work properly in the current implementation. This is because the trace layer has only information about the highest possible SWO frequency supported by the adapter. With that the trace layer calculates the SWO prescaler which usually leads to a frequency deviation greater than what is permitted by J-Link adapters. Move the calculation of the SWO prescaler from the trace layer into the trace configuration of the adapter to overcome this problem. The adapter has the necessary information to choose a suitable SWO frequency and calculate the corresponding prescaler that complies with the maximum allowed frequency deviation. Tested with: - STM32L152RC Discovery Kit (ST-Link) - EFM32GG-STK3700 (J-Link) Change-Id: I38ff2b89d32f0a92c597989b590afe5c75cf4902 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3903 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Diffstat (limited to 'src/jtag/interface.h')
-rw-r--r--src/jtag/interface.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/jtag/interface.h b/src/jtag/interface.h
index 905f1eb..ba3dea6 100644
--- a/src/jtag/interface.h
+++ b/src/jtag/interface.h
@@ -303,10 +303,14 @@ struct jtag_interface {
* @param trace_freq A pointer to the configured trace
* frequency; if it points to 0, the adapter driver must write
* its maximum supported rate there
+ * @param traceclkin_freq TRACECLKIN frequency provided to the TPIU in Hz
+ * @param prescaler Pointer to the SWO prescaler calculated by the
+ * adapter
* @returns ERROR_OK on success, an error code on failure.
*/
int (*config_trace)(bool enabled, enum tpiu_pin_protocol pin_protocol,
- uint32_t port_size, unsigned int *trace_freq);
+ uint32_t port_size, unsigned int *trace_freq,
+ unsigned int traceclkin_freq, uint16_t *prescaler);
/**
* Poll for new trace data
@@ -325,7 +329,8 @@ extern const char * const jtag_only[];
void adapter_assert_reset(void);
void adapter_deassert_reset(void);
int adapter_config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol,
- uint32_t port_size, unsigned int *trace_freq);
+ uint32_t port_size, unsigned int *trace_freq,
+ unsigned int traceclkin_freq, uint16_t *prescaler);
int adapter_poll_trace(uint8_t *buf, size_t *size);
#endif /* OPENOCD_JTAG_INTERFACE_H */