URL
https://opencores.org/ocsvn/thor/thor/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 30 |
Rev 32 |
#pragma once
|
#pragma once
|
class clsKeyboard
|
#include "clsDevice.h"
|
|
|
|
class clsKeyboard : public clsDevice
|
{
|
{
|
unsigned __int8 buffer[32];
|
unsigned __int8 buffer[32];
|
int head;
|
int head;
|
int tail;
|
int tail;
|
public:
|
public:
|
volatile unsigned __int8 scancode;
|
volatile unsigned __int8 scancode;
|
volatile unsigned __int8 status;
|
volatile unsigned __int8 status;
|
clsKeyboard(void);
|
clsKeyboard(void);
|
~clsKeyboard(void);
|
~clsKeyboard(void);
|
bool IsSelected(unsigned int ad) { return ((ad & 0xFFFFFFF0)==0xFFDC0000); };
|
bool IsSelected(unsigned int ad) { return ((ad & 0xFFFFFFF0)==0xFFDC0000); };
|
void Put(unsigned __int8 sc) {
|
void Put(unsigned __int8 sc) {
|
scancode = sc;
|
scancode = sc;
|
buffer[head] = sc;
|
buffer[head] = sc;
|
head++;
|
head++;
|
head &= 31;
|
head &= 31;
|
};
|
};
|
unsigned __int8 Get() {
|
unsigned __int8 Get() {
|
unsigned __int8 sc;
|
unsigned __int8 sc;
|
|
|
sc = 0;
|
sc = 0;
|
if (head != tail) {
|
if (head != tail) {
|
sc = buffer[tail];
|
sc = buffer[tail];
|
tail++;
|
tail++;
|
tail &= 31;
|
tail &= 31;
|
}
|
}
|
return sc;
|
return sc;
|
};
|
};
|
unsigned __int8 Peek(int amt) {
|
unsigned __int8 Peek(int amt) {
|
unsigned __int8 sc;
|
unsigned __int8 sc;
|
int ndx;
|
int ndx;
|
|
|
ndx = tail + amt;
|
ndx = tail + amt;
|
ndx &= 31;
|
ndx &= 31;
|
sc = buffer[ndx];
|
sc = buffer[ndx];
|
return sc;
|
return sc;
|
};
|
};
|
unsigned __int8 GetStatus() {
|
unsigned __int8 GetStatus() {
|
if (head != tail)
|
if (head != tail)
|
return 0x80;
|
return 0x80;
|
else
|
else
|
return 0x00;
|
return 0x00;
|
};
|
};
|
};
|
};
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.