mirror of
https://github.com/GorgonMeducer/perf_counter.git
synced 2025-02-07 19:34:18 +08:00
minor update
- Fix support for GCC - update safe_atom_code() and __IRQ_SAFE for the latest version of CMSIS
This commit is contained in:
parent
189090d936
commit
1f10f986fa
@ -218,9 +218,10 @@ void init_cycle_counter(bool bSysTickIsOccupied)
|
|||||||
s_nOffset = stop_cycle_counter();
|
s_nOffset = stop_cycle_counter();
|
||||||
|
|
||||||
s_nUnit = SystemCoreClock / 1000000ul;
|
s_nUnit = SystemCoreClock / 1000000ul;
|
||||||
|
#if !(defined(__IS_COMPILER_GCC__) && __IS_COMPILER_GCC__)
|
||||||
extern void __ensure_systick_wrapper(void);
|
extern void __ensure_systick_wrapper(void);
|
||||||
__ensure_systick_wrapper();
|
__ensure_systick_wrapper();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief try to start the performance counter
|
/*! \brief try to start the performance counter
|
||||||
|
@ -30,6 +30,54 @@
|
|||||||
|
|
||||||
/*============================ MACROS ========================================*/
|
/*============================ MACROS ========================================*/
|
||||||
|
|
||||||
|
//! \name The macros to identify the compiler
|
||||||
|
//! @{
|
||||||
|
|
||||||
|
//! \note for IAR
|
||||||
|
#ifdef __IS_COMPILER_IAR__
|
||||||
|
# undef __IS_COMPILER_IAR__
|
||||||
|
#endif
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
# define __IS_COMPILER_IAR__ 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//! \note for arm compiler 5
|
||||||
|
#ifdef __IS_COMPILER_ARM_COMPILER_5__
|
||||||
|
# undef __IS_COMPILER_ARM_COMPILER_5__
|
||||||
|
#endif
|
||||||
|
#if ((__ARMCC_VERSION >= 5000000) && (__ARMCC_VERSION < 6000000))
|
||||||
|
# define __IS_COMPILER_ARM_COMPILER_5__ 1
|
||||||
|
#endif
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \note for arm compiler 6
|
||||||
|
#ifdef __IS_COMPILER_ARM_COMPILER_6__
|
||||||
|
# undef __IS_COMPILER_ARM_COMPILER_6__
|
||||||
|
#endif
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||||
|
# define __IS_COMPILER_ARM_COMPILER_6__ 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IS_COMPILER_LLVM__
|
||||||
|
# undef __IS_COMPILER_LLVM__
|
||||||
|
#endif
|
||||||
|
#if defined(__clang__) && !__IS_COMPILER_ARM_COMPILER_6__
|
||||||
|
# define __IS_COMPILER_LLVM__ 1
|
||||||
|
#else
|
||||||
|
//! \note for gcc
|
||||||
|
# ifdef __IS_COMPILER_GCC__
|
||||||
|
# undef __IS_COMPILER_GCC__
|
||||||
|
# endif
|
||||||
|
# if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER_5__) \
|
||||||
|
|| defined(__IS_COMPILER_ARM_COMPILER_6__) \
|
||||||
|
|| defined(__IS_COMPILER_LLVM__))
|
||||||
|
# define __IS_COMPILER_GCC__ 1
|
||||||
|
# endif
|
||||||
|
//! @}
|
||||||
|
#endif
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#ifndef __PLOOC_VA_NUM_ARGS_IMPL
|
#ifndef __PLOOC_VA_NUM_ARGS_IMPL
|
||||||
# define __PLOOC_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11, \
|
# define __PLOOC_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11, \
|
||||||
_12,_13,_14,_15,_16,__N,...) __N
|
_12,_13,_14,_15,_16,__N,...) __N
|
||||||
@ -170,14 +218,16 @@
|
|||||||
|
|
||||||
#ifndef safe_atom_code
|
#ifndef safe_atom_code
|
||||||
# define safe_atom_code() \
|
# define safe_atom_code() \
|
||||||
using( uint32_t CONNECT2(temp,__LINE__) = __disable_irq(), \
|
using( uint32_t CONNECT2(temp,__LINE__) = \
|
||||||
__set_PRIMASK(CONNECT2(temp,__LINE__)))
|
({uint32_t temp=__get_PRIMASK();__disable_irq();temp;}),\
|
||||||
|
__set_PRIMASK(CONNECT2(temp,__LINE__)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __IRQ_SAFE
|
#ifndef __IRQ_SAFE
|
||||||
# define __IRQ_SAFE \
|
# define __IRQ_SAFE \
|
||||||
using( uint32_t CONNECT2(temp,__LINE__) = __disable_irq(), \
|
using( uint32_t CONNECT2(temp,__LINE__) = \
|
||||||
__set_PRIMASK(CONNECT2(temp,__LINE__)))
|
({uint32_t temp=__get_PRIMASK();__disable_irq();temp;}),\
|
||||||
|
__set_PRIMASK(CONNECT2(temp,__LINE__)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user