1 | /* |
---|
2 | * This include file contains all board IO definitions. |
---|
3 | * |
---|
4 | * generic sh4 BSP |
---|
5 | * |
---|
6 | * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia |
---|
7 | * Author: Victor V. Vengerov <vvv@oktet.ru> |
---|
8 | * |
---|
9 | * Based on work: |
---|
10 | * Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de) |
---|
11 | * |
---|
12 | * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
17 | * |
---|
18 | * |
---|
19 | * COPYRIGHT (c) 1998-2001. |
---|
20 | * On-Line Applications Research Corporation (OAR). |
---|
21 | * |
---|
22 | * The license and distribution terms for this file may be |
---|
23 | * found in the file LICENSE in this distribution or at |
---|
24 | * http://www.OARcorp.com/rtems/license.html. |
---|
25 | * |
---|
26 | * Minor adaptations for sh2 by: |
---|
27 | * John M. Mills (jmills@tga.com) |
---|
28 | * TGA Technologies, Inc. |
---|
29 | * 100 Pinnacle Way, Suite 140 |
---|
30 | * Norcross, GA 30071 U.S.A. |
---|
31 | * |
---|
32 | * This modified file may be copied and distributed in accordance |
---|
33 | * the above-referenced license. It is provided for critique and |
---|
34 | * developmental purposes without any warranty nor representation |
---|
35 | * by the authors or by TGA Technologies. |
---|
36 | * |
---|
37 | * $Id$ |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __gensh4_h |
---|
41 | #define __gensh4_h |
---|
42 | |
---|
43 | #ifdef __cplusplus |
---|
44 | extern "C" { |
---|
45 | #endif |
---|
46 | |
---|
47 | #include <rtems.h> |
---|
48 | #include <clockdrv.h> |
---|
49 | #include <console.h> |
---|
50 | #include <bspopts.h> |
---|
51 | |
---|
52 | #include "rtems/score/sh7750_regs.h" |
---|
53 | |
---|
54 | |
---|
55 | /* |
---|
56 | * confdefs.h overrides for this BSP: |
---|
57 | * - number of termios serial ports (defaults to 1) |
---|
58 | * - Interrupt stack space is not minimum if defined. |
---|
59 | */ |
---|
60 | |
---|
61 | /* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */ |
---|
62 | #define CONFIGURE_INTERRUPT_STACK_MEMORY (4 * 1024) |
---|
63 | |
---|
64 | /* |
---|
65 | * Define the time limits for RTEMS Test Suite test durations. |
---|
66 | * Long test and short test duration limits are provided. These |
---|
67 | * values are in seconds and need to be converted to ticks for the |
---|
68 | * application. |
---|
69 | * |
---|
70 | */ |
---|
71 | |
---|
72 | #define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ |
---|
73 | #define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ |
---|
74 | |
---|
75 | /* |
---|
76 | * Stuff for Time Test 27 |
---|
77 | */ |
---|
78 | |
---|
79 | #define MUST_WAIT_FOR_INTERRUPT 1 |
---|
80 | |
---|
81 | #ifndef SH7750_EVT_WDT_ITI |
---|
82 | # error "..." |
---|
83 | #endif |
---|
84 | |
---|
85 | #define Install_tm27_vector( handler ) \ |
---|
86 | { \ |
---|
87 | rtems_isr_entry old_handler; \ |
---|
88 | rtems_status_code status; \ |
---|
89 | status = rtems_interrupt_catch( (handler), \ |
---|
90 | SH7750_EVT_TO_NUM(SH7750_EVT_WDT_ITI), &old_handler); \ |
---|
91 | if (status != RTEMS_SUCCESSFUL) \ |
---|
92 | printf("Status of rtems_interrupt_catch = %d", status); \ |
---|
93 | } |
---|
94 | |
---|
95 | #define Cause_tm27_intr() \ |
---|
96 | { \ |
---|
97 | *(volatile rtems_unsigned16 *)SH7750_IPRB |= 0xf000; \ |
---|
98 | *(volatile rtems_unsigned16 *)SH7750_WTCSR = SH7750_WTCSR_KEY; \ |
---|
99 | *(volatile rtems_unsigned16 *)SH7750_WTCNT = SH7750_WTCNT_KEY | 0xfe; \ |
---|
100 | *(volatile rtems_unsigned16 *)SH7750_WTCSR = \ |
---|
101 | SH7750_WTCSR_KEY | SH7750_WTCSR_TME; \ |
---|
102 | } |
---|
103 | |
---|
104 | #define Clear_tm27_intr() \ |
---|
105 | { \ |
---|
106 | *(volatile rtems_unsigned16 *)SH7750_WTCSR = SH7750_WTCSR_KEY; \ |
---|
107 | } |
---|
108 | |
---|
109 | #define Lower_tm27_intr() \ |
---|
110 | { \ |
---|
111 | sh_set_interrupt_level((SH7750_IPRB & 0xf000) << SH4_SR_IMASK_S); \ |
---|
112 | } |
---|
113 | |
---|
114 | /* Constants */ |
---|
115 | |
---|
116 | /* |
---|
117 | * Simple spin delay in microsecond units for device drivers. |
---|
118 | * This is very dependent on the clock speed of the target. |
---|
119 | */ |
---|
120 | |
---|
121 | #define delay( microseconds ) CPU_delay(microseconds) |
---|
122 | #define sh_delay( microseconds ) CPU_delay( microseconds ) |
---|
123 | |
---|
124 | |
---|
125 | /* |
---|
126 | * Defined in the linker script 'linkcmds' |
---|
127 | */ |
---|
128 | |
---|
129 | extern unsigned32 HeapStart ; |
---|
130 | extern unsigned32 HeapEnd ; |
---|
131 | extern unsigned32 WorkSpaceStart ; |
---|
132 | extern unsigned32 WorkSpaceEnd ; |
---|
133 | |
---|
134 | extern void *CPU_Interrupt_stack_low ; |
---|
135 | extern void *CPU_Interrupt_stack_high ; |
---|
136 | |
---|
137 | /* |
---|
138 | * This variable is nesessary for console driver. |
---|
139 | */ |
---|
140 | extern rtems_unsigned32 SH4_CPU_HZ_Frequency; |
---|
141 | |
---|
142 | /* |
---|
143 | * Defined in start.S |
---|
144 | */ |
---|
145 | extern unsigned32 boot_mode; |
---|
146 | #define SH4_BOOT_MODE_FLASH 0 |
---|
147 | #define SH4_BOOT_MODE_IPL 1 |
---|
148 | |
---|
149 | /* miscellaneous stuff assumed to exist */ |
---|
150 | |
---|
151 | extern rtems_configuration_table BSP_Configuration; |
---|
152 | |
---|
153 | extern void bsp_cleanup( void ); |
---|
154 | |
---|
155 | |
---|
156 | /* |
---|
157 | * Device Driver Table Entries |
---|
158 | */ |
---|
159 | |
---|
160 | /* |
---|
161 | * We redefine CONSOLE_DRIVER_TABLE_ENTRY to redirect /dev/console |
---|
162 | */ |
---|
163 | #undef CONSOLE_DRIVER_TABLE_ENTRY |
---|
164 | #define CONSOLE_DRIVER_TABLE_ENTRY \ |
---|
165 | { console_initialize, console_open, console_close, \ |
---|
166 | console_read, console_write, console_control } |
---|
167 | |
---|
168 | /* |
---|
169 | * NOTE: Use the standard Clock driver entry |
---|
170 | */ |
---|
171 | |
---|
172 | #ifdef __cplusplus |
---|
173 | } |
---|
174 | #endif |
---|
175 | |
---|
176 | #endif |
---|
177 | /* end of include file */ |
---|