source: rtems/c/src/lib/libbsp/mips/genmongoosev/startup/bspstart.c @ 58eee41

4.104.115
Last change on this file since 58eee41 was 58eee41, checked in by Joel Sherrill <joel.sherrill@…>, on 09/14/08 at 21:26:23

2008-09-14 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Split out bsp_get_work_area() into its own file and user BSP Framework to perform more initialization.
  • startup/bspgetworkarea.c: New file.
  • 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 <rtems/libio.h>
25#include <rtems/libcsupport.h>
26#include <libcpu/mongoose-v.h>
27
28extern void _sys_exit(int);
29extern void mips_install_isr_entries(void);
30extern void mips_gdb_stub_install(void);
31
32/*
33 *  bsp_start
34 *
35 *  This routine does the bulk of the system initialization.
36 */
37void bsp_start( void )
38{
39 /* mask off any interrupts */
40 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_MASK_REGISTER, 0 );
41
42 /* reset the config register & clear any pending peripheral interrupts */
43 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, 0 );
44 MONGOOSEV_WRITE(
45   MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, MONGOOSEV_UART_CMD_RESET_BOTH_PORTS );
46 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_COMMAND_REGISTER, 0 );
47
48 /* reset both timers */
49 MONGOOSEV_WRITE_REGISTER(
50   MONGOOSEV_TIMER1_BASE, MONGOOSEV_TIMER_INITIAL_COUNTER_REGISTER, 0xffffffff);
51 MONGOOSEV_WRITE_REGISTER(
52   MONGOOSEV_TIMER1_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, 0);
53
54 MONGOOSEV_WRITE_REGISTER(
55   MONGOOSEV_TIMER2_BASE, MONGOOSEV_TIMER_INITIAL_COUNTER_REGISTER, 0xffffffff);
56 MONGOOSEV_WRITE_REGISTER(
57   MONGOOSEV_TIMER2_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, 0);
58
59 /* clear any pending interrupts */
60 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_STATUS_REGISTER, 0xffffffff );
61
62 /* clear any writable bits in the cause register */
63 mips_set_cause( 0 );
64
65 /* set interrupt mask, but globally off. */
66
67 /*
68  *  Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit  9 | Bit  8 |
69  *  periph | unused |  FPU   | unused | timer2 | timer1 | swint1 | swint2 |
70  *  extern |        |        |        |        |        |        |        |
71  *
72  *    1        0        1        0        0        1        0        0
73  *
74  *    0x8C00   Enable only internal Mongoose V timers.
75  *    0xA400   Enable Peripherial ints, FPU and timer1
76  *    0x0400   Timer1 only
77  */
78
79  /* mips_set_sr( (SR_CU0 | SR_CU1 | 0xA400) ); */
80
81  /* to start up, only enable coprocessor 0 & timer int. per-task
82   * processor settings will be applied as they are created, this
83   * is just to configure the processor for startup
84   */
85  mips_set_sr( (SR_CU0 | 0x400) );
86
87  mips_install_isr_entries();
88}
89
90void clear_cache( void )
91{
92   extern void promCopyIcacheFlush(void);       /* from start.S */
93   extern void promCopyDcacheFlush(void);
94
95   promCopyIcacheFlush();
96   promCopyDcacheFlush();
97}
Note: See TracBrowser for help on using the repository browser.