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