Console Service
[HelenOS Services]


Files

file  console.c
file  console.h
file  gcons.c
file  gcons.h
file  screenbuffer.c
file  screenbuffer.h

Data Structures

struct  attr_idx_t
struct  attr_rgb_t
struct  attr_style_t
union  attr_val_t
struct  attrs_t
struct  console_t
struct  hid_class_info
struct  keyfield_t
 One field on screen. More...
struct  screenbuffer_t
 Structure for buffering state of one virtual console. More...

Defines

#define COLOR_BACKGROUND   0xffffff
#define COLOR_FOREGROUND   0x202020
#define COLOR_MAIN   0xffffff
#define CONSOLE_COUNT   12
#define CONSOLE_MARGIN   6
#define CONSOLE_TOP   66
#define HOTPLUG_WATCH_INTERVAL   (1000 * 250)
 Interval for checking for new keyboard (1/4s).
#define KERNEL_CONSOLE   11
#define MAX_IPC_OUTGOING_PHONES   128
#define NAME   "console"
#define NAMESPACE   "term"
#define STATUS_HEIGHT   48
#define STATUS_SPACE   4
#define STATUS_START   110
#define STATUS_TOP   8
#define STATUS_WIDTH   48

Enumerations

enum  attr_type_t
enum  butstate

Functions

static int async_connect_to_me_hack (int phone, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, async_client_conn_t client_receiver, ipc_callid_t *hash)
static bool attrs_same (attrs_t a1, attrs_t a2)
 Compares two sets of attributes.
static int ccap_fb_to_con (sysarg_t ccap_fb, sysarg_t *ccap_con)
static void cell_mark_changed (sysarg_t col, sysarg_t row)
 Mark a character cell as changed.
static void change_console (console_t *cons)
 Switch to new console.
static int check_new_device_fibril (void *arg)
 Periodically check for new keyboards in /dev/class/.
static void check_new_devices_in_background (int(*connection_func)(const char *), const char *classname)
 Start a fibril monitoring hot-plugged keyboards.
static void clear (void)
static void client_connection (ipc_callid_t iid, ipc_call_t *icall)
 Default thread for new connections.
static void close_driver_phone (ipc_callid_t hash)
static int connect_keyboard (const char *path)
static int connect_keyboard_or_mouse (const char *devname, async_client_conn_t handler, const char *path)
static int connect_mouse (const char *path)
static void cons_get_event (console_t *cons, ipc_callid_t rid, ipc_call_t *request)
static void cons_read (console_t *cons, ipc_callid_t rid, ipc_call_t *request)
static void cons_write (console_t *cons, ipc_callid_t rid, ipc_call_t *request)
static bool console_init (char *input)
static void curs_goto (sysarg_t x, sysarg_t y)
static void curs_hide_sync (void)
static void curs_visibility (bool visible)
static void draw_pixmap (char *logo, size_t size, sysarg_t x, sysarg_t y)
 Draw a PPM pixmap to framebuffer.
static void fb_pending_flush (void)
 Flush pending cells to FB.
static void fb_putchar (wchar_t c, sysarg_t col, sysarg_t row)
 Print a character to the active VC with buffering.
static void fb_update_area (console_t *cons, sysarg_t x0, sysarg_t y0, sysarg_t width, sysarg_t height)
 Send an area of screenbuffer to the FB driver.
void gcons_change_console (size_t index)
 Notification run on changing console (except kernel console).
static int gcons_find_conbut (sysarg_t x, sysarg_t y)
void gcons_in_kernel (void)
 Change to kernel console.
void gcons_init (int phone)
 Initialize nice graphical console environment.
int gcons_mouse_btn (bool state)
 Handle mouse click.
void gcons_mouse_move (ssize_t dx, ssize_t dy)
 Handle mouse move.
void gcons_notify_char (size_t index)
 Notification function that gets called on new output to virtual console.
void gcons_notify_connect (size_t index)
 Notification function called on console connect.
void gcons_notify_disconnect (size_t index)
 Notification function called on service disconnect from console.
void gcons_redraw_console (void)
 Redraws console graphics.
static keyfield_tget_field_at (screenbuffer_t *scr, sysarg_t x, sysarg_t y)
 Returns keyfield for position on screen.
static void interrupt_received (ipc_callid_t callid, ipc_call_t *call)
static void kbd_reclaim (void)
static void kbd_yield (void)
static void keyboard_events (ipc_callid_t iid, ipc_call_t *icall)
 Handler for keyboard.
