source: anotherchoice/tags/jsp-1.4.4-full-UTF8/config/tlcs900-toshiba/cpu_config.c

Last change on this file was 363, checked in by ykominami, 5 years ago

add tags/jsp-1.4.4-full-UTF8

  • Property svn:executable set to *
File size: 7.0 KB
Line 
1/*
2 * TOPPERS/JSP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Just Standard Profile Kernel
5 *
6 * Copyright (C) 2006-2010 by Witz Corporation, JAPAN
7 *
8 * The above copyright holders grant permission gratis to use,
9 * duplicate, modify, or redistribute (hereafter called use) this
10 * software (including the one made by modifying this software),
11 * provided that the following four conditions (1) through (4) are
12 * satisfied.
13 *
14 * (1) When this software is used in the form of source code, the above
15 * copyright notice, this use conditions, and the disclaimer shown
16 * below must be retained in the source code without modification.
17 *
18 * (2) When this software is redistributed in the forms usable for the
19 * development of other software, such as in library form, the above
20 * copyright notice, this use conditions, and the disclaimer shown
21 * below must be shown without modification in the document provided
22 * with the redistributed software, such as the user manual.
23 *
24 * (3) When this software is redistributed in the forms unusable for the
25 * development of other software, such as the case when the software
26 * is embedded in a piece of equipment, either of the following two
27 * conditions must be satisfied:
28 *
29 * (a) The above copyright notice, this use conditions, and the
30 * disclaimer shown below must be shown without modification in
31 * the document provided with the redistributed software, such as
32 * the user manual.
33 *
34 * (b) How the software is to be redistributed must be reported to the
35 * TOPPERS Project according to the procedure described
36 * separately.
37 *
38 * (4) The above copyright holders and the TOPPERS Project are exempt
39 * from responsibility for any type of damage directly or indirectly
40 * caused from the use of this software and are indemnified by any
41 * users or end users of this software from any and all causes of
42 * action whatsoever.
43 *
44 * THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
45 * THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
46 * INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
47 * PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
48 * TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
49 * INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
50 *
51 * 上記著作権者
52は,以下の (1)〜(4) の条件を満たす場合に限り,本ソフトウェ
53 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改変・
54 * 再é…
55å¸ƒï¼ˆä»¥ä¸‹ï¼Œåˆ©ç”¨ã¨å‘¼ã¶ï¼‰ã™ã‚‹ã“とを無償で許諾する.
56 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作権
57 * 表示,この利用条件および下記の無保証規定が,そのままの形でソース
58 * コード中に含まれていること.
59 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使用
60 * できる形で再é…
61å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
62å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
63マ
64 * ニュアルなど)に,上記の著作権表示,この利用条件および下記の無保
65 * 証規定を掲載すること.
66 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使用
67 * できない形で再é…
68å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこと.
69 * (a) 再é…
70å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
71マニュアルなど)に,上記の著作
72 * 権表示,この利用条件および下記の無保証規定を掲載すること.
73 * (b) 再é…
74å¸ƒã®å½¢æ…
75‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに報
76 * 告すること.
77 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損害
78 * からも,上記著作権者
79およびTOPPERSプロジェクトをå…
80è²¬ã™ã‚‹ã“と.また,
81 * 本ソフトウェアのユーザまたはエンドユーザからのいかなる理由に基づ
82 * く請求からも,上記著作権者
83およびTOPPERSプロジェクトをå…
84è²¬ã™ã‚‹ã“と.
85 *
86 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
87およ
88 * びTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的に対す
89 * る適合性も含めて,いかなる保証も行わない.また,本ソフトウェアの利用
90 * により直接的または間接的に生じたいかなる損害に関しても,その責任を負
91 * わない.
92 *
93 * @(#) $Id: cpu_config.c,v 1.1 2006/04/10 08:19:25 honda Exp $
94 */
95
96/*
97 * プロセッサ依存モジュール(TLCS-900L1用)
98 */
99
100#include "jsp_kernel.h"
101#include "check.h"
102#include "task.h"
103
104/*
105 * 割込み/CPU例外ネストカウンタ
106 */
107UINT intcnt;
108
109/*
110 * タスクコンテキストでの割込みマスク
111 */
112#ifdef SUPPORT_CHG_IPM
113UH task_intmask;
114#endif /* SUPPORT_CHG_IPM */
115
116/*
117 * 非タスクコンテキストでの割込みマスク
118 */
119UH int_intmask;
120
121/*
122 * プロセッサ依存の初期化
123 */
124void
125cpu_initialize()
126{
127 /* 割込みネストカウント初期化(割込みコンテキスト) */
128 intcnt = 1;
129
130 /*
131 * タスクコンテキストでの割込みマスクの初期化
132 */
133#ifdef SUPPORT_CHG_IPM
134 task_intmask = 0x0000;
135#endif /* SUPPORT_CHG_IPM */
136
137}
138
139/*
140 * プロセッサ依存の終了処理
141 */
142void
143cpu_terminate()
144{
145}
146
147#ifdef SUPPORT_CHG_IPM
148
149/*
150 * 割込みマスクの変更
151 *
152 * chg_ipm を使って IPM を 7(NMI 以外のすべての割込みを禁止)に変更
153 * することはできない.NMI 以外のすべての割込みを禁止したい場合には,
154 * loc_cpu によりCPUロック状æ…
155‹ã«ã™ã‚Œã°ã‚ˆã„.
156 * IPM が 0 以外の時にも,タスクディスパッチは保留されない.IPM は,
157 * タスクディスパッチによって,新しく実行状æ…
158‹ã«ãªã£ãŸã‚¿ã‚¹ã‚¯ã¸å¼•ãç¶™ãŒ
159 * れる.そのため,タスクが実行中に,別のタスクによって IPM が変更さ
160 * れる場合がある.JSPカーネルでは,IPM の変更はタスク例外処理ルーチ
161 * ンによっても起こるので,これによって扱いが難しくなる状況は少ないと
162 * 思われる.IPM の値によってタスクディスパッチを禁止したい場合には,
163 * dis_dsp を併用すればよい.
164 */
165SYSCALL ER
166chg_ipm(IPM ipm)
167{
168 ER ercd;
169
170 LOG_CHG_IPM_ENTER(ipm);
171 CHECK_TSKCTX_UNL();
172 CHECK_PAR(0 <= ipm && ipm <= 6);
173
174 t_lock_cpu();
175 task_intmask = (ipm << 12);
176 ercd = E_OK;
177 t_unlock_cpu();
178
179 exit:
180 LOG_CHG_IPM_LEAVE(ercd);
181 return(ercd);
182}
183
184/*
185 * 割込みマスクの参ç…
186§
187 */
188SYSCALL ER
189get_ipm(IPM *p_ipm)
190{
191 ER ercd;
192
193 LOG_GET_IPM_ENTER(p_ipm);
194 CHECK_TSKCTX_UNL();
195
196 t_lock_cpu();
197 *p_ipm = (task_intmask >> 12);
198 ercd = E_OK;
199 t_unlock_cpu();
200
201 exit:
202 LOG_GET_IPM_LEAVE(ercd, *p_ipm);
203 return(ercd);
204}
205
206#endif /* SUPPORT_CHG_IPM */
Note: See TracBrowser for help on using the repository browser.