XINU
Functions
ttyputc.c File Reference
#include <xinu.h>
Include dependency graph for ttyputc.c:

Go to the source code of this file.

Functions

devcall ttyputc (struct dentry *devptr, char ch)
 

Function Documentation

◆ ttyputc()

devcall ttyputc ( struct dentry devptr,
char  ch 
)

Definition at line 9 of file ttyputc.c.

References dentry::dvcsr, dentry::dvminor, OK, ttykickout(), ttytab, TY_NEWLINE, TY_OBUFLEN, TY_RETURN, ttycblk::tyobuff, ttycblk::tyocrlf, ttycblk::tyosem, ttycblk::tyotail, and wait().

Referenced by ttywrite().

13 {
14  struct ttycblk *typtr; /* Pointer to tty control block */
15 
16  typtr = &ttytab[devptr->dvminor];
17 
18  /* Handle output CRLF by sending CR first */
19 
20  if ( ch==TY_NEWLINE && typtr->tyocrlf ) {
21  ttyputc(devptr, TY_RETURN);
22  }
23 
24  wait(typtr->tyosem); /* Wait for space in queue */
25  *typtr->tyotail++ = ch;
26 
27  /* Wrap around to beginning of buffer, if needed */
28 
29  if (typtr->tyotail >= &typtr->tyobuff[TY_OBUFLEN]) {
30  typtr->tyotail = typtr->tyobuff;
31  }
32 
33  /* Start output in case device is idle */
34 
35  ttykickout((struct uart_csreg *)devptr->dvcsr);
36 
37  return OK;
38 }
bool8 tyocrlf
Definition: tty.h:56
int32 dvminor
Definition: conf.h:8
#define OK
処理が成功した場合
Definition: kernel.h:77
Definition: tty.h:26
char tyobuff[TY_OBUFLEN]
Definition: tty.h:33
#define TY_RETURN
Definition: tty.h:69
devcall ttyputc(struct dentry *devptr, char ch)
Definition: ttyputc.c:9
#define TY_OBUFLEN
Definition: tty.h:16
struct ttycblk ttytab[]
Definition: ttyinit.c:11
char * tyotail
Definition: tty.h:32
syscall wait(sid32)
Definition: wait.c:9
#define TY_NEWLINE
Definition: tty.h:68
void ttykickout(struct uart_csreg *)
Definition: ttykickout.c:10
void * dvcsr
Definition: conf.h:19
sid32 tyosem
Definition: tty.h:34
Here is the call graph for this function:
Here is the caller graph for this function: