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

4.104.114.84.95
Last change on this file since df49c60 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/00 at 15:00:15

Merged from 4.5.0-beta3a

  • Property mode set to 100644
File size: 3.1 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 <rtems.h>
16#include <console.h>
17#include <libcpu/io.h>
18#include <clockdrv.h>
19#include <bsp/vectors.h>
20
21/*
22 *  confdefs.h overrides for this BSP:
23 *   - termios serial ports (defaults to 1)
24 *   - Interrupt stack space is not minimum if defined.
25 */
26
27/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */
28#define CONFIGURE_INTERRUPT_STACK_MEMORY  (16 * 1024)
29 
30#ifndef ASM
31#define outport_byte(port,value) outb(value,port)
32#define outport_word(port,value) outw(value,port)
33#define outport_long(port,value) outl(value,port)
34
35#define inport_byte(port,value) (value = inb(port))
36#define inport_word(port,value) (value = inw(port))
37#define inport_long(port,value) (value = inl(port))
38/*
39 * Vital Board data Start using DATA RESIDUAL
40 */
41/*
42 * Total memory using RESIDUAL DATA
43 */
44extern unsigned int BSP_mem_size;
45/*
46 * PCI Bus Frequency
47 */
48extern unsigned int BSP_bus_frequency;
49/*
50 * processor clock frequency
51 */
52extern unsigned int BSP_processor_frequency;
53/*
54 * Time base divisior (how many tick for 1 second).
55 */
56extern unsigned int BSP_time_base_divisor;
57
58#define BSP_Convert_decrementer( _value ) \
59  ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value)))
60
61extern rtems_configuration_table  BSP_Configuration;
62extern void BSP_panic(char *s);
63extern void rtemsReboot(void);
64extern int printk(const char *, ...) __attribute__((format(printf, 1, 2)));
65extern int BSP_disconnect_clock_handler (void);
66extern int BSP_connect_clock_handler (void);
67
68/*
69 *  TM27 stuff
70 */
71
72#if defined(USE_ENHANCED_INTR_API) && defined(RTEMS_TM27)
73
74#include <bsp/irq.h>
75
76#define MUST_WAIT_FOR_INTERRUPT 1
77
78void nullFunc() {}
79static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
80                                              0,
81                                              (rtems_irq_enable)nullFunc,
82                                              (rtems_irq_disable)nullFunc,
83                                              (rtems_irq_is_enabled) nullFunc};
84void Install_tm27_vector(void (*_handler)())
85{
86  clockIrqData.hdl = _handler;
87  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
88        printk("Error installing clock interrupt handler!\n");
89        rtems_fatal_error_occurred(1);
90  }
91}
92
93#define Cause_tm27_intr()  \
94  do { \
95    unsigned32 _clicks = 8; \
96    asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
97  } while (0)
98
99
100#define Clear_tm27_intr() \
101  do { \
102    unsigned32 _clicks = 0xffffffff; \
103    asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
104  } while (0)
105
106#define Lower_tm27_intr() \
107  do { \
108    unsigned32 _msr = 0; \
109    _ISR_Set_level( 0 ); \
110    asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
111    _msr |=  0x8002; \
112    asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
113  } while (0)
114#endif
115
116
117#endif
118
119#endif
Note: See TracBrowser for help on using the repository browser.