summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/mcf5206elite/include/bsp.h
blob: 074e05c589669249e32d01dd023e053b720f7664 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*
 * Board Support Package for MCF5206eLITE evaluation board
 * BSP definitions
 *
 * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia
 * Author: Victor V. Vengerov <vvv@oktet.ru>
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 *
 * http://www.rtems.com/license/LICENSE.
 */

#ifndef _BSP_H
#define _BSP_H

#include "mcf5206/mcf5206e.h"

/*** Board resources allocation ***/

/*
 * To achieve some compatibility with dBUG monitor, we use the same
 * memory resources allocation as it is used in dBUG.
 *
 * If this definitions will be changed, change the linker script also.
 */

/* Memory mapping */
/* CS0: Boot Flash */
#define BSP_MEM_ADDR_FLASH    (0xFFE00000)
#define BSP_MEM_SIZE_FLASH    (1*1024*1024)
#define BSP_MEM_MASK_FLASH    (MCF5206E_CSMR_MASK_1M)

/* CS2: External SRAM */
#define BSP_MEM_ADDR_ESRAM    (0x30000000)
#define BSP_MEM_SIZE_ESRAM    (1*1024*1024)
#define BSP_MEM_MASK_ESRAM    (MCF5206E_CSMR_MASK_1M)

/* CS3: General-Purpose I/O register */
#define BSP_MEM_ADDR_GPIO     (0x40000000)
#define BSP_MEM_SIZE_GPIO     (64*1024)
#define BSP_MEM_MASK_GPIO     (MCF5206E_CSMR_MASK_64K)

/* DRAM0: Dynamic RAM */
#define BSP_MEM_ADDR_DRAM     (0x00000000)
#define BSP_MEM_SIZE_DRAM     (16*1024*1024)
#define BSP_MEM_MASK_DRAM     (MCF5206E_DCMR_MASK_16M)

/* On-chip SRAM */
#define BSP_MEM_ADDR_SRAM     (0x20000000)
#define BSP_MEM_SIZE_SRAM     (8*1024)

/* On-chip peripherial registers */
#define BSP_MEM_ADDR_IMM      (0x10000000)
#define BSP_MEM_SIZE_IMM      (1*1024)
#define MBAR BSP_MEM_ADDR_IMM

/* Interrupt vector assignment */
#define BSP_INTVEC_AVEC1    (25)
#define BSP_INTLVL_AVEC1    (1)
#define BSP_INTPRIO_AVEC1   (3)

#define BSP_INTVEC_AVEC2    (26)
#define BSP_INTLVL_AVEC2    (2)
#define BSP_INTPRIO_AVEC2   (3)

#define BSP_INTVEC_AVEC3    (27)
#define BSP_INTLVL_AVEC3    (3)
#define BSP_INTPRIO_AVEC3   (3)

#define BSP_INTVEC_AVEC4    (28)
#define BSP_INTLVL_AVEC4    (4)
#define BSP_INTPRIO_AVEC4   (3)

#define BSP_INTVEC_AVEC5    (29)
#define BSP_INTLVL_AVEC5    (5)
#define BSP_INTPRIO_AVEC5   (3)

#define BSP_INTVEC_AVEC6    (30)
#define BSP_INTLVL_AVEC6    (6)
#define BSP_INTPRIO_AVEC6   (3)

#define BSP_INTVEC_AVEC7    (31)
#define BSP_INTLVL_AVEC7    (7)
#define BSP_INTPRIO_AVEC7   (3)

#define BSP_INTVEC_TIMER1   (BSP_INTVEC_AVEC5)
#define BSP_INTLVL_TIMER1   (BSP_INTLVL_AVEC5)
#define BSP_INTPRIO_TIMER1  (2)

#define BSP_INTVEC_TIMER2    (BSP_INTVEC_AVEC6)
#define BSP_INTLVL_TIMER2    (BSP_INTLVL_AVEC6)
#define BSP_INTPRIO_TIMER2   (2)

#define BSP_INTVEC_MBUS     (BSP_INTVEC_AVEC4)
#define BSP_INTLVL_MBUS     (BSP_INTLVL_AVEC4)
#define BSP_INTPRIO_MBUS    (2)

#define BSP_INTVEC_UART1    (64)
#define BSP_INTLVL_UART1    (4)
#define BSP_INTPRIO_UART1   (0)

#define BSP_INTVEC_UART2    (65)
#define BSP_INTLVL_UART2    (4)
#define BSP_INTPRIO_UART2   (1)

#define BSP_INTVEC_DMA0     (66)
#define BSP_INTLVL_DMA0     (3)
#define BSP_INTPRIO_DMA0    (1)

#define BSP_INTVEC_DMA1     (67)
#define BSP_INTLVL_DMA1     (3)
#define BSP_INTPRIO_DMA1    (2)

/* Location of DS1307 Real-Time Clock/NVRAM chip */
#define DS1307_I2C_BUS_NUMBER (0)

#ifndef ASM

#ifdef __cplusplus
extern "C" {
#endif

#include <bspopts.h>
#include <rtems.h>
#include <rtems/console.h>
#include <rtems/iosupp.h>
#include <rtems/clockdrv.h>
#include <rtems/rtc.h>

#include "i2c.h"

/* System frequency */
#define BSP_SYSTEM_FREQUENCY ((unsigned int)&_SYS_CLOCK_FREQUENCY)
extern char _SYS_CLOCK_FREQUENCY; /* Don't use this variable directly!!! */

/* MBUS I2C bus clock default frequency */
#define BSP_MBUS_FREQUENCY (16000)

/* Number of I2C buses supported in this board */
#define I2C_NUMBER_OF_BUSES (1)

/* I2C bus selection */
#define I2C_SELECT_BUS(bus)

/*
 *  Simple spin delay in microsecond units for device drivers.
 *  This is very dependent on the clock speed of the target.
 */

#define delay( microseconds ) \
  { register uint32_t         _delay=(microseconds); \
    register uint32_t         _tmp=123; \
    __asm__ volatile( "0: \
                     nbcd      %0 ; \
                     nbcd      %0 ; \
                     dbf       %1,0b" \
                  : "=d" (_tmp), "=d" (_delay) \
                  : "0"  (_tmp), "1"  (_delay) ); \
  }


extern rtems_isr_entry M68Kvec[];   /* vector table address */

extern rtems_isr (*rtems_clock_hook)(rtems_vector_number);

/* functions */

rtems_isr_entry set_vector(
  rtems_isr_entry     handler,
  rtems_vector_number vector,
  int                 type
);

#ifdef __cplusplus
}
#endif

#endif /* ASM */

#endif