5 #if !defined(CoreDebug)
7 "CoreDebug not defined. Include dwt.h AFTER core_cmX.h (typically after including device-specific header)"
12 "DWT not defined. Include dwt.h AFTER core_cmX.h (typically after including device-specific header)"
183 DWTEnableComparator(uint8_t comparator, uintptr_t address, uint8_t ignoreBits,
bool emitRange, uint8_t
function);
199 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
207 ctrl |= (options->
ExceptionTrace ? 1 : 0) << DWT_CTRL_EXCTRCENA_Pos;
208 ctrl |= (options->
PCSampling ? 1 : 0) << DWT_CTRL_PCSAMPLENA_Pos;
209 ctrl |= (((int)options->
SyncTap) & 3) << DWT_CTRL_SYNCTAP_Pos;
210 ctrl |= (((int)options->
CycleTap) & 3) << DWT_CTRL_CYCTAP_Pos;
212 ctrl |= DWT_CTRL_CYCCNTENA_Msk;
217 void DWTEnableComparator(uint8_t comparator, uintptr_t address, uint8_t ignoreBits,
bool emitRange, uint8_t
function)
219 uint32_t funcRaw = ((
function << DWT_FUNCTION_FUNCTION_Pos) & DWT_FUNCTION_FUNCTION_Msk) |
220 ((emitRange ? 1 : 0) << DWT_FUNCTION_EMITRANGE_Pos);
225 DWT->COMP0 = address;
226 DWT->MASK0 = ignoreBits;
227 DWT->FUNCTION0 = funcRaw;
230 DWT->COMP1 = address;
231 DWT->MASK1 = ignoreBits;
232 DWT->FUNCTION1 = funcRaw;
235 DWT->COMP2 = address;
236 DWT->MASK2 = ignoreBits;
237 DWT->FUNCTION2 = funcRaw;
240 DWT->COMP3 = address;
241 DWT->MASK3 = ignoreBits;
242 DWT->FUNCTION3 = funcRaw;
DWTCycleTap
Interval of PC sampling and event counter packets.
Definition: dwt.h:81
static void DWTSetup(const DWTOptions *options)
Configures DWT component.
Definition: dwt.h:197
static void DWTDisableComparator(uint8_t comparator)
Disables DWT comparator.
Definition: dwt.h:247
DWTSyncTap
Interval of ITM synchronization packet.
Definition: dwt.h:49
static void DWTEnableComparator(uint8_t comparator, uintptr_t address, uint8_t ignoreBits, bool emitRange, uint8_t function)
Configures DWT comparator.
Definition: dwt.h:217
@ DWTCycleTap10
Output packet when bit CYCCNT[10] changes.
Definition: dwt.h:93
@ DWTCycleTap6
Output packet when bit CYCCNT[6] changes.
Definition: dwt.h:87
@ DWTSyncTap28
Output synchronization when CYCCNT[28] bit changes.
Definition: dwt.h:72
@ DWTSyncTap24
Output synchronization when CYCCNT[24] bit changes.
Definition: dwt.h:59
@ DWTSyncTapDisabled
Disabled.
Definition: dwt.h:53
@ DWTSyncTap26
Output synchronization when CYCCNT[26] bit changes.
Definition: dwt.h:65
DWT configuration.
Definition: dwt.h:104
bool FoldedInstructionCounterEvent
Enable folded instruction event counter.
Definition: dwt.h:108
DWTSyncTap SyncTap
Specifies interval for ITM synchronization and timestamp packets.
Definition: dwt.h:140
bool SleepCounterEvent
Enable sleep event counter.
Definition: dwt.h:116
uint8_t SamplingPrescaler
Defines prescaler for PC sampling.
Definition: dwt.h:152
bool CPICounterEvent
Enable Cycles-per-Instruction counter event.
Definition: dwt.h:124
bool LSUCounterEvent
Enable load/store event counter.
Definition: dwt.h:112
bool ExceptionOverheadCounterEvent
Enable exception overhead counter event.
Definition: dwt.h:120
bool ExceptionTrace
Enable exception entry/exit trace.
Definition: dwt.h:130
bool PCSampling
Enable PC sampling.
Definition: dwt.h:136
DWTCycleTap CycleTap
Specifies divider for counter used in PC sampling and event counters.
Definition: dwt.h:144