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; 31#ifdef TX_ENABLE_FIQ_SUPPORT 32INT_MASK DEFINE 0xC0 ; Interrupt bit mask 33#else 34INT_MASK DEFINE 0x80 ; Interrupt bit mask 35#endif 36; 37; 38;/**************************************************************************/ 39;/* */ 40;/* FUNCTION RELEASE */ 41;/* */ 42;/* _tx_thread_interrupt_control ARM9/IAR */ 43;/* 6.1 */ 44;/* AUTHOR */ 45;/* */ 46;/* William E. Lamie, Microsoft Corporation */ 47;/* */ 48;/* DESCRIPTION */ 49;/* */ 50;/* This function is responsible for changing the interrupt lockout */ 51;/* posture of the system. */ 52;/* */ 53;/* INPUT */ 54;/* */ 55;/* new_posture New interrupt lockout posture */ 56;/* */ 57;/* OUTPUT */ 58;/* */ 59;/* old_posture Old interrupt lockout posture */ 60;/* */ 61;/* CALLS */ 62;/* */ 63;/* None */ 64;/* */ 65;/* CALLED BY */ 66;/* */ 67;/* Application Code */ 68;/* */ 69;/* RELEASE HISTORY */ 70;/* */ 71;/* DATE NAME DESCRIPTION */ 72;/* */ 73;/* 09-30-2020 William E. Lamie Initial Version 6.1 */ 74;/* */ 75;/**************************************************************************/ 76;UINT _tx_thread_interrupt_control(UINT new_posture) 77;{ 78 RSEG .text:CODE:NOROOT(2) 79 PUBLIC _tx_thread_interrupt_control 80 CODE32 81_tx_thread_interrupt_control 82; 83; /* Pickup current interrupt lockout posture. */ 84; 85 MRS r3, CPSR ; Pickup current CPSR 86 BIC r1, r3, #INT_MASK ; Clear interrupt lockout bits 87 ORR r1, r1, r0 ; Or-in new interrupt lockout bits 88; 89; /* Apply the new interrupt posture. */ 90; 91 MSR CPSR_cxsf, r1 ; Setup new CPSR 92 AND r0, r3, #INT_MASK ; Return previous interrupt mask 93#ifdef TX_THUMB 94 BX lr ; Return to caller 95#else 96 MOV pc, lr ; Return to caller 97#endif 98; 99;} 100; 101; 102 END 103