Skip to content

Commit

Permalink
Minor changes for eCv
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Aug 18, 2021
1 parent 49ea934 commit 5d3eaaf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@
// Basic CPU and I/O pin support

#include "ecv.h"
#undef array
#undef assert
#undef result
#undef value

#ifdef array
# undef array
#endif
#ifdef assert
# undef assert
#endif
#ifdef result
# undef result
#endif
#ifdef value
# undef value
#endif

#if defined(__SAME54P20A__) || defined(__SAME51P20A__)
# define __ARM_ARCH_7EM__ 1
Expand Down Expand Up @@ -259,7 +268,7 @@ static inline void delayMicroseconds(uint32_t usec) noexcept
* @brief Enable interrupts unconditionally
*
*/
static __always_inline void IrqEnable() noexcept
static __attribute__(always_inline) void IrqEnable() noexcept
{
__enable_irq();
}
Expand All @@ -268,7 +277,7 @@ static __always_inline void IrqEnable() noexcept
* @brief Disable interrupts unconditionally
*
*/
static __always_inline void IrqDisable() noexcept
static __attribute__(always_inline) void IrqDisable() noexcept
{
__disable_irq();
}
Expand All @@ -280,7 +289,7 @@ typedef uint32_t irqflags_t; ///< Type used to indicate whether interrupts were
*
* @return True iff interrupts are enabled
*/
static __always_inline bool IsIrqEnabled() noexcept
static __attribute__(always_inline) bool IsIrqEnabled() noexcept
{
return __get_PRIMASK() == 0;
}
Expand All @@ -290,7 +299,7 @@ static __always_inline bool IsIrqEnabled() noexcept
*
* @return The initial interrupts enabled state
*/
static __always_inline irqflags_t IrqSave() noexcept
static __attribute__(always_inline) irqflags_t IrqSave() noexcept
{
const irqflags_t flags = __get_PRIMASK();
__disable_irq();
Expand All @@ -303,7 +312,7 @@ static __always_inline irqflags_t IrqSave() noexcept
* @param flags Value to convert
* @return Converted value
*/
static __always_inline bool IsIrqEnabledFlags(irqflags_t flags) noexcept
static __attribute__(always_inline) bool IsIrqEnabledFlags(irqflags_t flags) noexcept
{
return (flags & 0x01) == 0;
}
Expand All @@ -313,7 +322,7 @@ static __always_inline bool IsIrqEnabledFlags(irqflags_t flags) noexcept
*
* @param flags The original interrupts enabled state returned by a call to IrqSave
*/
static __always_inline void IrqRestore(irqflags_t flags) noexcept
static __attribute__(always_inline) void IrqRestore(irqflags_t flags) noexcept
{
__set_PRIMASK(flags);
}
Expand Down
2 changes: 2 additions & 0 deletions src/ecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ struct threadmbcinfostruct { int _x; }; /* this is defined only in the CRT sourc

#define __inline__ inline
#define __restrict__ _ecv_restrict
#define __restrict _ecv_restrict
#define __asm asm

/* Hide gcc __attribute__ keyword from eCv.
* WARNING: some header files (e.g. _mingw.h) may "#undef __attribute__", which undoes this. */
Expand Down

0 comments on commit 5d3eaaf

Please sign in to comment.