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