/**************************************************************************/
/*                                                                        */
/*       Copyright (c) Microsoft Corporation. All rights reserved.        */
/*                                                                        */
/*       This software is licensed under the Microsoft Software License   */
/*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
/*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
/*       and in the root directory of this software.                      */
/*                                                                        */
/**************************************************************************/


/**************************************************************************/
/**************************************************************************/
/**                                                                       */
/** ThreadX Component                                                     */
/**                                                                       */
/**   Thread                                                              */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/

#define TX_SOURCE_CODE


/* Include necessary system files.  */

#include "tx_api.h"
#include "tx_thread.h"

/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _tx_thread_fp_enable                             Cortex-A5x-SMP/GCC */
/*                                                           6.1.9        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    William E. Lamie, Microsoft Corporation                             */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function enabled the FP for the currently executing thread.    */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    None                                                                */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    None                                                                */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    None                                                                */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    Application Code                                                    */
/*                                                                        */
/*  RELEASE HISTORY                                                       */
/*                                                                        */
/*    DATE              NAME                      DESCRIPTION             */
/*                                                                        */
/*  09-30-2020     William E. Lamie         Initial Version 6.1           */
/*  10-15-2021     Andres Mlinar            Updated comments,             */
/*                                             resulting in version 6.1.9 */
/*                                                                        */
/**************************************************************************/
VOID  _tx_thread_fp_enable(VOID)
{

TX_THREAD   *thread_ptr;
ULONG       system_state;


    /* Pickup the current thread pointer.  */
    TX_THREAD_GET_CURRENT(thread_ptr);

    /* Get the system state.  */
    system_state =  TX_THREAD_GET_SYSTEM_STATE();

    /* Make sure it is not NULL. */
    if (thread_ptr != TX_NULL)
    {

        /* Thread is running... make sure the call is from the thread context.  */
        if (system_state == 0)
        {

            /* Yes, now setup the FP enable flag in the TX_THREAD structure.  */
            thread_ptr -> tx_thread_fp_enable =  TX_TRUE;
        }
    }
}

