source: uKadecot/trunk/ssp/arch/rx630_ccrx/prc_insn.h@ 101

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

TOPPERS/uKadecotのソースコードを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/plain
File size: 3.5 KB
Line 
1/*
2 * TOPPERS/SSP Kernel
3 * Smallest Set Profile Kernel
4 *
5 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
6 * Toyohashi Univ. of Technology, JAPAN
7 * Copyright (C) 2005,2006 by Embedded and Real-Time Systems Laboratory
8 * Graduate School of Information Science, Nagoya Univ., JAPAN
9 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN
10 *
11 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚©CFree Software Foundation
12 * ‚É‚æ‚Á‚ÄŒö•\‚³‚ê‚Ä‚¢‚é GNU General Public License ‚Ì Version 2 ‚É‹L
13 * q‚³‚ê‚Ä‚¢‚éðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒFƒAi–{ƒ\ƒtƒgƒEƒFƒA
14 * ‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏEÄ”z•ziˆÈ‰ºC
15 * —˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
16 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
17 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
18 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
19 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
20 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
21ƒƒ“ƒgi—˜—p
22 * ŽÒƒ}ƒjƒ…
23ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
24 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
25 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
26 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
27 * ‚ƁD
28 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
29ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
30ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
31 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
32 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
33 * •ñ‚·‚邱‚ƁD
34 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
35 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
36 *
37 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
38 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC‚»‚Ì“K—p‰Â”\«‚à
39 * ŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼
40 * Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚𕉂í‚È‚¢D
41 *
42 */
43
44/*
45 * ƒvƒƒZƒbƒT‚Ì“ÁŽê–½—߂̃Cƒ“ƒ‰ƒCƒ“ŠÖ”’è‹`iRX630—pj
46 */
47
48#ifndef TOPPERS_PRC_INSN_H
49#define TOPPERS_PRC_INSN_H
50
51
52static uint32_t current_psw( void );
53static void set_psw( uint32_t psw );
54Inline uint32_t current_ipl( void );
55Inline void set_ipl( uint32_t ipl );
56static void disint( void );
57static void enaint( void );
58static uint16_t rev_endian_uint16( uint16_t data );
59static uint32_t rev_endian_uint32( uint32_t data );
60
61
62/*
63 * Iƒtƒ‰ƒO, IPL‚ðŽæ“¾‚·‚邽‚߂̃}ƒNƒ’è‹`
64 */
65#define PSW_I_MASK ( 0x00010000UL )
66#define PSW_IPL_MASK ( 0x0F000000UL )
67
68
69/*
70 * ƒvƒƒZƒbƒTƒXƒe[ƒ^ƒXƒŒƒWƒXƒ^(PSW)‚ÌŒ»Ý’l‚̓Ǐo‚µ
71 */
72#pragma inline_asm current_psw
73static uint32_t
74current_psw( void )
75{
76 mvfc psw, r1
77}
78
79
80/*
81 * ƒvƒƒZƒbƒTƒXƒe[ƒ^ƒXƒŒƒWƒXƒ^(PSW)‚֐ݒè
82 */
83#pragma inline_asm set_psw
84static void
85set_psw( uint32_t psw )
86{
87 mvtc r1, psw
88}
89
90
91/*
92 * IPL‚ÌŒ»Ý’l‚̓Ǐo‚µ
93 */
94Inline uint32_t
95current_ipl( void )
96{
97 return ( uint32_t )( current_psw() & PSW_IPL_MASK );
98}
99
100
101/*
102 * IPL‚֐ݒè
103 */
104Inline void
105set_ipl( uint32_t ipl )
106{
107 set_psw( ( current_psw() & ( ~PSW_IPL_MASK ) ) | ipl );
108}
109
110
111/*
112 * NMI‚ðœ‚­‚·‚ׂĂ̊„ž‚Ý‚Ì‹ÖŽ~
113 */
114#pragma inline_asm disint
115static void
116disint( void )
117{
118 clrpsw i
119}
120
121
122/*
123 * NMI‚ðœ‚­‚·‚ׂĂ̊„ž‚Ý‚Ì‹–‰Â
124 */
125#pragma inline_asm enaint
126static void
127enaint( void )
128{
129 setpsw i
130}
131
132
133/*
134 * ƒGƒ“ƒfƒBƒAƒ“•ÏŠ· 16bit
135 */
136#pragma inline_asm rev_endian_uint16
137static uint16_t
138rev_endian_uint16( uint16_t data )
139{
140 revw r1, r1
141}
142
143/*
144 * ƒGƒ“ƒfƒBƒAƒ“•ÏŠ· 32bit
145 */
146#pragma inline_asm rev_endian_uint32
147static uint32_t
148rev_endian_uint32( uint32_t data )
149{
150 revl r1, r1
151}
152
153
154#endif /* TOPPERS_PRC_INSN_H */
Note: See TracBrowser for help on using the repository browser.