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#ifdef TX_INCLUDE_USER_DEFINE_FILE 23#include "tx_user.h" 24#endif 25 26 27INT_MASK = 0x03F 28 29@ 30@/* Define the 16-bit Thumb mode veneer for _tx_thread_interrupt_control for 31@ applications calling this function from to 16-bit Thumb mode. */ 32@ 33 .text 34 .align 2 35 .global $_tx_thread_interrupt_control 36$_tx_thread_interrupt_control: 37 .thumb 38 BX pc @ Switch to 32-bit mode 39 NOP @ 40 .arm 41 STMFD sp!, {lr} @ Save return address 42 BL _tx_thread_interrupt_control @ Call _tx_thread_interrupt_control function 43 LDMFD sp!, {lr} @ Recover saved return address 44 BX lr @ Return to 16-bit caller 45@ 46@ 47 .text 48 .align 2 49@/**************************************************************************/ 50@/* */ 51@/* FUNCTION RELEASE */ 52@/* */ 53@/* _tx_thread_interrupt_control ARM9/GNU */ 54@/* 6.2.1 */ 55@/* AUTHOR */ 56@/* */ 57@/* William E. Lamie, Microsoft Corporation */ 58@/* */ 59@/* DESCRIPTION */ 60@/* */ 61@/* This function is responsible for changing the interrupt lockout */ 62@/* posture of the system. */ 63@/* */ 64@/* INPUT */ 65@/* */ 66@/* new_posture New interrupt lockout posture */ 67@/* */ 68@/* OUTPUT */ 69@/* */ 70@/* old_posture Old interrupt lockout posture */ 71@/* */ 72@/* CALLS */ 73@/* */ 74@/* None */ 75@/* */ 76@/* CALLED BY */ 77@/* */ 78@/* Application Code */ 79@/* */ 80@/* RELEASE HISTORY */ 81@/* */ 82@/* DATE NAME DESCRIPTION */ 83@/* */ 84@/* 09-30-2020 William E. Lamie Initial Version 6.1 */ 85@/* 03-08-2023 Cindy Deng Modified comment(s), added */ 86@/* #include tx_user.h, */ 87@/* resulting in version 6.2.1 */ 88@/* */ 89@/**************************************************************************/ 90@UINT _tx_thread_interrupt_control(UINT new_posture) 91@{ 92 .global _tx_thread_interrupt_control 93 .type _tx_thread_interrupt_control,function 94_tx_thread_interrupt_control: 95@ 96@ /* Pickup current interrupt lockout posture. */ 97@ 98 MRS r3, CPSR @ Pickup current CPSR 99 MOV r2, #INT_MASK @ Build interrupt mask 100 AND r1, r3, r2 @ Clear interrupt lockout bits 101 ORR r1, r1, r0 @ Or-in new interrupt lockout bits 102@ 103@ /* Apply the new interrupt posture. */ 104@ 105 MSR CPSR, r1 @ Setup new CPSR 106 BIC r0, r3, r2 @ Return previous interrupt mask 107#ifdef __THUMB_INTERWORK 108 BX lr @ Return to caller 109#else 110 MOV pc, lr @ Return to caller 111#endif 112@} 113 114