Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:01

0001 /*
0002  *  This file contains the basic algorithms for all assembly code used
0003  *  in an specific CPU port of RTEMS.  These algorithms must be implemented
0004  *  in assembly language
0005  *
0006  *  NOTE:  This port uses a C file with inline assembler instructions
0007  *
0008  *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
0009  *           Bernd Becker (becker@faw.uni-ulm.de)
0010  *
0011  *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
0012  *
0013  *  This program is distributed in the hope that it will be useful,
0014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0016  *
0017  *
0018  *  COPYRIGHT (c) 1998.
0019  *  On-Line Applications Research Corporation (OAR).
0020  *
0021  *  The license and distribution terms for this file may be
0022  *  found in the file LICENSE in this distribution or at
0023  *  http://www.rtems.org/license/LICENSE.
0024  */
0025 
0026 /*
0027  *  This is supposed to be an assembly file.  This means that system.h
0028  *  and cpu.h should not be included in a "real" cpu_asm file.  An
0029  *  implementation in assembly should include "cpu_asm.h"
0030  */
0031 
0032 #include <rtems/score/cpu.h>
0033 #include <rtems/score/isr.h>
0034 #include <rtems/score/threaddispatch.h>
0035 #include <rtems/score/sh.h>
0036 #include <rtems/score/ispsh7750.h>
0037 #include <rtems/score/iosh7750.h>
0038 #include <rtems/score/sh4_regs.h>
0039 #include <rtems/score/sh_io.h>
0040 
0041 unsigned long *_old_stack_ptr;
0042 
0043 register unsigned long  *stack_ptr __asm__ ("r15");
0044 
0045 /*
0046  *  This routine provides the RTEMS interrupt management.
0047  */
0048 
0049 void __ISR_Handler( uint32_t   vector)
0050 {
0051   ISR_Level level;
0052 
0053   _ISR_Local_disable( level );
0054 
0055    _Thread_Dispatch_disable();
0056 
0057   if ( _ISR_Nest_level == 0 )
0058     {
0059       /* Install irq stack */
0060       _old_stack_ptr = stack_ptr;
0061       stack_ptr = _CPU_Interrupt_stack_high;
0062     }
0063 
0064   _ISR_Nest_level++;
0065 
0066   _ISR_Local_enable( level );
0067 
0068   /* call isp */
0069   if ( _ISR_Vector_table[ vector])
0070     (*_ISR_Vector_table[ vector ])( vector );
0071 
0072   _ISR_Local_disable( level );
0073 
0074   _Thread_Dispatch_enable( _Per_CPU_Get() );
0075 
0076   _ISR_Nest_level--;
0077 
0078   if ( _ISR_Nest_level == 0 )
0079     /* restore old stack pointer */
0080     stack_ptr = _old_stack_ptr;
0081 
0082   _ISR_Local_enable( level );
0083 
0084   if ( _ISR_Nest_level )
0085     return;
0086 
0087   if ( !_Thread_Dispatch_is_enabled() ) {
0088     return;
0089   }
0090 
0091   if ( _Thread_Dispatch_necessary ) {
0092     _Thread_Dispatch();
0093   }
0094 }