From fbbbc75200008e2b603e5b7df8cd2e1a5d17483b Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sun, 24 May 2015 03:32:14 +0200 Subject: syscalls and terminal functionality for GAMING mode --- kernel/kernel.c | 1 + kernel/kernel.h | 2 ++ kernel/syscalls.c | 39 +++++++++++++++++++++++++++++++++++++++ kernel/syscalls.h | 2 ++ 4 files changed, 44 insertions(+) (limited to 'kernel') diff --git a/kernel/kernel.c b/kernel/kernel.c index 6937031..d54baf6 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -75,6 +75,7 @@ static void init_stdio() input.put_char=stdin_put_char; tty1=terminal_init(&screen,&input); + get_fool()->tty=&tty1; get_fool()->std_out.data=&tty1; get_fool()->std_out.put=terminal_put; diff --git a/kernel/kernel.h b/kernel/kernel.h index 2929a28..757c3bf 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -4,12 +4,14 @@ #define KERNEL_VERSION "FoolOs 0.2.1" #include "fifo.h" +#include "terminal/terminal.h" typedef struct fool_os_struct { fifo std_in; fifo std_out; + terminal_tty* tty; }fool_os; diff --git a/kernel/syscalls.c b/kernel/syscalls.c index f5169e7..c935ecd 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -87,6 +87,45 @@ int syscall_readdir(const char *name,fs_dirent *dirs,int max) return fs_readdir(name,dirs,max); } +// for non blocking io? +int syscall_has_data_waiting(int file) +{ + + #ifdef LOG_SYSCALLS + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"has data waiting?"); + #endif + + return fifo_has(&get_fool()->std_in); +} + +int syscall_tune(int v1,int v2, int v3) +{ + + + #ifdef LOG_SYSCALLS + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"tuning request"); + #endif + + + if(v1==0) // regular tty mode + { + get_fool()->tty->set_buff=true; + get_fool()->tty->set_echo=true; + } + if(v1==1) // gaming tty mode + { + get_fool()->tty->set_buff=false; + get_fool()->tty->set_echo=false; + } + + + return 0; +} + + + + + int copy_args(char **in, char **out) { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"copy_args(0x%08x, 0x%08X)",in,out); diff --git a/kernel/syscalls.h b/kernel/syscalls.h index ff7c2e5..5c7a772 100644 --- a/kernel/syscalls.h +++ b/kernel/syscalls.h @@ -6,6 +6,8 @@ //fool-os syscalls #define SYSCALL_READDIR 63 +#define SYSCALL_HAS_DATA 80 +#define SYSCALL_TUNE 81 //syscalls required by newlib #define SYSCALL_EXIT 60 -- cgit v1.2.3