summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authormiguel <miguel@miguel-acer.softwarefools.com>2014-08-25 16:48:00 +0200
committermiguel <miguel@miguel-acer.softwarefools.com>2014-08-25 16:48:00 +0200
commitfc7022286a14e7325907fb4e77aa44330037229b (patch)
treed4e5b7ee6455f601313e0c347a158a655ebf2b27 /README.md
parent838e8c0a19b64008e4da6222ca7a7cb60d95d021 (diff)
minor changes and some notes on keyboard driver
Diffstat (limited to 'README.md')
-rw-r--r--README.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/README.md b/README.md
index f3be90c..0bd2a18 100644
--- a/README.md
+++ b/README.md
@@ -116,6 +116,57 @@ REFERENCES
MY NOTES BELOW THIS LINE
========================
+Keyboard Driver
+---------------
+
+//some thoughts on redesign of the keyboard driver
+//use uint8_t for proc_pos and buff_pos and a BUF_SIZE of 256 for auto wrap!?
+
+// kb input ringbuffer
+#define BUF_SIZE 256
+kb_scancode kb_buff[BUF_SIZE];
+
+buff_pos=0;
+proc_pos=0;
+buffered=0;
+
+void kb_irq()
+{
+ cli
+
+ //we get one interrupt for EACH scancode!
+ kb_scancode val=get_scancode();
+
+ // think about race condition if called while inside kb_proc();
+ if(buffered+1<BUF_SIZE)
+ {
+ kb_buff[buff_pos]=val;
+ buff_pos++;
+ buffered++;
+ }
+ else
+ {
+ //kb ring buffer is full;
+ }
+ sti
+
+}
+
+
+void kb_proc()
+{
+ if(proc_pos!=buff_pos)
+ {
+ kb_scancode val=kb_buff[proc_pos];
+
+ proc_pos++;
+ buffered--;
+
+ stdin(scancode_to_char(val));
+
+ }
+}
+
Linux Startup x86
-----------------
~ ontogeny recapitulates phylogeny ~