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    SECTION `.text`:CODE:NOROOT(2)
28    THUMB
29/**************************************************************************/
30/*                                                                        */
31/*  FUNCTION                                               RELEASE        */
32/*                                                                        */
33/*    _tx_thread_interrupt_control                     Cortex-Mx/IAR      */
34/*                                                           6.3.0        */
35/*  AUTHOR                                                                */
36/*                                                                        */
37/*    Scott Larson, Microsoft Corporation                                 */
38/*                                                                        */
39/*  DESCRIPTION                                                           */
40/*                                                                        */
41/*    This function is responsible for changing the interrupt lockout     */
42/*    posture of the system.                                              */
43/*                                                                        */
44/*  INPUT                                                                 */
45/*                                                                        */
46/*    new_posture                           New interrupt lockout posture */
47/*                                                                        */
48/*  OUTPUT                                                                */
49/*                                                                        */
50/*    old_posture                           Old interrupt lockout posture */
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/*  06-02-2021      Scott Larson            Initial Version 6.1.7         */
65/*  10-31-2023      Tiejun Zhou             Included tx_user.h,           */
66/*                                            resulting in version 6.3.0  */
67/*                                                                        */
68/**************************************************************************/
69// UINT   _tx_thread_interrupt_control(UINT new_posture)
70// {
71    PUBLIC  _tx_thread_interrupt_control
72_tx_thread_interrupt_control:
73#ifdef TX_PORT_USE_BASEPRI
74    MRS     r1, BASEPRI                         // Pickup current interrupt posture
75    MSR     BASEPRI, r0                         // Apply the new interrupt posture
76    MOV     r0, r1                              // Transfer old to return register
77#else
78    MRS     r1, PRIMASK                         // Pickup current interrupt lockout
79    MSR     PRIMASK, r0                         // Apply the new interrupt lockout
80    MOV     r0, r1                              // Transfer old to return register
81#endif
82    BX      lr                                  // Return to caller
83// }
84    END
85