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#ifdef TX_INCLUDE_USER_DEFINE_FILE
23#include "tx_user.h"
24#endif
25
26@/* Define the 16-bit Thumb mode veneer for _tx_thread_interrupt_restore for
27@   applications calling this function from to 16-bit Thumb mode.  */
28@
29    .text
30    .align 2
31    .global $_tx_thread_interrupt_restore
32$_tx_thread_interrupt_restore:
33        .thumb
34     BX        pc                               @ Switch to 32-bit mode
35     NOP                                        @
36    .arm
37     STMFD     sp!, {lr}                        @ Save return address
38     BL        _tx_thread_interrupt_restore     @ Call _tx_thread_interrupt_restore function
39     LDMFD     sp!, {lr}                        @ Recover saved return address
40     BX        lr                               @ Return to 16-bit caller
41@
42@
43    .text
44    .align 2
45@/**************************************************************************/
46@/*                                                                        */
47@/*  FUNCTION                                               RELEASE        */
48@/*                                                                        */
49@/*    _tx_thread_interrupt_restore                        ARM11/GNU       */
50@/*                                                            6.2.1       */
51@/*  AUTHOR                                                                */
52@/*                                                                        */
53@/*    William E. Lamie, Microsoft Corporation                             */
54@/*                                                                        */
55@/*  DESCRIPTION                                                           */
56@/*                                                                        */
57@/*    This function is responsible for restoring interrupts to the state  */
58@/*    returned by a previous _tx_thread_interrupt_disable call.           */
59@/*                                                                        */
60@/*  INPUT                                                                 */
61@/*                                                                        */
62@/*    old_posture                           Old interrupt lockout posture */
63@/*                                                                        */
64@/*  OUTPUT                                                                */
65@/*                                                                        */
66@/*    None                                                                */
67@/*                                                                        */
68@/*  CALLS                                                                 */
69@/*                                                                        */
70@/*    None                                                                */
71@/*                                                                        */
72@/*  CALLED BY                                                             */
73@/*                                                                        */
74@/*    Application Code                                                    */
75@/*                                                                        */
76@/*  RELEASE HISTORY                                                       */
77@/*                                                                        */
78@/*    DATE              NAME                      DESCRIPTION             */
79@/*                                                                        */
80@/*  09-30-2020     William E. Lamie         Initial Version 6.1           */
81@/*  03-08-2023     Cindy Deng               Modified comment(s), added    */
82@/*                                            #include tx_user.h,         */
83@/*                                            resulting in version 6.2.1  */
84@/*                                                                        */
85@/**************************************************************************/
86@UINT   _tx_thread_interrupt_restore(UINT old_posture)
87@{
88    .global  _tx_thread_interrupt_restore
89    .type    _tx_thread_interrupt_restore,function
90_tx_thread_interrupt_restore:
91@
92@    /* Apply the new interrupt posture.  */
93@
94    MSR     CPSR_cxsf, r0                       @ Setup new CPSR
95#ifdef __THUMB_INTERWORK
96    BX      lr                                  @ Return to caller
97#else
98    MOV     pc, lr                              @ Return to caller
99#endif
100@}
101
102