source: ssp_qb_r5f100le_cs/trunk/target/cq_frk_fm3_gcc/MB9BF618T.h

Last change on this file was 95, checked in by nmir-saito, 9 years ago

ファイルの mime-type 変更

  • Property svn:mime-type set to text/plain; charset=shift_jis
File size: 13.5 KB
Line 
1/*
2 * TOPPERS/SSP Kernel
3 * Smallest Set Profile Kernel
4 *
5 * Copyright (C) 2012 Meika Sugimoto
6 *
7 * 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
8 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
9 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
10 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
11 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
12 * スコード中に含まれていること.
13 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
14 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
15 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
16 * の無保証規定を掲載すること.
17 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
18 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
19 * と.
20 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
21 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
22 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
23 * 報告すること.
24 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
25* 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
26 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
27 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
28 * 免責すること.
29 *
30 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
31 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
32 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
33 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
34 * の責任を負わない.
35 *
36 */
37
38#ifndef TOPPERS_MB9BF618T_H
39#define TOPPERS_MB9BF618T_H
40
41/*
42 * CORTEX-M3 CPUの依存部のインクルード
43 */
44#include "arm_m_gcc/arm_m.h"
45
46/*
47 * プロセッサのエンディアン定義
48 * MB9BF618Tはリトルエンディアン
49 */
50#define SIL_ENDIAN_LITTLE
51
52
53/*
54 * 割込み番号の最大値
55 */
56#define TMAX_INTNO (16 + 48)
57
58/*
59 * 割込み優先度のビット幅
60 */
61#define TBITW_IPRI (4)
62
63
64/*
65 * 割込みベクタ番号定義
66 */
67#define INT_FCS (16)
68#define INT_LVD (17)
69#define INT_SW_WDT (18)
70#define INT_MFT (19)
71#define INT_EXTI0TO7 (20)
72#define INT_EXT_8TO31 (21)
73#define INT_DUALTMR_QPRC (22)
74#define INT_MFS0_RX (23)
75#define INT_MFS0_TX (24)
76#define INT_MFS1_RX (25)
77#define INT_MFS1_TX (26)
78#define INT_MFS2_RX (27)
79#define INT_MFS2_TX (28)
80#define INT_MFS3_RX (29)
81#define INT_MFS3_TX (30)
82#define INT_MFS4_RX (31)
83#define INT_MFS4_TX (32)
84#define INT_MFS5_RX (33)
85#define INT_MFS5_TX (34)
86#define INT_MFS6_RX (35)
87#define INT_MFS6_TX (36)
88#define INT_MFS7_RX (37)
89#define INT_MFS7_TX (38)
90#define INT_PPG (39)
91#define INT_CLK_CNT (40)
92#define INT_AD0 (41)
93#define INT_AD1 (42)
94#define INT_AD2 (43)
95#define INT_BASETMR_0TO7 (44)
96#define INT_MFT_FREERUN (45)
97#define INT_MFT_INCAPTURE (46)
98#define INT_OUTCOMPARE (47)
99#define INT_CAN0_ETH0 (48)
100#define INT_CAN1_ETH1 (49)
101#define INT_USB0_FNC (50)
102#define INT_USB0_FNCHOST (51)
103#define INT_USB1_FNC (52)
104#define INT_USB1_FNCHOST (53)
105#define INT_DMA0 (54)
106#define INT_DMA1 (55)
107#define INT_DMA2 (56)
108#define INT_DMA3 (57)
109#define INT_DMA4 (58)
110#define INT_DMA5 (59)
111#define INT_DMA6 (60)
112#define INT_DMA7 (61)
113#define INT_BASETMR_8TO15 (62)
114#define INT_RESERVE (63)
115
116
117/*
118 * 割込み優先度ビット幅中のサブ優先度のビット幅
119 */
120#define TBITW_SUBIPRI 0
121
122
123/* MB9BF618Tのペリフェラルレジスタ定義 */
124
125/* BUS:AHB */
126#define AHBPERIPH_BASE (0x40000000)
127
128#define FLASHIF_BASE (AHBPERIPH_BASE + 0x0000)
129
130/* BUS:APB0 */
131#define APB0PERIPH_BASE (0x40010000)
132
133#define CLOCKRESET_BASE (APB0PERIPH_BASE + 0x0000)
134#define HW_WDT_BASE (APB0PERIPH_BASE + 0x1000)
135#define SW_WDT_BASE (APB0PERIPH_BASE + 0x2000)
136#define DUALTMR_BASE (APB0PERIPH_BASE + 0x5000)
137
138/* BUS:APB1 */
139#define APB1PERIPH_BASE (0x40020000)
140#define MFT0_BASE (APB1PERIPH_BASE + 0x0000)
141#define MFT1_BASE (APB1PERIPH_BASE + 0x1000)
142#define PPG_BASE (APB1PERIPH_BASE + 0x4000)
143#define BASETMR_BASE (APB1PERIPH_BASE + 0x5000)
144#define QUADCNT_BASE (APB1PERIPH_BASE + 0x5000)
145#define ADCONV_BASE (APB1PERIPH_BASE + 0x7000)
146#define HSPDCR_TRIM_BASE (APB1PERIPH_BASE + 0xE000)
147
148/* BUS:APB2 */
149#define APB2PERIPH_BASE (0x40030000)
150#define EXTI_BASE (APB2PERIPH_BASE + 0x0000)
151#define INTREQ_BASE (APB2PERIPH_BASE + 0x1000)
152#define GPIO_BASE (APB2PERIPH_BASE + 0x3000)
153#define LVD_BASE (APB2PERIPH_BASE + 0x5000)
154#define DSTBY_MODE_BASE (APB2PERIPH_BASE + 0x5800)
155#define USBCLK_BASE (APB2PERIPH_BASE + 0x6000)
156#define CAN_PRESCL_BASE (APB2PERIPH_BASE + 0x7000)
157#define MFS_BASE (APB2PERIPH_BASE + 0x8000)
158#define CRC_BASE (APB2PERIPH_BASE + 0x9000)
159#define WATCHCNT_BASE (APB2PERIPH_BASE + 0xA000)
160#define RTC_BASE (APB2PERIPH_BASE + 0xB000)
161#define EXTBUS_BASE (APB2PERIPH_BASE + 0xF000)
162
163/* BUS:AHB */
164#define USB_CH0_BASE (AHBPERIPH_BASE + 0x40000)
165#define USB_CH1_BASE (AHBPERIPH_BASE + 0x50000)
166#define DMAC_BASE (AHBPERIPH_BASE + 0x60000)
167#define CAN_CH0_BASE (AHBPERIPH_BASE + 0x62000)
168#define CAN_CH1_BASE (AHBPERIPH_BASE + 0x63000)
169#define ETH0_BASE (AHBPERIPH_BASE + 0x64000)
170#define ETHSYS_BASE (AHBPERIPH_BASE + 0x66000)
171#define ETH1_BASE (AHBPERIPH_BASE + 0x67000)
172
173#define FLASHIF_WORK_BASE (0x200E0000)
174
175/* クロック/リセット関連のレジスタ */
176#define SCM_CTL (CLOCKRESET_BASE + 0x0000)
177#define SCM_STR (CLOCKRESET_BASE + 0x0004)
178#define STB_CTL (CLOCKRESET_BASE + 0x0008) /* 4byte access */
179#define RST_STR (CLOCKRESET_BASE + 0x000C) /* 2byte access */
180#define BSC_PSR (CLOCKRESET_BASE + 0x0010)
181#define APBC0_PSR (CLOCKRESET_BASE + 0x0014)
182#define APBC1_PSR (CLOCKRESET_BASE + 0x0018)
183#define APBC2_PSR (CLOCKRESET_BASE + 0x001C)
184#define TTC_PSR (CLOCKRESET_BASE + 0x0028)
185#define CSW_PSR (CLOCKRESET_BASE + 0x0030)
186#define PSW_TMR (CLOCKRESET_BASE + 0x0034)
187#define PLL_CTL1 (CLOCKRESET_BASE + 0x0038)
188#define PLL_CTL2 (CLOCKRESET_BASE + 0x003C)
189#define INT_ENR (CLOCKRESET_BASE + 0x0060)
190#define INT_STR (CLOCKRESET_BASE + 0x0064)
191#define INT_CLR (CLOCKRESET_BASE + 0x0068)
192
193/* SCM_CTL , SCM_STRのビット割当て */
194#define SCM_CTL_RCS_HIGHCR (0 << 5)
195#define SCM_CTL_RCS_MAINCLK (1 << 5)
196#define SCM_CTL_RCS_PLLCLK (2 << 5)
197#define SCM_CTL_RCS_LOWCR (4 << 5)
198#define SCM_CTL_RCS_SUBCLK (5 << 5)
199#define SCM_CTL_RCS_MASK (7 << 5)
200
201#define SCM_CTL_MOSCE (1 << 1)
202#define SCM_CTL_SOSCE (1 << 3)
203#define SCM_CTL_PLLE (1 << 4)
204#define SCM_STR_MORDY (1 << 1)
205#define SCM_STR_SOSCE (1 << 3)
206#define SCM_STR_PLRDY (1 << 4)
207
208/* クロック分周比設定値 */
209#define BSC_CLK_DIV_1 (0)
210#define BSC_CLK_DIV_2 (1)
211#define BSC_CLK_DIV_3 (2)
212#define BSC_CLK_DIV_4 (3)
213#define BSC_CLK_DIV_6 (4)
214#define BSC_CLK_DIV_8 (5)
215#define BSC_CLK_DIV_16 (6)
216
217/* APBクロック制御設定値 */
218#define APBC_EN (1 << 7)
219#define APBC_RESET (1 << 4)
220
221/* クロック分周比設定値 */
222#define APB_CLK_DIV_1 (0)
223#define APB_CLK_DIV_2 (1)
224#define APB_CLK_DIV_4 (2)
225#define APB_CLK_DIV_8 (3)
226
227
228/* クロック関連割込みのビット割当て */
229#define INT_CLL_MCS (1 << 0)
230#define INT_CLL_SCS (1 << 1)
231#define INT_CLL_PCS (1 << 2)
232#define INT_CLL_FCS (1 << 5)
233
234/* CSW_TMRのビット割当て */
235#define PSW_TMR_MOWT_CONF0 (0 << 0) /* 2^1 / FCRH */
236#define PSW_TMR_MOWT_CONF1 (1 << 0) /* 2^5 / FCRH */
237#define PSW_TMR_MOWT_CONF2 (2 << 0) /* 2^6 / FCRH */
238#define PSW_TMR_MOWT_CONF3 (3 << 0) /* 2^7 / FCRH */
239#define PSW_TMR_MOWT_CONF4 (4 << 0) /* 2^8 / FCRH */
240#define PSW_TMR_MOWT_CONF5 (5 << 0) /* 2^9 / FCRH */
241#define PSW_TMR_MOWT_CONF6 (6 << 0) /* 2^10 / FCRH */
242#define PSW_TMR_MOWT_CONF7 (7 << 0) /* 2^11 / FCRH */
243#define PSW_TMR_MOWT_CONF8 (8 << 0) /* 2^12 / FCRH */
244#define PSW_TMR_MOWT_CONF9 (9 << 0) /* 2^13 / FCRH */
245#define PSW_TMR_MOWT_CONF10 (10 << 0) /* 2^14 / FCRH */
246#define PSW_TMR_MOWT_CONF11 (11 << 0) /* 2^16 / FCRH */
247#define PSW_TMR_MOWT_CONF12 (12 << 0) /* 2^17 / FCRH */
248#define PSW_TMR_MOWT_CONF13 (13 << 0) /* 2^19 / FCRH */
249#define PSW_TMR_MOWT_CONF14 (14 << 0) /* 2^21 / FCRH */
250#define PSW_TMR_MOWT_CONF15 (15 << 0) /* 2^23 / FCRH */
251
252/* PSW_TMRのビット割当て */
253#define PSW_TMR_PINC_MO (0 << 4)
254#define PSW_TMR_PINC_CR (1 << 4)
255#define PSW_TMR_POWT_CONF0 (0 << 0) /* 2^9 / FCRH */
256#define PSW_TMR_POWT_CONF1 (1 << 0) /* 2^10 / FCRH */
257#define PSW_TMR_POWT_CONF2 (2 << 0) /* 2^11 / FCRH */
258#define PSW_TMR_POWT_CONF3 (3 << 0) /* 2^12 / FCRH */
259#define PSW_TMR_POWT_CONF4 (4 << 0) /* 2^13 / FCRH */
260#define PSW_TMR_POWT_CONF5 (5 << 0) /* 2^14 / FCRH */
261#define PSW_TMR_POWT_CONF6 (6 << 0) /* 2^15 / FCRH */
262#define PSW_TMR_POWT_CONF7 (7 << 0) /* 2^16 / FCRH */
263
264/* PLL_CTL1 , PLL_CTL2のビット割当て */
265#define PLL_CTL1_PLLK(n) (((n) - 1) << 4)
266#define PLL_CTL1_PLLM(n) (((n) - 1) << 0)
267#define PLL_CTL2_PLLN(n) (((n) - 1) << 0)
268
269/* WDT */
270#define WDG_CTL (HW_WDT_BASE + 0x0008)
271#define WDG_LCK (HW_WDT_BASE + 0x0C00)
272
273#define WDG_RESDIS (0 << 1)
274#define WDG_RESENA (1 << 1)
275#define WDG_RESINTDIS (0 << 0)
276#define WDG_RESINTENA (1 << 0)
277
278#define WDG_UNLOCK_VAL (0x1ACCE551)
279
280/* MFS(Multi Functional Serial */
281#define MFS_BASEADDR(ch) (MFS_BASE + ((ch) * 0x0100))
282
283#define MFS_SMR(ch) (MFS_BASEADDR((ch)) + 0x00)
284#define MFS_SCR(ch) (MFS_BASEADDR((ch)) + 0x01)
285#define MFS_ESCR(ch) (MFS_BASEADDR((ch)) + 0x04)
286#define MFS_SSR(ch) (MFS_BASEADDR((ch)) + 0x05)
287#define MFS_RDRTDR(ch) (MFS_BASEADDR((ch)) + 0x08) /* 2byte access */
288#define MFS_BGR0(ch) (MFS_BASEADDR((ch)) + 0x0C)
289#define MFS_BGR1(ch) (MFS_BASEADDR((ch)) + 0x0D)
290#define MFS_FCR0(ch) (MFS_BASEADDR((ch)) + 0x14)
291#define MFS_FCR1(ch) (MFS_BASEADDR((ch)) + 0x15)
292
293/* GPIO */
294#define BITMAP_0 (1 << 0)
295#define BITMAP_1 (1 << 1)
296#define BITMAP_2 (1 << 2)
297#define BITMAP_3 (1 << 3)
298#define BITMAP_4 (1 << 4)
299#define BITMAP_5 (1 << 5)
300#define BITMAP_6 (1 << 6)
301#define BITMAP_7 (1 << 7)
302
303/* #define GPIO_BASE (APB2PERIPH_BASE + 0x3000) */
304#define PFR0 (GPIO_BASE + 0x0000)
305#define PFR1 (GPIO_BASE + 0x0004)
306#define PFR2 (GPIO_BASE + 0x0008)
307#define PFR3 (GPIO_BASE + 0x000C)
308#define PFR4 (GPIO_BASE + 0x0010)
309#define PFR5 (GPIO_BASE + 0x0014)
310#define PFR6 (GPIO_BASE + 0x0018)
311#define PFR7 (GPIO_BASE + 0x001C)
312#define PFR8 (GPIO_BASE + 0x0020)
313#define PFR9 (GPIO_BASE + 0x0024)
314#define PFRA (GPIO_BASE + 0x0028)
315#define PFRB (GPIO_BASE + 0x002C)
316#define PFRC (GPIO_BASE + 0x0030)
317#define PFRD (GPIO_BASE + 0x0034)
318#define PFRE (GPIO_BASE + 0x0038)
319#define PFRF (GPIO_BASE + 0x003C)
320
321#define PDDR0 (GPIO_BASE + 0x0200)
322#define PDDR1 (GPIO_BASE + 0x0204)
323#define PDDR2 (GPIO_BASE + 0x0208)
324#define PDDR3 (GPIO_BASE + 0x020C)
325#define PDDR4 (GPIO_BASE + 0x0210)
326#define PDDR5 (GPIO_BASE + 0x0214)
327#define PDDR6 (GPIO_BASE + 0x0218)
328#define PDDR7 (GPIO_BASE + 0x021C)
329#define PDDR8 (GPIO_BASE + 0x0220)
330#define PDDR9 (GPIO_BASE + 0x0224)
331#define PDDRA (GPIO_BASE + 0x0228)
332#define PDDRB (GPIO_BASE + 0x022C)
333#define PDDRC (GPIO_BASE + 0x0230)
334#define PDDRD (GPIO_BASE + 0x0234)
335#define PDDRE (GPIO_BASE + 0x0238)
336#define PDDRF (GPIO_BASE + 0x023C)
337
338#define PDIR0 (GPIO_BASE + 0x0300)
339#define PDIR1 (GPIO_BASE + 0x0304)
340#define PDIR2 (GPIO_BASE + 0x0308)
341#define PDIR3 (GPIO_BASE + 0x030C)
342#define PDIR4 (GPIO_BASE + 0x0310)
343#define PDIR5 (GPIO_BASE + 0x0314)
344#define PDIR6 (GPIO_BASE + 0x0318)
345#define PDIR7 (GPIO_BASE + 0x031C)
346#define PDIR8 (GPIO_BASE + 0x0320)
347#define PDIR9 (GPIO_BASE + 0x0324)
348#define PDIRA (GPIO_BASE + 0x0328)
349#define PDIRB (GPIO_BASE + 0x032C)
350#define PDIRC (GPIO_BASE + 0x0330)
351#define PDIRD (GPIO_BASE + 0x0334)
352#define PDIRE (GPIO_BASE + 0x0338)
353#define PDIRF (GPIO_BASE + 0x033C)
354
355#define PDOR0 (GPIO_BASE + 0x0400)
356#define PDOR1 (GPIO_BASE + 0x0404)
357#define PDOR2 (GPIO_BASE + 0x0408)
358#define PDOR3 (GPIO_BASE + 0x040C)
359#define PDOR4 (GPIO_BASE + 0x0410)
360#define PDOR5 (GPIO_BASE + 0x0414)
361#define PDOR6 (GPIO_BASE + 0x0418)
362#define PDOR7 (GPIO_BASE + 0x041C)
363#define PDOR8 (GPIO_BASE + 0x0420)
364#define PDOR9 (GPIO_BASE + 0x0424)
365#define PDORA (GPIO_BASE + 0x0428)
366#define PDORB (GPIO_BASE + 0x042C)
367#define PDORC (GPIO_BASE + 0x0430)
368#define PDORD (GPIO_BASE + 0x0434)
369#define PDORE (GPIO_BASE + 0x0438)
370#define PDORF (GPIO_BASE + 0x043C)
371
372#define EPFR0 (GPIO_BASE + 0x0600)
373#define EPFR1 (GPIO_BASE + 0x0604)
374#define EPFR2 (GPIO_BASE + 0x0608)
375#define EPFR3 (GPIO_BASE + 0x060C)
376#define EPFR4 (GPIO_BASE + 0x0610)
377#define EPFR5 (GPIO_BASE + 0x0614)
378#define EPFR6 (GPIO_BASE + 0x0618)
379#define EPFR7 (GPIO_BASE + 0x061C)
380#define EPFR8 (GPIO_BASE + 0x0620)
381#define EPFR9 (GPIO_BASE + 0x0624)
382#define EPFRA (GPIO_BASE + 0x0628)
383#define EPFRB (GPIO_BASE + 0x062C)
384#define EPFRC (GPIO_BASE + 0x0630)
385#define EPFRD (GPIO_BASE + 0x0634)
386#define EPFRE (GPIO_BASE + 0x0638)
387#define EPFRF (GPIO_BASE + 0x063C)
388
389#define PCR0 (GPIO_BASE + 0x0100)
390#define PCR1 (GPIO_BASE + 0x0104)
391
392
393#define ADE (GPIO_BASE + 0x0500)
394
395#endif /* TOPPERS_MB9BF618T_H */
Note: See TracBrowser for help on using the repository browser.