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_disable                      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 disabling interrupts and returning */
40/*    the previous interrupt lockout posture.                             */
41/*                                                                        */
42/*  INPUT                                                                 */
43/*                                                                        */
44/*    None                                                                */
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_disable(VOID)
68// {
69    .section .text
70    .balign 4
71    .syntax unified
72    .eabi_attribute Tag_ABI_align_preserved, 1
73    .global  _tx_thread_interrupt_disable
74    .thumb_func
75.type _tx_thread_interrupt_disable, function
76_tx_thread_interrupt_disable:
77    /* Return current interrupt lockout posture.  */
78#ifdef TX_PORT_USE_BASEPRI
79    MRS     r0, BASEPRI
80    LDR     r1, =TX_PORT_BASEPRI
81    MSR     BASEPRI, r1
82#else
83    MRS     r0, PRIMASK
84    CPSID   i
85#endif
86    BX      lr
87// }
88    .end
89