Changeset 432a269 in mainline for uspace/srv/hid/fb/port/ski.c


Ignore:
Timestamp:
2011-09-16T21:13:57Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3a11f17
Parents:
c0e53ff (diff), fd07e526 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/fb/port/ski.c

    rc0e53ff r432a269  
    11/*
    2  * Copyright (c) 2005 Jakub Jermar
    3  * Copyright (c) 2008 Jiri Svoboda
     2 * Copyright (c) 2006 Ondrej Palkovsky
     3 * Copyright (c) 2008 Martin Decky
    44 * All rights reserved.
    55 *
     
    2828 */
    2929
    30 /** @defgroup msimfb MSIM text console
    31  * @brief       HelenOS MSIM text console.
    32  * @ingroup fbs
    33  * @{
    34  */
    3530/** @file
    3631 */
    3732
    38 #include <async.h>
    39 #include <libc.h>
     33#include <sys/types.h>
     34#include <errno.h>
    4035#include <sysinfo.h>
    41 #include <as.h>
    42 #include <ddi.h>
    43 
    44 #include "serial_console.h"
     36#include "../ctl/serial.h"
    4537#include "ski.h"
    4638
    47 #define SKI_PUTCHAR             31
     39#ifdef UARCH_ia64
    4840
    49 #define WIDTH 80
    50 #define HEIGHT 24
     41#define SKI_PUTCHAR  31
    5142
    5243/** Display character on ski debug console
     
    5546 * display character on debug console.
    5647 *
    57  * @param ch Character to be printed.
     48 * @param c Character to be printed.
     49 *
    5850 */
    59 static void ski_putc(const char ch)
     51static void ski_putc(const char c)
    6052{
    6153        asm volatile (
    6254                "mov r15 = %0\n"
    63                 "mov r32 = %1\n"        /* r32 is in0 */
    64                 "break 0x80000\n"       /* modifies r8 */
     55                "mov r32 = %1\n"   /* r32 is in0 */
     56                "break 0x80000\n"  /* modifies r8 */
    6557                :
    66                 : "i" (SKI_PUTCHAR), "r" (ch)
     58                : "i" (SKI_PUTCHAR), "r" (c)
    6759                : "r15", "in0", "r8"
    6860        );
    6961       
    70         if (ch == '\n')
     62        if (c == '\n')
    7163                ski_putc('\r');
     64}
     65
     66static void ski_putchar(wchar_t ch)
     67{
     68        if ((ch >= 0) && (ch < 128))
     69                ski_putc(ch);
     70        else
     71                ski_putc('?');
     72}
     73
     74static void ski_control_puts(const char *str)
     75{
     76        while (*str)
     77                ski_putc(*(str++));
    7278}
    7379
    7480int ski_init(void)
    7581{
    76         serial_console_init(ski_putc, WIDTH, HEIGHT);
     82        sysarg_t present;
     83        int rc = sysinfo_get_value("fb", &present);
     84        if (rc != EOK)
     85                present = false;
    7786       
    78         async_set_client_connection(serial_client_connection);
    79         return 0;
     87        if (!present)
     88                return ENOENT;
     89       
     90        sysarg_t kind;
     91        rc = sysinfo_get_value("fb.kind", &kind);
     92        if (rc != EOK)
     93                kind = (sysarg_t) -1;
     94       
     95        if (kind != 6)
     96                return EINVAL;
     97       
     98        return serial_init(ski_putchar, ski_control_puts);
    8099}
    81100
    82 /**
    83  * @}
     101#else /* UARCH_ia64 */
     102
     103int ski_init(void)
     104{
     105        return ENOENT;
     106}
     107
     108#endif
     109
     110/** @}
    84111 */
Note: See TracChangeset for help on using the changeset viewer.