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    .text
24;/**************************************************************************/
25;/*                                                                        */
26;/*  FUNCTION                                               RELEASE        */
27;/*                                                                        */
28;/*    _tx_thread_interrupt_control                         RXv1/GNURX     */
29;/*                                                           6.1.11       */
30;/*  AUTHOR                                                                */
31;/*                                                                        */
32;/*    William E. Lamie, Microsoft Corporation                             */
33;/*                                                                        */
34;/*  DESCRIPTION                                                           */
35;/*                                                                        */
36;/*    This function is responsible for changing the interrupt lockout     */
37;/*    posture of the system.                                              */
38;/*                                                                        */
39;/*  INPUT                                                                 */
40;/*                                                                        */
41;/*    new_posture                           New interrupt lockout posture */
42;/*                                                                        */
43;/*  OUTPUT                                                                */
44;/*                                                                        */
45;/*    old_posture                           Old interrupt lockout posture */
46;/*                                                                        */
47;/*  CALLS                                                                 */
48;/*                                                                        */
49;/*    None                                                                */
50;/*                                                                        */
51;/*  CALLED BY                                                             */
52;/*                                                                        */
53;/*    Application Code                                                    */
54;/*                                                                        */
55;/*  RELEASE HISTORY                                                       */
56;/*                                                                        */
57;/*    DATE              NAME                      DESCRIPTION             */
58;/*                                                                        */
59;/*  08-02-2021     William E. Lamie         Initial Version 6.1.8         */
60;/*  10-15-2021     William E. Lamie         Modified comment(s),          */
61;/*                                            resulting in version 6.1.9  */
62;/*  01-31-2022     William E. Lamie         Modified comment(s),          */
63;/*                                            resulting in version 6.1.10 */
64;/*  04-25-2022     William E. Lamie         Modified comment(s),          */
65;/*                                            resulting in version 6.1.11 */
66;/*                                                                        */
67;/**************************************************************************/
68;UINT   _tx_thread_interrupt_control(UINT new_posture)
69;{
70
71    .global __tx_thread_interrupt_control
72__tx_thread_interrupt_control:
73;
74;    /* Pickup current interrupt lockout posture.  */
75;
76
77    MVFC      PSW, R2           ; Save PSW to R2
78    MOV.L     R2, R3            ; Make a copy of PSW in r3
79
80;
81;    /* Apply the new interrupt posture.  */
82;
83
84    BTST    #16, R1             ; Test I bit of PSW of "new posture"
85    BMNE    #16, R2             ; Conditionally set I bit of intermediate posture
86
87    MVTC    R2, PSW             ; Save intermediate posture to PSW
88
89    MOV.L   R3,R1               ; Get original SR
90    RTS                         ; Return to caller
91;}
92    .end
93