source: rc_os_nios2/atk2-sc1_1.3.2/target/nios2_dev_gcc/target_hw_counter.h@ 128

Last change on this file since 128 was 128, checked in by ertl-honda, 9 years ago

追加.

File size: 7.6 KB
Line 
1/*
2 * TOPPERS ATK2
3 * Toyohashi Open Platform for Embedded Real-Time Systems
4 * Automotive Kernel Version 2
5 *
6 * Copyright (C) 2008-2015 by Center for Embedded Computing Systems
7 * Graduate School of Information Science, Nagoya Univ., JAPAN
8 * Copyright (C) 2011-2015 by FUJI SOFT INCORPORATED, JAPAN
9 * Copyright (C) 2011-2013 by Spansion LLC, USA
10 * Copyright (C) 2011-2015 by NEC Communication Systems, Ltd., JAPAN
11 * Copyright (C) 2011-2015 by Panasonic Advanced Technology Development Co., Ltd., JAPAN
12 * Copyright (C) 2011-2014 by Renesas Electronics Corporation, JAPAN
13 * Copyright (C) 2011-2015 by Sunny Giken Inc., JAPAN
14 * Copyright (C) 2011-2015 by TOSHIBA CORPORATION, JAPAN
15 * Copyright (C) 2011-2015 by Witz Corporation
16 * Copyright (C) 2014-2015 by AISIN COMCRUISE Co., Ltd., JAPAN
17 * Copyright (C) 2014-2015 by eSOL Co.,Ltd., JAPAN
18 * Copyright (C) 2014-2015 by SCSK Corporation, JAPAN
19 *
20 * 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
21 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
22 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
23 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
24 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
25 * スコード中に含まれていること.
26 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
27 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
28 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
29 * の無保証規定を掲載すること.
30 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
31 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
32 * と.
33 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
34 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
35 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
36 * 報告すること.
37 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
38 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
39 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
40 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
41 * 免責すること.
42 *
43 * 本ソフトウェアは,AUTOSAR(AUTomotive Open System ARchitecture)仕
44 * 様に基づいている.上記の許諾は,AUTOSARの知的財産権を許諾するもので
45 * はない.AUTOSARは,AUTOSAR仕様に基づいたソフトウェアを商用目的で利
46 * 用する者に対して,AUTOSARパートナーになることを求めている.
47 *
48 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
49 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
50 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
51 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
52 * の責任を負わない.
53 *
54 * $Id: target_hw_counter.h 1801 2015-03-27 06:34:43Z t_ishikawa $
55 */
56
57/*
58 * ハードウェアカウンタのターゲット依存定義(NIOS2_DEV用)
59 */
60
61#ifndef TOPPERS_TARGET_HW_COUNTER_H
62#define TOPPERS_TARGET_HW_COUNTER_H
63
64/*
65 * カウンタ最大値
66 */
67#define MAX_TIMER_CNT ((uint32) 0xFFFFFFFF)
68
69/*
70 * カウンタ周期最大値
71 */
72#define MAX_CNT_CYCLE ((uint32) 0x7FFFFFFF)
73
74/*
75 * タイマハードウェア依存のベース定義
76 */
77#ifdef TOPPERS_NIOS2_DEV_2S180
78
79/*
80 * タイマークロック周波数(Hz)50MHz
81 */
82#define TIMER_CLOCK_HZ ((uint32) 50000000)
83
84/*
85 * NIOS2_DEV_2S180 用の定義割込み番号
86 */
87#define TIMER_0_IRQ UINT_C(16)
88#define TIMER_1_IRQ UINT_C(17)
89#define TIMER_2_IRQ UINT_C(18)
90#define TIMER_3_IRQ UINT_C(19)
91#define TIMER_4_IRQ UINT_C(20)
92#define TIMER_5_IRQ UINT_C(21)
93#define TIMER_6_IRQ UINT_C(22)
94#define TIMER_7_IRQ UINT_C(23)
95#define TIMER_8_IRQ UINT_C(24)
96#define TIMER_9_IRQ UINT_C(25)
97#define TIMER_10_IRQ UINT_C(26)
98#define TIMER_11_IRQ UINT_C(27)
99#define TIMER_12_IRQ UINT_C(28)
100#define TIMER_13_IRQ UINT_C(29)
101#define TIMER_14_IRQ UINT_C(30)
102#define TIMER_15_IRQ UINT_C(31)
103
104/*
105 * NIOS2_DEV_2S180 用の定義タイマレジスタベース
106 */
107#define TIMER_BASE(INTNO) (UINT_C(0x01001020) + (UINT_C(0x20) * ((INTNO) - UINT_C(16))))
108
109#elif defined(TOPPERS_NIOS2_DEV_DE2_115) || defined(TOPPERS_NIOS2_DEV_DE0_NANO)
110
111/*
112 * タイマークロック周波数(Hz)60MHz
113 */
114#define TIMER_CLOCK_HZ ((uint32) 60000000)
115
116/*
117 * NIOS2_DEV_DE2_115 用の定義割込み番号
118 */
119#define TIMER_0_IRQ UINT_C(16)
120#define TIMER_1_IRQ UINT_C(17)
121#define TIMER_2_IRQ UINT_C(18)
122#define TIMER_3_IRQ UINT_C(19)
123#define TIMER_4_IRQ UINT_C(20)
124#define TIMER_5_IRQ UINT_C(21)
125#define TIMER_6_IRQ UINT_C(22)
126#define TIMER_7_IRQ UINT_C(23)
127#define TIMER_8_IRQ UINT_C(24)
128#define TIMER_9_IRQ UINT_C(25)
129#define TIMER_10_IRQ UINT_C(26)
130#define TIMER_11_IRQ UINT_C(27)
131#define TIMER_12_IRQ UINT_C(28)
132#define TIMER_13_IRQ UINT_C(29)
133#define TIMER_14_IRQ UINT_C(30)
134#define TIMER_15_IRQ UINT_C(31)
135
136/*
137 * NIOS2_DEV_DE2_115 用の定義タイマレジスタベース
138 */
139#define TIMER_BASE(INTNO) (UINT_C(0x08000000) + (UINT_C(0x00000020) * (INTNO)))
140
141#else /* TOPPERS_NIOS2_DEV_2S180/TOPPERS_NIOS2_DEV_DE2_115 */
142
143/* それ以外のターゲット定義 */
144#endif /* TOPPERS_NIOS2_DEV_2S180/TOPPERS_NIOS2_DEV_DE2_115 */
145
146/*
147 * タイマcontrolレジスタのビット定義
148 */
149#define TIMER_CONTROL_ITO (UINT_C(0x00000001))
150#define TIMER_CONTROL_CONT (UINT_C(0x00000002))
151#define TIMER_CONTROL_START (UINT_C(0x00000004))
152#define TIMER_CONTROL_STOP (UINT_C(0x00000008))
153
154/*
155 * TIMER関連レジスタ定義
156 */
157#define TIMER_STATUS(INTNO) (TIMER_BASE(INTNO) + UINT_C(0x00000000))
158#define TIMER_CONTROL(INTNO) (TIMER_BASE(INTNO) + UINT_C(0x00000004))
159#define TIMER_PERIODL(INTNO) (TIMER_BASE(INTNO) + UINT_C(0x00000008))
160#define TIMER_PERIODH(INTNO) (TIMER_BASE(INTNO) + UINT_C(0x0000000C))
161#define TIMER_SNAPL(INTNO) (TIMER_BASE(INTNO) + UINT_C(0x00000010))
162#define TIMER_SNAPH(INTNO) (TIMER_BASE(INTNO) + UINT_C(0x00000014))
163
164/* MAIN_HW_COUNTERの定義 */
165extern void init_hwcounter_MAIN_HW_COUNTER(TickType maxval, TimeType nspertick);
166extern void start_hwcounter_MAIN_HW_COUNTER(void);
167extern void stop_hwcounter_MAIN_HW_COUNTER(void);
168extern void set_hwcounter_MAIN_HW_COUNTER(TickType exprtick);
169extern TickType get_hwcounter_MAIN_HW_COUNTER(void);
170extern void cancel_hwcounter_MAIN_HW_COUNTER(void);
171extern void trigger_hwcounter_MAIN_HW_COUNTER(void);
172extern void int_clear_hwcounter_MAIN_HW_COUNTER(void);
173extern void int_cancel_hwcounter_MAIN_HW_COUNTER(void);
174extern void increment_hwcounter_MAIN_HW_COUNTER(void);
175
176/* SUB_HW_COUNTER1の定義 */
177extern void init_hwcounter_SUB_HW_COUNTER1(TickType maxval, TimeType nspertick);
178extern void start_hwcounter_SUB_HW_COUNTER1(void);
179extern void stop_hwcounter_SUB_HW_COUNTER1(void);
180extern void set_hwcounter_SUB_HW_COUNTER1(TickType exprtick);
181extern TickType get_hwcounter_SUB_HW_COUNTER1(void);
182extern void cancel_hwcounter_SUB_HW_COUNTER1(void);
183extern void trigger_hwcounter_SUB_HW_COUNTER1(void);
184extern void int_clear_hwcounter_SUB_HW_COUNTER1(void);
185extern void int_cancel_hwcounter_SUB_HW_COUNTER1(void);
186extern void increment_hwcounter_SUB_HW_COUNTER1(void);
187
188/* SUB_HW_COUNTER2の定義 */
189extern void init_hwcounter_SUB_HW_COUNTER2(TickType maxval, TimeType nspertick);
190extern void start_hwcounter_SUB_HW_COUNTER2(void);
191extern void stop_hwcounter_SUB_HW_COUNTER2(void);
192extern void set_hwcounter_SUB_HW_COUNTER2(TickType exprtick);
193extern TickType get_hwcounter_SUB_HW_COUNTER2(void);
194extern void cancel_hwcounter_SUB_HW_COUNTER2(void);
195extern void trigger_hwcounter_SUB_HW_COUNTER2(void);
196extern void int_clear_hwcounter_SUB_HW_COUNTER2(void);
197extern void int_cancel_hwcounter_SUB_HW_COUNTER2(void);
198extern void increment_hwcounter_SUB_HW_COUNTER2(void);
199
200/*
201 * 10msと一致するティック値(サンプルプログラム用)
202 */
203#define TICK_FOR_10MS TIMER_CLOCK_HZ / 100
204
205#endif /* TOPPERS_TARGET_HW_COUNTER_H */
Note: See TracBrowser for help on using the repository browser.