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