xref: /nrf52832-nimble/rt-thread/libcpu/arm/armv6/vfp.c (revision 167494296f0543431a51b6b1b83e957045294e05)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2014-11-07     weety      first version
9  */
10 
11 #include <rthw.h>
12 #include <rtthread.h>
13 #include "vfp.h"
14 
15 #ifdef RT_USING_VFP
16 
17 void vfp_init(void)
18 {
19     int ret = 0;
20     unsigned int value;
21     asm  volatile ("mrc p15, 0, %0, c1, c0, 2"
22             :"=r"(value)
23             :);
24     value |= 0xf00000;/*enable CP10, CP11 user access*/
25     asm volatile("mcr p15, 0, %0, c1, c0, 2"
26             :
27             :"r"(value));
28 
29     asm volatile("fmrx %0, fpexc"
30             :"=r"(value));
31     value |=(1<<30);
32     asm volatile("fmxr fpexc, %0"
33             :
34             :"r"(value));
35 
36 }
37 
38 #endif
39