From dafb5464fe8b9a3f8ff41de233f9ff6cd21162ea Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Wed, 22 Aug 2018 06:00:39 +1000 Subject: Added the header file limits.h which contains one definition for SSIZE_MAX which is needed to limit the number of bytes read() will transfer. Laid the foundation for a TTY subsystem. This works by taking the previously used buffer and r/w pointers concept and implements it as a 'tty_queue' struct. The struct 'tty_struct' is used to represent a TTY device. This struct currently contains three elements; a read queue for data flowing from the device to the user, a write queue for data flowing from the user to the device and a function pointer to an init function. The latter element will reduce complexity by allowing the TTY subsystem to initialize each TTY device driver (when it's ready), rather than each driver having to be initialized during bootup. Each TTY device is implemented as a pointer to a tty_struct. The structures are defined separately by each driver as well as tracked and maintained by pointers in the table 'ttys' in tty.c. Modified the RS232 serial driver to make use of the new TTY subsystem for transferring data to the user. Currently, write calls are still handled manually through the rsputs() function though this will change in future. Modified the read() system call to direct read calls to the TTY subsystem which will further direct the call to the appropriate TTY device driver. The serial driver's interrupt routine now uses the wake_up() function to wake processes blocking for serial data. This is to ensure the scheduler is notified of the wakeup. This function is the preferred method for waking processes since accessing the task state field directly may not be possible in the future and is discouraged. The reason for this is that the scheduler's behaviour may change to require being notified of task wakeup events in the future. --- include/limits.h | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 include/limits.h (limited to 'include/limits.h') diff --git a/include/limits.h b/include/limits.h new file mode 100644 index 0000000..c2c9cc5 --- /dev/null +++ b/include/limits.h @@ -0,0 +1,8 @@ +#ifndef _LIMITS_H +#define _LIMITS_H + +#include + +#define SSIZE_MAX ((size_t) ~((size_t) 1 << (sizeof(size_t) * 8 - 1))) + +#endif -- cgit v1.3