Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 676e833 in mainline


Ignore:
Timestamp:
2017-11-10T14:15:41Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
ee98e81
Parents:
7654f3e
Message:

Move receiving side of Msim console to a separate driver. Work around possibility that console character device is not available at the moment input server starts.

Files:
4 added
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • boot/arch/mips32/Makefile.inc

    r7654f3e r676e833  
    6868        RD_DRVS_ESSENTIAL += \
    6969                platform/msim \
    70                 block/ddisk
     70                block/ddisk \
     71                char/msim-con
    7172endif
    7273
  • uspace/drv/char/msim-con/msim-con.h

    r7654f3e r676e833  
    11/*
    2  * Copyright (c) 2006 Josef Cejka
    3  * Copyright (c) 2011 Jiri Svoboda
     2 * Copyright (c) 2017 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup kbd_port
    31  * @ingroup  kbd
     29/** @addtogroup genarch
    3230 * @{
    3331 */
    3432/** @file
    35  * @brief Msim keyboard port driver.
    3633 */
    3734
     35#ifndef MSIM_CON_H
     36#define MSIM_CON_H
     37
    3838#include <async.h>
    39 #include <sysinfo.h>
    40 #include <ddi.h>
    41 #include <errno.h>
    42 #include "../kbd_port.h"
    43 #include "../kbd.h"
     39#include <ddf/driver.h>
     40#include <loc.h>
     41#include <stdint.h>
    4442
    45 static int msim_port_init(kbd_dev_t *);
    46 static void msim_port_write(uint8_t data);
     43/** MSIM console */
     44typedef struct {
     45        async_sess_t *client_sess;
     46        ddf_dev_t *dev;
     47} msim_con_t;
    4748
    48 kbd_port_ops_t msim_port = {
    49         .init = msim_port_init,
    50         .write = msim_port_write
    51 };
     49extern int msim_con_init(msim_con_t *);
     50extern void msim_con_write(uint8_t data);
    5251
    53 static kbd_dev_t *kbd_dev;
    5452
    55 static irq_pio_range_t msim_ranges[] = {
    56         {
    57                 .base = 0,
    58                 .size = 1
    59         }
    60 };
     53extern int msim_con_add(msim_con_t *);
     54extern int msim_con_remove(msim_con_t *);
     55extern int msim_con_gone(msim_con_t *);
    6156
    62 static irq_cmd_t msim_cmds[] = {
    63         {
    64                 .cmd = CMD_PIO_READ_8,
    65                 .addr = (void *) 0,     /* will be patched in run-time */
    66                 .dstarg = 2
    67         },
    68         {
    69                 .cmd = CMD_ACCEPT
    70         }
    71 };
    72 
    73 static irq_code_t msim_kbd = {
    74         sizeof(msim_ranges) / sizeof(irq_pio_range_t),
    75         msim_ranges,
    76         sizeof(msim_cmds) / sizeof(irq_cmd_t),
    77         msim_cmds
    78 };
    79 
    80 static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
    81 {
    82         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
    83 }
    84 
    85 static int msim_port_init(kbd_dev_t *kdev)
    86 {
    87         kbd_dev = kdev;
    88 
    89         sysarg_t paddr;
    90         if (sysinfo_get_value("kbd.address.physical", &paddr) != EOK)
    91                 return -1;
    92        
    93         sysarg_t inr;
    94         if (sysinfo_get_value("kbd.inr", &inr) != EOK)
    95                 return -1;
    96        
    97         msim_ranges[0].base = paddr;
    98         msim_cmds[0].addr = (void *) paddr;
    99         async_irq_subscribe(inr, msim_irq_handler, NULL, &msim_kbd);
    100        
    101         return 0;
    102 }
    103 
    104 static void msim_port_write(uint8_t data)
    105 {
    106         (void) data;
    107 }
     57#endif
    10858
    10959/** @}
  • uspace/drv/char/ski-con/ski-con.c

    r7654f3e r676e833  
    5050static void ski_con_connection(ipc_callid_t, ipc_call_t *, void *);
    5151
    52 #include <stdio.h>
    53 /** Initialize Ski port driver. */
     52/** Add ski console device. */
    5453int ski_con_add(ski_con_t *con)
    5554{
  • uspace/drv/char/ski-con/ski-con.h

    r7654f3e r676e833  
    4141#include <stdint.h>
    4242
    43 /** IntegratorCP Interrupt Controller */
     43/** Ski console */
    4444typedef struct {
    4545        async_sess_t *client_sess;
  • uspace/drv/platform/msim/msim.c

    r7654f3e r676e833  
    192192static bool msim_add_functions(ddf_dev_t *dev)
    193193{
    194         return msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data);
     194        if (!msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data))
     195                return false;
     196        if (!msim_add_fun(dev, "console", "msim/console", &disk_data))
     197                return false;
     198        return true;
    195199}
    196200
  • uspace/srv/hid/input/Makefile

    r7654f3e r676e833  
    4040        port/adb_mouse.c \
    4141        port/chardev.c \
    42         port/msim.c \
    4342        port/niagara.c \
    4443        proto/adb.c \
  • uspace/srv/hid/input/input.c

    r7654f3e r676e833  
    641641#endif
    642642#if defined(MACHINE_msim)
    643         kbd_add_dev(&msim_port, &stty_ctl);
     643        kbd_add_dev(&chardev_port, &stty_ctl);
    644644#endif
    645645#if defined(UARCH_ppc32)
  • uspace/srv/hid/input/kbd_port.h

    r7654f3e r676e833  
    4949extern kbd_port_ops_t adb_port;
    5050extern kbd_port_ops_t chardev_port;
    51 extern kbd_port_ops_t msim_port;
    5251extern kbd_port_ops_t niagara_port;
    5352extern kbd_port_ops_t ns16550_port;
  • uspace/srv/hid/input/port/chardev.c

    r7654f3e r676e833  
    6161        /** S3C24xx UART - Openmoko debug console */
    6262        "char/s3c24xx_uart",
    63         /** Ski console */
     63        /** Ski console, MSIM console */
    6464        "devices/\\hw\\console\\a"
    6565};
     
    7575       
    7676        kbd_dev = kdev;
    77        
     77again:
    7878        for (i = 0; i < num_devs; i++) {
    7979                rc = loc_service_get_id(in_devs[i], &service_id, 0);
     
    8383       
    8484        if (i >= num_devs) {
    85                 printf("%s: Could not find any suitable input device\n", NAME);
    86                 return -1;
     85                /* XXX This is just a hack. */
     86                printf("%s: No input device found, sleep for retry.\n", NAME);
     87                async_usleep(1000 * 1000);
     88                goto again;
    8789        }
    8890       
     
    113115        }
    114116       
     117        printf("%s: Found input device '%s'\n", NAME, in_devs[i]);
    115118        return 0;
    116119}
Note: See TracChangeset for help on using the changeset viewer.