source: rtems/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @ 356b2c23

5
Last change on this file since 356b2c23 was 356b2c23, checked in by Joel Sherrill <joel@…>, on Mar 4, 2016 at 9:40:49 PM

pc386: Add PCI UART support

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