target: add generic Xtensa LX support
[fw/openocd] / src / target / armv7m_trace.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /***************************************************************************
4  *   Copyright (C) 2015  Paul Fertser <fercerpav@gmail.com>                *
5  ***************************************************************************/
6
7 #ifndef OPENOCD_TARGET_ARMV7M_TRACE_H
8 #define OPENOCD_TARGET_ARMV7M_TRACE_H
9
10 #include <helper/command.h>
11 #include <target/target.h>
12
13 /**
14  * @file
15  * Holds the interface to ITM and DWT configuration functions.
16  */
17
18 enum itm_ts_prescaler {
19         ITM_TS_PRESCALE1,       /**< no prescaling for the timestamp counter */
20         ITM_TS_PRESCALE4,       /**< refclock divided by 4 for the timestamp counter */
21         ITM_TS_PRESCALE16,      /**< refclock divided by 16 for the timestamp counter */
22         ITM_TS_PRESCALE64,      /**< refclock divided by 64 for the timestamp counter */
23 };
24
25 struct armv7m_trace_config {
26         /** Bitmask of currently enabled ITM stimuli */
27         uint32_t itm_ter[8];
28         /** Identifier for multi-source trace stream formatting */
29         unsigned int trace_bus_id;
30         /** Prescaler for the timestamp counter */
31         enum itm_ts_prescaler itm_ts_prescale;
32         /** Enable differential timestamps */
33         bool itm_diff_timestamps;
34         /** Enable async timestamps model */
35         bool itm_async_timestamps;
36         /** Enable synchronisation packet transmission (for sync port only) */
37         bool itm_synchro_packets;
38         /** Config ITM after target examine */
39         bool itm_deferred_config;
40 };
41
42 extern const struct command_registration armv7m_trace_command_handlers[];
43
44 /**
45  * Configure hardware accordingly to the current ITM target settings
46  */
47 int armv7m_trace_itm_config(struct target *target);
48
49 #endif /* OPENOCD_TARGET_ARMV7M_TRACE_H */