source: rtems/bsps/sh/gensh4/start/cpu_asm.c @ 9964895

5
Last change on this file since 9964895 was 9964895, checked in by Sebastian Huber <sebastian.huber@…>, on 04/20/18 at 08:35:35

bsps: Move startup files to bsps

Adjust build support files to new directory layout.

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 *  This file contains the basic algorithms for all assembly code used
3 *  in an specific CPU port of RTEMS.  These algorithms must be implemented
4 *  in assembly language
5 *
6 *  NOTE:  This port uses a C file with inline assembler instructions
7 *
8 *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
9 *           Bernd Becker (becker@faw.uni-ulm.de)
10 *
11 *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
12 *
13 *  This program is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 *
18 *  COPYRIGHT (c) 1998.
19 *  On-Line Applications Research Corporation (OAR).
20 *
21 *  The license and distribution terms for this file may be
22 *  found in the file LICENSE in this distribution or at
23 *  http://www.rtems.org/license/LICENSE.
24 */
25
26/*
27 *  This is supposed to be an assembly file.  This means that system.h
28 *  and cpu.h should not be included in a "real" cpu_asm file.  An
29 *  implementation in assembly should include "cpu_asm.h"
30 */
31
32#include <rtems/system.h>
33#include <rtems/score/cpu.h>
34#include <rtems/score/isr.h>
35#include <rtems/score/threaddispatch.h>
36#include <rtems/score/sh.h>
37#include <rtems/score/ispsh7750.h>
38#include <rtems/score/iosh7750.h>
39#include <rtems/score/sh4_regs.h>
40#include <rtems/score/sh_io.h>
41
42/* from cpu_isps.c */
43extern proc_ptr         _Hardware_isr_Table[];
44
45#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
46  unsigned long    *_old_stack_ptr;
47#endif
48
49register unsigned long  *stack_ptr __asm__ ("r15");
50
51/*
52 *  This routine provides the RTEMS interrupt management.
53 */
54
55void __ISR_Handler( uint32_t   vector)
56{
57  ISR_Level level;
58
59  _ISR_Local_disable( level );
60
61   _Thread_Dispatch_disable();
62
63#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
64  if ( _ISR_Nest_level == 0 )
65    {
66      /* Install irq stack */
67      _old_stack_ptr = stack_ptr;
68      stack_ptr = _CPU_Interrupt_stack_high;
69    }
70
71#endif
72
73  _ISR_Nest_level++;
74
75  _ISR_Local_enable( level );
76
77  /* call isp */
78  if ( _ISR_Vector_table[ vector])
79    (*_ISR_Vector_table[ vector ])( vector );
80
81  _ISR_Local_disable( level );
82
83  _Thread_Dispatch_enable( _Per_CPU_Get() );
84
85  _ISR_Nest_level--;
86
87#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
88  if ( _ISR_Nest_level == 0 )
89    /* restore old stack pointer */
90    stack_ptr = _old_stack_ptr;
91#endif
92
93  _ISR_Local_enable( level );
94
95  if ( _ISR_Nest_level )
96    return;
97
98  if ( !_Thread_Dispatch_is_enabled() ) {
99    return;
100  }
101
102  if ( _Thread_Dispatch_necessary ) {
103    _Thread_Dispatch();
104  }
105}
Note: See TracBrowser for help on using the repository browser.