A project to implement a console using the Mbed using VGA for video output and a PS/2 keyboard for the input. The eventual goal is to also include tools for managing SD cards, and a semi-self-hosting programming environment.
Dependencies: PS2_MbedConsole fastlib SDFileSystem vga640x480g_mbedconsole lightvm mbed
MbedConsole is a cool little project to have a self-contained computer all on an Mbed. So far it has VGA and PS/2 support and can stand alone without a computer powering it. Next planned features are SD card support and a lightweight programmable VM complete with a file editor and self-hosted assembler.
You can view additional details about it at http://earlz.net/tags/mbedconsole
mbedconsole.h@16:370b9e559f92, 2012-09-30 (annotated)
- Committer:
- earlz
- Date:
- Sun Sep 30 16:48:41 2012 +0000
- Revision:
- 16:370b9e559f92
- Parent:
- 13:442bd2fb4ea0
- Child:
- 20:13556e5bac04
Added BSD license notice
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
earlz | 16:370b9e559f92 | 1 | /* |
earlz | 16:370b9e559f92 | 2 | <Copyright Header> |
earlz | 16:370b9e559f92 | 3 | Copyright (c) 2012 Jordan "Earlz" Earls <http://lastyearswishes.com> |
earlz | 16:370b9e559f92 | 4 | All rights reserved. |
earlz | 16:370b9e559f92 | 5 | |
earlz | 16:370b9e559f92 | 6 | Redistribution and use in source and binary forms, with or without |
earlz | 16:370b9e559f92 | 7 | modification, are permitted provided that the following conditions |
earlz | 16:370b9e559f92 | 8 | are met: |
earlz | 16:370b9e559f92 | 9 | |
earlz | 16:370b9e559f92 | 10 | 1. Redistributions of source code must retain the above copyright |
earlz | 16:370b9e559f92 | 11 | notice, this list of conditions and the following disclaimer. |
earlz | 16:370b9e559f92 | 12 | 2. Redistributions in binary form must reproduce the above copyright |
earlz | 16:370b9e559f92 | 13 | notice, this list of conditions and the following disclaimer in the |
earlz | 16:370b9e559f92 | 14 | documentation and/or other materials provided with the distribution. |
earlz | 16:370b9e559f92 | 15 | 3. The name of the author may not be used to endorse or promote products |
earlz | 16:370b9e559f92 | 16 | derived from this software without specific prior written permission. |
earlz | 16:370b9e559f92 | 17 | |
earlz | 16:370b9e559f92 | 18 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
earlz | 16:370b9e559f92 | 19 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
earlz | 16:370b9e559f92 | 20 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
earlz | 16:370b9e559f92 | 21 | THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
earlz | 16:370b9e559f92 | 22 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
earlz | 16:370b9e559f92 | 23 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
earlz | 16:370b9e559f92 | 24 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
earlz | 16:370b9e559f92 | 25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
earlz | 16:370b9e559f92 | 26 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
earlz | 16:370b9e559f92 | 27 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
earlz | 16:370b9e559f92 | 28 | |
earlz | 16:370b9e559f92 | 29 | This file is part of the MbedConsole project |
earlz | 16:370b9e559f92 | 30 | */ |
earlz | 16:370b9e559f92 | 31 | |
earlz | 2:e2a4c5d17d59 | 32 | #ifndef MBEDCONSOLE_H |
earlz | 2:e2a4c5d17d59 | 33 | #define MBEDCONSOLE_H |
earlz | 2:e2a4c5d17d59 | 34 | |
earlz | 2:e2a4c5d17d59 | 35 | #include "mbed.h" |
earlz | 2:e2a4c5d17d59 | 36 | #include "vga640x480g.h" |
earlz | 9:4211d638b2e9 | 37 | #include "PS2Keyboard.h" |
earlz | 2:e2a4c5d17d59 | 38 | |
earlz | 2:e2a4c5d17d59 | 39 | void vputc(char c); |
earlz | 2:e2a4c5d17d59 | 40 | void vputs(char *s); |
earlz | 2:e2a4c5d17d59 | 41 | char vgetc(); |
earlz | 2:e2a4c5d17d59 | 42 | int vgetsl(char *s, int len); |
earlz | 2:e2a4c5d17d59 | 43 | void vsetcursor(int x, int y); |
earlz | 2:e2a4c5d17d59 | 44 | |
earlz | 2:e2a4c5d17d59 | 45 | int strlcmp(const char *s1,const char *s2,size_t count); |
earlz | 2:e2a4c5d17d59 | 46 | |
earlz | 2:e2a4c5d17d59 | 47 | void shell_begin(); |
earlz | 2:e2a4c5d17d59 | 48 | |
earlz | 9:4211d638b2e9 | 49 | extern PS2Keyboard *ps2kb; |
earlz | 3:2bc2b0dce10e | 50 | |
earlz | 3:2bc2b0dce10e | 51 | |
earlz | 3:2bc2b0dce10e | 52 | |
earlz | 2:e2a4c5d17d59 | 53 | extern Serial serial; |
earlz | 2:e2a4c5d17d59 | 54 | |
earlz | 2:e2a4c5d17d59 | 55 | |
earlz | 9:4211d638b2e9 | 56 | class ConsoleStream : public Stream //do this so we get printf and other goodies. Uses C functions for VGA and PS/2 |
earlz | 9:4211d638b2e9 | 57 | { |
earlz | 9:4211d638b2e9 | 58 | public: |
earlz | 13:442bd2fb4ea0 | 59 | ConsoleStream(const char* name):Stream(name){} |
earlz | 9:4211d638b2e9 | 60 | protected: |
earlz | 9:4211d638b2e9 | 61 | |
earlz | 9:4211d638b2e9 | 62 | // Stream implementation functions |
earlz | 9:4211d638b2e9 | 63 | virtual int _putc(int value) |
earlz | 9:4211d638b2e9 | 64 | { |
earlz | 9:4211d638b2e9 | 65 | vputc((char)value); |
earlz | 9:4211d638b2e9 | 66 | return 1; |
earlz | 9:4211d638b2e9 | 67 | } |
earlz | 9:4211d638b2e9 | 68 | virtual int _getc() |
earlz | 9:4211d638b2e9 | 69 | { |
earlz | 11:fede136943a9 | 70 | return vgetc(); |
earlz | 9:4211d638b2e9 | 71 | } |
earlz | 9:4211d638b2e9 | 72 | }; |
earlz | 9:4211d638b2e9 | 73 | |
earlz | 9:4211d638b2e9 | 74 | extern ConsoleStream console; |
earlz | 9:4211d638b2e9 | 75 | |
earlz | 2:e2a4c5d17d59 | 76 | |
earlz | 13:442bd2fb4ea0 | 77 | //Byte array of bitmap of 464 x 240 px: |
earlz | 13:442bd2fb4ea0 | 78 | |
earlz | 13:442bd2fb4ea0 | 79 | #define HACKADAY_WIDTH 464 |
earlz | 13:442bd2fb4ea0 | 80 | #define HACKADAY_HEIGHT 240 |
earlz | 13:442bd2fb4ea0 | 81 | |
earlz | 13:442bd2fb4ea0 | 82 | extern "C" const uint8_t hackadaylogo[]; |
earlz | 13:442bd2fb4ea0 | 83 | |
earlz | 13:442bd2fb4ea0 | 84 | |
earlz | 1:eb209f0468de | 85 | #endif |