Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

console.h

Go to the documentation of this file.
00001 /*!     \file include/kernel/console.h
00002  *      \brief Virtual consoles header.
00003  *      \author Andrea Righi <drizzt@inwind.it>
00004  *      \date Last update: 2003-11-01
00005  *      \note Copyright (&copy;) 2003 Andrea Righi
00006  */
00007 
00008 #ifndef CONSOLE_H
00009 #define CONSOLE_H
00010 
00011 // Console colors                                                       //
00012 #define BLACK                   0x00 //!< Black color.
00013 #define BLUE                    0x01 //!< Blue color.
00014 #define GREEN                   0x02 //!< Green color.
00015 #define CYAN                    0x03 //!< Cyan color.
00016 #define RED                     0x04 //!< Red color.
00017 #define MAGENTA                 0x05 //!< Magenta color.
00018 #define BROWN                   0x06 //!< Brown color.
00019 #define LIGHT_GREY              0x07 //!< Light grey color.
00020 #define GREY                    0x08 //!< Grey color.
00021 #define LIGHT_BLUE              0x09 //!< Light blue color.
00022 #define LIGHT_GREEN             0x0A //!< Light green color.
00023 #define LIGHT_CYAN              0x0B //!< Light cyan color.
00024 #define LIGHT_RED               0x0C //!< Light red color.
00025 #define LIGHT_MAGENTA           0x0D //!< Light magenta color.
00026 #define YELLOW                  0x0E //!< Yellow color.
00027 #define WHITE                   0x0F //!< White color.
00028 
00029 //! The default color for the text of the console.
00030 #define DEFAULT_COLOR           0x07
00031 
00032 //! Size of the console keyboard buffer.
00033 #define KEYB_BUF_DIM            32
00034 
00035 //! Number of virtual consoles (must be at least 1).
00036 #define K_TOT_VIR_CONS          10
00037 
00038 /** \ingroup Kernel
00039  *  \defgroup VirConsoles Virtual Consoles
00040  *  Functions to manage virtual text-based consoles.
00041  *  @{
00042  */
00043 
00044 //! Virtual console structure.
00045 typedef struct console
00046 {
00047         // --- VIDEO ---                                                //
00048         word    *vid_buffer;            //!< Video buffer.
00049         word    cur_pos;                //!< Cursor position.
00050         byte    cur_color;              //!< Current text color.
00051 
00052         // --- KEYBOARD ---                                             //
00053         byte    num_lock,               //!< NUM-LOCK flag.
00054                 caps_lock,              //!< CAPS-LOCK flag.
00055                 scroll_lock;            //!< SCROLL-LOCK flag.
00056 
00057         word    keyb_buf_read,          //!< The first character to read from the buffer.
00058                 keyb_buf_write,         //!< The last character insered into the buffer.
00059                 keyb_buf_count;         //!< How many characters are present into the buffer.
00060 
00061         //! The keyboard circular buffer.
00062         word    keyb_buffer[KEYB_BUF_DIM];
00063 } console_t;
00064 
00065 // Prototypes                                                   //
00066 
00067 console_t *get_console_addr(int c);
00068 int get_curr_console();
00069 bool set_curr_console(int c);
00070 bool switch_to_console(int c);
00071 
00072 void clrscr();
00073 byte get_color();
00074 void set_color(byte attrib);
00075 void scroll_up();
00076 void gotoxy(int x, int y);
00077 
00078 void kputchar(int c);
00079 int kprintf(const char *fmt, ...);
00080 
00081 void init_main_console();
00082 void create_virtual_console();
00083 
00084 /** @} */ // end of VirConsoles
00085 
00086 #endif

Generated on Fri Feb 20 15:32:15 2004 for Minirighi by doxygen1.2.18