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    .text 32
27    .align 4
28    .syntax unified
29/**************************************************************************/
30/*                                                                        */
31/*  FUNCTION                                               RELEASE        */
32/*                                                                        */
33/*    _tx_thread_interrupt_control                     Cortex-Mx/AC6      */
34/*                                                           6.2.1        */
35/*  AUTHOR                                                                */
36/*                                                                        */
37/*    Scott Larson, Microsoft Corporation                                 */
38/*                                                                        */
39/*  DESCRIPTION                                                           */
40/*                                                                        */
41/*    This function is responsible for changing the interrupt lockout     */
42/*    posture of the system.                                              */
43/*                                                                        */
44/*  INPUT                                                                 */
45/*                                                                        */
46/*    new_posture                           New interrupt lockout posture */
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/*  03-08-2023      Scott Larson            Include tx_user.h,            */
66/*                                            resulting in version 6.2.1  */
67/*                                                                        */
68/**************************************************************************/
69// UINT   _tx_thread_interrupt_control(UINT new_posture)
70// {
71    .global  _tx_thread_interrupt_control
72    .thumb_func
73_tx_thread_interrupt_control:
74#ifdef TX_PORT_USE_BASEPRI
75    MRS     r1, BASEPRI                         // Pickup current interrupt posture
76    MSR     BASEPRI, r0                         // Apply the new interrupt posture
77    MOV     r0, r1                              // Transfer old to return register
78#else
79    MRS     r1, PRIMASK                         // Pickup current interrupt lockout
80    MSR     PRIMASK, r0                         // Apply the new interrupt lockout
81    MOV     r0, r1                              // Transfer old to return register
82#endif
83    BX      lr                                  // Return to caller
84// }
85