[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-2003 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 8 | * Copyright (C) 2000-2003 by Industrial Technology Institute,
|
---|
| 9 | * Miyagi Prefectural Government, JAPAN
|
---|
| 10 | * Copyright (C) 2002-2004 by Hokkaido Industrial Research Institute, JAPAN
|
---|
| 11 | * Copyright (C) 2010 by Cronus Computer Works, JAPAN
|
---|
| 12 | *
|
---|
| 13 | * ä¸è¨èä½æ¨©è
|
---|
| 14 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 15 | * ã«ãã£ã¦å
|
---|
| 16 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 17 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 18 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 19 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 20 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 21 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 22 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 23 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 24 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 25 | * ç¨ã§ããå½¢ã§åé
|
---|
| 26 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 27 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 28 | * è
|
---|
| 29 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 30 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 31 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 32 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 33 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 34 | * ã¨ï¼
|
---|
| 35 | * (a) åé
|
---|
| 36 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 37 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 38 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 39 | * (b) åé
|
---|
| 40 | å¸ã®å½¢æ
|
---|
| 41 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 42 | * å ±åãããã¨ï¼
|
---|
| 43 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 44 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 45 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 46 | 責ãããã¨ï¼
|
---|
| 47 | *
|
---|
| 48 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 49 | ã
|
---|
| 50 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 51 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 52 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 53 | *
|
---|
| 54 | * @(#) $Id
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * SH2å
|
---|
| 59 | èµã·ãªã¢ã«ã³ãã¥ãã±ã¼ã·ã§ã³ã¤ã³ã¿ãã§ã¼ã¹SCIFç¨ ç°¡æãã©ã¤ã
|
---|
| 60 | */
|
---|
| 61 |
|
---|
| 62 | #include <s_services.h>
|
---|
| 63 | #include "sh726xscif.h"
|
---|
| 64 | #define _MACRO_ONLY
|
---|
| 65 | #include "hw_serial.h"
|
---|
| 66 |
|
---|
| 67 | /*
|
---|
| 68 | * ã·ãªã¢ã«I/Oãã¼ã管çãããã¯ã®å®ç¾©
|
---|
| 69 | */
|
---|
| 70 |
|
---|
| 71 | #ifndef GDB_STUB
|
---|
| 72 |
|
---|
| 73 | const SIOPINIB siopinib_table[TNUM_PORT] = {
|
---|
| 74 | {REGBASE_SERIAL, BRR_VALUE(SCIF_BPS), 0x0, SCIF_INTLVL},
|
---|
| 75 | #if TNUM_PORT >= 2
|
---|
| 76 | {REGBASE_SERIAL2, BRR_VALUE(SCIF_BPS), 0x0, SCIF_INTLVL},
|
---|
| 77 | #endif /* TNUM_PORT >= 2 */
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | #else /* GDB_STUB */
|
---|
| 81 |
|
---|
| 82 | const SIOPINIB siopinib_table[TNUM_PORT] = {
|
---|
| 83 | {REGBASE_SERIAL, BRR_VALUE(SCIF_BPS), 0x0, SCIF_INTLVL},
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 | #endif /* GDB_STUB */
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | * ã·ãªã¢ã«I/Oãã¼ã管çãããã¯ã®ã¨ãªã¢
|
---|
| 90 | */
|
---|
| 91 | static SIOPCB siopcb_table[TNUM_PORT];
|
---|
| 92 |
|
---|
| 93 | /*
|
---|
| 94 | * ã·ãªã¢ã«I/Oãã¼ãIDãã管çãããã¯ãåãåºãããã®ãã¯ã
|
---|
| 95 | */
|
---|
| 96 | #define INDEX_SIOP(siopid) ((UINT)((siopid) - 1))
|
---|
| 97 | #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)]))
|
---|
| 98 |
|
---|
| 99 | /*
|
---|
| 100 | * æåãåä¿¡ã§ãããï¼
|
---|
| 101 | */
|
---|
| 102 | Inline BOOL
|
---|
| 103 | sh2scif_getready (SIOPCB * siopcb)
|
---|
| 104 | {
|
---|
| 105 | /* ã¬ã·ã¼ããã¼ã¿ã¬ã¸ã¹ã¿ãã«ã»ãã©ã°ã®ãã§ã㯠*/
|
---|
| 106 | return (sil_reh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFSR)) &
|
---|
| 107 | SCFSR_RDRF);
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | * æåãéä¿¡ã§ãããï¼
|
---|
| 112 | */
|
---|
| 113 | Inline BOOL
|
---|
| 114 | sh2scif_putready (SIOPCB * siopcb)
|
---|
| 115 | {
|
---|
| 116 | /* ãã©ã³ã¹ãããFIFOãã¼ã¿ã¬ã¸ã¹ã¿ã¨ã³ããã£ã»ãã©ã°ã®ãã§ã㯠*/
|
---|
| 117 | return (sil_reh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFSR)) &
|
---|
| 118 | SCFSR_TDFE);
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | /*
|
---|
| 122 | * åä¿¡ããæåã®ååºã
|
---|
| 123 | */
|
---|
| 124 | Inline char
|
---|
| 125 | sh2scif_getchar (SIOPCB * siopcb)
|
---|
| 126 | {
|
---|
| 127 | VB data;
|
---|
| 128 |
|
---|
| 129 | data = sil_reb_mem ((VB *) (siopcb->siopinib->reg_base + SCIF_SCFRDR));
|
---|
| 130 | /* ã¬ã·ã¼ããã¼ã¿ã¬ã¸ã¹ã¿ãã«ã»ãã©ã°ã®ã¯ãªã¢ */
|
---|
| 131 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFSR),
|
---|
| 132 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 133 | SCIF_SCFSR)) & ~SCFSR_RDRF);
|
---|
| 134 | return data;
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | /*
|
---|
| 138 | * éä¿¡ããæåã®æ¸è¾¼ã¿
|
---|
| 139 | */
|
---|
| 140 | Inline void
|
---|
| 141 | sh2scif_putchar (SIOPCB * siopcb, char c)
|
---|
| 142 | {
|
---|
| 143 | /* ãã©ã³ã¹ãããFIFOãã¼ã¿ã¬ã¸ã¹ã¿ã¨ã³ããã£ã»ãã©ã°ã®ã¯ãªã¢ */
|
---|
| 144 | sil_wrb_mem ((VB *) (siopcb->siopinib->reg_base + SCIF_SCFTDR), c);
|
---|
| 145 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFSR),
|
---|
| 146 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 147 | SCIF_SCFSR)) & ~SCFSR_TDFE);
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | /*
|
---|
| 151 | * SIOãã©ã¤ãã®åæåã«ã¼ãã³
|
---|
| 152 | */
|
---|
| 153 | void
|
---|
| 154 | sh2scif_initialize ()
|
---|
| 155 | {
|
---|
| 156 | SIOPCB *siopcb;
|
---|
| 157 | UINT i;
|
---|
| 158 |
|
---|
| 159 | /*
|
---|
| 160 | * ã·ã«ã¢ã«I/Oãã¼ã管çãããã¯ã®åæå
|
---|
| 161 | */
|
---|
| 162 | for (siopcb = siopcb_table, i = 0; i < TNUM_PORT; siopcb++, i++) {
|
---|
| 163 | siopcb->openflag = FALSE;
|
---|
| 164 | siopcb->siopinib = (&siopinib_table[i]);
|
---|
| 165 | }
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | /*
|
---|
| 169 | * ãªã¼ãã³ãã¦ãããã¼ãããããï¼
|
---|
| 170 | */
|
---|
| 171 | BOOL
|
---|
| 172 | sh2scif_openflag (ID siopid)
|
---|
| 173 | {
|
---|
| 174 | return (siopcb_table[siopid - 1].openflag);
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | /*
|
---|
| 178 | * ã·ãªã¢ã«I/Oãã¼ãã®ãªã¼ãã³
|
---|
| 179 | */
|
---|
| 180 | SIOPCB *
|
---|
| 181 | sh2scif_opn_por (ID siopid, VP_INT exinf)
|
---|
| 182 | {
|
---|
| 183 | SIOPCB *siopcb;
|
---|
| 184 |
|
---|
| 185 | siopcb = get_siopcb (siopid);
|
---|
| 186 |
|
---|
| 187 | /* éåä¿¡åæ¢ */
|
---|
| 188 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR),
|
---|
| 189 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 190 | SCIF_SCSCR)) & ~(SCSCR_TE | SCSCR_RE));
|
---|
| 191 |
|
---|
| 192 | /* SCIFãã¼ã¿å
|
---|
| 193 | ¥åºåãã¼ãã®è¨å® */
|
---|
| 194 | /* ãã³ã¢ãµã¤ã³ */
|
---|
| 195 | /* sys_initializeã§è¨å® */
|
---|
| 196 |
|
---|
| 197 | /* FIFOã®åæå */
|
---|
| 198 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFCR),
|
---|
| 199 | (VH) (SCFCR_TFRST | SCFCR_RFRST));
|
---|
| 200 |
|
---|
| 201 | /* éåä¿¡ãã©ã¼ããã */
|
---|
| 202 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSMR), 0x0000);
|
---|
| 203 | /* 調æ©åæå¼ */
|
---|
| 204 | /* 8ããããããªãã£ãªã */
|
---|
| 205 | /* ã¹ããããããã¬ã³ã°ã¹ï¼1 */
|
---|
| 206 | /* ã¯ããã¯ã»ã¬ã¯ã */
|
---|
| 207 |
|
---|
| 208 | sil_wrb_mem ((VB *) (siopcb->siopinib->reg_base + SCIF_SCBRR),
|
---|
| 209 | (VB) siopcb->siopinib->brr); /* ãã¼ã¬ã¼ãè¨å® */
|
---|
| 210 |
|
---|
| 211 |
|
---|
| 212 | /*
|
---|
| 213 | * ãã¼ã¬ã¼ãã®è¨å®å¾ã1ã«ã¦ã³ãåå¾
|
---|
| 214 | ããªããã°ãªããªãã
|
---|
| 215 | */
|
---|
| 216 | sil_dly_nse (sh2scif_DELAY);
|
---|
| 217 |
|
---|
| 218 | /* FIFOã®è¨å® */
|
---|
| 219 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFCR), 0x0030);
|
---|
| 220 |
|
---|
| 221 | /* ã¨ã©ã¼ãã©ã°ãã¯ãªã¢ */
|
---|
| 222 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFSR),
|
---|
| 223 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 224 | SCIF_SCFSR)) & ~SCFSR_ER);
|
---|
| 225 |
|
---|
| 226 | /* éåä¿¡éå§ */
|
---|
| 227 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR),
|
---|
| 228 | (VH) (SCSCR_TE | SCSCR_RE));
|
---|
| 229 |
|
---|
| 230 | siopcb->exinf = exinf;
|
---|
| 231 | siopcb->openflag = TRUE;
|
---|
| 232 | return (siopcb);
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | /*
|
---|
| 236 | * ã·ãªã¢ã«I/Oãã¼ãã®ã¯ãã¼ãº
|
---|
| 237 | */
|
---|
| 238 | void
|
---|
| 239 | sh2scif_cls_por (SIOPCB * siopcb)
|
---|
| 240 | {
|
---|
| 241 | /* éåä¿¡åæ¢ãå²è¾¼ã¿ç¦æ¢ */
|
---|
| 242 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR),
|
---|
| 243 | (VH) ~ (SCSCR_TIE | SCSCR_RIE | SCSCR_TE | SCSCR_RE));
|
---|
| 244 |
|
---|
| 245 | siopcb->openflag = FALSE;
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | /*
|
---|
| 249 | * ã·ãªã¢ã«I/Oãã¼ãã¸ã®æåéä¿¡
|
---|
| 250 | */
|
---|
| 251 | BOOL
|
---|
| 252 | sh2scif_snd_chr (SIOPCB * siopcb, char c)
|
---|
| 253 | {
|
---|
| 254 | if (sh2scif_putready (siopcb)) {
|
---|
| 255 | sh2scif_putchar (siopcb, c);
|
---|
| 256 | return (TRUE);
|
---|
| 257 | }
|
---|
| 258 | return (FALSE);
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | /*
|
---|
| 262 | * ã·ãªã¢ã«I/Oãã¼ãããã®æååä¿¡
|
---|
| 263 | */
|
---|
| 264 | INT
|
---|
| 265 | sh2scif_rcv_chr (SIOPCB * siopcb)
|
---|
| 266 | {
|
---|
| 267 | if (sh2scif_getready (siopcb)) {
|
---|
| 268 | return ((INT) (UB) sh2scif_getchar (siopcb));
|
---|
| 269 | }
|
---|
| 270 | return (-1);
|
---|
| 271 | }
|
---|
| 272 |
|
---|
| 273 | /*
|
---|
| 274 | * ã·ãªã¢ã«I/Oãã¼ãããã®ã³ã¼ã«ããã¯ã®è¨±å¯
|
---|
| 275 | */
|
---|
| 276 | void
|
---|
| 277 | sh2scif_ena_cbr (SIOPCB * siopcb, UINT cbrtn)
|
---|
| 278 | {
|
---|
| 279 | switch (cbrtn) {
|
---|
| 280 | case SIO_ERDY_SND: /* éä¿¡å²ãè¾¼ã¿è¦æ±ãè¨±å¯ */
|
---|
| 281 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR),
|
---|
| 282 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 283 | SCIF_SCSCR)) | SCSCR_TIE);
|
---|
| 284 | break;
|
---|
| 285 | case SIO_ERDY_RCV: /* åä¿¡å²ãè¾¼ã¿è¦æ±ãè¨±å¯ */
|
---|
| 286 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR),
|
---|
| 287 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 288 | SCIF_SCSCR)) | SCSCR_RIE);
|
---|
| 289 | break;
|
---|
| 290 | }
|
---|
| 291 | }
|
---|
| 292 |
|
---|
| 293 | /*
|
---|
| 294 | * ã·ãªã¢ã«I/Oãã¼ãããã®ã³ã¼ã«ããã¯ã®ç¦æ¢
|
---|
| 295 | */
|
---|
| 296 | void
|
---|
| 297 | sh2scif_dis_cbr (SIOPCB * siopcb, UINT cbrtn)
|
---|
| 298 | {
|
---|
| 299 | switch (cbrtn) {
|
---|
| 300 | case SIO_ERDY_SND: /* éä¿¡å²ãè¾¼ã¿è¦æ±ãç¦æ¢ */
|
---|
| 301 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR),
|
---|
| 302 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 303 | SCIF_SCSCR)) & ~SCSCR_TIE);
|
---|
| 304 | break;
|
---|
| 305 | case SIO_ERDY_RCV: /* åä¿¡å²ãè¾¼ã¿è¦æ±ãç¦æ¢ */
|
---|
| 306 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR),
|
---|
| 307 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 308 | SCIF_SCSCR)) & ~SCSCR_RIE);
|
---|
| 309 | break;
|
---|
| 310 | }
|
---|
| 311 | }
|
---|
| 312 |
|
---|
| 313 | /*
|
---|
| 314 | * ã·ãªã¢ã«I/Oãã¼ãã«å¯¾ããéä¿¡å²è¾¼ã¿å¦ç
|
---|
| 315 | */
|
---|
| 316 | Inline void
|
---|
| 317 | sh2scif_isr_siop_out (SIOPCB * siopcb)
|
---|
| 318 | {
|
---|
| 319 | VH scr0 = sil_reh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR));
|
---|
| 320 |
|
---|
| 321 | if ((scr0 & SCSCR_TIE) != 0 && sh2scif_putready (siopcb)) {
|
---|
| 322 | /*
|
---|
| 323 | * éä¿¡éç¥ã³ã¼ã«ããã¯ã«ã¼ãã³ãå¼ã³åºãï¼
|
---|
| 324 | */
|
---|
| 325 | sh2scif_ierdy_snd (siopcb->exinf);
|
---|
| 326 | }
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | /*
|
---|
| 330 | * ã·ãªã¢ã«I/Oãã¼ãã«å¯¾ããåä¿¡å²è¾¼ã¿å¦ç
|
---|
| 331 | */
|
---|
| 332 | Inline void
|
---|
| 333 | sh2scif_isr_siop_in (SIOPCB * siopcb)
|
---|
| 334 | {
|
---|
| 335 | VH scr0 = sil_reh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCSCR));
|
---|
| 336 |
|
---|
| 337 | if ((scr0 & SCSCR_RIE) != 0 && sh2scif_getready (siopcb)) {
|
---|
| 338 | /*
|
---|
| 339 | * åä¿¡éç¥ã³ã¼ã«ããã¯ã«ã¼ãã³ãå¼ã³åºãï¼
|
---|
| 340 | */
|
---|
| 341 | sh2scif_ierdy_rcv (siopcb->exinf);
|
---|
| 342 | }
|
---|
| 343 | }
|
---|
| 344 |
|
---|
| 345 | /*
|
---|
| 346 | * ã·ãªã¢ã«I/Oãã¼ãã«å¯¾ããåä¿¡ã¨ã©ã¼å²è¾¼ã¿å¦ç
|
---|
| 347 | */
|
---|
| 348 | Inline void
|
---|
| 349 | sh2scif_isr_siop_err (SIOPCB * siopcb)
|
---|
| 350 | {
|
---|
| 351 | /* ã¨ã©ã¼ãã©ã°ãã¯ãªã¢ */
|
---|
| 352 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFSR),
|
---|
| 353 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 354 | SCIF_SCFSR)) & ~SCFSR_ER);
|
---|
| 355 | /* FIFOã®åæå */
|
---|
| 356 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFCR),
|
---|
| 357 | (VH) SCFCR_RFRST);
|
---|
| 358 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFCR), 0x0030);
|
---|
| 359 | }
|
---|
| 360 |
|
---|
| 361 | /* ãã¬ã¼ã¯æ¤åºå¦ç */
|
---|
| 362 | /* ãã©ã°ããªã»ãããã */
|
---|
| 363 | Inline void
|
---|
| 364 | sh2scif_isr_siop_brk (SIOPCB * siopcb)
|
---|
| 365 | {
|
---|
| 366 | /* ãã©ã°ãã¯ãªã¢ */
|
---|
| 367 | sil_wrh_mem ((VH *) (siopcb->siopinib->reg_base + SCIF_SCFSR),
|
---|
| 368 | sil_reh_mem ((VH *) (siopcb->siopinib->reg_base +
|
---|
| 369 | SCIF_SCFSR)) & ~SCFSR_BRK);
|
---|
| 370 | }
|
---|
| 371 |
|
---|
| 372 | /*
|
---|
| 373 | * SCIFéä¿¡å²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 374 | *
|
---|
| 375 | * ãSH2å
|
---|
| 376 | èµã®SCIFã§ã¯å²è¾¼ã¿çªå·ãéåä¿¡å¥ããã£ãã«å¥ã«åããã¦ããã®ã§ã
|
---|
| 377 | * ãSCIFã®éä¿¡å²è¾¼ã¿ä»¥å¤ã§ãã®ã«ã¼ãã³ãå¼ã°ãããã¨ã¯ãªã
|
---|
| 378 | *
|
---|
| 379 | */
|
---|
| 380 | void
|
---|
| 381 | sh2scif_isr_out ()
|
---|
| 382 | {
|
---|
| 383 | if (siopcb_table[0].openflag) {
|
---|
| 384 | sh2scif_isr_siop_out (get_siopcb (1));
|
---|
| 385 | }
|
---|
| 386 | }
|
---|
| 387 |
|
---|
| 388 | /*
|
---|
| 389 | * SCIFåä¿¡å²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 390 | *
|
---|
| 391 | * ãSH2å
|
---|
| 392 | èµã®SCIFã§ã¯å²è¾¼ã¿çªå·ãéåä¿¡å¥ããã£ãã«å¥ã«åããã¦ããã®ã§ã
|
---|
| 393 | * ãSCIFã®åä¿¡å²è¾¼ã¿ä»¥å¤ã§ãã®ã«ã¼ãã³ãå¼ã°ãããã¨ã¯ãªã
|
---|
| 394 | *
|
---|
| 395 | */
|
---|
| 396 | void
|
---|
| 397 | sh2scif_isr_in ()
|
---|
| 398 | {
|
---|
| 399 | if (siopcb_table[0].openflag) {
|
---|
| 400 | sh2scif_isr_siop_in (get_siopcb (1));
|
---|
| 401 | }
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | /*
|
---|
| 405 | * SIOåä¿¡ã¨ã©ã¼å²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 406 | *
|
---|
| 407 | * ãSH2å
|
---|
| 408 | èµã®SCIFã§ã¯å²è¾¼ã¿çªå·ããã£ãã«å¥ã«åããã¦ããã®ã§ã
|
---|
| 409 | * ãSCIFã®åä¿¡ã¨ã©ã¼å²è¾¼ã¿ä»¥å¤ã§ãã®ã«ã¼ãã³ãå¼ã°ãããã¨ã¯ãªã
|
---|
| 410 | * ã
|
---|
| 411 | * ãã¨ã©ã¼å¦çèªä½ã¯ã¨ã©ã¼ãã©ã°ã®ã¯ãªã¢ã®ã¿ã«ã¨ã©ãã¦ããã
|
---|
| 412 | * ãããã»ãªã¼ãã¼ã©ã³ã¨ã©ã¼
|
---|
| 413 | * ãããã»ãã¬ã¼ãã³ã°ã¨ã©ã¼
|
---|
| 414 | * ãããã»ããªãã£ã¨ã©ã¼
|
---|
| 415 | */
|
---|
| 416 | void
|
---|
| 417 | sh2scif_isr_error (void)
|
---|
| 418 | {
|
---|
| 419 |
|
---|
| 420 | if (siopcb_table[0].openflag) {
|
---|
| 421 | sh2scif_isr_siop_err (get_siopcb (1));
|
---|
| 422 | }
|
---|
| 423 | }
|
---|
| 424 |
|
---|
| 425 | /* ãã¬ã¼ã¯æ¤åº */
|
---|
| 426 | void
|
---|
| 427 | sh2scif_isr_brk (void)
|
---|
| 428 | {
|
---|
| 429 |
|
---|
| 430 | if (siopcb_table[0].openflag) {
|
---|
| 431 | sh2scif_isr_siop_brk (get_siopcb (1));
|
---|
| 432 | }
|
---|
| 433 | }
|
---|
| 434 |
|
---|
| 435 | /*
|
---|
| 436 | * ãã¼ãªã³ã°ã«ããæåã®éä¿¡
|
---|
| 437 | */
|
---|
| 438 | void
|
---|
| 439 | sh2scif_putc_pol (ID portid, char c)
|
---|
| 440 | {
|
---|
| 441 | while (!sh2scif_putready (&siopcb_table[portid - 1]));
|
---|
| 442 | sh2scif_putchar (&siopcb_table[portid - 1], c);
|
---|
| 443 | }
|
---|
| 444 |
|
---|
| 445 | #if TNUM_PORT >= 2
|
---|
| 446 | /*
|
---|
| 447 | * SCIFåä¿¡å²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 448 | *
|
---|
| 449 | */
|
---|
| 450 | void
|
---|
| 451 | sh2scif_isr2_in (void)
|
---|
| 452 | {
|
---|
| 453 | if (siopcb_table[1].openflag) {
|
---|
| 454 | sh2scif_isr_siop_in (get_siopcb (2));
|
---|
| 455 | }
|
---|
| 456 | }
|
---|
| 457 |
|
---|
| 458 | /*
|
---|
| 459 | * SCIFéä¿¡å²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 460 | *
|
---|
| 461 | */
|
---|
| 462 | void
|
---|
| 463 | sh2scif_isr2_out (void)
|
---|
| 464 | {
|
---|
| 465 | if (siopcb_table[1].openflag) {
|
---|
| 466 | sh2scif_isr_siop_out (get_siopcb (2));
|
---|
| 467 | }
|
---|
| 468 | }
|
---|
| 469 |
|
---|
| 470 | /*
|
---|
| 471 | * SCIFåä¿¡ã¨ã©ã¼å²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 472 | */
|
---|
| 473 | void
|
---|
| 474 | sh2scif_isr2_error (void)
|
---|
| 475 | {
|
---|
| 476 | if (siopcb_table[1].openflag) {
|
---|
| 477 | sh2scif_isr_siop_err (get_siopcb (2));
|
---|
| 478 | }
|
---|
| 479 | }
|
---|
| 480 |
|
---|
| 481 | /* ãã¬ã¼ã¯æ¤åº */
|
---|
| 482 | void
|
---|
| 483 | sh2scif_isr2_brk (void)
|
---|
| 484 | {
|
---|
| 485 |
|
---|
| 486 | if (siopcb_table[1].openflag) {
|
---|
| 487 | sh2scif_isr_siop_brk (get_siopcb (2));
|
---|
| 488 | }
|
---|
| 489 | }
|
---|
| 490 | #endif /* of #if TNUM_PORT >= 2 */
|
---|