10 "ITM not defined. Include itm.h AFTER core_cmX.h (typically after including device-specific header)"
13 #if !defined(CoreDebug)
15 "CoreDebug not defined. Include itm.h AFTER core_cmX.h (typically after including device-specific header)"
44 #define ITM_ENABLE_STIMULUS_PORTS_ALL 0xFFFFFFFF
53 ITMGlobalTimestampFrequencyDisabled = 0,
54 ITMGlobalTimestampFrequencyPosition7 = 1,
55 ITMGlobalTimestampFrequencyPosition13 = 2,
56 ITMGlobalTimestampFrequencyIfOutputFIFOEmpty = 3
66 ITMLocalTimestampPrescalerNoPrescaling = 0,
67 ITMLocalTimestampPrescalerDivideBy4 = 1,
68 ITMLocalTimestampPrescalerDivideBy10 = 2,
69 ITMLocalTimestampPrescalerDivideBy64 = 3,
163 static inline void ITMWrite8(uint8_t port, uint8_t c);
171 static inline void ITMWrite16(uint8_t port, uint16_t value);
179 static inline void ITMWrite32(uint8_t port, uint32_t value);
193 static inline void ITMWriteBuffer(uint8_t port,
const void* buffer,
size_t size);
199 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
200 ITM->LAR = 0xC5ACCE55;
204 tcr |= options->
TraceBusID << ITM_TCR_TraceBusID_Pos;
207 tcr |= (options->
ForwardDWT ? 1 : 0) << ITM_TCR_DWTENA_Pos;
210 tcr |= ITM_TCR_ITMENA_Msk;
214 ITM->TER = 0xFFFFFFFF;
219 return ((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) &&
220 ((ITM->TER & (1 << port)) != 0UL);
230 while(ITM->PORT[port].u32 == 0UL)
234 ITM->PORT[port].u8 = value;
244 while(ITM->PORT[port].u32 == 0UL)
248 ITM->PORT[port].u16 = value;
258 while(ITM->PORT[port].u32 == 0UL)
262 ITM->PORT[port].u32 = value;
272 const uint8_t* buf8 = (
const uint8_t*)buffer;
276 memcpy(&v, buf8,
sizeof(v));
277 while(ITM->PORT[port].u32 == 0UL)
281 ITM->PORT[port].u32 = v;
290 memcpy(&v, buf8,
sizeof(v));
291 memcpy(&v, buf8,
sizeof(v));
292 while(ITM->PORT[port].u32 == 0UL)
296 ITM->PORT[port].u16 = v;
304 while(ITM->PORT[port].u32 == 0UL)
308 ITM->PORT[port].u8 = *(buf8++);
static void ITMWrite8(uint8_t port, uint8_t c)
Writes 8-bit value to stimulus port.
Definition: itm.h:223
static void ITMWrite16(uint8_t port, uint16_t value)
Writes 16-bit value to stimulus port.
Definition: itm.h:237
ITMGlobalTimestampFrequency
Global timestamp frequency.
Definition: itm.h:52
static bool ITMIsPortEnabled(uint8_t port)
Checks if stimulus port is enabled.
Definition: itm.h:217
ITMLocalTimestampPrescaler
Local timestamp frequency.
Definition: itm.h:65
static void ITMWrite32(uint8_t port, uint32_t value)
Writes 32-bit value to stimulus port.
Definition: itm.h:251
static void ITMWriteBuffer(uint8_t port, const void *buffer, size_t size)
Writes buffer to stimulus port.
Definition: itm.h:265
static void ITMSetup(const ITMOptions *options)
Configures ITM as requested.
Definition: itm.h:197
ITM configuration options.
Definition: itm.h:78
int TraceBusID
Trace bus ID.
Definition: itm.h:84
ITMGlobalTimestampFrequency GlobalTimestampFrequency
Configure global timestamp frequency.
Definition: itm.h:93
bool EnableSyncPacket
Enable ITM synchronization packet.
Definition: itm.h:125
uint32_t EnabledStimulusPorts
Enable stimulus port.
Definition: itm.h:135
bool ForwardDWT
Forward DWT packets.
Definition: itm.h:116
bool EnableLocalTimestamp
Enable local timestamps.
Definition: itm.h:109
ITMLocalTimestampPrescaler LocalTimestampPrescaler
Configure local timestamp frequency.
Definition: itm.h:102