fpu.h
Go to the documentation of this file.
1 
33 /*
34  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
35  */
36 
37 #ifndef _FPU_H_INCLUDED_
38 #define _FPU_H_INCLUDED_
39 
40 #include <compiler.h>
41 
43 #define ADDR_CPACR 0xE000ED88
44 
46 #define REG_CPACR (*((volatile uint32_t *)ADDR_CPACR))
47 
51 __always_inline static void fpu_enable(void)
52 {
53  irqflags_t flags;
54  flags = cpu_irq_save();
55  REG_CPACR |= (0xFu << 20);
56  __DSB();
57  __ISB();
58  cpu_irq_restore(flags);
59 }
60 
64 __always_inline static void fpu_disable(void)
65 {
66  irqflags_t flags;
67  flags = cpu_irq_save();
68  REG_CPACR &= ~(0xFu << 20);
69  __DSB();
70  __ISB();
71  cpu_irq_restore(flags);
72 }
73 
79 __always_inline static bool fpu_is_enabled(void)
80 {
81  return (REG_CPACR & (0xFu << 20));
82 }
83 
84 #endif /* _FPU_H_INCLUDED_ */
static __always_inline bool fpu_is_enabled(void)
Check if FPU is enabled.
Definition: fpu.h:79
static irqflags_t cpu_irq_save(void)
Get and clear the global interrupt flags.
static void cpu_irq_restore(irqflags_t flags)
Restore global interrupt flags.
Commonly used includes, types and macros.
#define REG_CPACR
Definition: fpu.h:46
static __always_inline void fpu_disable(void)
Disable FPU.
Definition: fpu.h:64
uint32_t irqflags_t
Type used for holding state of interrupt flag.
static __always_inline void fpu_enable(void)
Enable FPU.
Definition: fpu.h:51


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57