source: rtems/c/src/lib/libbsp/powerpc/shared/include/bsp.h @ 69ed59f

4.104.114.84.95
Last change on this file since 69ed59f was 69ed59f, checked in by Joel Sherrill <joel.sherrill@…>, on 05/14/02 at 17:10:17

2001-05-14 Till Straumann <strauman@…>

  • bootloader/misc.c, console/Makefile.am, console/console.c, console/consoleIo.h, console/inch.c, console/polled_io.c, console/uart.c, console/uart.h, include/bsp.h, irq/Makefile.am, irq/irq.c, irq/irq.h, irq/irq_init.c, openpic/openpic.c, openpic/openpic.h, pci/Makefile.am, pci/pci.c, pci/pci.h, residual/Makefile.am, start/start.S, startup/bspstart.c, vectors/vectors.S, vectors/vectors.h, vectors/vectors_init.c: Per PR216, "libbsp/powerpc/shared" BSP has been modified considerably with the goal to make it more flexible and reusable by other BSPs. The main strategies were:
    • eliminate hardcoded base addresses; devices use offsets and a BSP defined base address.
    • separate functionality into different files (e.g. reboot from inch.c to reboot.c) which can be overridden by a 'derived' BSP.
    • separate initialization code into separate files (e.g. PCI bridge detection/initialization was separated from the more generic PCI access routines), also to make it easier for 'derived' BSPs to substitute their own initialization code.

There are also a couple of enhancements and fixes:

  • IRQ handling code now has a hook for attaching a VME bridge.
  • OpenPIC is now explicitely initialized (polarities, senses). Eliminated the implicit assumption on the presence of an ISA PIC.
  • UART and console driver now supports more than 1 port. The current maximum of 2 can easily be extended by enlarging a table (it would even be easier if the ISR API was not broken by design).
  • fixed polled_io.c so it correctly supports console on COM2
  • fixed TLB invalidation code (start.S).
  • exception handler prints a stack backtrace.
  • added BSP_pciFindDevice() to scan the pci bus for a particular vendor/device/instance.
  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 *  bsp.h  -- contain BSP API definition.
3 *
4 *  Copyright (C) 1999 Eric Valette. valette@crf.canon.fr
5 *
6 *  The license and distribution terms for this file may be
7 *  found in found in the file LICENSE in this distribution or at
8 *  http://www.OARcorp.com/rtems/license.html.
9 *
10 * $Id$
11 */
12#ifndef LIBBSP_POWERPC_MOTOROLA_SHARED_BSP_H
13#define LIBBSP_POWERPC_MOTOROLA_SHARED_BSP_H
14
15#include <bspopts.h>
16
17#include <rtems.h>
18#include <console.h>
19#include <libcpu/io.h>
20#include <clockdrv.h>
21#include <bsp/vectors.h>
22
23/*
24 *  confdefs.h overrides for this BSP:
25 *   - termios serial ports (defaults to 1)
26 *   - Interrupt stack space is not minimum if defined.
27 */
28
29#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
30#define CONFIGURE_INTERRUPT_STACK_MEMORY  (16 * 1024)
31
32/* fundamental addresses for this BSP (PREPxxx are from libcpu/io.h) */
33#define _IO_BASE                        PREP_ISA_IO_BASE
34#define _ISA_MEM_BASE           PREP_ISA_MEM_BASE
35/* address of our ram on the PCI bus   */
36#define PCI_DRAM_OFFSET         PREP_PCI_DRAM_OFFSET
37/* offset of pci memory as seen from the CPU */
38#define PCI_MEM_BASE            PREP_ISA_MEM_BASE
39
40/*
41 *  base address definitions for several devices
42 *
43 */
44#define BSP_UART_IOBASE_COM1 ((_IO_BASE)+0x3f8)
45#define BSP_UART_IOBASE_COM2 ((_IO_BASE)+0x2f8)
46#define BSP_KBD_IOBASE       ((_IO_BASE)+0x60)
47#define BSP_VGA_IOBASE       ((_IO_BASE)+0x3c0)
48
49#define BSP_CONSOLE_PORT        BSP_UART_COM1
50#define BSP_UART_BAUD_BASE      115200
51 
52#include <bsp/openpic.h>
53#define BSP_PIC_DO_EOI openpic_eoi(0)
54
55
56#ifndef ASM
57#define outport_byte(port,value) outb(value,port)
58#define outport_word(port,value) outw(value,port)
59#define outport_long(port,value) outl(value,port)
60
61#define inport_byte(port,value) (value = inb(port))
62#define inport_word(port,value) (value = inw(port))
63#define inport_long(port,value) (value = inl(port))
64/*
65 * Vital Board data Start using DATA RESIDUAL
66 */
67/*
68 * Total memory using RESIDUAL DATA
69 */
70extern unsigned int BSP_mem_size;
71/*
72 * PCI Bus Frequency
73 */
74extern unsigned int BSP_bus_frequency;
75/*
76 * processor clock frequency
77 */
78extern unsigned int BSP_processor_frequency;
79/*
80 * Time base divisior (how many tick for 1 second).
81 */
82extern unsigned int BSP_time_base_divisor;
83
84#define BSP_Convert_decrementer( _value ) \
85  ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value)))
86
87extern rtems_configuration_table  BSP_Configuration;
88extern void BSP_panic(char *s);
89extern void rtemsReboot(void);
90/* extern int printk(const char *, ...) __attribute__((format(printf, 1, 2))); */
91extern int BSP_disconnect_clock_handler (void);
92extern int BSP_connect_clock_handler (void);
93
94/*
95 *  TM27 stuff
96 */
97
98#if defined(USE_ENHANCED_INTR_API) && defined(RTEMS_TM27)
99
100#include <bsp/irq.h>
101
102#define MUST_WAIT_FOR_INTERRUPT 1
103
104void nullFunc() {}
105static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
106                                              0,
107                                              (rtems_irq_enable)nullFunc,
108                                              (rtems_irq_disable)nullFunc,
109                                              (rtems_irq_is_enabled) nullFunc};
110void Install_tm27_vector(void (*_handler)())
111{
112  clockIrqData.hdl = _handler;
113  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
114        printk("Error installing clock interrupt handler!\n");
115        rtems_fatal_error_occurred(1);
116  }
117}
118
119#define Cause_tm27_intr()  \
120  do { \
121    unsigned32 _clicks = 8; \
122    asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
123  } while (0)
124
125
126#define Clear_tm27_intr() \
127  do { \
128    unsigned32 _clicks = 0xffffffff; \
129    asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
130  } while (0)
131
132#define Lower_tm27_intr() \
133  do { \
134    unsigned32 _msr = 0; \
135    _ISR_Set_level( 0 ); \
136    asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
137    _msr |=  0x8002; \
138    asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
139  } while (0)
140#endif
141
142
143#endif
144
145#endif
Note: See TracBrowser for help on using the repository browser.