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