1 #if !defined(HOST) 2 #if !defined(NORTE) 3 #include "RTE_Components.h" 4 #include CMSIS_device_header 5 #endif 6 #endif 7 8 #ifdef __cplusplus 9 10 #include <cstdint> 11 #else 12 #include <stdint.h> 13 #endif 14 15 #ifdef __cplusplus 16 17 18 extern "C" 19 { 20 #endif 21 22 extern uint32_t start_time; 23 extern uint32_t stop_time; 24 extern uint32_t cycle_count; 25 26 #if defined(HOST) || defined(TESTMODE) 27 #define INIT_SYSTICK 28 #define START_CYCLE_MEASUREMENT \ 29 start_time = 0; 30 #define STOP_CYCLE_MEASUREMENT \ 31 stop_time = 0; \ 32 cycle_count = start_time - stop_time; \ 33 printf ("Cycle count = %d\r\n",(int)cycle_count); 34 #else 35 #define INIT_SYSTICK \ 36 SysTick->CTRL=0; \ 37 SysTick->LOAD=0xFFFFFFUL;\ 38 SysTick->VAL=0; \ 39 SysTick->CTRL=5; \ 40 while (SysTick->VAL==0)\ 41 ; 42 43 #define START_CYCLE_MEASUREMENT \ 44 start_time= SysTick->VAL; 45 46 #define STOP_CYCLE_MEASUREMENT \ 47 stop_time= SysTick->VAL; \ 48 SysTick->CTRL=0; \ 49 cycle_count = start_time - stop_time; \ 50 printf ("Cycle count = %d\r\n",(int)cycle_count); 51 #endif 52 53 #if !defined(HOST) && (__ARM_ARCH > 6) 54 #define dbgInst(imm) __asm volatile("DBG %0\n\t" : :"Ir" ((imm)) ) 55 #define startSectionNB(num) dbgInst(((num) & 0x7) | 0x0) 56 #define stopSectionNB(num) dbgInst(((num) & 0x7) | 0x8) 57 #else 58 #define startSectionNB(num) 59 #define stopSectionNB(num) 60 #endif 61 62 #ifdef __cplusplus 63 } 64 #endif