MP3 1.0
This is the Doxygen document for ECE391 MP3.
Loading...
Searching...
No Matches
Macros | Functions | Variables
keyboard.h File Reference

Header file for keyboard.c. More...

#include "terminal.h"

Go to the source code of this file.

Macros

#define SCANCODE_ARRAY_SIZE   (84)
 
#define KEYBOARD_PORT   (0x60)
 
#define KEYBOARD_BUF_SIZE   (128)
 
#define LSHIFT_PRESSED   (0x2A)
 
#define LSHIFT_RELEASED   (0xAA)
 
#define RSHIFT_PRESSED   (0x36)
 
#define RSHIFT_RELEASED   (0xB6)
 
#define CTRL_PRESSED   (0x1D)
 
#define CTRL_RELEASED   (0x9D)
 
#define ALT_PRESSED   (0x38)
 
#define ALT_RELEASED   (0xB8)
 
#define F1_PRESSED   (0x3B)
 
#define F2_PRESSED   (0x3C)
 
#define F3_PRESSED   (0x3D)
 
#define TAB_SIZE   (4)
 

Functions

void keyboardInit ()
 Initializes the keyboard by enabling its interrupts to the PIC. More...
 
void keyboardInterrupt ()
 Handler for keyboard interrupt. More...
 
int populateKeyboardBuffer (char c)
 Add the input character c into the keyboard buffer. More...
 
void clearKeyboardBuffer ()
 Wipe the keyboard buffer. More...
 
void transferKeyboardBuffer (char *buf, int32_t nbytes)
 Transfer nbytes of the active terminal's keyboard buffer into the provided buf. More...
 
void checkTerminalSwap (unsigned char i)
 Checks keyboard inputs to see if terminal swap command issued. More...
 

Variables

int keyboardBufIndex [MAX_NUM_TERMINALS]
 
int enterPressed [MAX_NUM_TERMINALS]
 
char keyboardBuf [MAX_NUM_TERMINALS][KEYBOARD_BUF_SIZE]
 Buffers of keys typed for terminal to interpret. More...
 

Detailed Description

Header file for keyboard.c.

Author
Group 8
Version
1.0
Date
2023-03-11

Macro Definition Documentation

◆ ALT_PRESSED

#define ALT_PRESSED   (0x38)

◆ ALT_RELEASED

#define ALT_RELEASED   (0xB8)

◆ CTRL_PRESSED

#define CTRL_PRESSED   (0x1D)

◆ CTRL_RELEASED

#define CTRL_RELEASED   (0x9D)

◆ F1_PRESSED

#define F1_PRESSED   (0x3B)

◆ F2_PRESSED

#define F2_PRESSED   (0x3C)

◆ F3_PRESSED

#define F3_PRESSED   (0x3D)

◆ KEYBOARD_BUF_SIZE

#define KEYBOARD_BUF_SIZE   (128)

◆ KEYBOARD_PORT

#define KEYBOARD_PORT   (0x60)

◆ LSHIFT_PRESSED

#define LSHIFT_PRESSED   (0x2A)

◆ LSHIFT_RELEASED

#define LSHIFT_RELEASED   (0xAA)

◆ RSHIFT_PRESSED

#define RSHIFT_PRESSED   (0x36)

◆ RSHIFT_RELEASED

#define RSHIFT_RELEASED   (0xB6)

◆ SCANCODE_ARRAY_SIZE

#define SCANCODE_ARRAY_SIZE   (84)

◆ TAB_SIZE

#define TAB_SIZE   (4)

Function Documentation

◆ checkTerminalSwap()

void checkTerminalSwap ( unsigned char  i)

Checks keyboard inputs to see if terminal swap command issued.

Parameters
iHexcode returned from keyboard for current key pressed / released.
Note
This function enters swapTerminal if valid F key is pressed.
Parameters
iHexcode returned from keyboard for current key pressed / released.
Note
This function enters swapTerminal if valid F key is pressed.

◆ clearKeyboardBuffer()

void clearKeyboardBuffer ( )

Wipe the keyboard buffer.

◆ keyboardInit()

void keyboardInit ( )

Initializes the keyboard by enabling its interrupts to the PIC.

◆ keyboardInterrupt()

void keyboardInterrupt ( )

Handler for keyboard interrupt.

Takes scancode and indexes into array to print relevant character. Also handle special cases such as shift, caps lock, ctrl + L, enter, backspace, tab, and Alt + F1/F2/F3 (terminal swaps).

Note
Always uses kputc instead of putc in order to always write to display.

Takes scancode and indexes into array to print relevant character. Also handle special cases such as shift, caps lock, ctrl + L, enter, backspace, tab, and Alt + F1/F2/F3 (terminal swaps).

Note
Always uses kputc instead of putc in order to always write to display.

◆ populateKeyboardBuffer()

int populateKeyboardBuffer ( char  c)

Add the input character c into the keyboard buffer.

Parameters
cThe character to be added to the corresponding keyboard buffer.
Returns
0 on success.
-1 on failure.
Note
If buffer is full, we stall and don't take any more key presses.
Parameters
cThe character to be added to the corresponding keyboard buffer.
Returns
0 on success.
-1 on failure.
Note
If buffer is full, we stall and don't take any more key presses.

◆ transferKeyboardBuffer()

void transferKeyboardBuffer ( char *  buf,
int32_t  nbytes 
)

Transfer nbytes of the active terminal's keyboard buffer into the provided buf.

Parameters
bufBuffer that will contain the characters transfered.
nbytesNumber of bytes to copy.
Warning
This clears the active terminal's keyboard buffer.
Parameters
bufBuffer that will contain the characters transfered.
nbytesNumber of bytes to copy.
Warning
This clears the active terminal's keyboard buffer.

Variable Documentation

◆ enterPressed

int enterPressed[MAX_NUM_TERMINALS]

◆ keyboardBuf

Buffers of keys typed for terminal to interpret.

◆ keyboardBufIndex

int keyboardBufIndex[MAX_NUM_TERMINALS]