diff options
| author | miguel <miguel@miguel-acer.softwarefools.com> | 2014-08-25 16:48:00 +0200 |
|---|---|---|
| committer | miguel <miguel@miguel-acer.softwarefools.com> | 2014-08-25 16:48:00 +0200 |
| commit | fc7022286a14e7325907fb4e77aa44330037229b (patch) | |
| tree | d4e5b7ee6455f601313e0c347a158a655ebf2b27 /README.md | |
| parent | 838e8c0a19b64008e4da6222ca7a7cb60d95d021 (diff) | |
minor changes and some notes on keyboard driver
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -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 ~ |
