Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/console.h

    r64d2b10 r7c014d1  
    3636#define LIBC_IO_CONSOLE_H_
    3737
     38#include <sys/time.h>
     39#include <io/keycode.h>
     40#include <async.h>
    3841#include <bool.h>
     42#include <stdio.h>
     43
     44typedef enum {
     45        CONSOLE_CAP_NONE = 0,
     46        CONSOLE_CAP_STYLE = 1,
     47        CONSOLE_CAP_INDEXED = 2,
     48        CONSOLE_CAP_RGB = 4
     49} console_caps_t;
     50
     51/** Console control structure. */
     52typedef struct {
     53        /** Console input file */
     54        FILE *input;
     55       
     56        /** Console output file */
     57        FILE *output;
     58       
     59        /** Console input session */
     60        async_sess_t *input_sess;
     61       
     62        /** Console output session */
     63        async_sess_t *output_sess;
     64       
     65        /** Input request call with timeout */
     66        ipc_call_t input_call;
     67       
     68        /** Input response with timeout */
     69        aid_t input_aid;
     70} console_ctrl_t;
    3971
    4072typedef enum {
    4173        KEY_PRESS,
    4274        KEY_RELEASE
    43 } console_ev_type_t;
    44 
    45 typedef enum {
    46         CONSOLE_CCAP_NONE = 0,
    47         CONSOLE_CCAP_STYLE,
    48         CONSOLE_CCAP_INDEXED,
    49         CONSOLE_CCAP_RGB
    50 } console_caps_t;
     75} kbd_event_type_t;
    5176
    5277/** Console event structure. */
    5378typedef struct {
     79        /** List handle */
     80        link_t link;
     81       
    5482        /** Press or release event. */
    55         console_ev_type_t type;
     83        kbd_event_type_t type;
    5684       
    5785        /** Keycode of the key that was pressed or released. */
    58         unsigned int key;
     86        keycode_t key;
    5987       
    6088        /** Bitmask of modifiers held. */
    61         unsigned int mods;
     89        keymod_t mods;
    6290       
    6391        /** The character that was generated or '\0' for none. */
    6492        wchar_t c;
    65 } console_event_t;
     93} kbd_event_t;
    6694
    67 extern void console_clear(int phone);
     95extern console_ctrl_t *console_init(FILE *, FILE *);
     96extern void console_done(console_ctrl_t *);
     97extern bool console_kcon(void);
    6898
    69 extern int console_get_size(int phone, sysarg_t *cols, sysarg_t *rows);
    70 extern int console_get_pos(int phone, sysarg_t *col, sysarg_t *row);
    71 extern void console_set_pos(int phone, sysarg_t col, sysarg_t row);
     99extern void console_flush(console_ctrl_t *);
     100extern void console_clear(console_ctrl_t *);
    72101
    73 extern void console_set_style(int phone, uint8_t style);
    74 extern void console_set_color(int phone, uint8_t fg_color, uint8_t bg_color,
    75     uint8_t flags);
    76 extern void console_set_rgb_color(int phone, uint32_t fg_color, uint32_t bg_color);
     102extern int console_get_size(console_ctrl_t *, sysarg_t *, sysarg_t *);
     103extern int console_get_pos(console_ctrl_t *, sysarg_t *, sysarg_t *);
     104extern void console_set_pos(console_ctrl_t *, sysarg_t, sysarg_t);
    77105
    78 extern void console_cursor_visibility(int phone, bool show);
    79 extern int console_get_color_cap(int phone, sysarg_t *ccap);
    80 extern void console_kcon_enable(int phone);
     106extern void console_set_style(console_ctrl_t *, uint8_t);
     107extern void console_set_color(console_ctrl_t *, uint8_t, uint8_t, uint8_t);
     108extern void console_set_rgb_color(console_ctrl_t *, uint32_t, uint32_t);
    81109
    82 extern bool console_get_event(int phone, console_event_t *event);
     110extern void console_cursor_visibility(console_ctrl_t *, bool);
     111extern int console_get_color_cap(console_ctrl_t *, sysarg_t *);
     112extern bool console_get_kbd_event(console_ctrl_t *, kbd_event_t *);
     113extern bool console_get_kbd_event_timeout(console_ctrl_t *, kbd_event_t *,
     114    suseconds_t *);
    83115
    84116#endif
Note: See TracChangeset for help on using the changeset viewer.