source: rtems/cpukit/score/cpu/bfin/cpu.c @ 43e0599

4.115
Last change on this file since 43e0599 was 43e0599, checked in by Mathew Kallada <matkallada@…>, on 12/02/12 at 21:23:57

score misc: Clean up Doxygen #13 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/8013205

  • Property mode set to 100644
File size: 4.9 KB
Line 
1/**
2 * @file
3 *
4 * @brief Blackfin CPU Dependent Source
5 */
6
7/*
8 *  COPYRIGHT (c) 2006 by Atos Automacao Industrial Ltda.
9 *             written by Alain Schaefer <alain.schaefer@easc.ch>
10 *                    and Antonio Giovanini <antonio@atos.com.br>
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/wkspace.h>
24#include <rtems/score/bfin.h>
25#include <rtems/bfin/bfin.h>
26
27/*  _CPU_Initialize
28 *
29 *  This routine performs processor dependent initialization.
30 *
31 *  INPUT PARAMETERS: NONE
32 *
33 *  NO_CPU Specific Information:
34 *
35 *  XXX document implementation including references if appropriate
36 */
37
38
39extern void _ISR15_Handler(void);
40extern void _CPU_Emulation_handler(void);
41extern void _CPU_Reset_handler(void);
42extern void _CPU_NMI_handler(void);
43extern void _CPU_Exception_handler(void);
44extern void _CPU_Unhandled_Interrupt_handler(void);
45
46void _CPU_Initialize(void)
47{
48  /*
49   *  If there is not an easy way to initialize the FP context
50   *  during Context_Initialize, then it is usually easier to
51   *  save an "uninitialized" FP context here and copy it to
52   *  the task's during Context_Initialize.
53   */
54
55  /* FP context initialization support goes here */
56
57
58
59  proc_ptr ignored;
60
61#if 0
62  /* occassionally useful debug stuff */
63  int i;
64  _CPU_ISR_install_raw_handler(0, _CPU_Emulation_handler, &ignored);
65  _CPU_ISR_install_raw_handler(1, _CPU_Reset_handler, &ignored);
66  _CPU_ISR_install_raw_handler(2, _CPU_NMI_handler, &ignored);
67  _CPU_ISR_install_raw_handler(3, _CPU_Exception_handler, &ignored);
68  for (i = 5; i < 15; i++)
69    _CPU_ISR_install_raw_handler(i, _CPU_Unhandled_Interrupt_handler, &ignored);
70#endif
71
72  /* install handler that will be used to call _Thread_Dispatch */
73  _CPU_ISR_install_raw_handler( 15, _ISR15_Handler, &ignored );
74  /* enable self nesting */
75  __asm__ __volatile__ ("syscfg = %0" : : "d" (0x00000004));
76}
77
78
79
80
81/*
82 *  _CPU_ISR_Get_level
83 *
84 *  NO_CPU Specific Information:
85 *
86 *  XXX document implementation including references if appropriate
87 */
88
89uint32_t   _CPU_ISR_Get_level( void )
90{
91  /*
92   *  This routine returns the current interrupt level.
93   */
94
95    register uint32_t   _tmpimask;
96
97    /*read from the IMASK registers*/
98
99    _tmpimask = *((uint32_t*)IMASK);
100
101    return (_tmpimask & 0xffe0) ? 0 : 1;
102}
103
104/*
105 *  _CPU_ISR_install_raw_handler
106 *
107 *  NO_CPU Specific Information:
108 *
109 *  XXX document implementation including references if appropriate
110 */
111
112void _CPU_ISR_install_raw_handler(
113  uint32_t    vector,
114  proc_ptr    new_handler,
115  proc_ptr   *old_handler
116)
117{
118   proc_ptr *interrupt_table = NULL;
119  /*
120   *  This is where we install the interrupt handler into the "raw" interrupt
121   *  table used by the CPU to dispatch interrupt handlers.
122   */
123
124   /* base of vector table on blackfin architecture */
125   interrupt_table = (void*)0xFFE02000;
126
127   *old_handler = interrupt_table[ vector ];
128   interrupt_table[ vector ] = new_handler;
129
130}
131
132/*
133 *  _CPU_ISR_install_vector
134 *
135 *  This kernel routine installs the RTEMS handler for the
136 *  specified vector.
137 *
138 *  Input parameters:
139 *    vector      - interrupt vector number
140 *    old_handler - former ISR for this vector number
141 *    new_handler - replacement ISR for this vector number
142 *
143 *  Output parameters:  NONE
144 *
145 *
146 *  NO_CPU Specific Information:
147 *
148 *  XXX document implementation including references if appropriate
149 */
150
151void _CPU_ISR_install_vector(
152  uint32_t    vector,
153  proc_ptr    new_handler,
154  proc_ptr   *old_handler
155)
156{
157   proc_ptr ignored;
158
159   *old_handler = _ISR_Vector_table[ vector ];
160
161   /*
162    *  We put the actual user ISR address in '_ISR_vector_table'.  This will
163    *  be used by the _ISR_Handler so the user gets control.
164    */
165
166    _ISR_Vector_table[ vector ] = new_handler;
167
168    _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
169}
170
171#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
172void *_CPU_Thread_Idle_body(uint32_t ignored)
173{
174  while (1) {
175    __asm__ __volatile__("ssync; idle; ssync");
176  }
177}
178#endif
179
180/*
181 * Copied from the arm port.
182 */
183void _CPU_Context_Initialize(
184  Context_Control  *the_context,
185  uint32_t         *stack_base,
186  uint32_t          size,
187  uint32_t          new_level,
188  void             *entry_point,
189  bool              is_fp
190)
191{
192    uint32_t     stack_high;  /* highest "stack aligned" address */
193    stack_high = ((uint32_t)(stack_base) + size);
194
195    /* blackfin abi requires caller to reserve 12 bytes on stack */
196    the_context->register_sp = stack_high - 12;
197    the_context->register_rets = (uint32_t) entry_point;
198    the_context->imask = new_level ? 0 : 0xffff;
199}
200
201
202
203/*
204 *  _CPU_Install_interrupt_stack
205 *
206 *  NO_CPU Specific Information:
207 *
208 *  XXX document implementation including references if appropriate
209 */
210
211void _CPU_Install_interrupt_stack( void )
212{
213}
Note: See TracBrowser for help on using the repository browser.