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;#define TX_SOURCE_CODE
23;
24;
25;/* Include necessary system files.  */
26;
27;#include "tx_api.h"
28;#include "tx_thread.h"
29;
30;
31FP          .set    A15
32DP          .set    B14
33SP          .set    B15
34;
35;
36    .sect   ".text"
37;/**************************************************************************/
38;/*                                                                        */
39;/*  FUNCTION                                               RELEASE        */
40;/*                                                                        */
41;/*    _tx_thread_interrupt_control                        C667x/TI        */
42;/*                                                           6.1          */
43;/*  AUTHOR                                                                */
44;/*                                                                        */
45;/*    William E. Lamie, Microsoft Corporation                             */
46;/*                                                                        */
47;/*  DESCRIPTION                                                           */
48;/*                                                                        */
49;/*    This function is responsible for changing the interrupt lockout     */
50;/*    posture of the system.                                              */
51;/*                                                                        */
52;/*  INPUT                                                                 */
53;/*                                                                        */
54;/*    new_posture                           New interrupt lockout posture */
55;/*                                                                        */
56;/*  OUTPUT                                                                */
57;/*                                                                        */
58;/*    old_posture                           Old interrupt lockout posture */
59;/*                                                                        */
60;/*  CALLS                                                                 */
61;/*                                                                        */
62;/*    None                                                                */
63;/*                                                                        */
64;/*  CALLED BY                                                             */
65;/*                                                                        */
66;/*    Application Code                                                    */
67;/*                                                                        */
68;/*  RELEASE HISTORY                                                       */
69;/*                                                                        */
70;/*    DATE              NAME                      DESCRIPTION             */
71;/*                                                                        */
72;/*  09-30-2020     William E. Lamie         Initial Version 6.1           */
73;/*                                                                        */
74;/**************************************************************************/
75;UINT   _tx_thread_interrupt_control(UINT new_posture)
76;{
77    .global _tx_thread_interrupt_control
78_tx_thread_interrupt_control:
79;
80;    /* Pickup current interrupt lockout posture.  */
81;
82        MVC         CSR,B0                              ; Pickup current CSR
83;
84;    /* Apply the new interrupt posture.  */
85;
86        B           B3                                  ; Return to caller
87        AND         -2,B0,B0                            ; Clear GIE bit
88        OR          A4,B0,B0                            ; Build new interrupt posture
89        MVC         CSR,B1                              ; Return previous posture
90        MVC         B0,CSR                              ; Apply new interrupt posture
91        AND         1,B1,A4                             ; Clear non-GIE bits
92;
93;}
94
95