|
@@ -43,7 +43,7 @@
|
|
|
/* slowest: schk will display function info in this mode */
|
|
/* slowest: schk will display function info in this mode */
|
|
|
#define DEBUG_LEVEL TEST_DEBUG_LEVEL
|
|
#define DEBUG_LEVEL TEST_DEBUG_LEVEL
|
|
|
|
|
|
|
|
-#include <modules/tty.h>
|
|
|
|
|
|
|
+#include <kernel/console.h>
|
|
|
|
|
|
|
|
#define trappoint() \
|
|
#define trappoint() \
|
|
|
printk(yellow, "system runs at %s:%s.%d\n", __FILE__, __FUNCTION__, __LINE__);
|
|
printk(yellow, "system runs at %s:%s.%d\n", __FILE__, __FUNCTION__, __LINE__);
|
|
@@ -116,6 +116,21 @@ struct inode_desc {
|
|
|
|
|
|
|
|
struct file_opt {
|
|
struct file_opt {
|
|
|
/* open a file */
|
|
/* open a file */
|
|
|
|
|
+
|
|
|
|
|
+#define O_EXEC 0x00000001
|
|
|
|
|
+#define O_RDONLY 0x00000002
|
|
|
|
|
+#define O_WRONLY 0x00000004
|
|
|
|
|
+#define O_RDWR (O_RDONLY | O_WRONLY)
|
|
|
|
|
+#define O_SEARCH 0x00000008
|
|
|
|
|
+#define O_APPEND 0x00000010
|
|
|
|
|
+#define O_CREAT 0x00000020
|
|
|
|
|
+#define O_DIRECTORY 0x00000040
|
|
|
|
|
+#define O_EXCL 0x00000080
|
|
|
|
|
+#define O_NOCTTY 0x00000100
|
|
|
|
|
+#define O_NOFOLLOW 0x00000200
|
|
|
|
|
+#define O_NONBLOCK 0x00000400
|
|
|
|
|
+#define O_TRUNC 0x00000800
|
|
|
|
|
+
|
|
|
int (* open) (char *, __uint32_t, __uint32_t, errno_t *);
|
|
int (* open) (char *, __uint32_t, __uint32_t, errno_t *);
|
|
|
|
|
|
|
|
/* or create one */
|
|
/* or create one */
|
|
@@ -123,9 +138,6 @@ struct file_opt {
|
|
|
/* `creat` doesn't return file-descriptor, it returns errno */
|
|
/* `creat` doesn't return file-descriptor, it returns errno */
|
|
|
errno_t (* creat) (char *, __uint32_t, __uint32_t);
|
|
errno_t (* creat) (char *, __uint32_t, __uint32_t);
|
|
|
|
|
|
|
|
- /* `fill` fills a inode descriptor */
|
|
|
|
|
- errno_t (* fill) (char *, __uint32_t, __uint32_t, struct inode_desc *);
|
|
|
|
|
-
|
|
|
|
|
/* read from file-descriptor */
|
|
/* read from file-descriptor */
|
|
|
errno_t (* read) (int, char *, __uint64_t);
|
|
errno_t (* read) (int, char *, __uint64_t);
|
|
|
|
|
|
|
@@ -142,5 +154,28 @@ struct file_opt {
|
|
|
void (* close) (int);
|
|
void (* close) (int);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+struct tty {
|
|
|
|
|
+ struct fifo *input_fifo;
|
|
|
|
|
+
|
|
|
|
|
+ /* unreadable (wr-only) */
|
|
|
|
|
+#define T_NORD 0x01
|
|
|
|
|
+ /* tty_read returns character / line */
|
|
|
|
|
+#define T_COOKED 0x02
|
|
|
|
|
+
|
|
|
|
|
+ /* put the input character to screen (in tty_read) */
|
|
|
|
|
+#define T_INPUT_BACK 0x04
|
|
|
|
|
+
|
|
|
|
|
+ __uint8_t mode;
|
|
|
|
|
+
|
|
|
|
|
+ /* the controller process id */
|
|
|
|
|
+ __uint32_t ctl;
|
|
|
|
|
+
|
|
|
|
|
+ __uint8_t vx, vy;
|
|
|
|
|
+
|
|
|
|
|
+ int (* putc) (struct tty *, char c);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|