/************************************************************************** * Put a character on the current console. * c - The ASCII value of the character. **************************************************************************/ s32int kputchar( s32int c ) { u32int flags; disable_and_save_interrupts(flags); // For now just print to the video buffer. video_put_char(c, (console_t *)(&vir_cons[0])); restore_interrupts(flags); return( 0 ); }
int main(void) { // Initial setup of the I/O ports. AD1PCFG = 0xFFFF; // Default all pins to digital. mJTAGPortEnable(0); // Turn off JTAG. // Setup the CPU. // System config performance. SYSTEMConfigPerformance(CLOCKFREQ); #if defined(MAXIMITE) || (defined(UBW32) && defined(__DEBUG)) || \ defined(DUINOMITE) // Fix the peripheral bus to the main clock speed. mOSCSetPBDIV(OSC_PB_DIV_1); #endif INTEnableSystemMultiVectoredInt(); // Allow vectored interrupts. keyboard_init(); // Initialise and startup the keyboard routines. video_init(); // Start the video state machine. video_clear_screen(); // Clear the video buffer. DelayUs(1*1000*1000); while (keyboard_inkey() != -1); video_display_string("MAXIMITE console\r\n"); while (1) { int ch = input_key(); video_put_char(ch); { static char buf[10]; sprintf(buf, "<%02X>", ch); video_display_string(buf); } if (ch == '\n') video_put_char('\r'); } }