void timer_isr(void) { if (++nr_ticks%32 == 31) con_putc('X'); pic_cmd_eoi(); return; }
/*======================================* * tty_write * * Write to the tty device from the given * buffer. * * @buf Character buffer to write from. * @count How many characters to write. * * @returns How many characters that were * actually written. *======================================*/ int tty_write(char *buf, uint32_t count) { // the tty device should have some sort of // write queue, but right now we just print // the characters in 'buf'. char c, *b = buf; while(count--) { c = *b++; con_putc(c); } return b - buf; }
void con_putsw( const wchar_t *s ) { while( *s ) { con_putc( *s++ ); } }
void con_puts( const char *s ) { while( *s ) { con_putc( *s++ ); } }
static void con_putch(void* p, char c) { con_putc(c); }
void con_char_handler(char newchar) { if((newchar>=0x20 || newchar == 0x0D || newchar == 0x08 || newchar == 0x0A) && !con_escape_flag) { con_buf[(int)con_buf_index] = newchar; con_buf_index++; } switch(newchar) { case 0x08: //Backspace if(con_buf_index>=2 && !con_escape_flag) { con_buf_index -= 2; //Erase last char con_putc(&newchar); con_putc(" "); con_putc(&newchar); } else { con_buf_index = 0; } break; case '\r': //Carriage Return if(!con_entry_flag && con_buf_index > 1 && !con_escape_flag) { memcpy(con_entry, con_buf, con_buf_index - 1); con_entry[con_buf_index - 1] = '\0';//convert in string con_entry_index = con_buf_index - 1; con_buf_index = 0; con_entry_flag = TRUE; } break; case '\n': //newline if(!con_entry_flag && con_buf_index > 1 && !con_escape_flag) { memcpy(con_entry, con_buf, con_buf_index - 1); con_entry[con_buf_index - 1] = '\0';//convert in string con_entry_index = con_buf_index - 1; con_buf_index = 0; con_entry_flag = TRUE; } break; case '\e': con_escape_flag = TRUE; break; default: if(con_escape_flag) { //space key pressed if(con_arrow_flag) { //arrow if(newchar == 'A') { // con_hist_up(); con_escape_flag = FALSE; con_arrow_flag = FALSE; } if(newchar == 'B') { con_escape_flag = FALSE; con_arrow_flag = FALSE; } if(newchar == 'C') { //con_hist_right();NOT IMPLEMENTED con_escape_flag = FALSE; con_arrow_flag = FALSE; } if(newchar == 'D') { //con_hist_down();NOT IMPLEMENTED con_escape_flag = FALSE; con_arrow_flag = FALSE; } } else { if(newchar == '[') { con_arrow_flag = TRUE; } } } else { con_putc(&newchar); } break; } if(con_buf_index >= CON_BUF_WIDTH) { con_buf_index = 0; con_printf("\r\n Command to long \r\n>>"); } con_prev_char = newchar; return; }