XINU
device
tty
ttyputc.c
Go to the documentation of this file.
1
/* ttyputc.c - ttyputc */
2
3
#include <
xinu.h
>
4
5
/*------------------------------------------------------------------------
6
* ttyputc - Write one character to a tty device (interrupts disabled)
7
*------------------------------------------------------------------------
8
*/
9
devcall
ttyputc
(
10
struct
dentry
*devptr,
/* Entry in device switch table */
11
char
ch
/* Character to write */
12
)
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
}
ttycblk::tyocrlf
bool8 tyocrlf
Definition:
tty.h:56
dentry::dvminor
int32 dvminor
Definition:
conf.h:8
xinu.h
全てのシステムヘッダファイルをインクルードする。
OK
#define OK
処理が成功した場合
Definition:
kernel.h:77
dentry
Definition:
conf.h:6
ttycblk
Definition:
tty.h:26
ttycblk::tyobuff
char tyobuff[TY_OBUFLEN]
Definition:
tty.h:33
TY_RETURN
#define TY_RETURN
Definition:
tty.h:69
ttyputc
devcall ttyputc(struct dentry *devptr, char ch)
Definition:
ttyputc.c:9
TY_OBUFLEN
#define TY_OBUFLEN
Definition:
tty.h:16
ttytab
struct ttycblk ttytab[]
Definition:
ttyinit.c:11
ttycblk::tyotail
char * tyotail
Definition:
tty.h:32
wait
syscall wait(sid32)
Definition:
wait.c:9
TY_NEWLINE
#define TY_NEWLINE
Definition:
tty.h:68
uart_csreg
Definition:
uart.h:13
devcall
int32 devcall
デバイスコール関数 返り値の型
Definition:
kernel.h:49
ttykickout
void ttykickout(struct uart_csreg *)
Definition:
ttykickout.c:10
dentry::dvcsr
void * dvcsr
Definition:
conf.h:19
ttycblk::tyosem
sid32 tyosem
Definition:
tty.h:34
Generated by
1.8.13