[313] | 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 | * ä¸è¨èä½æ¨©è
|
---|
| 8 | ã¯ï¼ä»¥ä¸ã®(1)ï½(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
| 9 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
| 10 | * å¤ã»åé
|
---|
| 11 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 12 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 13 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 14 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 15 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 16 | * ç¨ã§ããå½¢ã§åé
|
---|
| 17 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 18 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 19 | * è
|
---|
| 20 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 21 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 22 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 23 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 24 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 25 | * ã¨ï¼
|
---|
| 26 | * (a) åé
|
---|
| 27 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 28 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 29 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 30 | * (b) åé
|
---|
| 31 | å¸ã®å½¢æ
|
---|
| 32 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 33 | * å ±åãããã¨ï¼
|
---|
| 34 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 35 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 36 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 37 | 責ãããã¨ï¼
|
---|
| 38 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
| 39 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 40 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
| 41 | * å
|
---|
| 42 | 責ãããã¨ï¼
|
---|
| 43 | *
|
---|
| 44 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 45 | ã
|
---|
| 46 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
| 47 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
| 48 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
| 49 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
| 50 | *
|
---|
| 51 | * @(#) $Id: prc_sil.h 313 2017-07-23 04:50:32Z coas-nagasima $
|
---|
| 52 | */
|
---|
| 53 |
|
---|
| 54 | /*
|
---|
| 55 | * sil.hã®ããã»ããµä¾åé¨ï¼RX630ç¨ï¼
|
---|
| 56 | */
|
---|
| 57 |
|
---|
| 58 | #ifndef TOPPERS_PRC_SIL_H
|
---|
| 59 | #define TOPPERS_PRC_SIL_H
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | #ifndef TOPPERS_MACRO_ONLY
|
---|
| 63 | #include "prc_insn.h"
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | /*
|
---|
| 67 | * å
|
---|
| 68 | ¨å²è¾¼ã¿ç¦æ¢
|
---|
| 69 | */
|
---|
| 70 | Inline uint32_t
|
---|
| 71 | TOPPERS_disint( void )
|
---|
| 72 | {
|
---|
| 73 | volatile uint32_t TOPPERS_psw;
|
---|
| 74 |
|
---|
| 75 | TOPPERS_psw = current_psw();
|
---|
| 76 | disint();
|
---|
| 77 |
|
---|
| 78 | return( TOPPERS_psw );
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | /*
|
---|
| 83 | * å
|
---|
| 84 | ¨å²è¾¼ã¿è¨±å¯
|
---|
| 85 | */
|
---|
| 86 | Inline void
|
---|
| 87 | TOPPERS_enaint( uint32_t TOPPERS_psw )
|
---|
| 88 | {
|
---|
| 89 | if( TOPPERS_psw & PSW_I_MASK ){
|
---|
| 90 | enaint();
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | /*
|
---|
| 96 | * å
|
---|
| 97 | ¨å²è¾¼ã¿ããã¯ç¶æ
|
---|
| 98 | ã®å¶å¾¡
|
---|
| 99 | */
|
---|
| 100 | #define SIL_PRE_LOC uint32_t TOPPERS_i_psw;
|
---|
| 101 | #define SIL_LOC_INT() ( ( void )( TOPPERS_i_psw = TOPPERS_disint() ) )
|
---|
| 102 | #define SIL_UNL_INT() ( TOPPERS_enaint( TOPPERS_i_psw ) )
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | /*
|
---|
| 106 | * ã¨ã³ãã£ã¢ã³ã®å転
|
---|
| 107 | *
|
---|
| 108 | * æ¬éçºç°å¢ã§ã¯ã¨ã³ãã£ã¢ã³å¤æå½ä»¤ãåå¨ãããã,
|
---|
| 109 | * ã¢ã¼ããã¯ãã£ä¾åé¨ã«ã¦ãã¯ããä¸æ¸ããã.
|
---|
| 110 | */
|
---|
| 111 | #define TOPPERS_SIL_REV_ENDIAN_UINT16( data ) \
|
---|
| 112 | rev_endian_uint16( data )
|
---|
| 113 | #define TOPPERS_SIL_REV_ENDIAN_UINT32( data ) \
|
---|
| 114 | rev_endian_uint32( data )
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | /*
|
---|
| 118 | * å¾®å°æéå¾
|
---|
| 119 | ã¡
|
---|
| 120 | */
|
---|
| 121 | extern void sil_dly_nse( ulong_t dlytim ) throw();
|
---|
| 122 |
|
---|
| 123 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
| 124 |
|
---|
| 125 |
|
---|
| 126 | /*
|
---|
| 127 | * ããã»ããµã®ã¨ã³ãã£ã¢ã³
|
---|
| 128 | */
|
---|
| 129 | #define SIL_ENDIAN_LITTLE /* ãªãã«ã¨ã³ãã£ã¢ã³ */
|
---|
| 130 |
|
---|
| 131 | #ifndef TOPPERS_MACRO_ONLY
|
---|
| 132 |
|
---|
| 133 | /*
|
---|
| 134 | * ã¡ã¢ãªç©ºéã¢ã¯ã»ã¹é¢æ°
|
---|
| 135 | */
|
---|
| 136 | #define TOPPERS_OMIT_SIL_ACCESS
|
---|
| 137 |
|
---|
| 138 | /*
|
---|
| 139 | * 8ãããåä½ã®èªåºãï¼æ¸è¾¼ã¿
|
---|
| 140 | */
|
---|
| 141 | #ifdef UINT8_MAX
|
---|
| 142 |
|
---|
| 143 | Inline uint8_t
|
---|
| 144 | sil_reb_mem(const volatile uint8_t *mem)
|
---|
| 145 | {
|
---|
| 146 | uint8_t data;
|
---|
| 147 |
|
---|
| 148 | data = *((const volatile uint8_t *) mem);
|
---|
| 149 | return(data);
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | Inline void
|
---|
| 153 | sil_wrb_mem(volatile uint8_t *mem, uint8_t data)
|
---|
| 154 | {
|
---|
| 155 | *((volatile uint8_t *) mem) = data;
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | #endif /* UINT8_MAX */
|
---|
| 159 |
|
---|
| 160 | /*
|
---|
| 161 | * 16ãããåä½ã®èªåºãï¼æ¸è¾¼ã¿
|
---|
| 162 | */
|
---|
| 163 |
|
---|
| 164 | Inline uint16_t
|
---|
| 165 | sil_reh_mem(const volatile uint16_t *mem)
|
---|
| 166 | {
|
---|
| 167 | uint16_t data;
|
---|
| 168 |
|
---|
| 169 | data = *((const volatile uint16_t *) mem);
|
---|
| 170 | return(data);
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | Inline void
|
---|
| 174 | sil_wrh_mem(volatile uint16_t *mem, uint16_t data)
|
---|
| 175 | {
|
---|
| 176 | *((volatile uint16_t *) mem) = data;
|
---|
| 177 | }
|
---|
| 178 |
|
---|
| 179 | #ifdef SIL_ENDIAN_BIG /* ããã°ã¨ã³ãã£ã¢ã³ããã»ããµ */
|
---|
| 180 |
|
---|
| 181 | #define sil_reh_bem(mem) sil_reh_mem(mem)
|
---|
| 182 | #define sil_wrh_bem(mem, data) sil_wrh_mem(mem, data)
|
---|
| 183 |
|
---|
| 184 | #ifndef TOPPERS_OMIT_SIL_REH_LEM
|
---|
| 185 |
|
---|
| 186 | Inline uint16_t
|
---|
| 187 | sil_reh_lem(const volatile uint16_t *mem)
|
---|
| 188 | {
|
---|
| 189 | uint16_t data;
|
---|
| 190 |
|
---|
| 191 | data = *((const volatile uint16_t *) mem);
|
---|
| 192 | return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | #endif /* TOPPERS_OMIT_SIL_REH_LEM */
|
---|
| 196 | #ifndef TOPPERS_OMIT_SIL_WRH_LEM
|
---|
| 197 |
|
---|
| 198 | Inline void
|
---|
| 199 | sil_wrh_lem(volatile uint16_t *mem, uint16_t data)
|
---|
| 200 | {
|
---|
| 201 | *((volatile uint16_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
|
---|
| 202 | }
|
---|
| 203 |
|
---|
| 204 | #endif /* TOPPERS_OMIT_SIL_WRH_LEM */
|
---|
| 205 | #else /* SIL_ENDIAN_BIG */
|
---|
| 206 | #ifdef SIL_ENDIAN_LITTLE /* ãªãã«ã¨ã³ãã£ã¢ã³ããã»ããµ */
|
---|
| 207 |
|
---|
| 208 | #define sil_reh_lem(mem) sil_reh_mem(mem)
|
---|
| 209 | #define sil_wrh_lem(mem, data) sil_wrh_mem(mem, data)
|
---|
| 210 |
|
---|
| 211 | #ifndef TOPPERS_OMIT_SIL_REH_BEM
|
---|
| 212 |
|
---|
| 213 | Inline uint16_t
|
---|
| 214 | sil_reh_bem(const volatile uint16_t *mem)
|
---|
| 215 | {
|
---|
| 216 | uint16_t data;
|
---|
| 217 |
|
---|
| 218 | data = *((const volatile uint16_t *) mem);
|
---|
| 219 | return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
|
---|
| 220 | }
|
---|
| 221 |
|
---|
| 222 | #endif /* TOPPERS_OMIT_SIL_REH_BEM */
|
---|
| 223 | #ifndef TOPPERS_OMIT_SIL_WRH_BEM
|
---|
| 224 |
|
---|
| 225 | Inline void
|
---|
| 226 | sil_wrh_bem(volatile uint16_t *mem, uint16_t data)
|
---|
| 227 | {
|
---|
| 228 | *((volatile uint16_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
|
---|
| 229 | }
|
---|
| 230 |
|
---|
| 231 | #endif /* TOPPERS_OMIT_SIL_WRH_BEM */
|
---|
| 232 | #else /* SIL_ENDIAN_LITTLE */
|
---|
| 233 |
|
---|
| 234 | #error Neither SIL_ENDIAN_BIG nor SIL_ENDIAN_LITTLE is defined.
|
---|
| 235 |
|
---|
| 236 | #endif /* SIL_ENDIAN_LITTLE */
|
---|
| 237 | #endif /* SIL_ENDIAN_BIG */
|
---|
| 238 |
|
---|
| 239 | /*
|
---|
| 240 | * 32ãããåä½ã®èªåºãï¼æ¸è¾¼ã¿
|
---|
| 241 | */
|
---|
| 242 |
|
---|
| 243 | Inline uint32_t
|
---|
| 244 | sil_rew_mem(const volatile uint32_t *mem)
|
---|
| 245 | {
|
---|
| 246 | uint32_t data;
|
---|
| 247 |
|
---|
| 248 | data = *((const volatile uint32_t *) mem);
|
---|
| 249 | return(data);
|
---|
| 250 | }
|
---|
| 251 |
|
---|
| 252 | Inline void
|
---|
| 253 | sil_wrw_mem(volatile uint32_t *mem, uint32_t data)
|
---|
| 254 | {
|
---|
| 255 | *((volatile uint32_t *) mem) = data;
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 | #ifdef SIL_ENDIAN_BIG /* ããã°ã¨ã³ãã£ã¢ã³ããã»ããµ */
|
---|
| 259 |
|
---|
| 260 | #define sil_rew_bem(mem) sil_rew_mem(mem)
|
---|
| 261 | #define sil_wrw_bem(mem, data) sil_wrw_mem(mem, data)
|
---|
| 262 |
|
---|
| 263 | #ifndef TOPPERS_OMIT_SIL_REW_LEM
|
---|
| 264 |
|
---|
| 265 | Inline uint32_t
|
---|
| 266 | sil_rew_lem(const volatile uint32_t *mem)
|
---|
| 267 | {
|
---|
| 268 | uint32_t data;
|
---|
| 269 |
|
---|
| 270 | data = *((const volatile uint32_t *) mem);
|
---|
| 271 | return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 | #endif /* TOPPERS_OMIT_SIL_REW_LEM */
|
---|
| 275 | #ifndef TOPPERS_OMIT_SIL_WRW_LEM
|
---|
| 276 |
|
---|
| 277 | Inline void
|
---|
| 278 | sil_wrw_lem(volatile uint32_t *mem, uint32_t data)
|
---|
| 279 | {
|
---|
| 280 | *((volatile uint32_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
|
---|
| 281 | }
|
---|
| 282 |
|
---|
| 283 | #endif /* TOPPERS_OMIT_SIL_WRW_LEM */
|
---|
| 284 | #else /* SIL_ENDIAN_BIG */ /* ãªãã«ã¨ã³ãã£ã¢ã³ããã»ããµ */
|
---|
| 285 |
|
---|
| 286 | #define sil_rew_lem(mem) sil_rew_mem(mem)
|
---|
| 287 | #define sil_wrw_lem(mem, data) sil_wrw_mem(mem, data)
|
---|
| 288 |
|
---|
| 289 | #ifndef TOPPERS_OMIT_SIL_REW_BEM
|
---|
| 290 |
|
---|
| 291 | Inline uint32_t
|
---|
| 292 | sil_rew_bem(const volatile uint32_t *mem)
|
---|
| 293 | {
|
---|
| 294 | uint32_t data;
|
---|
| 295 |
|
---|
| 296 | data = *((const volatile uint32_t *) mem);
|
---|
| 297 | return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
|
---|
| 298 | }
|
---|
| 299 |
|
---|
| 300 | #endif /* TOPPERS_OMIT_SIL_REW_BEM */
|
---|
| 301 | #ifndef TOPPERS_OMIT_SIL_WRW_BEM
|
---|
| 302 |
|
---|
| 303 | Inline void
|
---|
| 304 | sil_wrw_bem(volatile uint32_t *mem, uint32_t data)
|
---|
| 305 | {
|
---|
| 306 | *((volatile uint32_t *) mem) = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
|
---|
| 307 | }
|
---|
| 308 |
|
---|
| 309 | #endif /* TOPPERS_OMIT_SIL_WRW_BEM */
|
---|
| 310 | #endif /* SIL_ENDIAN_BIG */
|
---|
| 311 |
|
---|
| 312 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
| 313 |
|
---|
| 314 | #endif /* TOPPERS_PRC_SIL_H */
|
---|