/* Checks if itm is busy and provides a delay to flush the fifo. 
This function disables the ARM ITM by resetting the TRCENA bit in the DEMCR register. */
void am_hal_itm_not_busy(void)
/* Checks if itm is busy and provides a delay to flush the fifo. 
This function disables the ARM ITM by resetting the TRCENA bit in the DEMCR register. */
void am_hal_itm_not_busy(void)
{
    while (AM_REG(ITM, TCR) & AM_REG_ITM_TCR_BUSY(1));
    am_hal_flash_delay(FLASH_CYCLES_US(50));
}