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