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#ifdef TX_INCLUDE_USER_DEFINE_FILE
24#include "tx_user.h"
25#endif
26
27    AREA ||.text||, CODE, READONLY
28/**************************************************************************/
29/*                                                                        */
30/*  FUNCTION                                               RELEASE        */
31/*                                                                        */
32/*    _tx_thread_interrupt_control                     Cortex-Mx/AC5      */
33/*                                                           6.3.0        */
34/*  AUTHOR                                                                */
35/*                                                                        */
36/*    Scott Larson, Microsoft Corporation                                 */
37/*                                                                        */
38/*  DESCRIPTION                                                           */
39/*                                                                        */
40/*    This function is responsible for changing the interrupt lockout     */
41/*    posture of the system.                                              */
42/*                                                                        */
43/*  INPUT                                                                 */
44/*                                                                        */
45/*    new_posture                           New interrupt lockout posture */
46/*                                                                        */
47/*  OUTPUT                                                                */
48/*                                                                        */
49/*    old_posture                           Old interrupt lockout posture */
50/*                                                                        */
51/*  CALLS                                                                 */
52/*                                                                        */
53/*    None                                                                */
54/*                                                                        */
55/*  CALLED BY                                                             */
56/*                                                                        */
57/*    Application Code                                                    */
58/*                                                                        */
59/*  RELEASE HISTORY                                                       */
60/*                                                                        */
61/*    DATE              NAME                      DESCRIPTION             */
62/*                                                                        */
63/*  06-02-2021      Scott Larson            Initial Version 6.1.7         */
64/*  10-31-2023      Tiejun Zhou             Included tx_user.h,           */
65/*                                            resulting in version 6.3.0  */
66/*                                                                        */
67/**************************************************************************/
68// UINT   _tx_thread_interrupt_control(UINT new_posture)
69// {
70    EXPORT  _tx_thread_interrupt_control
71_tx_thread_interrupt_control
72#ifdef TX_PORT_USE_BASEPRI
73    MRS     r1, BASEPRI                         // Pickup current interrupt posture
74    MSR     BASEPRI, r0                         // Apply the new interrupt posture
75    MOV     r0, r1                              // Transfer old to return register
76#else
77    MRS     r1, PRIMASK                         // Pickup current interrupt lockout
78    MSR     PRIMASK, r0                         // Apply the new interrupt lockout
79    MOV     r0, r1                              // Transfer old to return register
80#endif
81    BX      lr                                  // Return to caller
82// }
83    END
84