source: rtems/c/src/lib/libbsp/mips/genmongoosev/startup/bspstart.c @ 4edf8db5

4.104.115
Last change on this file since 4edf8db5 was 4edf8db5, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/16/09 at 10:09:46

2009-11-16 Ralf Corsépius <ralf.corsepius@…>

  • startup/bspstart.c: Remove nested externs. #include <libcpu/isr_entries.h.
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  This routine starts the application.  It includes application,
3 *  board, and monitor specific initialization and configuration.
4 *  The generic CPU dependent initialization has been performed
5 *  before this routine is invoked.
6 *
7 *  COPYRIGHT (c) 1989-2001.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 *
16 * Modification History:
17 *        12/10/01  A.Ferrer, NASA/GSFC, Code 582
18 *           Set interrupt mask to 0xAF00 (Line 139).
19 */
20
21#include <string.h>
22
23#include <bsp.h>
24#include <libcpu/mongoose-v.h>
25#include <libcpu/isr_entries.h>
26
27extern void _sys_exit(int);
28extern void mips_gdb_stub_install(void);
29
30/*
31 *  bsp_start
32 *
33 *  This routine does the bulk of the system initialization.
34 */
35void bsp_start( void )
36{
37 /* mask off any interrupts */
38 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_MASK_REGISTER, 0 );
39
40 /* reset the config register & clear any pending peripheral interrupts */
41 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, 0 );
42 MONGOOSEV_WRITE(
43   MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, MONGOOSEV_UART_CMD_RESET_BOTH_PORTS );
44 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, 0 );
45
46 /* reset both timers */
47 MONGOOSEV_WRITE_REGISTER(
48   MONGOOSEV_TIMER1_BASE, MONGOOSEV_TIMER_INITIAL_COUNTER_REGISTER, 0xffffffff);
49 MONGOOSEV_WRITE_REGISTER(
50   MONGOOSEV_TIMER1_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, 0);
51
52 MONGOOSEV_WRITE_REGISTER(
53   MONGOOSEV_TIMER2_BASE, MONGOOSEV_TIMER_INITIAL_COUNTER_REGISTER, 0xffffffff);
54 MONGOOSEV_WRITE_REGISTER(
55   MONGOOSEV_TIMER2_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, 0);
56
57 /* clear any pending interrupts */
58 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_STATUS_REGISTER, 0xffffffff );
59
60 /* clear any writable bits in the cause register */
61 mips_set_cause( 0 );
62
63 /* set interrupt mask, but globally off. */
64
65 /*
66  *  Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit  9 | Bit  8 |
67  *  periph | unused |  FPU   | unused | timer2 | timer1 | swint1 | swint2 |
68  *  extern |        |        |        |        |        |        |        |
69  *
70  *    1        0        1        0        0        1        0        0
71  *
72  *    0x8C00   Enable only internal Mongoose V timers.
73  *    0xA400   Enable Peripherial ints, FPU and timer1
74  *    0x0400   Timer1 only
75  */
76
77  /* mips_set_sr( (SR_CU0 | SR_CU1 | 0xA400) ); */
78
79  /* to start up, only enable coprocessor 0 & timer int. per-task
80   * processor settings will be applied as they are created, this
81   * is just to configure the processor for startup
82   */
83  mips_set_sr( (SR_CU0 | 0x400) );
84
85  mips_install_isr_entries();
86}
87
88void clear_cache( void )
89{
90   extern void promCopyIcacheFlush(void);       /* from start.S */
91   extern void promCopyDcacheFlush(void);
92
93   promCopyIcacheFlush();
94   promCopyDcacheFlush();
95}
Note: See TracBrowser for help on using the repository browser.