source: rtems/c/src/exec/score/cpu/m68k/cpu.c @ f4b7e297

4.104.114.84.95
Last change on this file since f4b7e297 was f4b7e297, checked in by Joel Sherrill <joel.sherrill@…>, on 12/02/96 at 19:43:22

Update from Chris Johns <cjohns@…> to add better support for
68000 class CPUs.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 *  Motorola MC68xxx Dependent Source
3 *
4 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
5 *  On-Line Applications Research Corporation (OAR).
6 *  All rights assigned to U.S. Government, 1994.
7 *
8 *  This material may be reproduced by or for the U.S. Government pursuant
9 *  to the copyright license under the clause at DFARS 252.227-7013.  This
10 *  notice must appear in all copies of this file and its derivatives.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/isr.h>
17
18/*  _CPU_Initialize
19 *
20 *  This routine performs processor dependent initialization.
21 *
22 *  INPUT PARAMETERS:
23 *    cpu_table       - CPU table to initialize
24 *    thread_dispatch - entry pointer to thread dispatcher
25 *
26 *  OUTPUT PARAMETERS: NONE
27 */
28
29void _CPU_Initialize(
30  rtems_cpu_table  *cpu_table,
31  void      (*thread_dispatch)      /* ignored on this CPU */
32)
33{
34#if ( M68K_HAS_VBR == 0 )
35  /* fill the isr redirect table with the code to place the format/id
36     onto the stack */
37
38  unsigned32 slot;
39
40  for (slot = 0; slot < CPU_INTERRUPT_NUMBER_OF_VECTORS; slot++)
41  {
42    _CPU_ISR_jump_table[slot].move_a7 = M68K_MOVE_A7;
43    _CPU_ISR_jump_table[slot].format_id = slot << 2;
44    _CPU_ISR_jump_table[slot].jmp = M68K_JMP;
45    _CPU_ISR_jump_table[slot].isr_handler = (unsigned32) 0xDEADDEAD;
46  }
47#endif /* M68K_HAS_VBR */
48
49  _CPU_Table = *cpu_table;
50}
51
52/*PAGE
53 *
54 *  _CPU_ISR_Get_level
55 */
56 
57unsigned32 _CPU_ISR_Get_level( void )
58{
59  unsigned32 level;
60
61  m68k_get_interrupt_level( level );
62
63  return level;
64}
65
66/*PAGE
67 *
68 *  _CPU_ISR_install_raw_handler
69 */
70 
71void _CPU_ISR_install_raw_handler(
72  unsigned32  vector,
73  proc_ptr    new_handler,
74  proc_ptr   *old_handler
75)
76{
77  proc_ptr *interrupt_table = NULL;
78
79  m68k_get_vbr( interrupt_table );
80
81  *old_handler = interrupt_table[ vector ];
82
83#if ( M68K_HAS_VBR == 1 )
84  interrupt_table[ vector ] = new_handler;
85#else
86  _CPU_ISR_jump_table[vector].isr_handler = (unsigned32) new_handler;
87  interrupt_table[ vector ] = (proc_ptr) &_CPU_ISR_jump_table[vector];
88#endif /* M68K_HAS_VBR */
89}
90
91/*PAGE
92 *
93 *  _CPU_ISR_install_vector
94 *
95 *  This kernel routine installs the RTEMS handler for the
96 *  specified vector.
97 *
98 *  Input parameters:
99 *    vector      - interrupt vector number
100 *    new_handler - replacement ISR for this vector number
101 *    old_handler - former ISR for this vector number
102 *
103 *  Output parameters:  NONE
104 */
105
106void _CPU_ISR_install_vector(
107  unsigned32  vector,
108  proc_ptr    new_handler,
109  proc_ptr   *old_handler
110)
111{
112  proc_ptr ignored;
113
114  *old_handler = _ISR_Vector_table[ vector ];
115
116  _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
117
118  _ISR_Vector_table[ vector ] = new_handler;
119}
120
121
122/*PAGE
123 *
124 *  _CPU_Install_interrupt_stack
125 */
126
127void _CPU_Install_interrupt_stack( void )
128{
129#if ( M68K_HAS_SEPARATE_STACKS == 1 )
130  void *isp = _CPU_Interrupt_stack_high;
131
132  asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) );
133#else
134#warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!"
135#endif
136}
137
138#if ( M68K_HAS_BFFFO != 1 )
139/*
140 * Returns table for duplication of the BFFFO instruction (16 bits only)
141 */
142const unsigned char __BFFFOtable[256] = {
143    8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
144    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
145    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
146    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
147    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
148    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
149    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
150    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
151    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
152    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
153    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
154    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
155    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
156    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
157    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
158    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
159};
160#endif
Note: See TracBrowser for help on using the repository browser.