source: rtems/c/src/lib/libbsp/mips/genmongoosev/startup/bspstart.c @ 63defa58

Last change on this file since 63defa58 was 63defa58, checked in by Jennifer Averett <jennifer.averett@…>, on 04/04/12 at 13:39:46

PR 1993 - Convert MIPS to PIC IRQ model

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