source: rtems/c/src/lib/libbsp/arm/gba/startup/cpu.c @ 9cc70d8

4.104.115
Last change on this file since 9cc70d8 was 9cc70d8, checked in by Joel Sherrill <joel.sherrill@…>, on 02/26/09 at 21:16:03

2009-02-26 Joel Sherrill <joel.sherrill@…>

  • startup/cpu.c: Now compiles. Does not run.
  • Property mode set to 100644
File size: 4.6 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 */
37void _CPU_Initialize(void)
38{
39}
40
41/**
42 *  @brief _CPU_ISR_Get_level returns the current interrupt level
43 *
44 *  @param  None
45 *  @return int level
46 */
47uint32_t  _CPU_ISR_Get_level( void )
48{
49    uint32_t  reg = 0; /* to avoid warning */
50
51    asm volatile ("mrs  %0, cpsr \n"        \
52                  "and  %0,  %0, #0xc0 \n"  \
53                  : "=r" (reg)              \
54                  : "0" (reg) );
55    return reg;
56}
57
58
59/**
60 *  @brief _CPU_ISR_install_vector kernel routine installs the RTEMS handler for the
61 *  specified vector
62 *
63 *  @param  vector interrupt vector number
64 *  @param  new_handler replacement ISR for this vector number
65 *  @param  old_handler pointer to store former ISR for this vector number
66 *  @return None
67 *
68 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
69 */
70extern __inline__ void _CPU_ISR_install_vector(uint32_t vector, proc_ptr new_handler, proc_ptr *old_handler);
71
72/**
73 *  @brief _CPU_Context_Initialize kernel routine initialize the specified context
74 *
75 *  @param  the_context
76 *  @param  stack_base
77 *  @param  size
78 *  @param  new_level
79 *  @param  entry_point
80 *  @param  is_fp
81 *  @return None
82 */
83void _CPU_Context_Initialize(
84  Context_Control  *the_context,
85  uint32_t         *stack_base,
86  uint32_t          size,
87  uint32_t          new_level,
88  void             *entry_point,
89  bool              is_fp
90)
91{
92    the_context->register_sp = (uint32_t)stack_base + size ;
93    the_context->register_lr = (uint32_t)entry_point;
94    the_context->register_cpsr = new_level | ModePriv;
95}
96
97
98/**
99 *  @brief _CPU_Install_interrupt_stack function is empty since the BSP must set up the interrupt stacks.
100 *
101 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
102 */
103extern __inline__ void  _CPU_Install_interrupt_stack( void );
104
105/**
106 *  @brief _defaultExcHandler function is empty
107 *
108 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
109 */
110extern void _defaultExcHandler (CPU_Exception_frame *ctx);
111
112/**
113 *  @brief _currentExcHandler function is empty (_defaultExcHandler)
114 *
115 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
116 */
117cpuExcHandlerType _currentExcHandler = _defaultExcHandler;
118/*
119extern void _Exception_Handler_Undef_Swi();
120extern void _Exception_Handler_Abort();
121extern void _exc_data_abort();
122*/
123
124/**
125 *  @brief rtems_exception_init_mngt function is empty since the BSP must set up the interrupt stacks.
126 *
127 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
128 */
129extern __inline__ void rtems_exception_init_mngt(void);
130
131
132/**
133 *  @brief do_data_abort function is empty
134 *
135 *  This function figure out what caused the data abort
136 *
137 *  @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!
138 *  This function is supposed to figure out what caused the data abort, do that, then return.
139 *  All unhandled instructions cause the system to hang.
140 */
141extern __inline__ void do_data_abort(uint32_t insn, uint32_t spsr, CPU_Exception_frame *ctx);
142
143
144/* @todo Can't use exception vectors in GBA because they are already in GBA ROM BIOS!!  */
145/* @todo Remove dummy functions needed by linker
146 ****************************************************************************************/
147/* @cond  INCLUDE_ASM */
148asm ("  .text");
149asm ("  .arm");
150asm ("  .global _CPU_ISR_install_vector");
151asm ("_CPU_ISR_install_vector:");
152asm ("  .global _CPU_Install_interrupt_stack");
153asm ("_CPU_Install_interrupt_stack:");
154asm ("  .global _defaultExcHandler");
155asm ("_defaultExcHandler:");
156asm ("  .global rtems_exception_init_mngt");
157asm ("rtems_exception_init_mngt:");
158asm ("  .global do_data_abort");
159asm ("do_data_abort:");
160asm ("  mov pc, lr");
161/* @endcond */
162
Note: See TracBrowser for help on using the repository browser.