1/***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12/**************************************************************************/
13/**************************************************************************/
14/**                                                                       */
15/** ThreadX Component                                                     */
16/**                                                                       */
17/**   Thread                                                              */
18/**                                                                       */
19/**************************************************************************/
20/**************************************************************************/
21
22#ifdef TX_INCLUDE_USER_DEFINE_FILE
23#include "tx_user.h"
24#endif
25
26    SECTION `.text`:CODE:NOROOT(2)
27    THUMB
28/**************************************************************************/
29/*                                                                        */
30/*  FUNCTION                                               RELEASE        */
31/*                                                                        */
32/*    _tx_thread_interrupt_disable                     Cortex-Mx/IAR      */
33/*                                                           6.3.0        */
34/*  AUTHOR                                                                */
35/*                                                                        */
36/*    Scott Larson, Microsoft Corporation                                 */
37/*                                                                        */
38/*  DESCRIPTION                                                           */
39/*                                                                        */
40/*    This function is responsible for disabling interrupts and returning */
41/*    the previous interrupt lockout posture.                             */
42/*                                                                        */
43/*  INPUT                                                                 */
44/*                                                                        */
45/*    None                                                                */
46/*                                                                        */
47/*  OUTPUT                                                                */
48/*                                                                        */
49/*    old_posture                           Old interrupt lockout posture */
50/*                                                                        */
51/*  CALLS                                                                 */
52/*                                                                        */
53/*    None                                                                */
54/*                                                                        */
55/*  CALLED BY                                                             */
56/*                                                                        */
57/*    Application Code                                                    */
58/*                                                                        */
59/*  RELEASE HISTORY                                                       */
60/*                                                                        */
61/*    DATE              NAME                      DESCRIPTION             */
62/*                                                                        */
63/*  06-02-2021      Scott Larson            Initial Version 6.1.7         */
64/*  10-31-2023      Tiejun Zhou             Included tx_user.h,           */
65/*                                            resulting in version 6.3.0  */
66/*                                                                        */
67/**************************************************************************/
68// UINT   _tx_thread_interrupt_disable(VOID)
69// {
70    PUBLIC  _tx_thread_interrupt_disable
71_tx_thread_interrupt_disable:
72    /* Return current interrupt lockout posture.  */
73#ifdef TX_PORT_USE_BASEPRI
74    MRS     r0, BASEPRI
75    LDR     r1, =TX_PORT_BASEPRI
76    MSR     BASEPRI, r1
77#else
78    MRS     r0, PRIMASK
79    CPSID   i
80#endif
81    BX      lr
82// }
83    END
84