1 | /* bsp.h |
---|
2 | * |
---|
3 | * This include file contains all Papyrus board IO definitions. |
---|
4 | * |
---|
5 | * Author: Andrew Bray <andy@i-cubed.co.uk> |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1995 by i-cubed ltd. |
---|
8 | * |
---|
9 | * To anyone who acknowledges that this file is provided "AS IS" |
---|
10 | * without any express or implied warranty: |
---|
11 | * permission to use, copy, modify, and distribute this file |
---|
12 | * for any purpose is hereby granted without fee, provided that |
---|
13 | * the above copyright notice and this notice appears in all |
---|
14 | * copies, and that the name of i-cubed limited not be used in |
---|
15 | * advertising or publicity pertaining to distribution of the |
---|
16 | * software without specific, written prior permission. |
---|
17 | * i-cubed limited makes no representations about the suitability |
---|
18 | * of this software for any purpose. |
---|
19 | * |
---|
20 | * Derived from c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h |
---|
21 | * |
---|
22 | * COPYRIGHT (c) 1989-1999. |
---|
23 | * On-Line Applications Research Corporation (OAR). |
---|
24 | * |
---|
25 | * The license and distribution terms for this file may be |
---|
26 | * found in found in the file LICENSE in this distribution or at |
---|
27 | * http://www.rtems.com/license/LICENSE. |
---|
28 | * |
---|
29 | * $Id$ |
---|
30 | */ |
---|
31 | |
---|
32 | #ifndef __PAPYRUS_h |
---|
33 | #define __PAPYRUS_h |
---|
34 | |
---|
35 | #ifdef __cplusplus |
---|
36 | extern "C" { |
---|
37 | #endif |
---|
38 | |
---|
39 | #include <bspopts.h> |
---|
40 | |
---|
41 | /* |
---|
42 | * confdefs.h overrides for this BSP: |
---|
43 | * - termios serial ports (defaults to 1) |
---|
44 | * - Interrupt stack space is not minimum if defined. |
---|
45 | */ |
---|
46 | |
---|
47 | /* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */ |
---|
48 | #define CONFIGURE_INTERRUPT_STACK_MEMORY (12 * 1024) |
---|
49 | |
---|
50 | #ifdef ASM |
---|
51 | /* Definition of where to store registers in alignment handler */ |
---|
52 | #define ALIGN_REGS 0x0140 |
---|
53 | |
---|
54 | #else |
---|
55 | #include <rtems.h> |
---|
56 | #include <console.h> |
---|
57 | #include <libcpu/io.h> |
---|
58 | #include <clockdrv.h> |
---|
59 | #include <iosupp.h> |
---|
60 | #include <bsp/vectors.h> |
---|
61 | |
---|
62 | /* |
---|
63 | * Stuff for Time Test 27 |
---|
64 | */ |
---|
65 | #if defined(RTEMS_TM27) |
---|
66 | |
---|
67 | #include <bsp/irq.h> |
---|
68 | |
---|
69 | #define MUST_WAIT_FOR_INTERRUPT 1 |
---|
70 | |
---|
71 | /* #define Install_tm27_vector( _handler ) \ |
---|
72 | set_vector( (_handler), PPC_IRQ_DECREMENTER, 1 ) */ |
---|
73 | |
---|
74 | void nullFunc() {} |
---|
75 | static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER, |
---|
76 | 0, |
---|
77 | (rtems_irq_enable)nullFunc, |
---|
78 | (rtems_irq_disable)nullFunc, |
---|
79 | (rtems_irq_is_enabled) nullFunc}; |
---|
80 | |
---|
81 | void Install_tm27_vector(void (*_handler)()) |
---|
82 | { |
---|
83 | clockIrqData.hdl = _handler; |
---|
84 | if (!BSP_install_rtems_irq_handler (&clockIrqData)) { |
---|
85 | printk("Error installing clock interrupt handler!\n"); |
---|
86 | rtems_fatal_error_occurred(1); |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | |
---|
91 | #define Cause_tm27_intr() \ |
---|
92 | do { \ |
---|
93 | unsigned32 _clicks = 1; \ |
---|
94 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
95 | } while (0) |
---|
96 | |
---|
97 | |
---|
98 | #define Clear_tm27_intr() \ |
---|
99 | do { \ |
---|
100 | unsigned32 _clicks = 0xffffffff; \ |
---|
101 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
102 | } while (0) |
---|
103 | |
---|
104 | #define Lower_tm27_intr() \ |
---|
105 | do { \ |
---|
106 | unsigned32 _msr = 0; \ |
---|
107 | _ISR_Set_level( 0 ); \ |
---|
108 | asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
109 | _msr |= 0x8002; \ |
---|
110 | asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
111 | } while (0) |
---|
112 | #endif |
---|
113 | |
---|
114 | /* Constants */ |
---|
115 | |
---|
116 | /* |
---|
117 | * Device Driver Table Entries |
---|
118 | */ |
---|
119 | |
---|
120 | /* |
---|
121 | * NOTE: Use the standard Console driver entry |
---|
122 | */ |
---|
123 | |
---|
124 | /* |
---|
125 | * NOTE: Use the standard Clock driver entry |
---|
126 | */ |
---|
127 | |
---|
128 | |
---|
129 | /* |
---|
130 | * Information placed in the linkcmds file. |
---|
131 | */ |
---|
132 | |
---|
133 | extern int RAM_END; |
---|
134 | extern int end; /* last address in the program */ |
---|
135 | |
---|
136 | |
---|
137 | #define BSP_Convert_decrementer( _value ) ( (unsigned long long) _value ) |
---|
138 | |
---|
139 | /* functions */ |
---|
140 | |
---|
141 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
142 | rtems_isr_entry handler, /* isr routine */ |
---|
143 | rtems_vector_number vector, /* vector number */ |
---|
144 | int type /* RTEMS or RAW intr */ |
---|
145 | ); |
---|
146 | |
---|
147 | void bsp_cleanup( void ); |
---|
148 | |
---|
149 | extern rtems_configuration_table BSP_Configuration; /* owned by BSP */ |
---|
150 | extern rtems_cpu_table Cpu_table; /* owned by BSP */ |
---|
151 | |
---|
152 | #endif /* ASM */ |
---|
153 | |
---|
154 | #ifdef __cplusplus |
---|
155 | } |
---|
156 | #endif |
---|
157 | |
---|
158 | #endif |
---|
159 | /* end of include file */ |
---|