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; 23; 24;#define TX_SOURCE_CODE 25; 26; 27;/* Include necessary system files. */ 28; 29;#include "tx_api.h" 30;#include "tx_thread.h" 31;#include "tx_timer.h" 32; 33; 34#ifdef TX_ENABLE_FIQ_SUPPORT 35DISABLE_INTS DEFINE 0xC0 ; Disable IRQ & FIQ interrupts 36#else 37DISABLE_INTS DEFINE 0x80 ; Disable IRQ interrupts 38#endif 39MODE_MASK DEFINE 0x1F ; Mode mask 40IRQ_MODE_BITS DEFINE 0x12 ; IRQ mode bits 41; 42; 43;/**************************************************************************/ 44;/* */ 45;/* FUNCTION RELEASE */ 46;/* */ 47;/* _tx_thread_irq_nesting_end ARM9/IAR */ 48;/* 6.1 */ 49;/* AUTHOR */ 50;/* */ 51;/* William E. Lamie, Microsoft Corporation */ 52;/* */ 53;/* DESCRIPTION */ 54;/* */ 55;/* This function is called by the application from IRQ mode after */ 56;/* _tx_thread_irq_nesting_start has been called and switches the IRQ */ 57;/* processing from system mode back to IRQ mode prior to the ISR */ 58;/* calling _tx_thread_context_restore. Note that this function */ 59;/* assumes the system stack pointer is in the same position after */ 60;/* nesting start function was called. */ 61;/* */ 62;/* This function assumes that the system mode stack pointer was setup */ 63;/* during low-level initialization (tx_initialize_low_level.s79). */ 64;/* */ 65;/* This function returns with IRQ interrupts disabled. */ 66;/* */ 67;/* INPUT */ 68;/* */ 69;/* None */ 70;/* */ 71;/* OUTPUT */ 72;/* */ 73;/* None */ 74;/* */ 75;/* CALLS */ 76;/* */ 77;/* None */ 78;/* */ 79;/* CALLED BY */ 80;/* */ 81;/* ISRs */ 82;/* */ 83;/* RELEASE HISTORY */ 84;/* */ 85;/* DATE NAME DESCRIPTION */ 86;/* */ 87;/* 09-30-2020 William E. Lamie Initial Version 6.1 */ 88;/* */ 89;/**************************************************************************/ 90;VOID _tx_thread_irq_nesting_end(VOID) 91;{ 92 RSEG .text:CODE:NOROOT(2) 93 PUBLIC _tx_thread_irq_nesting_end 94 CODE32 95_tx_thread_irq_nesting_end 96 MOV r3,lr ; Save ISR return address 97 MRS r0, CPSR ; Pickup the CPSR 98 ORR r0, r0, #DISABLE_INTS ; Build disable interrupt value 99 MSR CPSR_cxsf, r0 ; Disable interrupts 100 LDR lr, [sp] ; Pickup saved lr 101 ADD sp, sp, #4 ; Adjust stack pointer 102 BIC r0, r0, #MODE_MASK ; Clear mode bits 103 ORR r0, r0, #IRQ_MODE_BITS ; Build IRQ mode CPSR 104 MSR CPSR_cxsf, r0 ; Re-enter IRQ mode 105 MOV pc, r3 ; Return to ISR 106;} 107; 108; 109 END 110 111