ptty.c
来自「mips架构的bootloader,99左右的版本 但源代码现在没人更新了」· C语言 代码 · 共 64 行
C
64 行
/************************************************************* * File: lib/ptty.c * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: * 970304 Start of revision history */#include "terms.h"/* * memory-mapped pseudo tty device * */ptty(op,siodat,chan,ch)int op,chan,ch;struct pttyinfo *siodat;{int i,cha,c;switch (op) { case OP_RXRDY : if (siodat->rx->sr) return(1); break; case OP_RX : c = siodat->rx->hr; siodat->rx->sr = 0; return(c); break; case OP_TXRDY : if (siodat->tx->sr == 0) return(1); break; case OP_TX : siodat->tx->hr = ch; siodat->tx->sr = 1; break; case OP_INIT : if (chan) { /* Dte */ siodat->rx = (struct pttyRec *)(siodat->siobase+8); siodat->tx = (struct pttyRec *)siodat->siobase; siodat->rx->sr = 0; siodat->tx->sr = 0; } else { /* Dce */ siodat->rx = (struct pttyRec *)siodat->siobase; siodat->tx = (struct pttyRec *)(siodat->siobase+8); } break; case OP_BAUD : return(1); break; case OP_CLKINIT : return(0); /* no clock present */ break; case OP_DELAY : return(0); /* no clock present */ break; default : return(-1); }return(0); /* successful return */}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?