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#ifdef TX_INCLUDE_USER_DEFINE_FILE
22#include "tx_user.h"
23#endif
24
25    .syntax unified
26#if defined(THUMB_MODE)
27    .thumb
28#else
29    .arm
30#endif
31
32    .text
33    .align 2
34/**************************************************************************/
35/*                                                                        */
36/*  FUNCTION                                               RELEASE        */
37/*                                                                        */
38/*    _tx_thread_interrupt_disable                         ARMv7-A        */
39/*                                                           6.4.0        */
40/*  AUTHOR                                                                */
41/*                                                                        */
42/*    William E. Lamie, Microsoft Corporation                             */
43/*                                                                        */
44/*  DESCRIPTION                                                           */
45/*                                                                        */
46/*    This function is responsible for disabling interrupts               */
47/*                                                                        */
48/*  INPUT                                                                 */
49/*                                                                        */
50/*    None                                                                */
51/*                                                                        */
52/*  OUTPUT                                                                */
53/*                                                                        */
54/*    old_posture                           Old interrupt lockout posture */
55/*                                                                        */
56/*  CALLS                                                                 */
57/*                                                                        */
58/*    None                                                                */
59/*                                                                        */
60/*  CALLED BY                                                             */
61/*                                                                        */
62/*    Application Code                                                    */
63/*                                                                        */
64/*  RELEASE HISTORY                                                       */
65/*                                                                        */
66/*    DATE              NAME                      DESCRIPTION             */
67/*                                                                        */
68/*  09-30-2020     William E. Lamie         Initial Version 6.1           */
69/*  04-25-2022     Zhen Kong                Updated comments,             */
70/*                                            resulting in version 6.1.11 */
71/*  10-31-2023     Tiejun Zhou              Modified comment(s), added    */
72/*                                            #include tx_user.h,         */
73/*                                            resulting in version 6.3.0  */
74/*  12-31-2023     Yajun Xia                Modified comment(s),          */
75/*                                            Added thumb mode support,   */
76/*                                            resulting in version 6.4.0  */
77/*                                                                        */
78/**************************************************************************/
79#if defined(THUMB_MODE)
80    .thumb_func
81#endif
82    .global _tx_thread_interrupt_disable
83    .type   _tx_thread_interrupt_disable,function
84_tx_thread_interrupt_disable:
85
86    /* Pickup current interrupt lockout posture.  */
87
88    MRS     r0, CPSR                            // Pickup current CPSR
89
90    /* Mask interrupts.  */
91
92#ifdef TX_ENABLE_FIQ_SUPPORT
93    CPSID   if                                  // Disable IRQ and FIQ
94#else
95    CPSID   i                                   // Disable IRQ
96#endif
97
98    BX      lr                                  // Return to caller
99