[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 | *
|
---|
| 9 | * Copyright (C) 2005-2007 by Y.D.K.Co.,LTD Technologies company
|
---|
| 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: ns9360.c,v 1.2 2007/05/21 01:33:50 honda Exp $
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | /*
|
---|
| 56 | * å
|
---|
| 57 | é¨æ©è½ç¨ãã©ã¤ã
|
---|
| 58 | */
|
---|
| 59 | #include <s_services.h>
|
---|
| 60 | #include <ns9360.h>
|
---|
| 61 |
|
---|
| 62 | /*
|
---|
| 63 | * å
|
---|
| 64 | é¨UARTç¨ ç°¡æSIOãã©ã¤ã
|
---|
| 65 | */
|
---|
| 66 |
|
---|
| 67 | /*
|
---|
| 68 | * ã·ãªã¢ã«I/Oãã¼ãåæåãããã¯
|
---|
| 69 | */
|
---|
| 70 | const SIOPINIB siopinib_table[TNUM_SIOP] = {
|
---|
| 71 | {
|
---|
| 72 | /* UART Channel A */
|
---|
| 73 | (VP)SC1SRA_REG , (VP)SC1FIFO_REG , (VP)SC1CRA_REG , (VP)SC1CRB_REG
|
---|
| 74 | ,(VP)SC1RCT_REG , (VP)SC1RBT_REG , (VP)SC1BRG_REG
|
---|
| 75 | ,(SCCRA_CE | SCCRA_WLS | SCCRA_DTR | SCCRA_RTS)
|
---|
| 76 | ,0x08000000
|
---|
| 77 | ,0x80000008
|
---|
| 78 | ,0x80000008
|
---|
| 79 | ,(0xC0140000 | 7) /* 29.4912MHz /2/8 = 115200*16 */
|
---|
| 80 | ,BBBI_S1TX , BBBI_S1RX
|
---|
| 81 | }
|
---|
| 82 | #if TNUM_SIOP >= 2
|
---|
| 83 | ,
|
---|
| 84 | {
|
---|
| 85 | /* UART Channel C */
|
---|
| 86 | (VP)SC3SRA_REG , (VP)SC3FIFO_REG , (VP)SC3CRA_REG , (VP)SC3CRB_REG
|
---|
| 87 | ,(VP)SC3RCT_REG ,(VP)SC3RBT_REG , (VP)SC3BRG_REG
|
---|
| 88 | ,(SCCRA_CE | SCCRA_WLS | SCCRA_DTR | SCCRA_RTS)
|
---|
| 89 | ,0x08000000
|
---|
| 90 | ,0x80000008
|
---|
| 91 | ,0x80000008
|
---|
| 92 | ,(0xC0140000 | 7) /* 29.4912MHz /2/8 = 115200*16 */
|
---|
| 93 | ,BBBI_S3TX , BBBI_S3RX
|
---|
| 94 | }
|
---|
| 95 | #endif
|
---|
| 96 | };
|
---|
| 97 |
|
---|
| 98 | /*
|
---|
| 99 | * ã·ãªã¢ã«I/Oãã¼ã管çãããã¯ã®ã¨ãªã¢
|
---|
| 100 | */
|
---|
| 101 | SIOPCB siopcb_table[TNUM_SIOP];
|
---|
| 102 |
|
---|
| 103 | /*
|
---|
| 104 | * ã·ã¹ãã åºåç¨ã·ãªã¢ã«ãã¼ãæ
|
---|
| 105 | å ±
|
---|
| 106 | */
|
---|
| 107 | SIOPCB *sys_siopcb;
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | * ã·ãªã¢ã«I/Oãã¼ãIDãã管çãããã¯ãåãåºãããã®ãã¯ã
|
---|
| 112 | */
|
---|
| 113 | #define INDEX_SIOP(siopid) ((UINT)((siopid) - 1))
|
---|
| 114 | #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)]))
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | /*
|
---|
| 118 | * æåãåä¿¡ããã?
|
---|
| 119 | */
|
---|
| 120 | Inline BOOL
|
---|
| 121 | uart_getready(SIOPCB *siopcb)
|
---|
| 122 | {
|
---|
| 123 | VW dt;
|
---|
| 124 |
|
---|
| 125 | if(0 != siopcb->rxfdb)
|
---|
| 126 | return TRUE;
|
---|
| 127 |
|
---|
| 128 | dt = sil_rew_mem((VP)siopcb->siopinib->pSraReg);
|
---|
| 129 | return(dt &(SCSRA_RFS | SCSRA_RRDY));
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | /*
|
---|
| 133 | * æåãéä¿¡ã§ããã?
|
---|
| 134 | */
|
---|
| 135 | Inline BOOL
|
---|
| 136 | uart_putready(SIOPCB *siopcb)
|
---|
| 137 | {
|
---|
| 138 | return(sil_rew_mem((VP)siopcb->siopinib->pSraReg)&(SCSRA_TRDY | SCSRA_THALF | SCSRA_TEMPTY));
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | /*
|
---|
| 142 | * åä¿¡ããæåã®åãåºã
|
---|
| 143 | */
|
---|
| 144 | Inline UB
|
---|
| 145 | uart_getchar(SIOPCB *siopcb)
|
---|
| 146 | {
|
---|
| 147 | UW dt;
|
---|
| 148 |
|
---|
| 149 | if(0 == siopcb->rxfdb)
|
---|
| 150 | {
|
---|
| 151 | siopcb->rxfdb = (sil_rew_mem((VP)siopcb->siopinib->pSraReg) >> 20) & 0x03;
|
---|
| 152 | if(0 == siopcb->rxfdb)
|
---|
| 153 | siopcb->rxfdb = 4;
|
---|
| 154 |
|
---|
| 155 | siopcb->rxbuf = sil_rew_mem((VP)siopcb->siopinib->pFifoReg);
|
---|
| 156 | }
|
---|
| 157 | --(siopcb->rxfdb);
|
---|
| 158 | dt = (siopcb->rxbuf >> 24) & 0xff;
|
---|
| 159 | siopcb->rxbuf <<= 8;
|
---|
| 160 |
|
---|
| 161 | return (UB)dt;
|
---|
| 162 |
|
---|
| 163 | }
|
---|
| 164 |
|
---|
| 165 | /*
|
---|
| 166 | * éä¿¡ããæåã®æ¸ãè¾¼ã¿
|
---|
| 167 | */
|
---|
| 168 | Inline void
|
---|
| 169 | uart_putchar(SIOPCB *siopcb, UB c)
|
---|
| 170 | {
|
---|
| 171 | sil_wrb_mem((VP)siopcb->siopinib->pFifoReg, (VB)c);
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | /*
|
---|
| 175 | * éä¿¡å²è¾¼ã¿è¨±å¯
|
---|
| 176 | */
|
---|
| 177 | Inline void
|
---|
| 178 | uart_enable_send(SIOPCB *siopcb)
|
---|
| 179 | {
|
---|
| 180 | sil_wrw_mem((VP)BBBIE_REG,sil_rew_mem((VP)BBBIE_REG) | siopcb->siopinib->BbbiTx);
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | /*
|
---|
| 184 | * éä¿¡å²è¾¼ã¿ç¦æ¢
|
---|
| 185 | */
|
---|
| 186 | Inline void
|
---|
| 187 | uart_disable_send(SIOPCB *siopcb)
|
---|
| 188 | {
|
---|
| 189 | sil_wrw_mem((VP)BBBIE_REG,sil_rew_mem((VP)BBBIE_REG) & ~siopcb->siopinib->BbbiTx);
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 | /*
|
---|
| 193 | * åä¿¡å²è¾¼ã¿è¨±å¯
|
---|
| 194 | */
|
---|
| 195 | Inline void
|
---|
| 196 | uart_enable_rcv(SIOPCB *siopcb)
|
---|
| 197 | {
|
---|
| 198 | sil_wrw_mem((VP)BBBIE_REG,sil_rew_mem((VP)BBBIE_REG) | siopcb->siopinib->BbbiRx);
|
---|
| 199 | }
|
---|
| 200 |
|
---|
| 201 | /*
|
---|
| 202 | * åä¿¡å²è¾¼ã¿ç¦æ¢
|
---|
| 203 | */
|
---|
| 204 | Inline void
|
---|
| 205 | uart_disable_rcv(SIOPCB *siopcb)
|
---|
| 206 | {
|
---|
| 207 | sil_wrw_mem((VP)BBBIE_REG,sil_rew_mem((VP)BBBIE_REG) & ~siopcb->siopinib->BbbiRx);
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 |
|
---|
| 211 |
|
---|
| 212 | /*
|
---|
| 213 | * ã«ã¼ãã«èµ·åæã®ãã°åºåç¨ã®åæå
|
---|
| 214 | */
|
---|
| 215 | void
|
---|
| 216 | uart_init(ID siopid){
|
---|
| 217 | SIOPCB *siopcb;
|
---|
| 218 |
|
---|
| 219 | uart_initialize();
|
---|
| 220 |
|
---|
| 221 | siopcb = get_siopcb(siopid);
|
---|
| 222 |
|
---|
| 223 | sys_siopcb = siopcb;
|
---|
| 224 |
|
---|
| 225 | /* UART Initialize */
|
---|
| 226 | sil_wrw_mem((VP)siopcb->siopinib->pCraReg,(VW)siopcb->siopinib->CraData);
|
---|
| 227 | sil_wrw_mem((VP)siopcb->siopinib->pCrbReg,(VW)siopcb->siopinib->CrbData);
|
---|
| 228 | sil_wrw_mem((VP)siopcb->siopinib->pRctReg,(VW)0);
|
---|
| 229 |
|
---|
| 230 | /* Set bound rate */
|
---|
| 231 | sil_wrw_mem((VP)siopcb->siopinib->pBrgReg,siopcb->siopinib->BrgData);
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 |
|
---|
| 235 | /*
|
---|
| 236 | * ãªã³ãããã®UARTããã®ãã¼ãªã³ã°åºå
|
---|
| 237 | */
|
---|
| 238 | void
|
---|
| 239 | uart_putc(char c)
|
---|
| 240 | {
|
---|
| 241 | UW buf_level;
|
---|
| 242 |
|
---|
| 243 | do{
|
---|
| 244 | buf_level = sil_rew_mem((VP)sys_siopcb->siopinib->pSraReg) & SCSRA_TRDY;
|
---|
| 245 | }while(buf_level == 0);
|
---|
| 246 |
|
---|
| 247 | sil_wrb_mem((VP)sys_siopcb->siopinib->pFifoReg,(VW)c);
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | /*
|
---|
| 251 | * SIOãã©ã¤ãã®åæåã«ã¼ãã³
|
---|
| 252 | */
|
---|
| 253 | void
|
---|
| 254 | uart_initialize()
|
---|
| 255 | {
|
---|
| 256 | SIOPCB *siopcb;
|
---|
| 257 | UINT i;
|
---|
| 258 |
|
---|
| 259 | /*
|
---|
| 260 | * ã·ãªã¢ã«I/Oãã¼ã管çãããã¯ã®åæå
|
---|
| 261 | */
|
---|
| 262 | for (siopcb = siopcb_table, i = 0; i < TNUM_SIOP; siopcb++, i++) {
|
---|
| 263 | siopcb->siopinib = &(siopinib_table[i]);
|
---|
| 264 | siopcb->openflag = FALSE;
|
---|
| 265 | siopcb->sendflag = FALSE;
|
---|
| 266 | siopcb->rxfdb = 0;
|
---|
| 267 | siopcb->rxbuf = 0;
|
---|
| 268 | siopcb->siopid = i;
|
---|
| 269 | }
|
---|
| 270 | }
|
---|
| 271 |
|
---|
| 272 | /*
|
---|
| 273 | * ãªã¼ãã³ãã¦ãããã¼ããããã
|
---|
| 274 | */
|
---|
| 275 | BOOL
|
---|
| 276 | uart_openflag(ID siopid)
|
---|
| 277 | {
|
---|
| 278 | return(siopcb_table[siopid].openflag);
|
---|
| 279 | }
|
---|
| 280 |
|
---|
| 281 |
|
---|
| 282 | /*
|
---|
| 283 | * ã·ãªã¢ã«I/Oãã¼ãã®ãªã¼ãã³
|
---|
| 284 | */
|
---|
| 285 | SIOPCB *
|
---|
| 286 | uart_opn_por(ID siopid, VP_INT exinf)
|
---|
| 287 | {
|
---|
| 288 | SIOPCB *siopcb;
|
---|
| 289 | const SIOPINIB *siopinib;
|
---|
| 290 | UW n;
|
---|
| 291 |
|
---|
| 292 | siopcb = get_siopcb(siopid);
|
---|
| 293 | siopinib = siopcb->siopinib;
|
---|
| 294 |
|
---|
| 295 | /* UART Initialize */
|
---|
| 296 | sil_wrw_mem((VP)siopinib->pCraReg,(VW)siopinib->CraData);
|
---|
| 297 | sil_wrw_mem((VP)siopinib->pCrbReg,(VW)siopinib->CrbData);
|
---|
| 298 | sil_wrw_mem((VP)siopinib->pRctReg,(VW)siopinib->RctData);
|
---|
| 299 | sil_wrw_mem((VP)siopinib->pRbtReg,(VW)siopinib->RbtData);
|
---|
| 300 |
|
---|
| 301 | /* Set bound rate */
|
---|
| 302 | sil_wrw_mem((VP)siopinib->pBrgReg,siopinib->BrgData);
|
---|
| 303 |
|
---|
| 304 | /* åä¿¡RcvRdy,FIFO=Halfãéä¿¡TxEmpty,FIFO-Halfå²è¾¼ã¿è¨±å¯ */
|
---|
| 305 | n = sil_rew_mem((VP)siopinib->pCraReg);
|
---|
| 306 | n &= (~(SCCRA_RIE | SCCRA_TIC));
|
---|
| 307 | n |= (0xe00 | 0x0c);
|
---|
| 308 | sil_wrw_mem((VP)siopinib->pCraReg,(VW)n);
|
---|
| 309 |
|
---|
| 310 | /* BBUSå²è¾¼ã¿è¨±å¯ */
|
---|
| 311 | sil_wrw_mem((VP)BBBIE_REG,sil_rew_mem((VP)BBBIE_REG) | siopinib->BbbiRx);
|
---|
| 312 | sil_wrw_mem((VP)INT_CFG8_11_REG,sil_rew_mem((VP)INT_CFG8_11_REG)|0x80000000);
|
---|
| 313 |
|
---|
| 314 | siopcb->exinf = exinf;
|
---|
| 315 | siopcb->getready = siopcb->putready = FALSE;
|
---|
| 316 | siopcb->openflag = TRUE;
|
---|
| 317 | siopcb->rxfdb = 0;
|
---|
| 318 | siopcb->rxbuf = 0;
|
---|
| 319 |
|
---|
| 320 | return(siopcb);
|
---|
| 321 | }
|
---|
| 322 |
|
---|
| 323 | /*
|
---|
| 324 | * ã·ãªã¢ã«I/Oãã¼ãã®ã¯ãã¼ãº
|
---|
| 325 | */
|
---|
| 326 | void
|
---|
| 327 | uart_cls_por(SIOPCB *siopcb)
|
---|
| 328 | {
|
---|
| 329 | siopcb->openflag = FALSE;
|
---|
| 330 | }
|
---|
| 331 |
|
---|
| 332 | /*
|
---|
| 333 | * ã·ãªã¢ã«I/Oãã¼ãã¸ã®æåéä¿¡
|
---|
| 334 | */
|
---|
| 335 | BOOL
|
---|
| 336 | uart_snd_chr(SIOPCB *siopcb, char c)
|
---|
| 337 | {
|
---|
| 338 | if (uart_putready(siopcb)){
|
---|
| 339 | uart_putchar(siopcb, c);
|
---|
| 340 | return(TRUE);
|
---|
| 341 | }
|
---|
| 342 | return(FALSE);
|
---|
| 343 | }
|
---|
| 344 |
|
---|
| 345 | /*
|
---|
| 346 | * ã·ãªã¢ã«I/Oãã¼ãããã®æååä¿¡
|
---|
| 347 | */
|
---|
| 348 | INT
|
---|
| 349 | uart_rcv_chr(SIOPCB *siopcb)
|
---|
| 350 | {
|
---|
| 351 | if (uart_getready(siopcb)) {
|
---|
| 352 | return((INT)(UB) uart_getchar(siopcb));
|
---|
| 353 | }
|
---|
| 354 | return(-1);
|
---|
| 355 | }
|
---|
| 356 |
|
---|
| 357 | /*
|
---|
| 358 | * ã·ãªã¢ã«I/Oãã¼ãããã®ã³ã¼ã«ããã¯ã®è¨±å¯
|
---|
| 359 | */
|
---|
| 360 | void
|
---|
| 361 | uart_ena_cbr(SIOPCB *siopcb, UINT cbrtn)
|
---|
| 362 | {
|
---|
| 363 | switch (cbrtn) {
|
---|
| 364 | case SIO_ERDY_SND:
|
---|
| 365 | uart_enable_send(siopcb);
|
---|
| 366 | break;
|
---|
| 367 | case SIO_ERDY_RCV:
|
---|
| 368 | uart_enable_rcv(siopcb);
|
---|
| 369 | break;
|
---|
| 370 | }
|
---|
| 371 | }
|
---|
| 372 |
|
---|
| 373 |
|
---|
| 374 | /*
|
---|
| 375 | * ã·ãªã¢ã«I/Oãã¼ãããã®ã³ã¼ã«ããã¯ã®ç¦æ¢
|
---|
| 376 | */
|
---|
| 377 | void
|
---|
| 378 | uart_dis_cbr(SIOPCB *siopcb, UINT cbrtn)
|
---|
| 379 | {
|
---|
| 380 | switch (cbrtn) {
|
---|
| 381 | case SIO_ERDY_SND:
|
---|
| 382 | uart_disable_send(siopcb);
|
---|
| 383 | break;
|
---|
| 384 | case SIO_ERDY_RCV:
|
---|
| 385 | uart_disable_rcv(siopcb);
|
---|
| 386 | break;
|
---|
| 387 | }
|
---|
| 388 | }
|
---|
| 389 |
|
---|
| 390 |
|
---|
| 391 | /*
|
---|
| 392 | * ã·ãªã¢ã«I/Oãã¼ãã«å¯¾ããéä¿¡å²è¾¼ã¿å¦ç
|
---|
| 393 | */
|
---|
| 394 | static void
|
---|
| 395 | uart_Txisr_siop(SIOPCB *siopcb)
|
---|
| 396 | {
|
---|
| 397 | /*
|
---|
| 398 | * éä¿¡å¯è½ã³ã¼ã«ããã¯ã«ã¼ãã³ãå¼ã³åºãï¼
|
---|
| 399 | */
|
---|
| 400 | uart_ierdy_snd(siopcb->exinf);
|
---|
| 401 | }
|
---|
| 402 |
|
---|
| 403 | /*
|
---|
| 404 | * ã·ãªã¢ã«I/Oãã¼ãã«å¯¾ããåä¿¡å²è¾¼ã¿å¦ç
|
---|
| 405 | */
|
---|
| 406 | static void
|
---|
| 407 | uart_Rxisr_siop(SIOPCB *siopcb)
|
---|
| 408 | {
|
---|
| 409 | /*
|
---|
| 410 | * åä¿¡éç¥ã³ã¼ã«ããã¯ã«ã¼ãã³ãå¼ã³åºãï¼
|
---|
| 411 | * æ大4æå(32bit)åä¿¡ãã¦ããã®ã§ããã§å
|
---|
| 412 | ¨åä¿¡æåãå¦çãã
|
---|
| 413 | */
|
---|
| 414 | while(1)
|
---|
| 415 | {
|
---|
| 416 | uart_ierdy_rcv(siopcb->exinf);
|
---|
| 417 | if(0 == siopcb->rxfdb)
|
---|
| 418 | break; /* åä¿¡æ¸ã¿ãã£ã©ã¯ã¿ãªã */
|
---|
| 419 | }
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 |
|
---|
| 423 | /*
|
---|
| 424 | * SIOã®Txå²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 425 | */
|
---|
| 426 | void
|
---|
| 427 | uart_Tx_isr()
|
---|
| 428 | {
|
---|
| 429 | uart_Txisr_siop(&(siopcb_table[0]));
|
---|
| 430 | }
|
---|
| 431 |
|
---|
| 432 | /*
|
---|
| 433 | * SIOã®Rxå²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 434 | */
|
---|
| 435 | void
|
---|
| 436 | uart_Rx_isr()
|
---|
| 437 | {
|
---|
| 438 | uart_Rxisr_siop(&(siopcb_table[0]));
|
---|
| 439 | sil_wrw_mem((VP)siopcb_table[0].siopinib->pSraReg ,
|
---|
| 440 | sil_rew_mem((VP)siopcb_table[0].siopinib->pSraReg) );
|
---|
| 441 | }
|
---|
| 442 |
|
---|
| 443 | /*
|
---|
| 444 | * SIO2ã®Txå²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 445 | */
|
---|
| 446 | void
|
---|
| 447 | uart2_Tx_isr()
|
---|
| 448 | {
|
---|
| 449 | uart_Txisr_siop(&(siopcb_table[1]));
|
---|
| 450 | }
|
---|
| 451 |
|
---|
| 452 | /*
|
---|
| 453 | * SIO2ã®Rxå²è¾¼ã¿ãµã¼ãã¹ã«ã¼ãã³
|
---|
| 454 | */
|
---|
| 455 | void
|
---|
| 456 | uart2_Rx_isr()
|
---|
| 457 | {
|
---|
| 458 | uart_Rxisr_siop(&(siopcb_table[1]));
|
---|
| 459 | sil_wrw_mem((VP)siopcb_table[1].siopinib->pSraReg ,
|
---|
| 460 | sil_rew_mem((VP)siopcb_table[1].siopinib->pSraReg) );
|
---|
| 461 | }
|
---|
| 462 |
|
---|
| 463 |
|
---|
| 464 | /*
|
---|
| 465 | * SIOã®å²è¾¼ã¿è¨±å¯ã«ã¼ãã³
|
---|
| 466 | */
|
---|
| 467 | void
|
---|
| 468 | uart_TxRx_Enable(ID siopid)
|
---|
| 469 | {
|
---|
| 470 | sil_wrw_mem((VP)BBBIE_REG,
|
---|
| 471 | sil_rew_mem((VP)BBBIE_REG) | siopcb_table[siopid].siopinib->BbbiTx
|
---|
| 472 | | siopcb_table[siopid].siopinib->BbbiRx);
|
---|
| 473 | }
|
---|
| 474 |
|
---|
| 475 | /*
|
---|
| 476 | * SIOã®å²è¾¼ã¿ç¦æ¢ã«ã¼ãã³
|
---|
| 477 | */
|
---|
| 478 | void
|
---|
| 479 | uart_TxRx_Disable(ID siopid)
|
---|
| 480 | {
|
---|
| 481 | sil_wrw_mem((VP)BBBIE_REG,
|
---|
| 482 | sil_rew_mem((VP)BBBIE_REG) & ~(siopcb_table[siopid].siopinib->BbbiTx
|
---|
| 483 | | siopcb_table[siopid].siopinib->BbbiRx) );
|
---|
| 484 | }
|
---|
| 485 |
|
---|
| 486 | /*
|
---|
| 487 | * ç¾å¨ã®ã·ãªã¢ã«ãã¼ãã®åå¾
|
---|
| 488 | */
|
---|
| 489 | ID
|
---|
| 490 | uart_get_id(SIOPCB *siopcb)
|
---|
| 491 | {
|
---|
| 492 | return(siopcb->siopid);
|
---|
| 493 | }
|
---|
| 494 |
|
---|