From 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 27 Mar 2012 11:51:08 +0200 Subject: reorganize file structure to match the upstream requirements --- pintos-progos/devices/input.c | 52 ------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 pintos-progos/devices/input.c (limited to 'pintos-progos/devices/input.c') diff --git a/pintos-progos/devices/input.c b/pintos-progos/devices/input.c deleted file mode 100644 index 4a12160..0000000 --- a/pintos-progos/devices/input.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "devices/input.h" -#include -#include "devices/intq.h" -#include "devices/serial.h" - -/* Stores keys from the keyboard and serial port. */ -static struct intq buffer; - -/* Initializes the input buffer. */ -void -input_init (void) -{ - intq_init (&buffer); -} - -/* Adds a key to the input buffer. - Interrupts must be off and the buffer must not be full. */ -void -input_putc (uint8_t key) -{ - ASSERT (intr_get_level () == INTR_OFF); - ASSERT (!intq_full (&buffer)); - - intq_putc (&buffer, key); - serial_notify (); -} - -/* Retrieves a key from the input buffer. - If the buffer is empty, waits for a key to be pressed. */ -uint8_t -input_getc (void) -{ - enum intr_level old_level; - uint8_t key; - - old_level = intr_disable (); - key = intq_getc (&buffer); - serial_notify (); - intr_set_level (old_level); - - return key; -} - -/* Returns true if the input buffer is full, - false otherwise. - Interrupts must be off. */ -bool -input_full (void) -{ - ASSERT (intr_get_level () == INTR_OFF); - return intq_full (&buffer); -} -- cgit v1.2.3