source: ssp_qb_r5f100le_cs/trunk/include/sil.h@ 93

Last change on this file since 93 was 93, checked in by nmir-saito, 8 years ago

add Combined package of SSP kernel for QB-R5F100LE-TB(RL78 processor)

File size: 7.0 KB
Line 
1/*
2 * TOPPERS Software
3 * Toyohashi Open Platform for Embedded Real-Time Systems
4 *
5 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
6 * Toyohashi Univ. of Technology, JAPAN
7 * Copyright (C) 2004-2008 by Embedded and Real-Time Systems Laboratory
8 * Graduate School of Information Science, Nagoya Univ., JAPAN
9 * Copyright (C) 2015 by Naoki Saito
10 * Nagoya Municipal Industrial Research Institute, JAPAN
11 *
12 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
13 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
14 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
15 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
16 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
17 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
18 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
19 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
20ƒƒ“ƒgi—˜—p
21 * ŽÒƒ}ƒjƒ…
22ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
23 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
24 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
25 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
26 * ‚ƁD
27 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
28ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
29ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
30 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
31 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
32 * •ñ‚·‚邱‚ƁD
33 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
34 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
35 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
36 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
37 * –Ɛӂ·‚邱‚ƁD
38 *
39 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
40 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
41 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
42 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
43 * ‚̐ӔC‚𕉂í‚È‚¢D
44 *
45 * @(#) $Id: sil.h 883 2008-04-11 10:45:20Z hiro $
46 */
47
48/*
49 * ƒVƒXƒeƒ€ƒCƒ“ƒ^ƒtƒF[ƒXƒŒƒCƒ„
50 *
51 * ƒVƒXƒeƒ€ƒCƒ“ƒ^ƒtƒF[ƒXƒŒƒCƒ„‚̃T[ƒrƒXƒR[ƒ‹‚Ì’è‹`EéŒ¾‚ƃ}ƒNƒ‚È
52 * ‚Ç‚Ì’è‹`‚ðŠÜ‚Þƒwƒbƒ_ƒtƒ@ƒCƒ‹D
53 *
54 * ƒAƒZƒ“ƒuƒŠŒ¾Œê‚̃\[ƒXƒtƒ@ƒCƒ‹‚©‚炱‚̃tƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚鎞
55 * ‚́CTOPPERS_MACRO_ONLY‚ð’è‹`‚µ‚Ä‚¨‚­‚±‚ƂŁCƒ}ƒNƒ’è‹`ˆÈŠO‚Ì‹Lq‚ð
56 * œ‚­‚±‚Æ‚ª‚Å‚«‚éD
57 *
58 * ‚±‚̃tƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚é‘O‚ɃCƒ“ƒNƒ‹[ƒh‚µ‚Ä‚¨‚­‚ׂ«ƒtƒ@ƒCƒ‹
59 * ‚Í‚È‚¢D
60 */
61
62#ifndef TOPPERS_SIL_H
63#define TOPPERS_SIL_H
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69/*
70 * TOPPERS‹¤’ʂ̃f[ƒ^Œ^E’萔Eƒ}ƒNƒ
71 */
72#include <t_stddef.h>
73
74/*
75 * ƒ^[ƒQƒbƒgˆË‘¶•”
76 */
77#include "target_sil.h"
78
79#ifndef TOPPERS_MACRO_ONLY
80
81/*
82 * ‘SŠ„ž‚݃ƒbƒNó‘Ԃ̐§Œä
83 *
84 * SIL_PRE_LOCCSIL_LOC_INT()CSIL_UNL_INT()‚́Cƒ^[ƒQƒbƒgˆË‘¶•”‚Å—p
85 * ˆÓ‚·‚éDƒfƒtƒHƒ‹ƒg‚Ì’è‹`‚Í—pˆÓ‚µ‚Ä‚¢‚È‚¢D
86 */
87
88/*
89 * ”÷­ŽžŠÔ‘Ò‚¿
90 */
91extern void sil_dly_nse(ulong_t dlytim) throw();
92
93/*
94 * ƒGƒ“ƒfƒBƒAƒ“‚Ì”½“]
95 */
96#ifndef TOPPERS_SIL_REV_ENDIAN_UINT16
97#define TOPPERS_SIL_REV_ENDIAN_UINT16(data) \
98 ((((data) & 0xffU) << 8U) | (((data) >> 8U) & 0xffU))
99#endif /* TOPPERS_SIL_REV_ENDIAN_UINT16 */
100
101#ifndef TOPPERS_SIL_REV_ENDIAN_UINT32
102#define TOPPERS_SIL_REV_ENDIAN_UINT32(data) \
103 ((((data) & 0xffU) << 24U) | (((data) & 0xff00U) << 8U) \
104 | (((data) >> 8U) & 0xff00U) | (((data) >> 24U) & 0xffU))
105#endif /* TOPPERS_SIL_REV_ENDIAN_UINT32 */
106
107/*
108 * ƒƒ‚ƒŠ‹óŠÔƒAƒNƒZƒXŠÖ”
109 */
110#ifndef TOPPERS_OMIT_SIL_ACCESS
111
112/*
113 * 8ƒrƒbƒg’PˆÊ‚̓Ǐo‚µ^‘ž‚Ý
114 */
115#ifdef UINT8_MAX
116
117Inline uint8_t
118sil_reb_mem(void *mem)
119{
120 uint8_t data;
121
122 data = *((volatile uint8_t *) mem);
123 return(data);
124}
125
126Inline void
127sil_wrb_mem(void *mem, uint8_t data)
128{
129 *((volatile uint8_t *) mem) = data;
130}
131
132#endif /* UINT8_MAX */
133
134/*
135 * 16ƒrƒbƒg’PˆÊ‚̓Ǐo‚µ^‘ž‚Ý
136 */
137
138Inline uint16_t
139sil_reh_mem(void *mem)
140{
141 uint16_t data;
142
143 data = *((volatile uint16_t *) mem);
144 return(data);
145}
146
147Inline void
148sil_wrh_mem(void *mem, uint16_t data)
149{
150 *((volatile uint16_t *) mem) = data;
151}
152
153#ifdef SIL_ENDIAN_BIG /* ƒrƒbƒOƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
154
155#define sil_reh_bem(mem) sil_reh_mem(mem)
156#define sil_wrh_bem(mem, data) sil_wrh_mem(mem, data)
157
158#ifndef TOPPERS_OMIT_SIL_REH_LEM
159
160Inline uint16_t
161sil_reh_lem(void *mem)
162{
163 uint16_t data;
164
165 data = *((volatile uint16_t *) mem);
166 return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
167}
168
169#endif /* TOPPERS_OMIT_SIL_REH_LEM */
170#ifndef TOPPERS_OMIT_SIL_WRH_LEM
171
172Inline void
173sil_wrh_lem(void *mem, uint16_t data)
174{
175 *((volatile uint16_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
176}
177
178#endif /* TOPPERS_OMIT_SIL_WRH_LEM */
179#else /* SIL_ENDIAN_BIG */ /* ƒŠƒgƒ‹ƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
180
181#define sil_reh_lem(mem) sil_reh_mem((mem))
182#define sil_wrh_lem(mem, data) sil_wrh_mem((mem), (data))
183
184#ifndef TOPPERS_OMIT_SIL_REH_BEM
185
186Inline uint16_t
187sil_reh_bem(void *mem)
188{
189 uint16_t data;
190
191 data = *((volatile uint16_t *) mem);
192 return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
193}
194
195#endif /* TOPPERS_OMIT_SIL_REH_BEM */
196#ifndef TOPPERS_OMIT_SIL_WRH_BEM
197
198Inline void
199sil_wrh_bem(void *mem, uint16_t data)
200{
201 *((volatile uint16_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
202}
203
204#endif /* TOPPERS_OMIT_SIL_WRH_BEM */
205#endif /* SIL_ENDIAN_BIG */
206
207/*
208 * 32ƒrƒbƒg’PˆÊ‚̓Ǐo‚µ^‘ž‚Ý
209 */
210
211Inline uint32_t
212sil_rew_mem(void *mem)
213{
214 uint32_t data;
215
216 data = *((volatile uint32_t *) mem);
217 return(data);
218}
219
220Inline void
221sil_wrw_mem(void *mem, uint32_t data)
222{
223 *((volatile uint32_t *) mem) = data;
224}
225
226#ifdef SIL_ENDIAN_BIG /* ƒrƒbƒOƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
227
228#define sil_rew_bem(mem) sil_rew_mem(mem)
229#define sil_wrw_bem(mem, data) sil_wrw_mem(mem, data)
230
231#ifndef TOPPERS_OMIT_SIL_REW_LEM
232
233Inline uint32_t
234sil_rew_lem(void *mem)
235{
236 uint32_t data;
237
238 data = *((volatile uint32_t *) mem);
239 return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
240}
241
242#endif /* TOPPERS_OMIT_SIL_REW_LEM */
243#ifndef TOPPERS_OMIT_SIL_WRW_LEM
244
245Inline void
246sil_wrw_lem(void *mem, uint32_t data)
247{
248 *((volatile uint32_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
249}
250
251#endif /* TOPPERS_OMIT_SIL_WRW_LEM */
252#else /* SIL_ENDIAN_BIG */ /* ƒŠƒgƒ‹ƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
253
254#define sil_rew_lem(mem) sil_rew_mem((mem))
255#define sil_wrw_lem(mem, data) sil_wrw_mem((mem), (data))
256
257#ifndef TOPPERS_OMIT_SIL_REW_BEM
258
259Inline uint32_t
260sil_rew_bem(void *mem)
261{
262 uint32_t data;
263
264 data = *((volatile uint32_t *) mem);
265 return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
266}
267
268#endif /* TOPPERS_OMIT_SIL_REW_BEM */
269#ifndef TOPPERS_OMIT_SIL_WRW_BEM
270
271Inline void
272sil_wrw_bem(void *mem, uint32_t data)
273{
274 *((volatile uint32_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
275}
276
277#endif /* TOPPERS_OMIT_SIL_WRW_BEM */
278#endif /* SIL_ENDIAN_BIG */
279#endif /* TOPPERS_OMIT_SIL_ACCESS */
280
281#endif /* TOPPERS_MACRO_ONLY */
282
283#ifdef __cplusplus
284}
285#endif
286
287#endif /* TOPPERS_SIL_H */
Note: See TracBrowser for help on using the repository browser.