1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** ThreadX Component                                                     */
17 /**                                                                       */
18 /**   Thread                                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define TX_SOURCE_CODE
24 
25 
26 /* Include necessary system files.  */
27 
28 #include "tx_api.h"
29 #include "tx_thread.h"
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _tx_thread_fp_enable                                 ARMv8-A        */
36 /*                                                           6.1.10       */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    William E. Lamie, Microsoft Corporation                             */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function enabled the FP for the currently executing thread.    */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    None                                                                */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    None                                                                */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    None                                                                */
56 /*                                                                        */
57 /*  CALLED BY                                                             */
58 /*                                                                        */
59 /*    Application Code                                                    */
60 /*                                                                        */
61 /*  RELEASE HISTORY                                                       */
62 /*                                                                        */
63 /*    DATE              NAME                      DESCRIPTION             */
64 /*                                                                        */
65 /*  09-30-2020     William E. Lamie         Initial Version 6.1           */
66 /*  01-31-2022     Andres Mlinar            Updated comments,             */
67 /*                                            resulting in version 6.1.10 */
68 /*                                                                        */
69 /**************************************************************************/
_tx_thread_fp_enable(VOID)70 VOID  _tx_thread_fp_enable(VOID)
71 {
72 
73 TX_THREAD   *thread_ptr;
74 ULONG       system_state;
75 
76 
77     /* Pickup the current thread pointer.  */
78     TX_THREAD_GET_CURRENT(thread_ptr);
79 
80     /* Get the system state.  */
81     system_state =  TX_THREAD_GET_SYSTEM_STATE();
82 
83     /* Make sure it is not NULL. */
84     if (thread_ptr != TX_NULL)
85     {
86 
87         /* Thread is running... make sure the call is from the thread context.  */
88         if (system_state == 0)
89         {
90 
91             /* Yes, now setup the FP enable flag in the TX_THREAD structure.  */
92             thread_ptr -> tx_thread_fp_enable =  TX_TRUE;
93         }
94     }
95 }
96 
97