1/**************************************************************************/
2/*                                                                        */
3/*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4/*                                                                        */
5/*       This software is licensed under the Microsoft Software License   */
6/*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7/*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8/*       and in the root directory of this software.                      */
9/*                                                                        */
10/**************************************************************************/
11
12
13/**************************************************************************/
14/**************************************************************************/
15/**                                                                       */
16/** ThreadX Component                                                     */
17/**                                                                       */
18/**   Thread                                                              */
19/**                                                                       */
20/**************************************************************************/
21/**************************************************************************/
22
23#ifdef TX_INCLUDE_USER_DEFINE_FILE
24#include "tx_user.h"
25#endif
26
27    SECTION `.text`:CODE:NOROOT(2)
28    THUMB
29/**************************************************************************/
30/*                                                                        */
31/*  FUNCTION                                               RELEASE        */
32/*                                                                        */
33/*    _tx_thread_interrupt_control                      Cortex-Mxx/IAR    */
34/*                                                           6.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/*  09-30-2020      Scott Larson            Initial Version 6.1           */
65/*                                                                        */
66/**************************************************************************/
67// UINT   _tx_thread_interrupt_control(UINT new_posture)
68// {
69    PUBLIC  _tx_thread_interrupt_control
70_tx_thread_interrupt_control:
71#ifdef TX_PORT_USE_BASEPRI
72    MRS     r1, BASEPRI                         // Pickup current interrupt posture
73    MSR     BASEPRI, r0                         // Apply the new interrupt posture
74    MOV     r0, r1                              // Transfer old to return register
75#else
76    MRS     r1, PRIMASK                         // Pickup current interrupt lockout
77    MSR     PRIMASK, r0                         // Apply the new interrupt lockout
78    MOV     r0, r1                              // Transfer old to return register
79#endif
80    BX      lr                                  // Return to caller
81// }
82    END
83