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#ifdef TX_INCLUDE_USER_DEFINE_FILE 23#include "tx_user.h" 24#endif 25 26 SECTION `.text`:CODE:NOROOT(2) 27 THUMB 28/**************************************************************************/ 29/* */ 30/* FUNCTION RELEASE */ 31/* */ 32/* _tx_thread_interrupt_control Cortex-Mx/IAR */ 33/* 6.3.0 */ 34/* AUTHOR */ 35/* */ 36/* Scott Larson, Microsoft Corporation */ 37/* */ 38/* DESCRIPTION */ 39/* */ 40/* This function is responsible for changing the interrupt lockout */ 41/* posture of the system. */ 42/* */ 43/* INPUT */ 44/* */ 45/* new_posture New interrupt lockout posture */ 46/* */ 47/* OUTPUT */ 48/* */ 49/* old_posture Old interrupt lockout posture */ 50/* */ 51/* CALLS */ 52/* */ 53/* None */ 54/* */ 55/* CALLED BY */ 56/* */ 57/* Application Code */ 58/* */ 59/* RELEASE HISTORY */ 60/* */ 61/* DATE NAME DESCRIPTION */ 62/* */ 63/* 06-02-2021 Scott Larson Initial Version 6.1.7 */ 64/* 10-31-2023 Tiejun Zhou Included tx_user.h, */ 65/* resulting in version 6.3.0 */ 66/* */ 67/**************************************************************************/ 68// UINT _tx_thread_interrupt_control(UINT new_posture) 69// { 70 PUBLIC _tx_thread_interrupt_control 71_tx_thread_interrupt_control: 72#ifdef TX_PORT_USE_BASEPRI 73 MRS r1, BASEPRI // Pickup current interrupt posture 74 MSR BASEPRI, r0 // Apply the new interrupt posture 75 MOV r0, r1 // Transfer old to return register 76#else 77 MRS r1, PRIMASK // Pickup current interrupt lockout 78 MSR PRIMASK, r0 // Apply the new interrupt lockout 79 MOV r0, r1 // Transfer old to return register 80#endif 81 BX lr // Return to caller 82// } 83 END 84