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/**************************************************************************/
28/*                                                                        */
29/*  FUNCTION                                               RELEASE        */
30/*                                                                        */
31/*    _tx_thread_interrupt_control                      Cortex-Mxx/GNU    */
32/*                                                           6.2.1        */
33/*  AUTHOR                                                                */
34/*                                                                        */
35/*    Scott Larson, Microsoft Corporation                                 */
36/*                                                                        */
37/*  DESCRIPTION                                                           */
38/*                                                                        */
39/*    This function is responsible for changing the interrupt lockout     */
40/*    posture of the system.                                              */
41/*                                                                        */
42/*  INPUT                                                                 */
43/*                                                                        */
44/*    new_posture                           New interrupt lockout posture */
45/*                                                                        */
46/*  OUTPUT                                                                */
47/*                                                                        */
48/*    old_posture                           Old interrupt lockout posture */
49/*                                                                        */
50/*  CALLS                                                                 */
51/*                                                                        */
52/*    None                                                                */
53/*                                                                        */
54/*  CALLED BY                                                             */
55/*                                                                        */
56/*    Application Code                                                    */
57/*                                                                        */
58/*  RELEASE HISTORY                                                       */
59/*                                                                        */
60/*    DATE              NAME                      DESCRIPTION             */
61/*                                                                        */
62/*  09-30-2020      Scott Larson            Initial Version 6.1           */
63/*  03-08-2023      Scott Larson            Include tx_user.h,            */
64/*                                            resulting in version 6.2.1  */
65/*                                                                        */
66/**************************************************************************/
67// UINT   _tx_thread_interrupt_control(UINT new_posture)
68// {
69    .section .text
70    .balign 4
71    .eabi_attribute Tag_ABI_align_preserved, 1
72    .global  _tx_thread_interrupt_control
73    .thumb_func
74.type _tx_thread_interrupt_control, function
75_tx_thread_interrupt_control:
76#ifdef TX_PORT_USE_BASEPRI
77    MRS     r1, BASEPRI                         // Pickup current interrupt posture
78    MSR     BASEPRI, r0                         // Apply the new interrupt posture
79    MOV     r0, r1                              // Transfer old to return register
80#else
81    MRS     r1, PRIMASK                         // Pickup current interrupt lockout
82    MSR     PRIMASK, r0                         // Apply the new interrupt lockout
83    MOV     r0, r1                              // Transfer old to return register
84#endif
85    BX      lr                                  // Return to caller
86// }
87    .end
88