diff options
| author | Jake Mannens <jake72360@gmail.com> | 2018-08-06 00:32:06 +1000 |
|---|---|---|
| committer | Jake Mannens <jake72360@gmail.com> | 2018-08-06 00:32:06 +1000 |
| commit | 3ed830019561a06b0cb98f792cc447a157fd4ef2 (patch) | |
| tree | 08d6bcd81a84881a8158752e73a144f2989253f8 /include/stdio.h | |
| parent | 8e933fac9fd068343bb602f13175c8d70a6c5768 (diff) | |
Defined ssize_t in unistd.h.
Added the _syscall2 macro to unistd.h to facilitate system calls that
require two arguments to be passed.
Modified the ATA driver to simply abort initialisation if a drive is not
found, or cannot be configured. This will allow the kernel to function
on a diskless system without invoking panic() unnecessarily.
Added the functions irq_enable() and irq_disable() to asm/interrupt.h to
make it easier for C code to mask and unmask IRQ's on each PIC.
Moved the declaration for rsputs() from kernel/con.h to the new
kernel/serial.h file since this is a function provided by the serial
driver.
Implemented a basic I/O input framework. This involves the new system
call sys_read, which takes an I/O read request and directs it to the
appropriate kernel handler function depending on the calling process'
ctty value. This mechanism is identical to the sys_puts system call.
Added the rsread() function to service sys_read calls from processes
whose ctty value is equal to 1. This function will continually copy data
from the serial buffer to the location specified. If there is not a
sufficient amount of new data in the buffer to satisfy the request, the
process is put into the TSTATE_UNINTERRUPTIBLE state and the scheduler
is called to switch tasks. Prior to calling the scheduler, the function
will set the waiting_task pointer to the calling process. This pointer
will later be used by the interrupt handler to wake the process when new
data arrives.
Added an interrupt handler to service the IRQ4 (UART) interrupt. This
subroutine is a stub which will save the machine's state then transfer
control to rs_handler() in serial.c which will read bytes from the
serial port and place them in a buffer. Before returning, rs_handler()
checks the waiting_task pointer to see if a task is waiting for the
newly received data and if so, it sets the task's state to
TSTATE_RUNNING before resetting the pointer to NULL and returning.
Ideally, the scheduler should be invoked at this point to select another
task but since our basic round-robin scheduler currently has no concept
of task priorities (and for the sake of simplicity), we will avoid
invoking the scheduler in response to interrupts for now.
Diffstat (limited to 'include/stdio.h')
| -rw-r--r-- | include/stdio.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/stdio.h b/include/stdio.h index 824eb31..f94e783 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -2,6 +2,8 @@ #define _STDIO_H #include <stdarg.h> +#include <sys/types.h> +#include <unistd.h> #define EOF -1 @@ -12,6 +14,8 @@ int sprintf(char*, char*, ...); int vsprintf(char*, char*, va_list); +ssize_t read(void *buf, size_t len); + int ctty(int ctty); #endif |
