diff options
author | Paul Fertser <fercerpav@gmail.com> | 2015-02-09 17:04:52 +0300 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2015-03-25 20:46:43 +0000 |
commit | a09a75653dbe7ad99da6349285ab6622b80fdc15 (patch) | |
tree | b8e759d751b4f1c644c4365942a38bdc8b5e3ee6 /src/target/armv7m_trace.h | |
parent | 3e1dfdcb8531ae684537325ad2c94b845d741085 (diff) |
armv7m: add generic trace support (TPIU, ITM, etc.)
This provides support for various trace-related subsystems in a
generic and expandable way.
Change-Id: I3a27fa7b8cfb111753088bb8c3d760dd12d1395f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2538
Tested-by: jenkins
Diffstat (limited to 'src/target/armv7m_trace.h')
-rw-r--r-- | src/target/armv7m_trace.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/target/armv7m_trace.h b/src/target/armv7m_trace.h new file mode 100644 index 00000000..96c18958 --- /dev/null +++ b/src/target/armv7m_trace.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2015 Paul Fertser <fercerpav@gmail.com> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ***************************************************************************/ + +#ifndef ARMV7M_TRACE_H +#define ARMV7M_TRACE_H + +#include <command.h> + +/** + * @file + * Holds the interface to TPIU, ITM and DWT configuration functions. + */ + +enum trace_config_type { + DISABLED, /**< tracing is disabled */ + EXTERNAL, /**< trace output is captured externally */ + INTERNAL /**< trace output is handled by OpenOCD adapter driver */ +}; + +enum tpio_pin_protocol { + SYNC, /**< synchronous trace output */ + ASYNC_MANCHESTER, /**< asynchronous output with Manchester coding */ + ASYNC_UART /**< asynchronous output with NRZ coding */ +}; + +enum itm_ts_prescaler { + ITM_TS_PRESCALE1, /**< no prescaling for the timestamp counter */ + ITM_TS_PRESCALE4, /**< refclock divided by 4 for the timestamp counter */ + ITM_TS_PRESCALE16, /**< refclock divided by 16 for the timestamp counter */ + ITM_TS_PRESCALE64, /**< refclock divided by 64 for the timestamp counter */ +}; + +struct armv7m_trace_config { + /** Currently active trace capture mode */ + enum trace_config_type config_type; + + /** Currently active trace output mode */ + enum tpio_pin_protocol pin_protocol; + /** TPIU formatter enable/disable (in async mode) */ + bool formatter; + /** Synchronous output port width */ + uint32_t port_size; + + /** Bitmask of currenty enabled ITM stimuli */ + uint32_t itm_ter[8]; + /** Identifier for multi-source trace stream formatting */ + unsigned int trace_bus_id; + /** Prescaler for the timestamp counter */ + enum itm_ts_prescaler itm_ts_prescale; + /** Enable differential timestamps */ + bool itm_diff_timestamps; + /** Enable async timestamps model */ + bool itm_async_timestamps; + /** Enable synchronisation packet transmission (for sync port only) */ + bool itm_synchro_packets; + + /** Current frequency of TRACECLKIN (usually matches HCLK) */ + unsigned int traceclkin_freq; + /** Current frequency of trace port */ + unsigned int trace_freq; + /** Handle to output trace data in INTERNAL capture mode */ + FILE *trace_file; +}; + +extern const struct command_registration armv7m_trace_command_handlers[]; + +/** + * Configure hardware accordingly to the current TPIU target settings + */ +int armv7m_trace_tpiu_config(struct target *target); +/** + * Configure hardware accordingly to the current ITM target settings + */ +int armv7m_trace_itm_config(struct target *target); + +#endif |