# atkbd.c File Reference

`#include <isa/atkbd.h>`
`#include <isa/8259.h>`
`#include <sys/video.h>`
`#include <sys/idt.h>`
`#include <sys/gdt.h>`
`#include <sys/io.h>`
`#include <lib/kmalloc.h>`
`#include <lib/kprintf.h>`
`#include <ubixos/types.h>`
`#include <ubixos/sched.h>`
`#include <ubixos/endtask.h>`
`#include <ubixos/tty.h>`
`#include <ubixos/spinlock.h>`
`#include <ubixos/kpanic.h>`
`#include <ubixos/vitals.h>`

Include dependency graph for atkbd.c:

Go to the source code of this file.

## Functions

| asm (".globl atkbd_isr \n""atkbd_isr: \n"" pusha \n"" push %ss \n"" push %ds \n"" push %es \n"" push %fs \n"" push %gs \n"" call keyboardHandler \n"" mov $0x20,%dx \n"" mov $0x20,%ax \n"" outb %al,%dx \n"" pop %gs \n"" pop %fs \n"" pop %es \n"" pop %ds \n"" pop %ss \n"" popa \n"" iret \n")
int | atkbd_init ()
static int | atkbd_scan ()
unsigned char | getch ()
void | keyboardHandler ()
void | setLED ()

## Variables

static spinLock_t | atkbdSpinLock = SPIN_LOCK_INITIALIZER
static uInt32 | controlKeys = 0x0
static unsigned int | keyboardMap [255][8]
static unsigned int | keyMap = 0x0
static unsigned int | ledStatus = 0x0
static char | stdinBuffer [512]
static uInt16 | stdinSize

## Function Documentation

asm | ( | ".globl atkbd_isr \n""atkbd_isr: \n"" pusha \n"" push %ss \n"" push %ds \n"" push %es \n"" push %fs \n"" push %gs \n"" call keyboardHandler \n"" mov $ | 0x20,
|  | %dx\n""mov $ | 0x20,
|  | %ax\n""outb% | al,
|  | %dx\n""pop%gs\n""pop%fs\n""pop%es\n""pop%ds\n""pop%ss\n""popa\n""iret\n" |  |
| ) |  |  |

int atkbd_init | ( |  | ) |

Definition at line 157 of file atkbd.c.

References atkbd_isr(), atkbd_scan(), dDpl0, dInt, dPresent, irqEnable(), kprintf(), mVec, setLED(), setVector(), stdinBuffer, and x1.

Here is the call graph for this function:

static int atkbd_scan | ( |  | ) | `[static]`

Definition at line 203 of file atkbd.c.

References inportByte(), and outportByte().

Referenced by atkbd_init(), and keyboardHandler().

Here is the call graph for this function:

unsigned char getch | ( |  | ) |

Definition at line 329 of file atkbd.c.

References tty_termNode::stdin, stdinBuffer, tty_termNode::stdinSize, stdinSize, tty_foreground, and x1.

Referenced by sysFgetc().

void keyboardHandler | ( |  | ) |

Definition at line 216 of file atkbd.c.

References altKey, atkbd_scan(), atkbdSpinLock, backSpace(), controlKey, controlKeys, vitalsStruct::freePages, inportByte(), K_PANIC, keyboardMap, keyMap, kprintf(), ledCapslock, ledNumlock, ledScrolllock, ledStatus, outportByte(), setLED(), shiftKey, spinTryLock(), spinUnlock(), tty_termNode::stdin, stdinBuffer, tty_termNode::stdinSize, stdinSize, systemVitals, tty_change(), and tty_foreground.

Here is the call graph for this function:

void setLED | ( |  | ) |

Definition at line 321 of file atkbd.c.

References inportByte(), ledStatus, and outportByte().

Referenced by atkbd_init(), and keyboardHandler().

Here is the call graph for this function:

## Variable Documentation

spinLock_t atkbdSpinLock = SPIN_LOCK_INITIALIZER`[static]`

Definition at line 54 of file atkbd.c.

Referenced by keyboardHandler().

uInt32 controlKeys = 0x0`[static]`

Definition at line 52 of file atkbd.c.

Referenced by keyboardHandler().

unsigned int keyboardMap[255][8]`[static]`

Definition at line 56 of file atkbd.c.

Referenced by keyboardHandler().

unsigned int keyMap = 0x0`[static]`

Definition at line 48 of file atkbd.c.

Referenced by keyboardHandler().

unsigned int ledStatus = 0x0`[static]`

Definition at line 49 of file atkbd.c.

Referenced by keyboardHandler(), and setLED().

char stdinBuffer[512]`[static]`

Definition at line 50 of file atkbd.c.

Referenced by atkbd_init(), getch(), and keyboardHandler().

uInt16 stdinSize `[static]`

Definition at line 51 of file atkbd.c.

Referenced by getch(), and keyboardHandler().