assert_Figure3

/* Precondition: State should be less than maximum * Postcondition: SystemState */ SystemState_t System_StateSet(SystemState_t State) { assert(State < SYSTEM_STATE_MAX); SystemState = State; assert(SystemState < SYSTEM_STATE_MAX); return SystemState; }

assert_Figure2

/* Precondition: State should be less than maximum */ void System_StateSet(SystemState_t State) { assert(State < SYSTEM_STATE_MAX); SystemState = State; }

ITM_SendData

__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 … Continue reading ITM_SendData

CMSIS_ITM_Send

__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) { if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ { while (ITM->PORT[0].u32 == 0UL) { __NOP(); } ITM->PORT[0].u8 = (uint8_t)ch; } return (ch); }

GCC_ECLIPSE_WRITE_ITM

int _write(int file, char *ptr, int len) { int i=0; (void)file; for(i=0 ; i<len ; i++) { ITM_SendChar((uint32_t)(*ptr++)); } return len; }