source: rtems/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @ 364866d

Last change on this file since 364866d was 364866d, checked in by Joel Sherrill <joel@…>, on Mar 16, 2016 at 12:36:41 AM

pc386: Do not include rtems/pci.h from bsp.h. Add bsp/bspimpl.h

Start to migrate private symbols to bsp/bspimpl.h.

  • 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/bspimpl.h>
31#include <bsp/irq.h>
32#include <rtems/pci.h>
33#include <libcpu/cpuModel.h>
34
35/*
36 * PCI Bus Configuration
37 */
38rtems_pci_config_t BSP_pci_configuration = {
39  (volatile unsigned char*)0,
40  (volatile unsigned char*)0,
41  NULL
42};
43
44/*
45 * Helper to initialize the PCI Bus
46 */
47static void bsp_pci_initialize_helper(void)
48{
49#if (BSP_IS_EDISON == 0)
50  const pci_config_access_functions *pci_accessors;
51
52  pci_accessors = pci_bios_initialize();
53  if (pci_accessors != NULL) {
54    printk("PCI bus: using PCI BIOS interface\n");
55    BSP_pci_configuration.pci_functions = pci_accessors;
56    return;
57  }
58
59  pci_accessors = pci_io_initialize();
60  if (pci_accessors != NULL) {
61    printk("PCI bus: using PCI I/O interface\n");
62    BSP_pci_configuration.pci_functions = pci_accessors;
63    return;
64  }
65
66  printk("PCI bus: could not initialize PCI BIOS interface\n");
67#endif
68}
69
70/*-------------------------------------------------------------------------+
71|         Function: bsp_start
72|      Description: Called before main is invoked.
73| Global Variables: None.
74|        Arguments: None.
75|          Returns: Nothing.
76+--------------------------------------------------------------------------*/
77static void bsp_start_default( void )
78{
79  /*
80   * Turn off watchdog
81   */
82#if (BSP_IS_EDISON == 1)
83  volatile uint32_t *edison_wd = (volatile uint32_t *)0xff009000;
84  *edison_wd = 0x11f8;
85#endif
86
87  /*
88   * Calibrate variable for 1ms-loop (see timer.c)
89   */
90#if (BSP_IS_EDISON == 0)
91  Calibrate_loop_1ms();
92#endif
93
94  /*
95   * Init rtems interrupt management
96   */
97  rtems_irq_mngt_init();
98
99  /*
100   * Init rtems exceptions management
101   */
102  rtems_exception_init_mngt();
103
104  /*
105   * init PCI Bios interface...
106   */
107  bsp_pci_initialize_helper();
108
109  /*
110   * Probe for UARTs on PCI. One of these may end up as the console.
111   */
112  pci_uart_probe();
113
114  /*
115   * Figure out where printk() and console IO is to be directed.
116   * Do this after the PCI bus is initialized so we have a chance
117   * for those devices to be added to the set in the console driver.
118   * In general, Do it as early as possible so printk() has a chance
119   * to work early on devices found via PCI probe.
120   */
121  pc386_parse_console_arguments();
122
123#if (BSP_IS_EDISON == 0)
124  Clock_driver_install_handler();
125#endif
126
127#if BSP_ENABLE_IDE
128  bsp_ide_cmdline_init();
129#endif
130
131} /* bsp_start_default */
132
133/*
134 *  By making this a weak alias for bsp_start_default, a brave soul
135 *  can override the actual bsp_start routine used.
136 */
137void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.