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