Permalink
Browse files

Part 7, Echo Application

  • Loading branch information...
1 parent 6aa2bae commit 85043f536bb8c2aaf3c4a4995cc27128fa3ed781 @singpolyma committed Feb 2, 2013
Showing with 13 additions and 3 deletions.
  1. +13 −3 kernel.c
View
@@ -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);
}

0 comments on commit 85043f5

Please sign in to comment.