Overview   API Reference  

con_console.hpp

00001 #if !defined(__CON_CONSOLE_HPP__)
00002 #define __CON_CONSOLE_HPP__
00003 
00004 //
00005 // L4 includes
00006 //
00007 #include <l4/l4con/l4con_pslim.h>
00008 
00009 //
00010 // local includes
00011 //
00012 #include "core/common.hpp"
00013 
00017 struct con_console : private noncopyable
00018 {
00019     //
00020     // types
00021     //
00022     typedef l4con_pslim_color_t color_t;
00023     typedef l4con_pslim_rect_t rect_t;
00024     static_assert(is_unsigned<color_t>::conforms, "color_t must be an unsigned integer");
00025 
00026     //
00027     // constants
00028     //
00029     enum default_margin_constants
00030     {
00031         DEFAULT_HORIZONTAL_MARGIN = 5,
00032         DEFAULT_VERTICAL_MARGIN = 5
00033     };
00034 
00035     enum color_constants
00036     {
00037         DEFAULT_FGCOLOR = 0xffffff,
00038         DEFAULT_BGCOLOR = 0x000000
00039     };
00040 
00041     static const color_t colors[][2];
00042 
00043   protected:
00045     const rect_t margins;
00047     rect_t screen;
00048 
00050     l4_threadid_t vc_id;
00052     uint8_t  mode;
00053     uint32_t bits_per_pixel, bytes_per_pixel, bytes_per_line,
00054              flags, font_width, font_height;
00055 
00056     inline con_console(const rect_t &margins=((rect_t){x: 0, y: 0, w: 0, h: 0}))
00057         : margins(margins), screen(((rect_t){x: 0, y: 0, w: 0, h: 0})), vc_id(L4_INVALID_ID)
00058     {
00059         open_console();
00060     }
00061 
00062     inline ~con_console(void)
00063     {
00064         close_console();
00065     }
00066 
00067     int open_console(void);
00068     int close_console(void);
00069 
00070     inline bool is_open(void) const
00071     {
00072         return !l4_is_invalid_id(vc_id);
00073     }
00074 
00075     int fill(color_t fill_color=DEFAULT_BGCOLOR, uint32_t x=0, uint32_t y=0, uint32_t w=0, uint32_t h=0) const;
00076     int vscroll(color_t fill_color=DEFAULT_BGCOLOR, int delta=-1) const;
00077 
00078     inline int clear(color_t fill_color=DEFAULT_BGCOLOR) const
00079     {
00080         return fill(fill_color, screen.x, screen.y, screen.w, screen.h);
00081     }
00082 
00083   protected:
00084     static l4_threadid_t get_con_id(void);
00085 };
00086 
00087 #endif
00088 
00089 // ***** end of source ***** //
00090 

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008