OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [shared/] [include/] [bsp.h] - Blame information for rev 562

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: bsp.h,v 1.2 2001-09-27 12:01:06 chris Exp $
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
 */
44
extern unsigned int BSP_mem_size;
45
/*
46
 * PCI Bus Frequency
47
 */
48
extern unsigned int BSP_bus_frequency;
49
/*
50
 * processor clock frequency
51
 */
52
extern unsigned int BSP_processor_frequency;
53
/*
54
 * Time base divisior (how many tick for 1 second).
55
 */
56
extern 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
 
61
extern rtems_configuration_table  BSP_Configuration;
62
extern void BSP_panic(char *s);
63
extern void rtemsReboot(void);
64
extern int printk(const char *, ...) __attribute__((format(printf, 1, 2)));
65
extern int BSP_disconnect_clock_handler (void);
66
extern 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
 
78
void nullFunc() {}
79
static 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};
84
void 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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.