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
Diff: main.cpp
- Revision:
- 20:13556e5bac04
- Parent:
- 16:370b9e559f92
--- a/main.cpp Fri Apr 12 04:15:26 2013 +0000 +++ b/main.cpp Mon Apr 15 02:37:02 2013 +0000 @@ -33,20 +33,23 @@ #include "clock.h" #include "i2s.h" #include "nvic.h" - +#include "SDFileSystem.h" + +#define DEVICE_STDIO_MESSAGES +#include "mbed_debug.h" PS2Keyboard *ps2kb; DigitalOut myled(LED1); - - Serial serial(USBTX, USBRX); ConsoleStream console("console"); +SDFileSystem *sdcard; + void keyboard_init(); int main() { serial.baud(9600); - serial.puts("Resetting interrupt priorities..."); + serial.puts("Resetting interrupt priorities..\n"); //Set all priorities to 100 so we are able to make VGA a priority //By default, all priorities are at their highest 0 NVIC_SetPriority( NonMaskableInt_IRQn, 100 ); @@ -72,7 +75,7 @@ NVIC_SetPriority(I2C0_IRQn, 100); NVIC_SetPriority(I2C1_IRQn, 100); NVIC_SetPriority(I2C2_IRQn, 100); - NVIC_SetPriority(SPI_IRQn, 100); + NVIC_SetPriority(SPI_IRQn, 1); NVIC_SetPriority(SSP0_IRQn, 100); NVIC_SetPriority(SSP1_IRQn, 100); NVIC_SetPriority(PLL0_IRQn, 100); @@ -99,16 +102,25 @@ keyboard_init(); fl_select_clock_i2s(FL_CLOCK_DIV1); // assume 100MHz fl_i2s_set_tx_rate(1,4); // set 25 MHz pixel clock - + NVIC_SetPriority( EINT3_IRQn, 90 ); + //initialize way down here AFTER overclocking has already taken place + //Otherwise we end up with sdcard assume a different clockrate or something + wait(0.5); //MAGIC do not remove this wait statement. SD card won't work otherwise. + sdcard=new SDFileSystem(p11, p12, p13, p20, "sd"); + freopen("/console", "w", stdout); setvbuf(stdout, NULL, _IONBF, 0); freopen("/console", "r", stdin); - //setvbuf(stdout, NULL, _IONBF, 0); - freopen("/console", "w", stderr); + setvbuf(stdout, NULL, _IONBF, 0); + //freopen("/console", "w", stderr); setvbuf(stderr, NULL, _IONBF, 0); + //serial.baud(9216);//9600); + + serial.puts("Entering main shell\n"); + debug("testing... "); while(1) { vputs("mbedConsole by Jordan Earls\n");