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;#define TX_SOURCE_CODE
24;
25;
26;/* Include necessary system files.  */
27;
28;#include "tx_api.h"
29;#include "tx_thread.h"
30;
31;
32    .text
33;/**************************************************************************/
34;/*                                                                        */
35;/*  FUNCTION                                               RELEASE        */
36;/*                                                                        */
37;/*    _tx_thread_interrupt_control                         RXv3/GNURX     */
38;/*                                                           6.1.11       */
39;/*  AUTHOR                                                                */
40;/*                                                                        */
41;/*    William E. Lamie, Microsoft Corporation                             */
42;/*                                                                        */
43;/*  DESCRIPTION                                                           */
44;/*                                                                        */
45;/*    This function is responsible for changing the interrupt lockout     */
46;/*    posture of the system.                                              */
47;/*                                                                        */
48;/*  INPUT                                                                 */
49;/*                                                                        */
50;/*    new_posture                           New interrupt lockout posture */
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;/*  06-02-2021     William E. Lamie         Initial Version 6.1.7         */
69;/*  10-15-2021     William E. Lamie         Modified comment(s),          */
70;/*                                            resulting in version 6.1.9  */
71;/*  01-31-2022     William E. Lamie         Modified comment(s),          */
72;/*                                            resulting in version 6.1.10 */
73;/*  04-25-2022     William E. Lamie         Modified comment(s),          */
74;/*                                            resulting in version 6.1.11 */
75;/*                                                                        */
76;/**************************************************************************/
77;UINT   _tx_thread_interrupt_control(UINT new_posture)
78;{
79
80    .global __tx_thread_interrupt_control
81__tx_thread_interrupt_control:
82;
83;    /* Pickup current interrupt lockout posture.  */
84;
85
86    MVFC      PSW, R2                           ; Save PSW to R2
87    MOV.L     R2, R3                            ; Make a copy of PSW in r3
88
89;
90;    /* Apply the new interrupt posture.  */
91;
92
93    BTST    #16, R1                             ; Test I bit of PSW of "new posture"
94    BMNE    #16, R2                             ; Conditionally set I bit of intermediate posture
95
96    MVTC    R2, PSW                             ; Save intermediate posture to PSW
97
98    MOV.L   R3,R1                               ; Get original SR
99    RTS                                         ; Return to caller
100;}
101    .end
102
103
104