source: rtems/c/src/lib/libbsp/arm/gba/startup/cpu.c @ 3c7ed6b

4.104.114.84.9
Last change on this file since 3c7ed6b was 3c7ed6b, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 6, 2005 at 6:46:04 PM

2005-07-06 Markku Puro <markku.puro@…>

  • .cvsignore, ChangeLog?, Makefile.am, README, bsp_specs, configure.ac, clock/clockdrv.c, console/conio.c, console/console.c, console/defaultfont.c, include/arm_mode_bits.h, include/asm_macros.h, include/bsp.h, include/bspopts.h.in, include/conio.h, include/gba.h, include/gba_registers.h, include/tm27.h, irq/bsp_irq_asm.S, irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, irq/irq_asm.S, irq/irq_init.c, start/logo.S, start/start.S, startup/bspstart.c, startup/cpu.c, startup/cpu_asm.S, startup/exit.c, startup/linkcmds, timer/timer.c: New files.
  • Property mode set to 100644
File size: 4.8 KB
Line 
1/**
2 *  @file cpu.c
3 *
4 *  ARM CPU Dependent Source.
5 */
6/*
7 *  RTEMS GBA BSP
8 *
9 *  COPYRIGHT (c) 2000 Canon Research Centre France SA.
10 *      Emmanuel Raguet, mailto:raguet@crf.canon.fr
11 *
12 *  Copyright (c) 2002 Advent Networks, Inc
13 *      Jay Monkman <jmonkman@adventnetworks.com>
14 *
15 *  Copyright (c) 2004
16 *      Markku Puro <markku.puro@kopteri.net>
17 *
18 *  The license and distribution terms for this file may be
19 *  found in found in the file LICENSE in this distribution or at
20 *  http://www.rtems.com/license/LICENSE.
21 *
22 *  $Id$
23 */
24#include <stdint.h>
25#include <rtems/system.h>
26#include <rtems.h>
27#include <rtems/bspIo.h>
28#include <rtems/score/isr.h>
29#include <rtems/score/wkspace.h>
30#include <rtems/score/thread.h>
31#include <rtems/score/cpu.h>
32#include <arm_mode_bits.h>
33
34/**
35 *  @brief _CPU_Initialize routine performs processor dependent initialization
36 *
37 *  @param  cpu_table CPU table to initialize
38 *  @param  thread_dispatch address of ISR disptaching routine (unused)
39 *  @return None
40 */
41void _CPU_Initialize(
42    rtems_cpu_table  *cpu_table,
43    void      (*thread_dispatch)       /* ignored on this CPU */
44)
45{
46    _CPU_Table = *cpu_table;
47}
48
49/**
50 *  @brief _CPU_ISR_Get_level returns the current interrupt level
51 *
52 *  @param  None
53 *  @return int level
54 */
55uint32_t  _CPU_ISR_Get_level( void )
56{
57    uint32_t  reg = 0; /* to avoid warning */
58
59    asm volatile ("mrs  %0, cpsr \n"        \
60                  "and  %0,  %0, #0xc0 \n"  \
61                  : "=r" (reg)              \
62                  : "0" (reg) );
63    return reg;
64}
65
66
67/**
68 *  @brief _CPU_ISR_install_vector kernel routine installs the RTEMS handler for the
69 *  specified vector
70 *
71 *  @param  vector interrupt vector number
72 *  @param  new_handler replacement ISR for this vector number
73 *  @param  old_handler pointer to store former ISR for this vector number
74 *  @return None
75 *
76 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
77 */
78extern __inline__ void _CPU_ISR_install_vector(uint32_t vector, proc_ptr new_handler, proc_ptr *old_handler);
79
80/**
81 *  @brief _CPU_Context_Initialize kernel routine initialize the specified context
82 *
83 *  @param  the_context
84 *  @param  stack_base
85 *  @param  size
86 *  @param  new_level
87 *  @param  entry_point
88 *  @param  is_fp
89 *  @return None
90 */
91void _CPU_Context_Initialize(
92  Context_Control  *the_context,
93  uint32_t         *stack_base,
94  uint32_t          size,
95  uint32_t          new_level,
96  void             *entry_point,
97  boolean           is_fp
98)
99{
100    the_context->register_sp = (uint32_t)stack_base + size ;
101    the_context->register_lr = (uint32_t)entry_point;
102    the_context->register_cpsr = new_level | ModePriv;
103}
104
105
106/**
107 *  @brief _CPU_Install_interrupt_stack function is empty since the BSP must set up the interrupt stacks.
108 *
109 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
110 */
111extern __inline__ void  _CPU_Install_interrupt_stack( void );
112
113/**
114 *  @brief _defaultExcHandler function is empty
115 *
116 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
117 */
118extern void _defaultExcHandler (CPU_Exception_frame *ctx);
119
120/**
121 *  @brief _currentExcHandler function is empty (_defaultExcHandler)
122 *
123 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
124 */
125cpuExcHandlerType _currentExcHandler = _defaultExcHandler;
126/*
127extern void _Exception_Handler_Undef_Swi();
128extern void _Exception_Handler_Abort();
129extern void _exc_data_abort();
130*/
131
132/**
133 *  @brief rtems_exception_init_mngt function is empty since the BSP must set up the interrupt stacks.
134 *
135 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
136 */
137extern __inline__ void rtems_exception_init_mngt();
138
139
140/**
141 *  @brief do_data_abort function is empty
142 *
143 *  This function figure out what caused the data abort
144 *
145 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
146 *  This function is supposed to figure out what caused the data abort, do that, then return.
147 *  All unhandled instructions cause the system to hang.
148 */
149extern __inline__ void do_data_abort(uint32_t insn, uint32_t spsr, CPU_Exception_frame *ctx);
150
151
152/* @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!  */
153/* @todo Remove dummy functions needed by linker
154 ****************************************************************************************/
155/* @cond  INCLUDE_ASM */
156asm ("  .text");
157asm ("  .arm");
158asm ("  .global _CPU_ISR_install_vector");
159asm ("_CPU_ISR_install_vector:");
160asm ("  .global _CPU_Install_interrupt_stack");
161asm ("_CPU_Install_interrupt_stack:");
162asm ("  .global _defaultExcHandler");
163asm ("_defaultExcHandler:");
164asm ("  .global rtems_exception_init_mngt");
165asm ("rtems_exception_init_mngt:");
166asm ("  .global do_data_abort");
167asm ("do_data_abort:");
168asm ("  mov pc, lr");
169/* @endcond */
170
Note: See TracBrowser for help on using the repository browser.