CS318 - Pintos
Pintos source browser for JHU CS318 course
Functions | Variables
input.c File Reference
#include "devices/input.h"
#include <debug.h>
#include "devices/intq.h"
#include "devices/serial.h"
Include dependency graph for input.c:

Go to the source code of this file.

Functions

void input_init (void)
 Initializes the input buffer. More...
 
void input_putc (uint8_t key)
 Adds a key to the input buffer. More...
 
uint8_t input_getc (void)
 Retrieves a key from the input buffer. More...
 
bool input_full (void)
 Returns true if the input buffer is full, false otherwise. More...
 

Variables

static struct intq buffer
 Stores keys from the keyboard and serial port. More...
 

Function Documentation

◆ input_full()

bool input_full ( void  )

Returns true if the input buffer is full, false otherwise.

devices/input.h

Interrupts must be off.

Definition at line 48 of file input.c.

References ASSERT, buffer, intq_full(), intr_get_level(), and INTR_OFF.

Referenced by keyboard_interrupt(), serial_interrupt(), and write_ier().

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

◆ input_getc()

uint8_t input_getc ( void  )

Retrieves a key from the input buffer.

If the buffer is empty, waits for a key to be pressed.

Definition at line 31 of file input.c.

References buffer, intq_getc(), intr_disable(), intr_set_level(), and serial_notify().

Here is the call graph for this function:

◆ input_init()

void input_init ( void  )

Initializes the input buffer.

Definition at line 11 of file input.c.

References buffer, and intq_init().

Referenced by pintos_init().

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

◆ input_putc()

void input_putc ( uint8_t  key)

Adds a key to the input buffer.

Interrupts must be off and the buffer must not be full.

Definition at line 19 of file input.c.

References ASSERT, buffer, intq_full(), intq_putc(), intr_get_level(), INTR_OFF, and serial_notify().

Referenced by keyboard_interrupt(), and serial_interrupt().

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

Variable Documentation

◆ buffer

struct intq buffer
static