[363] | 1 | /*
|
---|
| 2 | * TOPPERS/JSP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Just Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2000-2004 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 8 | * Copyright (C) 2001-2007 by Industrial Technology Institute,
|
---|
| 9 | * Miyagi Prefectural Government, JAPAN
|
---|
| 10 | *
|
---|
| 11 | * ä¸è¨èä½æ¨©è
|
---|
| 12 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 13 | * ã«ãã£ã¦å
|
---|
| 14 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 15 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 16 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 17 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 18 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 19 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 20 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 21 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 22 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 23 | * ç¨ã§ããå½¢ã§åé
|
---|
| 24 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 25 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 26 | * è
|
---|
| 27 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 28 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 29 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 30 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 31 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 32 | * ã¨ï¼
|
---|
| 33 | * (a) åé
|
---|
| 34 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 35 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 36 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 37 | * (b) åé
|
---|
| 38 | å¸ã®å½¢æ
|
---|
| 39 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 40 | * å ±åãããã¨ï¼
|
---|
| 41 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 42 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 43 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 44 | 責ãããã¨ï¼
|
---|
| 45 | *
|
---|
| 46 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 47 | ã
|
---|
| 48 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 49 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 50 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 51 | *
|
---|
| 52 | * @(#) $Id: h8_sil.h,v 1.7 2007/03/23 07:58:33 honda Exp $
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | /*
|
---|
| 56 | * H8åãSILã®æ¡å¼µï¼ãããæ¼ç®ï¼
|
---|
| 57 | *
|
---|
| 58 | * h8.hã«è¨è¿°ããã®ãã¨ã¬ã¬ã³ãã ããsil.hã¨ã®ã¤ã³ã¯ã«ã¼ãã®
|
---|
| 59 | * é çªã®é¢ä¿ã§ç¬ç«ãããã¡ã¤ã«ã¨ãã
|
---|
| 60 | * t_config.hãç´æ¥ã¤ã³ã¯ã«ã¼ãããã¨ãã«sil.hããå
|
---|
| 61 | ã«ãã®
|
---|
| 62 | * ãã¡ã¤ã«ãã¤ã³ã¯ã«ã¼ããããå¯è½æ§ãããã
|
---|
| 63 | *
|
---|
| 64 | * ã³ã³ãã¤ã©ã®åãã§ãã¯æ©è½ãæå¹ã«ããããããã¤ã³ã¿åã¯
|
---|
| 65 | * UB *ãUH *ãUW *ãç¨ãã¦ããã
|
---|
| 66 | *
|
---|
| 67 | */
|
---|
| 68 |
|
---|
| 69 | #ifndef _SIL_H8_H_
|
---|
| 70 | #define _SIL_H8_H_
|
---|
| 71 |
|
---|
| 72 | #ifndef _MACRO_ONLY
|
---|
| 73 |
|
---|
| 74 | #include <sil.h>
|
---|
| 75 | #include <cpu_insn.h> /* bitset(), bitclr() */
|
---|
| 76 |
|
---|
| 77 | /*
|
---|
| 78 | * 8ãããã¬ã¸ã¹ã¿ã®ANDæ¼ç®
|
---|
| 79 | */
|
---|
| 80 | Inline void
|
---|
| 81 | h8_anb_reg(UB *mem, UB data)
|
---|
| 82 | {
|
---|
| 83 | UB reg = sil_reb_mem((VP)mem);
|
---|
| 84 | reg &= data;
|
---|
| 85 | sil_wrb_mem((VP)mem, (VB)reg);
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | * 8ãããã¬ã¸ã¹ã¿ã®ORæ¼ç®
|
---|
| 90 | */
|
---|
| 91 | Inline void
|
---|
| 92 | h8_orb_reg(UB *mem, UB data)
|
---|
| 93 | {
|
---|
| 94 | UB reg = sil_reb_mem((VP)mem);
|
---|
| 95 | reg |= data;
|
---|
| 96 | sil_wrb_mem((VP)mem, (VB)reg);
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | /*
|
---|
| 101 | * 16ãããã¬ã¸ã¹ã¿ã®ANDæ¼ç®
|
---|
| 102 | */
|
---|
| 103 | Inline void
|
---|
| 104 | h8_anh_reg(UH *mem, UH data)
|
---|
| 105 | {
|
---|
| 106 | UH reg = sil_reh_mem((VP)mem);
|
---|
| 107 | reg &= data;
|
---|
| 108 | sil_wrh_mem((VP)mem, (VH)reg);
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | /*
|
---|
| 112 | * 16ãããã¬ã¸ã¹ã¿ã®ORæ¼ç®
|
---|
| 113 | */
|
---|
| 114 | Inline void
|
---|
| 115 | h8_orh_reg(UH *mem, UH data)
|
---|
| 116 | {
|
---|
| 117 | UH reg = sil_reh_mem((VP)mem);
|
---|
| 118 | reg |= data;
|
---|
| 119 | sil_wrh_mem((VP)mem, (VH)reg);
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | /*
|
---|
| 123 | * 32ãããã¬ã¸ã¹ã¿ã®ANDæ¼ç®
|
---|
| 124 | */
|
---|
| 125 | Inline void
|
---|
| 126 | h8_anw_reg(UW *mem, UW data)
|
---|
| 127 | {
|
---|
| 128 | UW reg = sil_rew_mem((VP)mem);
|
---|
| 129 | reg &= data;
|
---|
| 130 | sil_wrw_mem((VP)mem, (VW)reg);
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | /*
|
---|
| 134 | * 32ãããã¬ã¸ã¹ã¿ã®ORæ¼ç®
|
---|
| 135 | */
|
---|
| 136 | Inline void
|
---|
| 137 | h8_orw_reg(UW *mem, UW data)
|
---|
| 138 | {
|
---|
| 139 | UW reg = sil_rew_mem((VP)mem);
|
---|
| 140 | reg |= data;
|
---|
| 141 | sil_wrw_mem((VP)mem, (VW)reg);
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | /*
|
---|
| 145 | * å²è¾¼ã¿ã¬ãã«ã®è¨å®
|
---|
| 146 | *
|
---|
| 147 | * ãirc ï¼IRCãã¼ã¿ã®å
|
---|
| 148 | é ã¢ãã¬ã¹
|
---|
| 149 | *
|
---|
| 150 | * ããUB *iprï¼è¨å®ããIPRã¬ã¸ã¹ã¿ã®çªå°
|
---|
| 151 | * ããUB bit ï¼IPRã¬ã¸ã¹ã¿ã®è©²å½ãããããçªå·
|
---|
| 152 | * ããIPM ipmï¼è¨å®ããå²è¾¼ã¿ã¬ãã«
|
---|
| 153 | * ãããããããIPM_LEVEL0,IPM_LEVEL1ã®ãããã
|
---|
| 154 | */
|
---|
| 155 | Inline void
|
---|
| 156 | define_int_plevel(const IRC *irc)
|
---|
| 157 | {
|
---|
| 158 | UB *ipr = irc->ipr;
|
---|
| 159 | UB bit = irc->bit;
|
---|
| 160 | IPM ipm = irc->ipm;
|
---|
| 161 |
|
---|
| 162 | switch(ipm) {
|
---|
| 163 | case IPM_LEVEL0: /* ãã©ã¤ãªãªãã£ã¬ãã«0ã«è¨å® */
|
---|
| 164 | bitclr(ipr, bit);
|
---|
| 165 | break;
|
---|
| 166 | case IPM_LEVEL1: /* ãã©ã¤ãªãªãã£ã¬ãã«1ã«è¨å® */
|
---|
| 167 | bitset(ipr, bit);
|
---|
| 168 | break;
|
---|
| 169 | default:
|
---|
| 170 | assert(FALSE);
|
---|
| 171 | }
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | /*
|
---|
| 175 | *ãI/Oãã¼ãã®ãã¼ã¿ã»ãã£ã¬ã¯ã·ã§ã³ã»ã¬ã¸ã¹ã¿DDRã¸ã®ã¢ã¯ã»ã¹
|
---|
| 176 | *ã
|
---|
| 177 | *ããH8ã®DDRã¯æ¸ãè¾¼ã¿å°ç¨ã§ããããã®ã¾ã¾ã§ã¯ææã®ãããã ãã
|
---|
| 178 | *ããå¤æ´ãããã¨ãã§ããªããï¼bset,bclrå½ä»¤ã§ãåé¿ä¸å¯ï¼
|
---|
| 179 | *ãããã®ãããæ¬å®è£
|
---|
| 180 | ã§ã¯ãã¡ã¢ãªä¸ã«ãã³ãã©ãªãç¨æãã¦ãDDRã®
|
---|
| 181 | *ããç¾å¨å¤ãä¿æããæ¹æ³ãæ¡ã£ã¦ããã
|
---|
| 182 | */
|
---|
| 183 | /*
|
---|
| 184 | *ãDDRã®çªå·å®ç¾©
|
---|
| 185 | *ã
|
---|
| 186 | *ããé
|
---|
| 187 | åã®ã¤ã³ããã¯ã¹ã«ç¨ããã
|
---|
| 188 | *ãããã¼ã7ã¯å
|
---|
| 189 | ¥åå°ç¨ã®ãããçç¥ãã¦ããã
|
---|
| 190 | */
|
---|
| 191 | typedef enum {
|
---|
| 192 | IO_PORT1,
|
---|
| 193 | IO_PORT2,
|
---|
| 194 | IO_PORT3,
|
---|
| 195 | IO_PORT4,
|
---|
| 196 | IO_PORT5,
|
---|
| 197 | IO_PORT6,
|
---|
| 198 | IO_PORT8,
|
---|
| 199 | IO_PORT9,
|
---|
| 200 | IO_PORTA,
|
---|
| 201 | IO_PORTB
|
---|
| 202 | } IO_PORT;
|
---|
| 203 |
|
---|
| 204 | extern UB sil_reb_ddr(IO_PORT port) throw();
|
---|
| 205 | extern void sil_wrb_ddr(IO_PORT port, UB data) throw();
|
---|
| 206 | extern void sil_anb_ddr(IO_PORT port, UB data) throw();
|
---|
| 207 | extern void sil_orb_ddr(IO_PORT port, UB data) throw();
|
---|
| 208 |
|
---|
| 209 | #endif /* _MACRO_ONLY */
|
---|
| 210 | #endif /* _SIL_H8_H_ */
|
---|