X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FCORTEX_M7_SAME70_Xplained_AtmelStudio%2Fsrc%2FASF%2Fsam%2Futils%2Ffpu%2Ffpu.h;fp=FreeRTOS%2FDemo%2FCORTEX_M7_SAME70_Xplained_AtmelStudio%2Fsrc%2FASF%2Fsam%2Futils%2Ffpu%2Ffpu.h;h=472a7455f3e6dcf9a5b0dac13c3e10952bfa2f9a;hb=f934fa7c6b2724e23523bd8a52764106e985c26b;hp=0000000000000000000000000000000000000000;hpb=831ff827e29d5cffe1ed6229d143e4b4fccd6486;p=freertos
diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/fpu/fpu.h b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/fpu/fpu.h
new file mode 100644
index 000000000..472a7455f
--- /dev/null
+++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/fpu/fpu.h
@@ -0,0 +1,94 @@
+/**
+ * \file
+ *
+ * \brief FPU support for SAM.
+ *
+ * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
+ *
+ * \asf_license_start
+ *
+ * \page License
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an
+ * Atmel microcontroller product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * \asf_license_stop
+ *
+ */
+/*
+ * Support and FAQ: visit Atmel Support
+ */
+
+#ifndef _FPU_H_INCLUDED_
+#define _FPU_H_INCLUDED_
+
+#include
+
+/** Address for ARM CPACR */
+#define ADDR_CPACR 0xE000ED88
+
+/** CPACR Register */
+#define REG_CPACR (*((volatile uint32_t *)ADDR_CPACR))
+
+/**
+ * \brief Enable FPU
+ */
+__always_inline static void fpu_enable(void)
+{
+ irqflags_t flags;
+ flags = cpu_irq_save();
+ REG_CPACR |= (0xFu << 20);
+ __DSB();
+ __ISB();
+ cpu_irq_restore(flags);
+}
+
+/**
+ * \brief Disable FPU
+ */
+__always_inline static void fpu_disable(void)
+{
+ irqflags_t flags;
+ flags = cpu_irq_save();
+ REG_CPACR &= ~(0xFu << 20);
+ __DSB();
+ __ISB();
+ cpu_irq_restore(flags);
+}
+
+/**
+ * \brief Check if FPU is enabled
+ *
+ * \return Return ture if FPU is enabled, otherwise return false.
+ */
+__always_inline static bool fpu_is_enabled(void)
+{
+ return (REG_CPACR & (0xFu << 20));
+}
+
+#endif /* _FPU_H_INCLUDED_ */