LF OS
Hobby operating system for amd64 with high ambitions
Loading...
Searching...
No Matches
keyboard.c File Reference

(475a4fe LLVM update: finally on 18.x!)

#include <stdint.h>
#include <string.h>
#include <sys/syscalls.h>
#include <sys/io.h>
#include <errno.h>
#include "main.h"
#include <vterm.h>
#include <vterm_keycodes.h>
+ Include dependency graph for keyboard.c:

Go to the source code of this file.

Macros

#define vterm_keycode(x)   ((uint16_t)(x) | 0x8000)
 
#define unused_single(x)   0xFFFF
 
#define unused(x)   unused_single(x), unused_single(x), unused_single(x)
 
#define unmapped   unused(not_mapped)
 
#define unmapped_single   unused_single(not_mapped)
 

Functions

static void translate_and_feed_scancode (lfos_term_state *term, int set, uint16_t scancode)
 
static void kbd_handle_input (lfos_term_state *term)
 
static void kbd_send_cmd (uint8_t cmd)
 
static bool kbd_wait_interrupt ()
 
void kbd_read (lfos_term_state *term)
 
void kbd_init ()
 

Macro Definition Documentation

◆ unmapped

#define unmapped   unused(not_mapped)

◆ unmapped_single

#define unmapped_single   unused_single(not_mapped)

◆ unused

#define unused (   x)    unused_single(x), unused_single(x), unused_single(x)

◆ unused_single

#define unused_single (   x)    0xFFFF

◆ vterm_keycode

#define vterm_keycode (   x)    ((uint16_t)(x) | 0x8000)

Function Documentation

◆ kbd_handle_input()

static void kbd_handle_input ( lfos_term_state term)
static

Definition at line 217 of file keyboard.c.

References inb(), and translate_and_feed_scancode().

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

◆ kbd_init()

void kbd_init ( )

Definition at line 288 of file keyboard.c.

References error, inb(), and kbd_send_cmd().

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

◆ kbd_read()

void kbd_read ( lfos_term_state term)

Definition at line 277 of file keyboard.c.

References kbd_handle_input(), and kbd_wait_interrupt().

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

◆ kbd_send_cmd()

static void kbd_send_cmd ( uint8_t  cmd)
static

Definition at line 254 of file keyboard.c.

References inb(), and outb().

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

◆ kbd_wait_interrupt()

static bool kbd_wait_interrupt ( )
static

Definition at line 259 of file keyboard.c.

References EAGAIN, error, free(), malloc(), memset(), MT_HardwareInterrupt, size, Message::size, and Message::type.

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

◆ translate_and_feed_scancode()

static void translate_and_feed_scancode ( lfos_term_state term,
int  set,
uint16_t  scancode 
)
static