Changeset 79ae36dd in mainline for uspace/lib/c/include/io/console.h


Ignore:
Timestamp:
2011-06-08T19:01:55Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0eff68e
Parents:
764d71e
Message:

new async framework with integrated exchange tracking

  • strict isolation between low-level IPC and high-level async framework with integrated exchange tracking
    • each IPC connection is represented by an async_sess_t structure
    • each IPC exchange is represented by an async_exch_t structure
    • exchange management is either based on atomic messages (EXCHANGE_ATOMIC), locking (EXCHANGE_SERIALIZE) or connection cloning (EXCHANGE_CLONE)
  • async_obsolete: temporary compatibility layer to keep old async clients working (several pieces of code are currently broken, but only non-essential functionality)
  • IPC_M_PHONE_HANGUP is now method no. 0 (for elegant boolean evaluation)
  • IPC_M_DEBUG_ALL has been renamed to IPC_M_DEBUG
  • IPC_M_PING has been removed (VFS protocol now has VFS_IN_PING)
  • console routines in libc have been rewritten for better abstraction
  • additional use for libc-private header files (FILE structure opaque to the client)
  • various cstyle changes (typos, indentation, missing externs in header files, improved comments, etc.)
File:
1 edited

Legend:

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

    r764d71e r79ae36dd  
    3636#define LIBC_IO_CONSOLE_H_
    3737
     38#include <sys/time.h>
     39#include <async.h>
    3840#include <bool.h>
    39 
    40 typedef enum {
    41         KEY_PRESS,
    42         KEY_RELEASE
    43 } console_ev_type_t;
     41#include <stdio.h>
    4442
    4543typedef enum {
     
    5048} console_caps_t;
    5149
     50/** Console control structure. */
     51typedef struct {
     52        /** Console input file */
     53        FILE *input;
     54       
     55        /** Console output file */
     56        FILE *output;
     57       
     58        /** Console input session */
     59        async_sess_t *input_sess;
     60       
     61        /** Console output session */
     62        async_sess_t *output_sess;
     63       
     64        /** Input request call with timeout */
     65        ipc_call_t input_call;
     66       
     67        /** Input response with timeout */
     68        aid_t input_aid;
     69} console_ctrl_t;
     70
     71typedef enum {
     72        KEY_PRESS,
     73        KEY_RELEASE
     74} kbd_event_type_t;
     75
    5276/** Console event structure. */
    5377typedef struct {
    5478        /** Press or release event. */
    55         console_ev_type_t type;
     79        kbd_event_type_t type;
    5680       
    5781        /** Keycode of the key that was pressed or released. */
     
    6387        /** The character that was generated or '\0' for none. */
    6488        wchar_t c;
    65 } console_event_t;
     89} kbd_event_t;
    6690
    67 extern void console_clear(int phone);
     91extern console_ctrl_t *console_init(FILE *, FILE *);
     92extern void console_done(console_ctrl_t *);
     93extern bool console_kcon(void);
    6894
    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);
     95extern void console_flush(console_ctrl_t *);
     96extern void console_clear(console_ctrl_t *);
    7297
    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);
     98extern int console_get_size(console_ctrl_t *, sysarg_t *, sysarg_t *);
     99extern int console_get_pos(console_ctrl_t *, sysarg_t *, sysarg_t *);
     100extern void console_set_pos(console_ctrl_t *, sysarg_t, sysarg_t);
    77101
    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);
     102extern void console_set_style(console_ctrl_t *, uint8_t);
     103extern void console_set_color(console_ctrl_t *, uint8_t, uint8_t, uint8_t);
     104extern void console_set_rgb_color(console_ctrl_t *, uint32_t, uint32_t);
    81105
    82 extern bool console_get_event(int phone, console_event_t *event);
     106extern void console_cursor_visibility(console_ctrl_t *, bool);
     107extern int console_get_color_cap(console_ctrl_t *, sysarg_t *);
     108extern bool console_get_kbd_event(console_ctrl_t *, kbd_event_t *);
     109extern bool console_get_kbd_event_timeout(console_ctrl_t *, kbd_event_t *,
     110    suseconds_t *);
    83111
    84112#endif
Note: See TracChangeset for help on using the changeset viewer.