static ssize_t limit (ssize_t a, ssize_t left, ssize_t right)
 Return x, where left <= x <= right && |a-x| == min(|a-x|) is smallest.
int main (int argc, char *argv[])
 Main entry point.
static void make_anim (void)
static int make_pixmap (char *data, size_t size)
 Creates a pixmap on framebuffer.
static void mouse_events (ipc_callid_t iid, ipc_call_t *icall)
 Handler for mouse events.
static void redraw_state (size_t index)
 Redraw the button showing state of a given console.
static void screen_clear (void)
static void screen_reclaim (void)
static void screen_yield (void)
void screenbuffer_clear (screenbuffer_t *scr)
 Clear screenbuffer.
void screenbuffer_clear_line (screenbuffer_t *scr, sysarg_t line)
 Clear one buffer line.
void screenbuffer_copy_buffer (screenbuffer_t *scr, keyfield_t *dest)
 Copy content buffer from screenbuffer to given memory.
void screenbuffer_goto (screenbuffer_t *scr, sysarg_t x, sysarg_t y)
 Set new cursor position in screenbuffer.
screenbuffer_tscreenbuffer_init (screenbuffer_t *scr, sysarg_t size_x, sysarg_t size_y)
 Initilize screenbuffer.
void screenbuffer_putchar (screenbuffer_t *scr, wchar_t ch)
 Store one character to screenbuffer.
void screenbuffer_set_color (screenbuffer_t *scr, uint8_t fg_color, uint8_t bg_color, uint8_t flags)
 Set new color.
void screenbuffer_set_rgb_color (screenbuffer_t *scr, uint32_t fg_color, uint32_t bg_color)
 Set new RGB color.
void screenbuffer_set_style (screenbuffer_t *scr, uint8_t style)
 Set new style.
static void set_attrs (attrs_t *attrs)
static void set_color (uint8_t fgcolor, uint8_t bgcolor, uint8_t flags)
static void set_rgb_color (uint32_t fgcolor, uint32_t bgcolor)
static void set_style (uint8_t style)
static void tran_putch (wchar_t ch, sysarg_t col, sysarg_t row)
 Transparent putchar.
