1 | /*
|
---|
2 | * TOPPERS ATK2
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | * Automotive Kernel Version 2
|
---|
5 | *
|
---|
6 | * Copyright (C) 2012-2015 by Center for Embedded Computing Systems
|
---|
7 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
8 | *
|
---|
9 | * ä¸è¨èä½æ¨©è
|
---|
10 | ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
11 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
12 | * å¤ã»åé
|
---|
13 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
14 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
15 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
16 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
17 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
18 | * ç¨ã§ããå½¢ã§åé
|
---|
19 | å¸ããå ´åã«ã¯ï¼åé
|
---|
20 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
21 | * è
|
---|
22 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
23 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
24 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
25 | * ç¨ã§ããªãå½¢ã§åé
|
---|
26 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
27 | * ã¨ï¼
|
---|
28 | * (a) åé
|
---|
29 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
31 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
32 | * (b) åé
|
---|
33 | å¸ã®å½¢æ
|
---|
34 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
35 | * å ±åãããã¨ï¼
|
---|
36 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
37 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
38 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
39 | 責ãããã¨ï¼
|
---|
40 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
41 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
42 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
43 | * å
|
---|
44 | 責ãããã¨ï¼
|
---|
45 | *
|
---|
46 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼AUTOSARï¼AUTomotive Open System ARchitectureï¼ä»
|
---|
47 | * æ§ã«åºã¥ãã¦ããï¼ä¸è¨ã®è¨±è«¾ã¯ï¼AUTOSARã®ç¥ç財ç£æ¨©ã許諾ãããã®ã§
|
---|
48 | * ã¯ãªãï¼AUTOSARã¯ï¼AUTOSARä»æ§ã«åºã¥ããã½ããã¦ã§ã¢ãåç¨ç®çã§å©
|
---|
49 | * ç¨ããè
|
---|
50 | ã«å¯¾ãã¦ï¼AUTOSARãã¼ããã¼ã«ãªããã¨ãæ±ãã¦ããï¼
|
---|
51 | *
|
---|
52 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
53 | ã
|
---|
54 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
55 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
56 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
57 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
58 | *
|
---|
59 | * $Id: prc_insn.h 182 2015-06-24 07:14:37Z t_ishikawa $
|
---|
60 | */
|
---|
61 |
|
---|
62 | /*
|
---|
63 | * ããã»ããµã®ç¹æ®å½ä»¤ã®ã¤ã³ã©ã¤ã³é¢æ°å®ç¾©ï¼V850ç¨ï¼
|
---|
64 | */
|
---|
65 | #ifndef TOPPERS_PRC_INSN_H
|
---|
66 | #define TOPPERS_PRC_INSN_H
|
---|
67 |
|
---|
68 | #include <prc_tool.h>
|
---|
69 |
|
---|
70 | /*
|
---|
71 | * V850E3V5ã®ã¿ãµãã¼ã
|
---|
72 | */
|
---|
73 | #ifndef __v850e3v5__
|
---|
74 | #error Only support v850e3v5 architecture!!
|
---|
75 | #endif /* __v850e3v5__ */
|
---|
76 |
|
---|
77 | #ifndef TOPPERS_MACRO_ONLY
|
---|
78 |
|
---|
79 | #define SYNCM __syncm();
|
---|
80 |
|
---|
81 | LOCAL_INLINE void
|
---|
82 | disable_int(void)
|
---|
83 | {
|
---|
84 | __DI();
|
---|
85 | }
|
---|
86 |
|
---|
87 | LOCAL_INLINE void
|
---|
88 | enable_int(void)
|
---|
89 | {
|
---|
90 | __EI();
|
---|
91 | }
|
---|
92 |
|
---|
93 | LOCAL_INLINE uint32
|
---|
94 | current_psw(void)
|
---|
95 | {
|
---|
96 | return(__stsr_rh(5, 0));
|
---|
97 | }
|
---|
98 |
|
---|
99 | LOCAL_INLINE void
|
---|
100 | set_psw(uint32 psw)
|
---|
101 | {
|
---|
102 | __ldsr_rh(5, 0, psw);
|
---|
103 | }
|
---|
104 |
|
---|
105 | /*
|
---|
106 | * V850E3V5ç¨ã®å²è¾¼ã¿ã³ã³ããã¼ã©æä½ã«ã¼ãã³
|
---|
107 | */
|
---|
108 | LOCAL_INLINE void
|
---|
109 | set_pmr(uint16 pmr)
|
---|
110 | {
|
---|
111 | uint32 psw;
|
---|
112 |
|
---|
113 | /* PMR must be set in di sate(PSW.ID = 1) */
|
---|
114 | psw = current_psw();
|
---|
115 | disable_int();
|
---|
116 |
|
---|
117 | __ldsr_rh(11, 2, pmr);
|
---|
118 |
|
---|
119 | set_psw(psw);
|
---|
120 | }
|
---|
121 |
|
---|
122 | LOCAL_INLINE uint16
|
---|
123 | get_ispr(void)
|
---|
124 | {
|
---|
125 | return(__stsr_rh(10, 2));
|
---|
126 | }
|
---|
127 |
|
---|
128 | LOCAL_INLINE void
|
---|
129 | clear_ispr(void)
|
---|
130 | {
|
---|
131 | uint32 psw;
|
---|
132 |
|
---|
133 | /* ISPR must be set in di sate(PSW.ID = 1) */
|
---|
134 | psw = current_psw();
|
---|
135 | disable_int();
|
---|
136 |
|
---|
137 | __ldsr_rh(13, 2, 1); /* INTCFG = 1; ISPR ãæ¸ãæãå¯è½ã« */
|
---|
138 | __ldsr_rh(10, 2, 0); /* ISPR = 0 */
|
---|
139 | __ldsr_rh(13, 2, 0); /* INTCFG = 0; ISPR ãæ¸ãæãç¦æ¢ã«(èªåæ´æ°ã«) */
|
---|
140 | __syncp();
|
---|
141 |
|
---|
142 | set_psw(psw);
|
---|
143 | }
|
---|
144 |
|
---|
145 | LOCAL_INLINE void
|
---|
146 | set_intbp(uint32 intbp)
|
---|
147 | {
|
---|
148 | uint32 psw;
|
---|
149 |
|
---|
150 | /* INTBP must be set in di sate(PSW.ID = 1) */
|
---|
151 | psw = current_psw();
|
---|
152 | disable_int();
|
---|
153 |
|
---|
154 | __ldsr_rh(4, 1, intbp);
|
---|
155 |
|
---|
156 | set_psw(psw);
|
---|
157 | }
|
---|
158 |
|
---|
159 | #define LDSR_REG(reg, sel, val) {\
|
---|
160 | __ldsr_rh(reg, sel, val);\
|
---|
161 | }
|
---|
162 |
|
---|
163 | #define STSR_REG(reg, sel, val) {\
|
---|
164 | val = __stsr_rh(reg, sel); \
|
---|
165 | }
|
---|
166 |
|
---|
167 | #define MPA_WRITE(mpuid, mpla, mpua, mpat) { \
|
---|
168 | __ldsr_rh(mpuid*4, 6, mpla); \
|
---|
169 | __ldsr_rh(mpuid*4+1, 6, mpua); \
|
---|
170 | __ldsr_rh(mpuid*4+2, 6, mpat); \
|
---|
171 | }
|
---|
172 |
|
---|
173 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
174 |
|
---|
175 | #endif /* TOPPERS_PRC_INSN_H */
|
---|