1 | /*-------------------------------------------------------------------------+ |
---|
2 | | This file contains the PC386 BSP startup package. It includes application, |
---|
3 | | board, and monitor specific initialization and configuration. The generic CPU |
---|
4 | | dependent initialization has been performed before this routine is invoked. |
---|
5 | +--------------------------------------------------------------------------+ |
---|
6 | | (C) Copyright 1997 - |
---|
7 | | - NavIST Group - Real-Time Distributed Systems and Industrial Automation |
---|
8 | | |
---|
9 | | http://pandora.ist.utl.pt |
---|
10 | | |
---|
11 | | Instituto Superior Tecnico * Lisboa * PORTUGAL |
---|
12 | +--------------------------------------------------------------------------+ |
---|
13 | | Disclaimer: |
---|
14 | | |
---|
15 | | This file is provided "AS IS" without warranty of any kind, either |
---|
16 | | expressed or implied. |
---|
17 | +--------------------------------------------------------------------------+ |
---|
18 | | This code is based on: |
---|
19 | | bspstart.c,v 1.8 1996/05/28 13:12:40 joel Exp - go32 BSP |
---|
20 | | With the following copyright notice: |
---|
21 | | ************************************************************************** |
---|
22 | | * COPYRIGHT (c) 1989-2008. |
---|
23 | | * On-Line Applications Research Corporation (OAR). |
---|
24 | | * |
---|
25 | | * The license and distribution terms for this file may be |
---|
26 | | * found in the file LICENSE in this distribution or at |
---|
27 | | * http://www.rtems.org/license/LICENSE. |
---|
28 | | ************************************************************************** |
---|
29 | +--------------------------------------------------------------------------*/ |
---|
30 | |
---|
31 | #include <bsp.h> |
---|
32 | #include <bsp/irq.h> |
---|
33 | #include <rtems/pci.h> |
---|
34 | #include <libcpu/cpuModel.h> |
---|
35 | |
---|
36 | /* |
---|
37 | * Helper to initialize the PCI Bus |
---|
38 | */ |
---|
39 | static void bsp_pci_initialize_helper(void) |
---|
40 | { |
---|
41 | #if (BSP_IS_EDISON == 0) |
---|
42 | int pci_init_retval; |
---|
43 | |
---|
44 | pci_init_retval = pci_initialize(); |
---|
45 | if (pci_init_retval != PCIB_ERR_SUCCESS) { |
---|
46 | printk("PCI bus: could not initialize PCI BIOS interface\n"); |
---|
47 | } |
---|
48 | #endif |
---|
49 | } |
---|
50 | |
---|
51 | /*-------------------------------------------------------------------------+ |
---|
52 | | Function: bsp_start |
---|
53 | | Description: Called before main is invoked. |
---|
54 | | Global Variables: None. |
---|
55 | | Arguments: None. |
---|
56 | | Returns: Nothing. |
---|
57 | +--------------------------------------------------------------------------*/ |
---|
58 | static void bsp_start_default( void ) |
---|
59 | { |
---|
60 | /* |
---|
61 | * Turn off watchdog |
---|
62 | */ |
---|
63 | #if (BSP_IS_EDISON == 1) |
---|
64 | volatile uint32_t *edison_wd = (volatile uint32_t *)0xff009000; |
---|
65 | *edison_wd = 0x11f8; |
---|
66 | #endif |
---|
67 | |
---|
68 | |
---|
69 | /* |
---|
70 | * Calibrate variable for 1ms-loop (see timer.c) |
---|
71 | */ |
---|
72 | #if (BSP_IS_EDISON == 0) |
---|
73 | Calibrate_loop_1ms(); |
---|
74 | #endif |
---|
75 | |
---|
76 | /* |
---|
77 | * Init rtems interrupt management |
---|
78 | */ |
---|
79 | rtems_irq_mngt_init(); |
---|
80 | |
---|
81 | /* |
---|
82 | * Init rtems exceptions management |
---|
83 | */ |
---|
84 | rtems_exception_init_mngt(); |
---|
85 | |
---|
86 | /* |
---|
87 | * init PCI Bios interface... |
---|
88 | */ |
---|
89 | bsp_pci_initialize_helper(); |
---|
90 | |
---|
91 | #if (BSP_IS_EDISON == 0) |
---|
92 | Clock_driver_install_handler(); |
---|
93 | #endif |
---|
94 | |
---|
95 | #if BSP_ENABLE_IDE |
---|
96 | bsp_ide_cmdline_init(); |
---|
97 | #endif |
---|
98 | |
---|
99 | } /* bsp_start_default */ |
---|
100 | |
---|
101 | /* |
---|
102 | * By making this a weak alias for bsp_start_default, a brave soul |
---|
103 | * can override the actual bsp_start routine used. |
---|
104 | */ |
---|
105 | void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); |
---|