Changeset 9940ce0 in mainline


Ignore:
Timestamp:
2017-11-26T01:03:40Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5f4c41b2
Parents:
96258fc
Message:

Move sending side of Ski driver out of output server.

Location:
uspace
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/ski-con/ski-con.c

    r96258fc r9940ce0  
    4343
    4444#define SKI_GETCHAR             21
     45#define SKI_PUTCHAR             31
    4546
    4647#define POLL_INTERVAL           10000
     
    5758        .write = ski_con_write
    5859};
     60
     61static void ski_con_putchar(ski_con_t *con, char ch); /* XXX */
    5962
    6063/** Add ski console device. */
     
    8891                goto error;
    8992        }
     93
     94        ddf_fun_add_to_category(fun, "console");
    9095
    9196        bound = true;
     
    177182}
    178183
     184
     185/** Display character on ski debug console
     186 *
     187 * Use SSC (Simulator System Call) to
     188 * display character on debug console.
     189 *
     190 * @param c Character to be printed.
     191 *
     192 */
    179193static void ski_con_putchar(ski_con_t *con, char ch)
    180194{
    181        
     195#ifdef UARCH_ia64
     196        asm volatile (
     197                "mov r15 = %0\n"
     198                "mov r32 = %1\n"   /* r32 is in0 */
     199                "break 0x80000\n"  /* modifies r8 */
     200                :
     201                : "i" (SKI_PUTCHAR), "r" (ch)
     202                : "r15", "in0", "r8"
     203        );
     204#else
     205        (void) ch;
     206#endif
     207        if (ch == '\n')
     208                ski_con_putchar(con, '\r');
    182209}
    183210
  • uspace/srv/hid/output/Makefile

    r96258fc r9940ce0  
    3737        port/kchar.c \
    3838        port/niagara.c \
    39         port/ski.c \
    4039        port/chardev.c \
    4140        proto/vt100.c \
  • uspace/srv/hid/output/output.c

    r96258fc r9940ce0  
    3838#include "port/kchar.h"
    3939#include "port/niagara.h"
    40 #include "port/ski.h"
    4140#include "port/chardev.h"
    4241#include "output.h"
     
    481480                kchar_init();
    482481                niagara_init();
    483                 ski_init();
    484         } else {
    485                 chardev_init();
    486         }
     482        }
     483       
     484        chardev_init();
    487485       
    488486        printf("%s: Accepting connections\n", NAME);
  • uspace/srv/hid/output/port/chardev.c

    r96258fc r9940ce0  
    11/*
    22 * Copyright (c) 2016 Jakub Jermar
     3 * Copyright (c) 2017 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    5051static chardev_t *chardev;
    5152static service_id_t serial_cat_id;
     53static service_id_t console_cat_id;
    5254
    5355static FIBRIL_MUTEX_INITIALIZE(discovery_lock);
     
    6870        chardev_write(chardev, (void *) str, str_size(str), &nwr);
    6971        /* XXX Handle error */
     72}
     73
     74static bool find_output_dev(service_id_t *svcid)
     75{
     76        service_id_t *svc;
     77        size_t svcs;
     78        int rc;
     79
     80        rc = loc_category_get_svcs(serial_cat_id, &svc, &svcs);
     81        if (rc != EOK) {
     82                fibril_mutex_unlock(&discovery_lock);
     83                printf("%s: Failed to get services\n", NAME);
     84                return false;
     85        }
     86
     87        for (size_t i = 0; i < svcs; i++) {
     88                char *name;
     89
     90                rc = loc_service_get_name(svc[i], &name);
     91                if (rc != EOK)
     92                        continue;
     93
     94                if (!str_cmp(console, name)) {
     95                        /*
     96                         * This is the serial console service that the user
     97                         * wanted to use.
     98                         */
     99                        *svcid = svc[i];
     100                        free(svc);
     101                        return true;
     102                }
     103
     104                free(name);
     105        }
     106
     107        free(svc);
     108
     109        /* Look for any service in the 'console' category */
     110
     111        rc = loc_category_get_svcs(console_cat_id, &svc, &svcs);
     112        if (rc != EOK) {
     113                fibril_mutex_unlock(&discovery_lock);
     114                printf("%s: Failed to get services\n", NAME);
     115                return false;
     116        }
     117
     118        if (svcs > 0) {
     119                *svcid = svc[0];
     120                free(svc);
     121                return true;
     122        }
     123
     124        free(svc);
     125        return false;
    70126}
    71127
     
    79135{
    80136        int rc;
     137        bool found;
     138        service_id_t sid;
    81139
    82140        fibril_mutex_lock(&discovery_lock);
     
    87145        }
    88146
    89         service_id_t *svc;
    90         size_t svcs;
    91         rc = loc_category_get_svcs(serial_cat_id, &svc, &svcs);
    92         if (rc != EOK) {
    93                 fibril_mutex_unlock(&discovery_lock);
    94                 printf("%s: Failed to get services\n", NAME);
    95                 return;
    96         }
    97 
    98         service_id_t sid;
    99         bool found = false;
    100 
    101         for (size_t i = 0; i < svcs && !found; i++) {
    102                 char *name;
    103                
    104                 rc = loc_service_get_name(svc[i], &name);
    105                 if (rc != EOK)
    106                         continue;
    107 
    108                 if (!str_cmp(console, name)) {
    109                         /*
    110                          * This is the serial console service that the user
    111                          * wanted to use.
    112                          */
    113                         found = true;
    114                         sid = svc[i];
    115                 }
    116                        
    117                 free(name);
    118         }
    119 
    120         free(svc);
    121 
     147        found = find_output_dev(&sid);
    122148        if (!found) {
    123149                fibril_mutex_unlock(&discovery_lock);
     
    148174int chardev_init(void)
    149175{
    150         console = config_get_value("console");
    151         if (!console) {
    152                 /*
    153                  * The system is not configured to use serial console.
    154                  */
     176        if (!config_key_exists("console")) {
     177                console = NULL;
     178#ifndef MACHINE_ski
    155179                return EOK;
     180#endif
     181        } else {
     182                console = config_get_value("console");
     183                if (!console)
     184                        return EOK;
    156185        }
    157186
     
    162191        }
    163192
     193        rc = loc_category_get_id("console", &console_cat_id, IPC_FLAG_BLOCKING);
     194        if (rc != EOK) {
     195                printf("%s: Failed to get \"console\" category ID.\n", NAME);
     196                return rc;
     197        }
     198
    164199        rc = loc_register_cat_change_cb(check_for_dev);
    165200        if (rc != EOK) {
     
    168203                return rc;
    169204        }
     205
     206        check_for_dev();
    170207
    171208        fibril_mutex_lock(&discovery_lock);
  • uspace/srv/locsrv/locsrv.c

    r96258fc r9940ce0  
    13471347        categ_dir_add_cat(&cdir, cat);
    13481348
     1349        cat = category_new("console");
     1350        categ_dir_add_cat(&cdir, cat);
     1351
    13491352        cat = category_new("clock");
    13501353        categ_dir_add_cat(&cdir, cat);
Note: See TracChangeset for help on using the changeset viewer.