PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
kbd.c File Reference
#include <kernel/drivers/abstract/kbd.h>
#include <kernel/fs/devfs.h>
#include <kernel/fs/file.h>
#include <kernel/fs/path.h>
#include <kernel/fs/vfs.h>
#include <kernel/log/log.h>
#include <kernel/sched/clock.h>
#include <kernel/sched/timer.h>
#include <kernel/sched/wait.h>
#include <kernel/sync/lock.h>
#include <errno.h>
#include <kernel/utils/fifo.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/fs.h>
#include <sys/math.h>
#include <sys/proc.h>
Include dependency graph for kbd.c:

Go to the source code of this file.

Functions

static size_t kbd_name_read (file_t *file, void *buffer, size_t count, size_t *offset)
 
static uint64_t kbd_events_open (file_t *file)
 
static void kbd_events_close (file_t *file)
 
static size_t kbd_events_read (file_t *file, void *buffer, size_t count, size_t *offset)
 
static wait_queue_tkbd_events_poll (file_t *file, poll_events_t *revents)
 
static void kbd_dir_cleanup (vnode_t *vnode)
 
kbd_tkbd_new (const char *name)
 Allocate and initialize a new keyboard.
 
void kbd_free (kbd_t *kbd)
 Frees a keyboard.
 
static void kbd_broadcast (kbd_t *kbd, const char *string, size_t length)
 
void kbd_press (kbd_t *kbd, keycode_t code)
 Push a keyboard press event to the keyboard event queue.
 
void kbd_release (kbd_t *kbd, keycode_t code)
 Push a keyboard release event to the keyboard event queue.
 

Variables

static dentry_tdir = NULL
 
static atomic_uint64_t newId = ATOMIC_VAR_INIT(0)
 
static file_ops_t nameOps
 
static file_ops_t eventsOps
 
static vnode_ops_t dirVnodeOps
 

Function Documentation

◆ kbd_name_read()

static size_t kbd_name_read ( file_t file,
void *  buffer,
size_t  count,
size_t offset 
)
static

Definition at line 25 of file kbd.c.

Here is the call graph for this function:

◆ kbd_events_open()

static uint64_t kbd_events_open ( file_t file)
static

Definition at line 38 of file kbd.c.

Here is the call graph for this function:

◆ kbd_events_close()

static void kbd_events_close ( file_t file)
static

Definition at line 60 of file kbd.c.

Here is the call graph for this function:

◆ kbd_events_read()

static size_t kbd_events_read ( file_t file,
void *  buffer,
size_t  count,
size_t offset 
)
static

Definition at line 78 of file kbd.c.

Here is the call graph for this function:

◆ kbd_events_poll()

static wait_queue_t * kbd_events_poll ( file_t file,
poll_events_t revents 
)
static

Definition at line 111 of file kbd.c.

Here is the call graph for this function:

◆ kbd_dir_cleanup()

static void kbd_dir_cleanup ( vnode_t vnode)
static

Definition at line 134 of file kbd.c.

Here is the call graph for this function:

◆ kbd_broadcast()

static void kbd_broadcast ( kbd_t kbd,
const char *  string,
size_t  length 
)
static

Definition at line 236 of file kbd.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dir

dentry_t* dir = NULL
static

Definition at line 21 of file kbd.c.

◆ newId

atomic_uint64_t newId = ATOMIC_VAR_INIT(0)
static

Definition at line 23 of file kbd.c.

◆ nameOps

file_ops_t nameOps
static
Initial value:
= {
.read = kbd_name_read,
}
static size_t kbd_name_read(file_t *file, void *buffer, size_t count, size_t *offset)
Definition kbd.c:25

Definition at line 34 of file kbd.c.

◆ eventsOps

file_ops_t eventsOps
static
Initial value:
= {
.open = kbd_events_open,
.close = kbd_events_close,
.read = kbd_events_read,
.poll = kbd_events_poll,
}
static size_t kbd_events_read(file_t *file, void *buffer, size_t count, size_t *offset)
Definition kbd.c:78
static void kbd_events_close(file_t *file)
Definition kbd.c:60
static wait_queue_t * kbd_events_poll(file_t *file, poll_events_t *revents)
Definition kbd.c:111
static uint64_t kbd_events_open(file_t *file)
Definition kbd.c:38

Definition at line 127 of file kbd.c.

◆ dirVnodeOps

vnode_ops_t dirVnodeOps
static
Initial value:
= {
.cleanup = kbd_dir_cleanup,
}
static void kbd_dir_cleanup(vnode_t *vnode)
Definition kbd.c:134

Definition at line 146 of file kbd.c.