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 03/04/16 at 21:40:49

pc386: Add PCI UART support

  • Property mode set to 100644
File size: 3.9 KB
RevLine 
[7150f00f]1/*-------------------------------------------------------------------------+
2| This file contains the PC386 BSP startup package. It includes application,
3| board, and monitor specific initialization and configuration. The generic CPU
[6128a4a]4| dependent initialization has been performed before this routine is invoked.
[7150f00f]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| **************************************************************************
[ef37cb6]22| *  COPYRIGHT (c) 1989-2008.
[6f9c75c3]23| *  On-Line Applications Research Corporation (OAR).
24| *
25| *  The license and distribution terms for this file may be
[ba64905]26| *  found in the file LICENSE in this distribution or at
[c499856]27| *  http://www.rtems.org/license/LICENSE.
[7150f00f]28| **************************************************************************
29+--------------------------------------------------------------------------*/
30
31#include <bsp.h>
[8a7ed82]32#include <bsp/irq.h>
[71319f77]33#include <rtems/pci.h>
[ab0df696]34#include <libcpu/cpuModel.h>
35
[f770fcb]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
[6128a4a]45/*
[7cdabc49]46 * Helper to initialize the PCI Bus
[662c157]47 */
[7cdabc49]48static void bsp_pci_initialize_helper(void)
49{
50#if (BSP_IS_EDISON == 0)
[f770fcb]51  const pci_config_access_functions *pci_accessors;
[7cdabc49]52
[f770fcb]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;
[7cdabc49]58  }
[f770fcb]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");
[7cdabc49]68#endif
69}
[e3a1d425]70
[7150f00f]71/*-------------------------------------------------------------------------+
[e2a2ec60]72|         Function: bsp_start
73|      Description: Called before main is invoked.
[7150f00f]74| Global Variables: None.
75|        Arguments: None.
[6128a4a]76|          Returns: Nothing.
[7150f00f]77+--------------------------------------------------------------------------*/
[3785ed6c]78static void bsp_start_default( void )
[7150f00f]79{
[7cdabc49]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
[eff217e]88  /*
89   * Calibrate variable for 1ms-loop (see timer.c)
90   */
[7cdabc49]91#if (BSP_IS_EDISON == 0)
[eff217e]92  Calibrate_loop_1ms();
[7cdabc49]93#endif
[8a496e46]94
[67a2288]95  /*
[eb562f2]96   * Init rtems interrupt management
[67a2288]97   */
98  rtems_irq_mngt_init();
[45550867]99
[eb562f2]100  /*
101   * Init rtems exceptions management
102   */
103  rtems_exception_init_mngt();
[71319f77]104
105  /*
106   * init PCI Bios interface...
107   */
[7cdabc49]108  bsp_pci_initialize_helper();
[1c5ebc5]109
[356b2c23]110  /*
111   * Probe for UARTs on PCI. One of these may end up as the console.
112   */
113  pci_uart_probe();
114
[c3c57b1]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
[7cdabc49]124#if (BSP_IS_EDISON == 0)
[8a7ed82]125  Clock_driver_install_handler();
[7cdabc49]126#endif
[8a7ed82]127
[93546b8]128#if BSP_ENABLE_IDE
[45550867]129  bsp_ide_cmdline_init();
[93546b8]130#endif
[1c5ebc5]131
[3785ed6c]132} /* bsp_start_default */
[45544f0]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.