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

4.104.114.84.95
Last change on this file since 94a86c40 was 94a86c40, checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/00 at 15:18:20

Per suggestions of Eric Valette <valette@…> and Jay
Kulpinski <jskulpin@…>, the bsp_specs now defines
USE_ENHANCED_INTR_API and powerpc/shared/include/bsp.h uses that
to enable its tm27 support.

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