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_disable                     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 disabling interrupts and returning */
42/*    the previous interrupt lockout posture.                             */
43/*                                                                        */
44/*  INPUT                                                                 */
45/*                                                                        */
46/*    None                                                                */
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_disable(VOID)
70// {
71    PUBLIC  _tx_thread_interrupt_disable
72_tx_thread_interrupt_disable:
73    /* Return current interrupt lockout posture.  */
74#ifdef TX_PORT_USE_BASEPRI
75    MRS     r0, BASEPRI
76    LDR     r1, =TX_PORT_BASEPRI
77    MSR     BASEPRI, r1
78#else
79    MRS     r0, PRIMASK
80    CPSID   i
81#endif
82    BX      lr
83// }
84    END
85