__STATIC_INLINE uint32_t ITM_SendData (uint8_t Channel, uint32_t Data, uint8_t DataSizeInBytes) { assert(Channel < 32); assert(DataSizeInBytes <= 4); /* 1, 2, 4 are valid */ assert((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL); /* ITM enabled */ assert((ITM->TER & (1UL << Channel) ) != 0UL); /* ITM Port enabled? */ /* Wait for the buffer to clear */ while (ITM->PORT[Channel].u32 == 0UL) { __NOP(); } if(DataSizeInBytes == 1) { ITM->PORT[Channel].u8 = (uint8_t)Data; } else if(DataSizeInBytes == 2) { ITM->PORT[Channel].u16 = (uint16_t)Data; } else { ITM->PORT[Channel].u32 = (uint32_t)Data; } return (Data); }
Contact Us Today! [email protected]