Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Part 7, Echo Application

  • Loading branch information...
commit 85043f536bb8c2aaf3c4a4995cc27128fa3ed781 1 parent 6aa2bae
@singpolyma authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 kernel.c
View
16 kernel.c
@@ -161,14 +161,24 @@ void serialin(volatile unsigned int* uart, unsigned int intr) {
}
}
+void echo(void) {
+ int fdout, fdin;
+ char c;
+ fdout = open("/dev/tty0/out", 0);
+ fdin = open("/dev/tty0/in", 0);
+
+ while(1) {
+ read(fdin, &c, 1);
+ write(fdout, &c, 1);
+ }
+}
+
void first(void) {
if(!fork()) pathserver();
if(!fork()) serialout(UART0, PIC_UART0);
if(!fork()) serialin(UART0, PIC_UART0);
+ if(!fork()) echo();
- fd = open("/dev/tty0/out", 0);
- write(fd, "woo\n", sizeof("woo\n"));
- write(fd, "thar\n", sizeof("thar\n"));
while(1);
}
Please sign in to comment.
Something went wrong with that request. Please try again.