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    AREA ||.text||, CODE, READONLY
27/**************************************************************************/
28/*                                                                        */
29/*  FUNCTION                                               RELEASE        */
30/*                                                                        */
31/*    _tx_thread_interrupt_disable                     Cortex-Mx/AC5      */
32/*                                                           6.3.0        */
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/*  06-02-2021      Scott Larson            Initial Version 6.1.7         */
63/*  10-31-2023      Tiejun Zhou             Included tx_user.h,           */
64/*                                            resulting in version 6.3.0  */
65/*                                                                        */
66/**************************************************************************/
67// UINT   _tx_thread_interrupt_disable(VOID)
68// {
69    EXPORT  _tx_thread_interrupt_disable
70_tx_thread_interrupt_disable
71    /* Return current interrupt lockout posture.  */
72#ifdef TX_PORT_USE_BASEPRI
73    MRS     r0, BASEPRI
74    LDR     r1, =TX_PORT_BASEPRI
75    MSR     BASEPRI, r1
76#else
77    MRS     r0, PRIMASK
78    CPSID   i
79#endif
80    BX      lr
81// }
82    END
83