source: rtems/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @ 2e516dd4

Last change on this file since 2e516dd4 was 2e516dd4, checked in by Joel Sherrill <joel@…>, on Mar 9, 2016 at 5:24:33 PM

pc386/startup/bspstart.c: Reformat and cleanup file header

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/**
2 * @file
3 *
4 * This file contains the PC386 BSP startup package. It includes application,
5 * board, and monitor specific initialization and configuration.
6 */
7
8/*
9 * This file was initially written by Joel Sherrill as part of the go32 BSP.
10 * It was subsequently adapted as part of the pc386 BSP by developers from
11 * the NavIST Group in 1997.
12 *
13 * COPYRIGHT (c) 1989-2008, 2016.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 *
20 * (C) Copyright 1997 -
21 * - NavIST Group - Real-Time Distributed Systems and Industrial Automation
22 * Instituto Superior Tecnico * Lisboa * PORTUGAL (http://pandora.ist.utl.pt)
23 *
24 * NavISY Disclaimer:
25 * This file is provided "AS IS" without warranty of any kind, either
26 * expressed or implied.
27 */
28
29#include <bsp.h>
30#include <bsp/irq.h>
31#include <rtems/pci.h>
32#include <libcpu/cpuModel.h>
33
34/*
35 * PCI Bus Configuration
36 */
37rtems_pci_config_t BSP_pci_configuration = {
38  (volatile unsigned char*)0,
39  (volatile unsigned char*)0,
40  NULL
41};
42
43/*
44 * Helper to initialize the PCI Bus
45 */
46static void bsp_pci_initialize_helper(void)
47{
48#if (BSP_IS_EDISON == 0)
49  const pci_config_access_functions *pci_accessors;
50
51  pci_accessors = pci_bios_initialize();
52  if (pci_accessors != NULL) {
53    printk("PCI bus: using PCI BIOS interface\n");
54    BSP_pci_configuration.pci_functions = pci_accessors;
55    return;
56  }
57
58  pci_accessors = pci_io_initialize();
59  if (pci_accessors != NULL) {
60    printk("PCI bus: using PCI I/O interface\n");
61    BSP_pci_configuration.pci_functions = pci_accessors;
62    return;
63  }
64
65  printk("PCI bus: could not initialize PCI BIOS interface\n");
66#endif
67}
68
69/*-------------------------------------------------------------------------+
70|         Function: bsp_start
71|      Description: Called before main is invoked.
72| Global Variables: None.
73|        Arguments: None.
74|          Returns: Nothing.
75+--------------------------------------------------------------------------*/
76static void bsp_start_default( void )
77{
78  /*
79   * Turn off watchdog
80   */
81#if (BSP_IS_EDISON == 1)
82  volatile uint32_t *edison_wd = (volatile uint32_t *)0xff009000;
83  *edison_wd = 0x11f8;
84#endif
85
86  /*
87   * Calibrate variable for 1ms-loop (see timer.c)
88   */
89#if (BSP_IS_EDISON == 0)
90  Calibrate_loop_1ms();
91#endif
92
93  /*
94   * Init rtems interrupt management
95   */
96  rtems_irq_mngt_init();
97
98  /*
99   * Init rtems exceptions management
100   */
101  rtems_exception_init_mngt();
102
103  /*
104   * init PCI Bios interface...
105   */
106  bsp_pci_initialize_helper();
107
108  /*
109   * Probe for UARTs on PCI. One of these may end up as the console.
110   */
111  pci_uart_probe();
112
113  /*
114   * Figure out where printk() and console IO is to be directed.
115   * Do this after the PCI bus is initialized so we have a chance
116   * for those devices to be added to the set in the console driver.
117   * In general, Do it as early as possible so printk() has a chance
118   * to work early on devices found via PCI probe.
119   */
120  pc386_parse_console_arguments();
121
122#if (BSP_IS_EDISON == 0)
123  Clock_driver_install_handler();
124#endif
125
126#if BSP_ENABLE_IDE
127  bsp_ide_cmdline_init();
128#endif
129
130} /* bsp_start_default */
131
132/*
133 *  By making this a weak alias for bsp_start_default, a brave soul
134 *  can override the actual bsp_start routine used.
135 */
136void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.