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.rtems.com/license/LICENSE. |
---|
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 <rtems/clockdrv.h> |
---|
49 | #include <rtems/console.h> |
---|
50 | #include <bspopts.h> |
---|
51 | |
---|
52 | #include "rtems/score/sh7750_regs.h" |
---|
53 | |
---|
54 | /* |
---|
55 | * confdefs.h overrides for this BSP: |
---|
56 | * - number of termios serial ports (defaults to 1) |
---|
57 | * - Interrupt stack space is not minimum if defined. |
---|
58 | */ |
---|
59 | |
---|
60 | /* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */ |
---|
61 | #define CONFIGURE_INTERRUPT_STACK_MEMORY (4 * 1024) |
---|
62 | |
---|
63 | /* |
---|
64 | * Define the time limits for RTEMS Test Suite test durations. |
---|
65 | * Long test and short test duration limits are provided. These |
---|
66 | * values are in seconds and need to be converted to ticks for the |
---|
67 | * application. |
---|
68 | * |
---|
69 | */ |
---|
70 | |
---|
71 | #define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ |
---|
72 | |
---|
73 | /* |
---|
74 | * Stuff for Time Test 27 |
---|
75 | */ |
---|
76 | |
---|
77 | #define MUST_WAIT_FOR_INTERRUPT 1 |
---|
78 | |
---|
79 | #ifndef SH7750_EVT_WDT_ITI |
---|
80 | # error "..." |
---|
81 | #endif |
---|
82 | |
---|
83 | #define Install_tm27_vector( handler ) \ |
---|
84 | { \ |
---|
85 | rtems_isr_entry old_handler; \ |
---|
86 | rtems_status_code status; \ |
---|
87 | status = rtems_interrupt_catch( (handler), \ |
---|
88 | SH7750_EVT_TO_NUM(SH7750_EVT_WDT_ITI), &old_handler); \ |
---|
89 | if (status != RTEMS_SUCCESSFUL) \ |
---|
90 | printf("Status of rtems_interrupt_catch = %d", status); \ |
---|
91 | } |
---|
92 | |
---|
93 | #define Cause_tm27_intr() \ |
---|
94 | { \ |
---|
95 | *(volatile uint16_t*)SH7750_IPRB |= 0xf000; \ |
---|
96 | *(volatile uint16_t*)SH7750_WTCSR = SH7750_WTCSR_KEY; \ |
---|
97 | *(volatile uint16_t*)SH7750_WTCNT = SH7750_WTCNT_KEY | 0xfe; \ |
---|
98 | *(volatile uint16_t*)SH7750_WTCSR = \ |
---|
99 | SH7750_WTCSR_KEY | SH7750_WTCSR_TME; \ |
---|
100 | } |
---|
101 | |
---|
102 | #define Clear_tm27_intr() \ |
---|
103 | { \ |
---|
104 | *(volatile uint16_t*)SH7750_WTCSR = SH7750_WTCSR_KEY; \ |
---|
105 | } |
---|
106 | |
---|
107 | #define Lower_tm27_intr() \ |
---|
108 | { \ |
---|
109 | sh_set_interrupt_level((SH7750_IPRB & 0xf000) << SH4_SR_IMASK_S); \ |
---|
110 | } |
---|
111 | |
---|
112 | /* Constants */ |
---|
113 | |
---|
114 | /* |
---|
115 | * Simple spin delay in microsecond units for device drivers. |
---|
116 | * This is very dependent on the clock speed of the target. |
---|
117 | */ |
---|
118 | |
---|
119 | #define delay( microseconds ) CPU_delay(microseconds) |
---|
120 | #define sh_delay( microseconds ) CPU_delay( microseconds ) |
---|
121 | |
---|
122 | /* |
---|
123 | * Defined in the linker script 'linkcmds' |
---|
124 | */ |
---|
125 | |
---|
126 | extern uint32_t HeapStart ; |
---|
127 | extern uint32_t HeapEnd ; |
---|
128 | extern uint32_t WorkSpaceStart ; |
---|
129 | extern uint32_t WorkSpaceEnd ; |
---|
130 | |
---|
131 | extern void *CPU_Interrupt_stack_low ; |
---|
132 | extern void *CPU_Interrupt_stack_high ; |
---|
133 | |
---|
134 | /* |
---|
135 | * Defined in start.S |
---|
136 | */ |
---|
137 | extern uint32_t boot_mode; |
---|
138 | #define SH4_BOOT_MODE_FLASH 0 |
---|
139 | #define SH4_BOOT_MODE_IPL 1 |
---|
140 | |
---|
141 | /* miscellaneous stuff assumed to exist */ |
---|
142 | |
---|
143 | extern rtems_configuration_table BSP_Configuration; |
---|
144 | |
---|
145 | extern void bsp_cleanup( void ); |
---|
146 | |
---|
147 | /* |
---|
148 | * Device Driver Table Entries |
---|
149 | */ |
---|
150 | |
---|
151 | /* |
---|
152 | * We redefine CONSOLE_DRIVER_TABLE_ENTRY to redirect /dev/console |
---|
153 | */ |
---|
154 | #undef CONSOLE_DRIVER_TABLE_ENTRY |
---|
155 | #define CONSOLE_DRIVER_TABLE_ENTRY \ |
---|
156 | { console_initialize, console_open, console_close, \ |
---|
157 | console_read, console_write, console_control } |
---|
158 | |
---|
159 | /* |
---|
160 | * NOTE: Use the standard Clock driver entry |
---|
161 | */ |
---|
162 | |
---|
163 | #ifdef __cplusplus |
---|
164 | } |
---|
165 | #endif |
---|
166 | |
---|
167 | #endif |
---|
168 | /* end of include file */ |
---|