source: UsbWattMeter/trunk/asp_dcre/arch/rx630_ccrx/prc_sil.h@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 6.7 KB
Line 
1/*
2 * TOPPERS Software
3 * Toyohashi Open Platform for Embedded Real-Time Systems
4 *
5 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN
6 *
7 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
8 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
9 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
10 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
11 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
12 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
13 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
14 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
15ƒƒ“ƒgi—˜—p
16 * ŽÒƒ}ƒjƒ…
17ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
18 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
19 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
20 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
21 * ‚ƁD
22 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
23ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
24ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
25 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
26 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
27 * •ñ‚·‚邱‚ƁD
28 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
29 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
30 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
31 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
32 * –Ɛӂ·‚邱‚ƁD
33 *
34 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
35 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
36 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
37 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
38 * ‚̐ӔC‚𕉂í‚È‚¢D
39 *
40 * @(#) $Id: prc_sil.h 164 2016-03-07 11:33:50Z coas-nagasima $
41 */
42
43/*
44 * sil.h‚̃vƒƒZƒbƒTˆË‘¶•”iRX630—pj
45 */
46
47#ifndef TOPPERS_PRC_SIL_H
48#define TOPPERS_PRC_SIL_H
49
50#define TOPPERS_OMIT_SIL_ACCESS
51
52#ifndef TOPPERS_MACRO_ONLY
53#include "prc_insn.h"
54
55
56/*
57 * ‘SŠ„ž‚Ý‹ÖŽ~
58 */
59Inline uint32_t
60TOPPERS_disint( void )
61{
62 volatile uint32_t TOPPERS_psw;
63
64 TOPPERS_psw = current_psw();
65 disint();
66
67 return( TOPPERS_psw );
68}
69
70
71/*
72 * ‘SŠ„ž‚Ý‹–‰Â
73 */
74Inline void
75TOPPERS_enaint( uint32_t TOPPERS_psw )
76{
77 if( TOPPERS_psw & PSW_I_MASK ){
78 enaint();
79 }
80}
81
82
83/*
84 * ‘SŠ„ž‚݃ƒbƒNó‘Ԃ̐§Œä
85 */
86#define SIL_PRE_LOC uint32_t TOPPERS_i_psw;
87#define SIL_LOC_INT() ( ( void )( TOPPERS_i_psw = TOPPERS_disint() ) )
88#define SIL_UNL_INT() ( TOPPERS_enaint( TOPPERS_i_psw ) )
89
90
91/*
92 * ƒGƒ“ƒfƒBƒAƒ“‚Ì”½“]
93 *
94 * –{ŠJ”­ŠÂ‹«‚ł̓Gƒ“ƒfƒBƒAƒ“•ÏŠ·–½—ß‚ª‘¶Ý‚·‚邽‚ß,
95 * ƒA[ƒLƒeƒNƒ`ƒƒˆË‘¶•”‚ɂă}ƒNƒ‚ðã‘‚«‚·‚é.
96 */
97#define TOPPERS_SIL_REV_ENDIAN_UINT16( data ) \
98 rev_endian_uint16( data )
99#define TOPPERS_SIL_REV_ENDIAN_UINT32( data ) \
100 rev_endian_uint32( data )
101
102
103/*
104 * ”÷­ŽžŠÔ‘Ò‚¿
105 */
106extern void sil_dly_nse( ulong_t dlytim );
107
108#endif /* TOPPERS_MACRO_ONLY */
109
110
111/*
112 * ƒvƒƒZƒbƒT‚̃Gƒ“ƒfƒBƒAƒ“
113 */
114#ifdef __LIT
115#define SIL_ENDIAN_LITTLE /* ƒŠƒgƒ‹ƒGƒ“ƒfƒBƒAƒ“ */
116#endif
117#ifdef __BIG
118#define SIL_ENDIAN_BIG /* ƒrƒbƒOƒGƒ“ƒfƒBƒAƒ“ */
119#endif
120
121
122/*
123 * 8ƒrƒbƒg’PˆÊ‚̓Ǐo‚µ^‘ž‚Ý
124 */
125#ifdef UINT8_MAX
126
127#pragma inline(sil_reb_mem)
128static uint8_t
129sil_reb_mem(const volatile uint8_t __evenaccess *mem)
130{
131 uint8_t data;
132
133 data = *mem;
134 return(data);
135}
136
137#pragma inline(sil_wrb_mem)
138static void
139sil_wrb_mem(volatile uint8_t __evenaccess *mem, uint8_t data)
140{
141 *mem = data;
142}
143
144#endif /* UINT8_MAX */
145
146/*
147 * 16ƒrƒbƒg’PˆÊ‚̓Ǐo‚µ^‘ž‚Ý
148 */
149
150#pragma inline(sil_reh_mem)
151static uint16_t
152sil_reh_mem(const volatile uint16_t __evenaccess *mem)
153{
154 uint16_t data;
155
156 data = *mem;
157 return(data);
158}
159
160#pragma inline(sil_wrh_mem)
161static void
162sil_wrh_mem(volatile uint16_t __evenaccess *mem, uint16_t data)
163{
164 *mem = data;
165}
166
167#ifdef SIL_ENDIAN_BIG /* ƒrƒbƒOƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
168
169#define sil_reh_bem(mem) sil_reh_mem(mem)
170#define sil_wrh_bem(mem, data) sil_wrh_mem(mem, data)
171
172#ifndef TOPPERS_OMIT_SIL_REH_LEM
173
174#pragma inline(sil_reh_lem)
175static uint16_t
176sil_reh_lem(const volatile uint16_t __evenaccess *mem)
177{
178 uint16_t data;
179
180 data = *mem;
181 return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
182}
183
184#endif /* TOPPERS_OMIT_SIL_REH_LEM */
185#ifndef TOPPERS_OMIT_SIL_WRH_LEM
186
187#pragma inline(sil_wrh_lem)
188static void
189sil_wrh_lem(volatile uint16_t __evenaccess *mem, uint16_t data)
190{
191 *mem = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
192}
193
194#endif /* TOPPERS_OMIT_SIL_WRH_LEM */
195#else /* SIL_ENDIAN_BIG */
196#ifdef SIL_ENDIAN_LITTLE /* ƒŠƒgƒ‹ƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
197
198#define sil_reh_lem(mem) sil_reh_mem(mem)
199#define sil_wrh_lem(mem, data) sil_wrh_mem(mem, data)
200
201#ifndef TOPPERS_OMIT_SIL_REH_BEM
202
203#pragma inline(sil_reh_bem)
204static uint16_t
205sil_reh_bem(const volatile uint16_t __evenaccess *mem)
206{
207 uint16_t data;
208
209 data = *mem;
210 return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
211}
212
213#endif /* TOPPERS_OMIT_SIL_REH_BEM */
214#ifndef TOPPERS_OMIT_SIL_WRH_BEM
215
216#pragma inline(sil_wrh_bem)
217static void
218sil_wrh_bem(volatile uint16_t __evenaccess *mem, uint16_t data)
219{
220 *mem = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
221}
222
223#endif /* TOPPERS_OMIT_SIL_WRH_BEM */
224#else /* SIL_ENDIAN_LITTLE */
225
226#error Neither SIL_ENDIAN_BIG nor SIL_ENDIAN_LITTLE is defined.
227
228#endif /* SIL_ENDIAN_LITTLE */
229#endif /* SIL_ENDIAN_BIG */
230
231/*
232 * 32ƒrƒbƒg’PˆÊ‚̓Ǐo‚µ^‘ž‚Ý
233 */
234
235#pragma inline(sil_rew_mem)
236static uint32_t
237sil_rew_mem(const volatile uint32_t __evenaccess *mem)
238{
239 uint32_t data;
240
241 data = *mem;
242 return(data);
243}
244
245#pragma inline(sil_wrw_mem)
246static void
247sil_wrw_mem(volatile uint32_t __evenaccess *mem, uint32_t data)
248{
249 *mem = data;
250}
251
252#ifdef SIL_ENDIAN_BIG /* ƒrƒbƒOƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
253
254#define sil_rew_bem(mem) sil_rew_mem(mem)
255#define sil_wrw_bem(mem, data) sil_wrw_mem(mem, data)
256
257#ifndef TOPPERS_OMIT_SIL_REW_LEM
258
259#pragma inline(sil_rew_lem)
260static uint32_t
261sil_rew_lem(const volatile uint32_t __evenaccess *mem)
262{
263 uint32_t data;
264
265 data = *mem;
266 return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
267}
268
269#endif /* TOPPERS_OMIT_SIL_REW_LEM */
270#ifndef TOPPERS_OMIT_SIL_WRW_LEM
271
272#pragma inline(sil_wrw_lem)
273static void
274sil_wrw_lem(volatile uint32_t __evenaccess *mem, uint32_t data)
275{
276 *mem = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
277}
278
279#endif /* TOPPERS_OMIT_SIL_WRW_LEM */
280#else /* SIL_ENDIAN_BIG */ /* ƒŠƒgƒ‹ƒGƒ“ƒfƒBƒAƒ“ƒvƒƒZƒbƒT */
281
282#define sil_rew_lem(mem) sil_rew_mem(mem)
283#define sil_wrw_lem(mem, data) sil_wrw_mem(mem, data)
284
285#ifndef TOPPERS_OMIT_SIL_REW_BEM
286
287#pragma inline(sil_rew_bem)
288static uint32_t
289sil_rew_bem(const volatile uint32_t __evenaccess *mem)
290{
291 uint32_t data;
292
293 data = *mem;
294 return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
295}
296
297#endif /* TOPPERS_OMIT_SIL_REW_BEM */
298#ifndef TOPPERS_OMIT_SIL_WRW_BEM
299
300#pragma inline(sil_wrw_bem)
301static void
302sil_wrw_bem(volatile uint32_t __evenaccess *mem, uint32_t data)
303{
304 *mem = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
305}
306
307#endif /* TOPPERS_OMIT_SIL_WRW_BEM */
308#endif /* SIL_ENDIAN_BIG */
309
310#endif /* TOPPERS_PRC_SIL_H */
Note: See TracBrowser for help on using the repository browser.