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 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _tx_thread_fp_disable                                ARMv8-A        */
36 /*                                                           6.1.10       */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    William E. Lamie, Microsoft Corporation                             */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function disables 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_disable(VOID)70 VOID  _tx_thread_fp_disable(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 set the FP enable flag to false in the TX_THREAD structure.  */
92             thread_ptr -> tx_thread_fp_enable =  TX_FALSE;
93         }
94     }
95 }
96 
97