static void usage (void)
static int vp_create (sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
 Create view port.
static void vp_switch (int vp)
static void write_char (console_t *cons, wchar_t ch)
 Process a character from the client (TTY emulation).

Variables

static size_t active_console = 0
static console_tactive_console = &consoles[0]
static int animation = -1
static bool btn_pressed = false
static sysarg_t btn_x = 0
static sysarg_t btn_y = 0
static enum butstate console_state [CONSOLE_COUNT]
static int console_vp
static console_t consoles [CONSOLE_COUNT]
 Array of data for virtual consoles.
static int cstatus_vp [CONSOLE_COUNT]
static ipc_callid_t driver_phones [MAX_IPC_OUTGOING_PHONES] = { 0 }
 To allow proper phone closing.
struct {
   sysarg_t   color_cap
 Color capabilities (FB_CCAP_xxx).
   sysarg_t   cols
 Framebuffer columns.
   int   phone
 Framebuffer phone.
   sysarg_t   rows
 Framebuffer rows.
fb_info
 Information about framebuffer.
struct {
   sysarg_t   cnt
 Width of the span.
   sysarg_t   col
 Leftmost column of the span.
   sysarg_t   row
 Row where the span lies.
fb_pending
 Information on row-span yet unsent to FB driver.
static int fbphone
static int ic_pixmaps [CONS_LAST] = {-1, -1, -1, -1, -1, -1}
 List of pixmaps identifying these icons.
static keyfield_tinterbuffer = NULL
 Pointer to memory shared with framebufer used for faster virtual console switching.
static int kbd_phone
 Phone to the keyboard driver.
static console_tkernel_console = &consoles[KERNEL_CONSOLE]
static int mouse_phone
 Phone to the mouse driver.
static sysarg_t mouse_x = 0
static sysarg_t mouse_y = 0
static console_tprev_console = &consoles[0]
static bool use_gcons = false
static sysarg_t xres
static sysarg_t yres

Function Documentation

static bool attrs_same ( attrs_t  a1,
attrs_t  a2 
) [inline, static]

Compares two sets of attributes.

Parameters:
s1 First style
s2 Second style
Returns:
Nonzero on equality

Definition at line 123 of file screenbuffer.h.

static void cell_mark_changed ( sysarg_t  col,
sysarg_t  row 
) [static]

Mark a character cell as changed.

This adds the cell to the pending rowspan if possible. Otherwise the old span is flushed first.

Definition at line 250 of file console.c.

static int check_new_device_fibril ( void *  arg  )  [static]

Periodically check for new keyboards in /dev/class/.

Parameters:
arg Class name.
Returns:
This function should never exit.

Definition at line 814 of file console.c.

static void draw_pixmap ( char *  logo,
size_t  size,
sysarg_t  x,
sysarg_t  y 
) [static]

Draw a PPM pixmap to framebuffer.

Parameters:
logo Pointer to PPM data
size Size of PPM data
x Coordinate of upper left corner
y Coordinate of upper left corner

Definition at line 365 of file gcons.c.

int gcons_mouse_btn ( bool  state  ) 

Handle mouse click.

Parameters:
state New state (true - pressed, false - depressed)

Definition at line 328 of file gcons.c.

void gcons_mouse_move ( ssize_t  dx,
ssize_t  dy 
)

Handle mouse move.

Parameters:
dx Delta X of mouse move
dy Delta Y of mouse move

Definition at line 283 of file gcons.c.

static keyfield_t* get_field_at ( screenbuffer_t scr,
sysarg_t  x,
sysarg_t  y 
) [inline, static]

Returns keyfield for position on screen.

Screenbuffer->buffer is cyclic buffer so we must couted in index of the topmost line.

Parameters:
scr Screenbuffer
x Position on screen
y Position on screen
Returns:
Keyfield structure with character and its attributes on x, y

Definition at line 110 of file screenbuffer.h.

int main ( int  argc,
char *  argv[] 
)

Main entry point.

Parameters:
[in] argc Nmber of arguments in argv vector (ignored).
[in] argv Cmdline argument vector (ignored).
Returns:
Error code.
Driver debug level is set here.

Definition at line 980 of file console.c.

static int make_pixmap ( char *  data,
size_t  size 
) [static]

Creates a pixmap on framebuffer.

Parameters:
data PPM data
size PPM data size
Returns:
Pixmap identification

Definition at line 425 of file gcons.c.

void screenbuffer_clear ( screenbuffer_t scr  ) 

Clear screenbuffer.

Parameters:
scr Screenbuffer

Definition at line 92 of file screenbuffer.c.

void screenbuffer_clear_line ( screenbuffer_t scr,
sysarg_t  line 
)

Clear one buffer line.

Parameters:
scr 
line One buffer line (not a screen line!)

Definition at line 112 of file screenbuffer.c.

void screenbuffer_copy_buffer ( screenbuffer_t scr,
keyfield_t dest 
)

Copy content buffer from screenbuffer to given memory.

Parameters:
scr Source screenbuffer
dest Destination

Definition at line 128 of file screenbuffer.c.

void screenbuffer_goto ( screenbuffer_t scr,
sysarg_t  x,
sysarg_t  y 
)

Set new cursor position in screenbuffer.

Parameters:
scr 
x 
y 

Definition at line 143 of file screenbuffer.c.

screenbuffer_t * screenbuffer_init ( screenbuffer_t scr,
sysarg_t  size_x,
sysarg_t  size_y 
)

Initilize screenbuffer.

Allocate space for screen content in accordance to given size.

Parameters:
scr Initialized screenbuffer
size_x Width in characters
size_y Height in characters
Returns:
Pointer to screenbuffer (same as scr parameter) or NULL

Definition at line 69 of file screenbuffer.c.

void screenbuffer_putchar ( screenbuffer_t scr,
wchar_t  ch 
)

Store one character to screenbuffer.

Its position is determined by scr->position_x and scr->position_y.

Parameters:
scr Screenbuffer
c Stored character

Definition at line 49 of file screenbuffer.c.

void screenbuffer_set_color ( screenbuffer_t scr,
uint8_t  fg_color,
uint8_t  bg_color,
uint8_t  flags 
)

Set new color.

Parameters:
scr 
fg_color 
bg_color 

Definition at line 169 of file screenbuffer.c.

void screenbuffer_set_rgb_color ( screenbuffer_t scr,
uint32_t  fg_color,
uint32_t  bg_color 
)

Set new RGB color.

Parameters:
scr 
fg_color 
bg_color 

Definition at line 185 of file screenbuffer.c.

void screenbuffer_set_style ( screenbuffer_t scr,
uint8_t  style 
)

Set new style.

Parameters:
scr 
fg_color 
bg_color 

Definition at line 156 of file screenbuffer.c.


Generated on Thu Jun 2 07:45:55 2011 for HelenOS/USB by  doxygen 1.4.7